Visualization Library 2.1.0
A lightweight C++ OpenGL middleware for 2D/3D graphics
|
[Download] [Tutorials] [All Classes] [Grouped Classes] |
The RayIntersector class is used to detect the intersection points between a Ray and a set of Actor[s]. More...
#include <RayIntersector.hpp>
Public Member Functions | |
RayIntersector () | |
const ActorCollection * | actors () const |
The Actors against which the intersection test is performed. More... | |
ActorCollection * | actors () |
The Actors against which the intersection test is performed. More... | |
const Ray & | ray () const |
The ray in world coordinates to be intersected with the actors() More... | |
void | setRay (const Ray &ray) |
The ray in world coordinates to be intersected with the actors() More... | |
const Frustum & | frustum () const |
The frustum in world coordinates used to cull the objects. More... | |
void | setFrustum (const Frustum &frustum) |
The frustum in world coordinates used to cull the objects. More... | |
const std::vector< ref< RayIntersection > > & | intersections () const |
The intersection points detected by the last intersect() call sorted according to their distance (the first one is the closest). More... | |
void | intersect () |
Executes the intersection test. More... | |
void | intersect (const Ray &ray, SceneManager *scene_manager) |
Computes the intersections between the given ray and the Actor[s] contained in the given scene manager. More... | |
Public Member Functions inherited from vl::Object | |
Object () | |
Constructor. More... | |
Object (const Object &other) | |
Copy constructor: copies the name, ref count mutex and user data. More... | |
Object & | operator= (const Object &other) |
Copy operator: copies the object's name, ref count mutex and user data. More... | |
const std::string & | objectName () const |
The name of the object, by default set to the object's class name. More... | |
void | setObjectName (const char *name) |
The name of the object, by default set to the object's class name in debug builds. More... | |
void | setObjectName (const std::string &name) |
The name of the object, by default set to the object's class name in debug builds. More... | |
void | setRefCountMutex (IMutex *mutex) |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
IMutex * | refCountMutex () |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
const IMutex * | refCountMutex () const |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
int | referenceCount () const |
Returns the number of references of an object. More... | |
void | incReference () const |
Increments the reference count of an object. More... | |
void | decReference () |
Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More... | |
void | setAutomaticDelete (bool autodel_on) |
If set to true the Object is deleted when its reference count reaches 0. More... | |
bool | automaticDelete () const |
If set to true the Object is deleted when its reference count reaches 0. More... | |
template<class T > | |
T * | as () |
Casts an Object to the specified class. More... | |
template<class T > | |
const T * | as () const |
Casts an Object to the specified class. More... | |
Protected Member Functions | |
void | intersect (Actor *act) |
void | intersectGeometry (Actor *act, Geometry *geom) |
template<class T > | |
void | intersectTriangle (const T &a, const T &b, const T &c, int ia, int ib, int ic, Actor *, Geometry *geom, DrawCall *prim, int prim_idx) |
Protected Member Functions inherited from vl::Object | |
virtual | ~Object () |
Static Protected Member Functions | |
static bool | sorter (const ref< RayIntersection > &a, const ref< RayIntersection > &b) |
Protected Attributes | |
Frustum | mFrustum |
std::vector< ref< RayIntersection > > | mIntersections |
ref< ActorCollection > | mActors |
Ray | mRay |
Protected Attributes inherited from vl::Object | |
std::string | mObjectName |
IMutex * | mRefCountMutex |
int | mReferenceCount |
bool | mAutomaticDelete |
The RayIntersector class is used to detect the intersection points between a Ray and a set of Actor[s].
Definition at line 133 of file RayIntersector.hpp.
|
inline |
Definition at line 138 of file RayIntersector.hpp.
|
inline |
The Actors against which the intersection test is performed.
Definition at line 145 of file RayIntersector.hpp.
Referenced by intersect().
|
inline |
The Actors against which the intersection test is performed.
Definition at line 147 of file RayIntersector.hpp.
|
inline |
The frustum in world coordinates used to cull the objects.
Definition at line 155 of file RayIntersector.hpp.
Referenced by intersect().
void RayIntersector::intersect | ( | ) |
Executes the intersection test.
Definition at line 46 of file RayIntersector.cpp.
References actors(), vl::Frustum::cull(), frustum(), mIntersections, vl::Collection< T >::size(), and sorter().
Referenced by intersect().
void RayIntersector::intersect | ( | const Ray & | ray, |
SceneManager * | scene_manager | ||
) |
Computes the intersections between the given ray and the Actor[s] contained in the given scene manager.
This is an utility function equivalent to:
Definition at line 38 of file RayIntersector.cpp.
References actors(), vl::Collection< T >::clear(), vl::SceneManager::extractVisibleActors(), intersect(), NULL, and setRay().
|
protected |
Definition at line 60 of file RayIntersector.cpp.
References intersectGeometry(), and vl::Actor::lod().
Definition at line 67 of file RayIntersector.cpp.
References vl::Geometry::drawCalls(), vl::ArrayAbstract::getAsVec3(), vl::TriangleIterator::hasNext(), intersectTriangle(), vl::Actor::transform(), vl::DrawCall::triangleIterator(), vl::Geometry::vertexArray(), and vl::Transform::worldMatrix().
Referenced by intersect().
|
inline |
The intersection points detected by the last intersect() call sorted according to their distance (the first one is the closest).
Definition at line 160 of file RayIntersector.hpp.
|
protected |
Definition at line 98 of file RayIntersector.cpp.
References vl::cross(), vl::Ray::direction(), vl::dot(), mIntersections, vl::Vector3< T_Scalar >::normalize(), vl::Ray::origin(), ray(), vl::RayIntersection::setActor(), vl::RayIntersection::setDistance(), vl::RayIntersectionGeometry::setGeometry(), vl::RayIntersection::setIntersectionPoint(), vl::RayIntersectionGeometry::setPrimitives(), vl::RayIntersectionGeometry::setTriangle(), and vl::RayIntersectionGeometry::setTriangleIndex().
Referenced by intersectGeometry().
|
inline |
The ray in world coordinates to be intersected with the actors()
Definition at line 150 of file RayIntersector.hpp.
Referenced by intersectTriangle().
|
inline |
The frustum in world coordinates used to cull the objects.
Definition at line 157 of file RayIntersector.hpp.
|
inline |
The ray in world coordinates to be intersected with the actors()
Definition at line 152 of file RayIntersector.hpp.
Referenced by intersect().
|
inlinestaticprotected |
Definition at line 180 of file RayIntersector.hpp.
Referenced by intersect().
|
protected |
Definition at line 192 of file RayIntersector.hpp.
|
protected |
Definition at line 190 of file RayIntersector.hpp.
|
protected |
Definition at line 191 of file RayIntersector.hpp.
Referenced by intersect(), and intersectTriangle().
|
protected |
Definition at line 193 of file RayIntersector.hpp.
Visualization Library 2.1.0 Reference Documentation
Updated on Wed Mar 10 2021 16:02:53.
© Copyright Michele Bosi. All rights reserved.