#include <RayIntersectTraverser.h>
Inheritance diagram for nvtraverser::RayIntersectTraverser:
Public Member Functions | |
NVSG_API | RayIntersectTraverser (void) |
Default constructor. | |
NVSG_API void | release () |
Release all resources. | |
NVSG_API void | setRay (const nvmath::Vec3f &origin, const nvmath::Vec3f &dir) |
Set the ray for the intersection test. | |
NVSG_API void | setCamClipping (bool b) |
Enable/disable camera plane clipping. | |
NVSG_API const Intersection & | getNearest (void) const |
Get the nearest intersection. | |
NVSG_API const Intersection * | getIntersections (void) const |
Get intersections. | |
NVSG_API size_t | getNumberOfIntersections (void) const |
Get number of intersections. | |
NVSG_API void | setBackFaceCulling (bool enable) |
Enable / disable back-face culling. | |
NVSG_API bool | isBackFaceCullingEnabled () |
Check if back-face culling is enabled. | |
Protected Types | |
enum | ISType { _NONE = 0, _BSTANGENT, _BSNEAR, _BSFAR, _BSNEARFAR } |
Intersection type (bounding sphere). More... | |
Protected Member Functions | |
virtual NVSG_API | ~RayIntersectTraverser (void) |
Default destructor. | |
virtual NVSG_API void | doApply (const nvsg::ViewState *pViewState, const nvsg::Scene *pScene) |
Apply the traverser to the scene. | |
virtual NVSG_API void | handleGeoNode (const nvsg::GeoNode *p) |
Routine to handle a GeoNode while traversing the scene graph. | |
virtual NVSG_API void | handleGroup (const nvsg::Group *p) |
Routine to handle a Group node while traversing the scene graph. | |
virtual NVSG_API void | handleLOD (const nvsg::LOD *p) |
Routine to handle a LOD (Level Of Detail) node while traversing the scene graph. | |
virtual NVSG_API void | handleSwitch (const nvsg::Switch *p) |
Routine to handle a Switch node while traversing the scene graph. | |
virtual NVSG_API void | handleTransform (const nvsg::Transform *p) |
Provide special treatment of a Transform node. | |
virtual NVSG_API void | handleQuads (const nvsg::Quads *p) |
Routine to handle a Quads object while traversing the scene graph. | |
virtual NVSG_API void | handleQuadStrips (const nvsg::QuadStrips *p) |
Routine to handle a QuadStrips object while traversing the scene graph. | |
virtual NVSG_API void | handleTriangles (const nvsg::Triangles *p) |
Routine to handle a Triangles object while traversing the scene graph. | |
virtual NVSG_API void | handleTriStrips (const nvsg::TriStrips *p) |
Routine to handle a TriStrips object while traversing the scene graph. | |
virtual NVSG_API bool | preTraverseTransform (const nvsg::Transform *p) |
Handles actions to take between transform stack adjustment and traversal. | |
virtual NVSG_API void | postTraverseTransform (const nvsg::Transform *p) |
Handles stuff to do between traversal and transform stack adjustment. | |
NVSG_API bool | checkIntersection (const nvmath::Sphere3f &sphere) |
Check the current ray for intersection with a Sphere3f . | |
NVSG_API bool | intersectTriangle (const nvmath::Vec3f &v0, const nvmath::Vec3f &v1, const nvmath::Vec3f &v2, nvmath::Vec3f &isp, float &dist) |
Intersect with triangle. | |
NVSG_API void | storeIntersection (const nvsg::GeoSet *p, const nvmath::Vec3f &isp, float dist) |
store the intersection point isp. | |
Protected Attributes | |
bool | m_backFaceCulling |
true: consider backface culling | |
bool | m_ccw |
true: winding is supposed to be counterclockwise | |
bool | m_camClipping |
true: use camera far/near clipping planes | |
nvmath::Vec3f | m_rayOrigin |
Origin point of the ray - default (0,0,0). | |
nvmath::Vec3f | m_rayDir |
Direction of the ray - default (0,0,-1). | |
const nvsg::Camera * | m_camera |
Camera of the scene that came in via apply (we ref/unref it). | |
std::stack< nvmath::Vec3f > | m_msRayOrigin |
stack of Origin point of the ray in model space | |
std::stack< nvmath::Vec3f > | m_msRayDir |
stack of Direction of the ray in model space | |
std::stack< nvmath::Vec3f > | m_msCamDir |
stack of camera direction in model space | |
std::vector< Intersection > | m_intersectionList |
Intersection list containing all intersections. | |
size_t | m_nearestIntIdx |
Index of the nearest z intersection. | |
nvsg::Path * | m_curPath |
Current path. | |
size_t | m_currentFrame |
This frame is to be used in an animation sequence. | |
float | m_scaleFactor |
Adjusts distances by the scalings of the Transform nodes. | |
Static Protected Attributes | |
static const nvmath::Vec3f | _RAY_ORIGIN_DEFAULT |
Default value: (0.f, 0.f, 0.f). | |
static const nvmath::Vec3f | _RAY_DIRECTION_DEFAULT |
Default value: (0.f, 0.f, -1.f). |
A RayIntersectTraverser is a specialized traverser that calculates the intersections of a given ray that passes through the scene.
If you create a special kind of transformation node you also have to take care of the transformation stack in this class.
|
Intersection type (bounding sphere). These are the possible types of intersections between the ray and the boundingsphere of an object in the scene. These types are used for the preintersection calculation with the objects bounding sphere. Regarding the intersection type we can skip objects.
|
|
Default constructor.
|
|
Default destructor.
|
|
Release all resources. By releasing all resources we can use this traverser for the next intersection calculation. |
|
Set the ray for the intersection test. Sets a world-space ray along which to pick. The ray is defined as a world space origin point and direction vector. The direction vector must be normalized.
|
|
Enable/disable camera plane clipping. Enabling camera plane clipping forces the traverser to calculate only intersections that lie in between the camera's clip planes.
|
|
Get the nearest intersection.
|
|
Get intersections.
|
|
Get number of intersections.
|
|
Enable / disable back-face culling. Take back-faces culling into account.
|
|
Check if back-face culling is enabled. Check if the ray intersection also test on back-faces.
|
|
Apply the traverser to the scene. Start the intersection calculation of the given ray with the scene objects.
Reimplemented from nvtraverser::Traverser. |
|
Routine to handle a GeoNode while traversing the scene graph. This routine gets called for each GeoNode object that will be visited while traversing the scene graph. The currently visited GeoNode object is pointed to by p. The base implementation ensures that all underlying components will be traversed in a correct way. For derived classes, it is recommended to always call the base implementation for traversing purposes.
Reimplemented from nvtraverser::Traverser. |
|
Routine to handle a Group node while traversing the scene graph. This routine gets called for each Group object that will be visited while traversing the scene graph. The currently visited Group object is pointed to by p. The base implementation ensures that all underlying components will be traversed in a correct way. For derived classes, it is recommended to always call the base implementation for traversing purposes.
Reimplemented from nvtraverser::Traverser. |
|
Routine to handle a LOD (Level Of Detail) node while traversing the scene graph. This routine gets called for each LOD object that will be visited while traversing the scene graph. The currently visited LOD object is pointed to by p. The base implementation ensures that all underlying components will be traversed in a correct way. For derived classes, it is recommended to always call the base implementation for traversing purposes.
Reimplemented from nvtraverser::ModelViewTraverser. |
|
Routine to handle a Switch node while traversing the scene graph. This routine gets called for each Switch object that will be visited while traversing the scene graph. The currently visited Switch object is pointed to by p. The base implementation ensures that all underlying components will be traversed in a correct way. For derived classes, it is recommended to always call the base implementation for traversing purposes.
Reimplemented from nvtraverser::Traverser. |
|
Provide special treatment of a Transform node. On a Transform the modelview matrix is modified, the children are traversed, and the modelview matrix is restored. Reimplemented from nvtraverser::ModelViewTraverser. |
|
Routine to handle a Quads object while traversing the scene graph. This routine gets called for each Quads object that will be visited while traversing the scene graph. The currently visited Quads object is pointed to by p. The base implementation ensures that all underlying components will be traversed in a correct way. For derived classes, it is recommended to always call the base implementation for traversing purposes.
Reimplemented from nvtraverser::Traverser. |
|
Routine to handle a QuadStrips object while traversing the scene graph. This routine gets called for each QuadStrips object that will be visited while traversing the scene graph. The currently visited QuadStrips object is pointed to by p. The base implementation ensures that all underlying components will be traversed in a correct way. For derived classes, it is recommended to always call the base implementation for traversing purposes.
Reimplemented from nvtraverser::Traverser. |
|
Routine to handle a Triangles object while traversing the scene graph. This routine gets called for each Triangles object that will be visited while traversing the scene graph. The currently visited Triangles object is pointed to by p. The base implementation ensures that all underlying components will be traversed in a correct way. For derived classes, it is recommended to always call the base implementation for traversing purposes.
Reimplemented from nvtraverser::Traverser. |
|
Routine to handle a TriStrips object while traversing the scene graph. This routine gets called for each TriStrips object that will be visited while traversing the scene graph. The currently visited TriStrips object is pointed to by p. The base implementation ensures that all underlying components will be traversed in a correct way. For derived classes, it is recommended to always call the base implementation for traversing purposes.
Reimplemented from nvtraverser::Traverser. |
|
Handles actions to take between transform stack adjustment and traversal. Adjusts the ray origin and direction and the camera direction in model space.
Reimplemented from nvtraverser::ModelViewTraverser. |
|
Handles stuff to do between traversal and transform stack adjustment. Readjusts the ray origin and direction and the camera direction in model space.
Reimplemented from nvtraverser::ModelViewTraverser. |
|
Check the current ray for intersection with a
|
|
Intersect with triangle. This method tells if it intersects the triangle or not. It also calculates the intersection point between triangle and ray and the distance of the intersection from the origin of the ray.
|
|
store the intersection point isp. If the point isn't clipped, it is stored to the intersection list.
|
|
Default value: (0.f, 0.f, 0.f).
|
|
Default value: (0.f, 0.f, -1.f).
|
|
true: consider backface culling
|
|
true: winding is supposed to be counterclockwise
|
|
true: use camera far/near clipping planes
|
|
Origin point of the ray - default (0,0,0).
|
|
Direction of the ray - default (0,0,-1).
|
|
Camera of the scene that came in via apply (we ref/unref it).
|
|
stack of Origin point of the ray in model space
|
|
stack of Direction of the ray in model space
|
|
stack of camera direction in model space
|
|
Intersection list containing all intersections.
|
|
Index of the nearest z intersection.
|
|
Current path.
|
|
This frame is to be used in an animation sequence.
|
|
Adjusts distances by the scalings of the Transform nodes.
|