Kanzi Graphics Engine
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
kzu_raypick.h File Reference

Ray picking utility. More...

Functions

kzsError kzuRayPick (const struct KzuRenderer *renderer, const struct KzcVector2 *limits, const struct KzuObjectSource *pickingSource, const struct KzuTransformedScene *transformedScene, const struct KzuTransformedObjectNode *transformedCameraNode, kzInt positionX, kzInt positionY, kzFloat *out_distance, struct KzuObjectNode **out_objectNode, struct KzuTransformedObjectNode **out_transformedNode, struct KzcVector3 *out_offsetFromOrigin, struct KzcRay *out_ray)
 Finds ObjectNode positioned in 3d space on a ray shot from point on near clip plane at viewport x,y to the direction of viewport x,y on far clip plane. More...
 
kzsError kzuRayPickFromCanvas (const struct KzuRenderer *renderer, const struct KzuCanvas *canvas, const struct KzuObjectSource *pickingSource, const struct KzuTransformedScene *transformedScene, const struct KzuTransformedObjectNode *transformedCameraNode, kzInt positionX, kzInt positionY, kzFloat *out_distance, struct KzuObjectNode **out_objectNode, struct KzuTransformedObjectNode **out_transformedNode, struct KzcVector3 *out_offsetFromOrigin, struct KzcRay *out_ray)
 As kzuRayPick, but take the limits from a canvas. More...
 
kzsError kzuInputHitTest (const struct KzcVector2 *limits, const struct KzuTransformedScene *transformedScene, const struct KzuTransformedObjectNode *transformedCameraNode, kzInt positionX, kzInt positionY, struct KzuObjectNode **out_node, struct KzcRay *out_ray, kzFloat *out_distance)
 Input hit testing. More...
 
kzsError kzuRayPickCalculateRay (kzInt pointerX, kzInt pointerY, const struct KzcVector2 *limits, const struct KzuTransformedObjectNode *transformedCameraNode, struct KzcRay *out_ray)
 Calculates a ray in world space from active window and given pointer coordinates. More...
 
kzsError kzuRayPickCalculateRayFromCanvas (kzInt pointerX, kzInt pointerY, const struct KzuCanvas *canvas, const struct KzuTransformedObjectNode *transformedCameraNode, struct KzcRay *out_ray)
 As kzuRayPickCalculateRay, but take limits from a canvas. More...
 

Detailed Description

Ray picking utility.

Copyright 2008-2019 by Rightware. All rights reserved.

Function Documentation

kzsError kzuRayPick ( const struct KzuRenderer renderer,
const struct KzcVector2 limits,
const struct KzuObjectSource pickingSource,
const struct KzuTransformedScene transformedScene,
const struct KzuTransformedObjectNode transformedCameraNode,
kzInt  positionX,
kzInt  positionY,
kzFloat out_distance,
struct KzuObjectNode **  out_objectNode,
struct KzuTransformedObjectNode **  out_transformedNode,
struct KzcVector3 out_offsetFromOrigin,
struct KzcRay out_ray 
)

Finds ObjectNode positioned in 3d space on a ray shot from point on near clip plane at viewport x,y to the direction of viewport x,y on far clip plane.

After the call: If object was hit:

  • out_distance will contain the distance from camera to object bounding box hit position.
  • out_node will contain the node hit
  • out_vector_to_origin will contain the vector from object's origin to hit position

If object was not hit

  • out_distance will be KZ_FLOAT_MAXIMUM
  • out_node will be KZ_NULL
  • out_vector_to_origin will will be a vector with all components set to KZ_FLOAT_MAXIMUM
Parameters
sourceObject source used for picking. It can be used to invalidate parts of scene from picking.
out_transformedNodeTransformed node of the hit object. Can be KZ_NULL
kzsError kzuRayPickFromCanvas ( const struct KzuRenderer renderer,
const struct KzuCanvas canvas,
const struct KzuObjectSource pickingSource,
const struct KzuTransformedScene transformedScene,
const struct KzuTransformedObjectNode transformedCameraNode,
kzInt  positionX,
kzInt  positionY,
kzFloat out_distance,
struct KzuObjectNode **  out_objectNode,
struct KzuTransformedObjectNode **  out_transformedNode,
struct KzcVector3 out_offsetFromOrigin,
struct KzcRay out_ray 
)

As kzuRayPick, but take the limits from a canvas.

kzsError kzuInputHitTest ( const struct KzcVector2 limits,
const struct KzuTransformedScene transformedScene,
const struct KzuTransformedObjectNode transformedCameraNode,
kzInt  positionX,
kzInt  positionY,
struct KzuObjectNode **  out_node,
struct KzcRay out_ray,
kzFloat out_distance 
)

Input hit testing.

Finds the closest visible node that was pointed.

kzsError kzuRayPickCalculateRay ( kzInt  pointerX,
kzInt  pointerY,
const struct KzcVector2 limits,
const struct KzuTransformedObjectNode transformedCameraNode,
struct KzcRay out_ray 
)

Calculates a ray in world space from active window and given pointer coordinates.

kzsError kzuRayPickCalculateRayFromCanvas ( kzInt  pointerX,
kzInt  pointerY,
const struct KzuCanvas canvas,
const struct KzuTransformedObjectNode transformedCameraNode,
struct KzcRay out_ray 
)

As kzuRayPickCalculateRay, but take limits from a canvas.