Castor3D 0.12.0
Multiplatform 3D engine
Public Member Functions | Public Attributes | List of all members
castor3d::Ray Class Reference

#include <Ray.hpp>

Public Member Functions

C3D_API Ray (castor::Position const &point, Camera const &camera)
 Constructor from mouse coordinates and a camera. More...
 
C3D_API Ray (int x, int y, Camera const &camera)
 Constructor from mouse coordinates and a camera. More...
 
C3D_API Ray (castor::Point3f const &origin, castor::Point3f const &direction)
 Constructor from origin and direction. More...
 
C3D_API castor::Intersection intersects (castor::Point3f const &pt1, castor::Point3f const &pt2, castor::Point3f const &pt3, float &distance) const
 Tells if the ray intersects the given triangle of vertices. More...
 
C3D_API castor::Intersection intersects (Face const &face, castor::Matrix4x4f const &transform, Submesh const &submesh, float &distance) const
 Tells if the ray intersects the given face. More...
 
C3D_API castor::Intersection intersects (castor::Point3f const &point, float &distance) const
 Tells if the vertex is on the ray. More...
 
C3D_API castor::Intersection intersects (castor::BoundingBox const &box, float &distance) const
 Tells if the ray intersects the given Combo box. More...
 
C3D_API castor::Intersection intersects (castor::BoundingSphere const &sphere, float &distance) const
 Tells if the ray intersects the given Sphere. More...
 
C3D_API castor::Intersection intersects (GeometrySPtr geometry, Face &nearestFace, SubmeshSPtr &nearestSubmesh, float &distance) const
 Tells if the ray intersects the given Geometry. More...
 
C3D_API bool projectVertex (castor::Point3f const &point, castor::Point3f &result) const
 Projects the given vertex on the ray. More...
 

Public Attributes

castor::Point3f m_origin
 
castor::Point3f m_direction
 

Constructor & Destructor Documentation

◆ Ray() [1/3]

C3D_API castor3d::Ray::Ray ( castor::Position const &  point,
Camera const &  camera 
)

Constructor from mouse coordinates and a camera.

Parameters
[in]pointThe mouse coordinates.
[in]cameraThe camera from which to retrieve the ray.

◆ Ray() [2/3]

C3D_API castor3d::Ray::Ray ( int  x,
int  y,
Camera const &  camera 
)

Constructor from mouse coordinates and a camera.

Parameters
[in]x,yThe mouse coordinates.
[in]cameraThe camera from which to retrieve the ray.

◆ Ray() [3/3]

C3D_API castor3d::Ray::Ray ( castor::Point3f const &  origin,
castor::Point3f const &  direction 
)

Constructor from origin and direction.

Parameters
[in]originThe origin of the ray.
[in]directionThe direction of the ray.

Member Function Documentation

◆ intersects() [1/6]

C3D_API castor::Intersection castor3d::Ray::intersects ( castor::BoundingBox const &  box,
float &  distance 
) const

Tells if the ray intersects the given Combo box.

Parameters
[in]boxThe box to test.
[out]distanceReceives the distance.
Returns
castor::Intersection::eIn or castor::Intersection::eOut.

◆ intersects() [2/6]

C3D_API castor::Intersection castor3d::Ray::intersects ( castor::BoundingSphere const &  sphere,
float &  distance 
) const

Tells if the ray intersects the given Sphere.

Parameters
[in]sphereThe sphere to test.
[out]distanceReceives the distance.
Returns
castor::Intersection::eIn or castor::Intersection::eOut.

◆ intersects() [3/6]

C3D_API castor::Intersection castor3d::Ray::intersects ( castor::Point3f const &  point,
float &  distance 
) const

Tells if the vertex is on the ray.

Parameters
[in]pointThe vertex to test.
[out]distanceReceives the distance.
Returns
castor::Intersection::eIn or castor::Intersection::eOut.

◆ intersects() [4/6]

C3D_API castor::Intersection castor3d::Ray::intersects ( castor::Point3f const &  pt1,
castor::Point3f const &  pt2,
castor::Point3f const &  pt3,
float &  distance 
) const

Tells if the ray intersects the given triangle of vertices.

Parameters
[in]pt1The first triangle vertex.
[in]pt2The second triangle vertex.
[in]pt3The third triangle vertex.
[out]distanceReceives the distance.
Returns
castor::Intersection::eIn or castor::Intersection::eOut.

◆ intersects() [5/6]

C3D_API castor::Intersection castor3d::Ray::intersects ( Face const &  face,
castor::Matrix4x4f const &  transform,
Submesh const &  submesh,
float &  distance 
) const

Tells if the ray intersects the given face.

Parameters
[in]faceThe face to test.
[in]transformThe face's vertex transformation matrix.
[in]submeshThe submesh holding the face.
[out]distanceReceives the distance.
Returns
castor::Intersection::eIn or castor::Intersection::eOut.

◆ intersects() [6/6]

C3D_API castor::Intersection castor3d::Ray::intersects ( GeometrySPtr  geometry,
Face nearestFace,
SubmeshSPtr &  nearestSubmesh,
float &  distance 
) const

Tells if the ray intersects the given Geometry.

Parameters
[in]geometryThe geometry to test.
[out]nearestFaceReceives the intersected face.
[out]nearestSubmeshReceives the intersected submesh.
[out]distanceReceives the distance.
Returns
castor::Intersection::eIn or castor::Intersection::eOut.

◆ projectVertex()

C3D_API bool castor3d::Ray::projectVertex ( castor::Point3f const &  point,
castor::Point3f &  result 
) const

Projects the given vertex on the ray.

Parameters
[in]pointThe vertex we want to project.
[out]resultThe projecion result.
Returns
true if the vertex can be projected on the ray, false if not.

Member Data Documentation

◆ m_direction

castor::Point3f castor3d::Ray::m_direction

The ray direction.

◆ m_origin

castor::Point3f castor3d::Ray::m_origin

The ray origin.


The documentation for this class was generated from the following file: