Skip to content

Commit

Permalink
Update documentation for ospPick
Browse files Browse the repository at this point in the history
  • Loading branch information
johguenther committed Oct 1, 2020
1 parent 4f9ef0c commit 8929c60
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions doc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ given object anymore, call

This decreases its reference count and if the count reaches `0` the
object will automatically get deleted. Passing `NULL` is not an error.
Note that every handle returned via the API needs to be released when
the object is no longer needed, to avoid memory leaks.

Sometimes applications may want to have more than one reference to an
object, where it is desirable for the application to increment the
Expand Down Expand Up @@ -2561,28 +2563,33 @@ by using the [general parameters](#cameras) understood by all cameras.
### Picking

To get the world-space position of the geometry (if any) seen at [0–1]
normalized screen-space pixel coordinates `screenPos` use
normalized screen-space pixel coordinates `screenPos_x` and
`screenPos_y` use

void ospPick(OSPPickResult *,
OSPFrameBuffer,
OSPRenderer,
OSPCamera,
OSPWorld,
osp_vec2f screenPos);
float screenPos_x,
float screenPos_y);

The result is returned in the provided `OSPPickResult` struct:

typedef struct {
int hasHit;
osp_vec3f worldPosition;
OSPGeometricModel GeometricModel;
float worldPosition[3];
OSPInstance instance;
OSPGeometricModel model;
uint32_t primID;
} OSPPickResult;

Note that `ospPick` considers exactly the same camera of the given
renderer that is used to render an image, thus matching results can be
expected. If the camera supports depth of field then the center of the
lens and thus the center of the circle of confusion is used for picking.
Note that the caller needs to `ospRelease` the `instance` and `model`
handles of `OSPPickResult` once the information is not needed anymore.


Framebuffer
Expand Down

0 comments on commit 8929c60

Please sign in to comment.