#include <mesh.h>
Describes a location somewhere on the surface of a Mesh.
SurfacePoint objects are generally returned by Picker objects, who have interpreted a user action that involves selecting a point on the mesh. Meshs are defined as having an inside (back face) and an outside (front face).
Public Member Functions | |
SurfacePoint (void) | |
Void Constructor. More... | |
SurfacePoint (class Mesh *pMesh, unsigned int iVertexIndex, unsigned int iFaceIndex) | |
Constructor. More... | |
class Mesh * | Mesh (void) const |
Returns the mesh on which the point is. More... | |
unsigned int | FaceIndex (void) const |
Returns the index of the face which contains the surface point. More... | |
Vector | LocalPosition (void) const |
Returns the position of the SurfacePoint in local space. More... | |
Vector | WorldPosition (void) const |
Returns the position of the SurfacePoint in world space. More... | |
Vector | LocalNormal (void) const |
Returns the normal of the selected face in local space. More... | |
Vector | WorldNormal (void) const |
Returns the normal of the selected face in world space. More... | |
TC | TextureCoordinate (void) const |
Returns the texture coordinate of the surface point. More... | |
Base | TangentBase (void) const |
Returns the tangent base at the surface point in local space. More... | |
Vector | FaceCoordinates (void) const |
Returns a 2d vector indicating the position of the selected point within its face. More... | |
bool | Fill (class Mesh *pMesh, unsigned int iFaceIndex, const Vector &vStart, const Vector &vEnd, bool bTwoSide=false, bool bOriginalPosition=false) |
Set the SurfacePoint values based on a line in local space. More... | |
void | Fill (class Mesh *pMesh, unsigned int iFaceIndex, float fFaceU, float fFaceV) |
Set the SurfacePoint values based on a given point inside a face. More... | |
void | Fill (class Mesh *pMesh, unsigned int iFaceIndex, const Vector &vLocalPosition, bool bRecalculatePosition) |
Set the SurfacePoint values based on the 3D position of a point in a face. More... | |
void | SetTangentGenerator (TangentGenerator *pGenerator) |
This function overrides the default tangent generator for the surface point. More... | |
void | Align (void) |
The following function aligns the face coordinates to be in the range 0-1. More... | |
void | Mirror (void) |
This function mirrors the surface point to the other side of the mesh using topological symmetry (if initialized) More... | |
void | Serialize (Stream &s) |
Serialize the SurfacePoint to the given stream. More... | |
Public Attributes | |
class Mesh * | m_pMesh |
the mesh that has been picked More... | |
unsigned int | m_iFaceIndex |
the index of the face that has been picked More... | |
float | m_fRelativeRange |
position of a mesh-line intersection relative to the line. Ranges from 0.0 (at the beginning of the line) to 1.0 (at the end). More... | |
Vector | m_vLocalPosition |
position of the point in local space More... | |
Vector | m_vLocalNormal |
the normal vector of the mesh at the picked point, in local space More... | |
bool | m_bSide |
if true, the backside of the face was selected. (This is not supported; use at your own risk.) More... | |
class TangentGenerator * | m_pTG |
address of a tangent generator which should be used to calculate tangents for this surface point More... | |
Vector | m_vFaceCoordinates |
|
inline |
Void Constructor.
Definition at line 351 of file mesh.h.
SurfacePoint | ( | class Mesh * | pMesh, |
unsigned int | iVertexIndex, | ||
unsigned int | iFaceIndex | ||
) |
Constructor.
[in] | pMesh | the mesh |
[in] | iVertexIndex | the index of a vertex on the mesh |
[in] | iFaceIndex | the index of a face on the mesh |
Returns the index of the face which contains the surface point.
Returns the position of the SurfacePoint in local space.
Returns the position of the SurfacePoint in world space.
Returns a 2d vector indicating the position of the selected point within its face.
bool Fill | ( | class Mesh * | pMesh, |
unsigned int | iFaceIndex, | ||
const Vector & | vStart, | ||
const Vector & | vEnd, | ||
bool | bTwoSide = false , |
||
bool | bOriginalPosition = false |
||
) |
Set the SurfacePoint values based on a line in local space.
This method looks at the line defined by vStart and vEnd and sees if it intersects the specified mesh and face. If it does, the remainder of the SurfacePoint values are filled in. The line in local space might represent the vector defined by the user clicking a point on the screen.
[in] | pMesh | the mesh |
[in] | iFaceIndex | the index of a face |
[in] | vStart | start point of a line defined in local space |
[in] | vEnd | end point of a line defined in local space |
[in] | bTwoSide | if true, allow both sides of the face to be considered |
[in] | bOriginalPosition | if true, the position in the structure will be calculated using the original position of vertices |
Set the SurfacePoint values based on a given point inside a face.
This function is useful when the caller wants to specify a point inside a known face using baricentric coordinates. The position and normal of the surface point is also filled based on the given face coordinates.
[in] | pMesh | the mesh |
[in] | iFaceIndex | the index of a face |
fFaceU | U coordinate of the point inside the face | |
fFaceV | V coordinate of the point inside the face |
void Fill | ( | class Mesh * | pMesh, |
unsigned int | iFaceIndex, | ||
const Vector & | vLocalPosition, | ||
bool | bRecalculatePosition | ||
) |
Set the SurfacePoint values based on the 3D position of a point in a face.
This function is useful when the caller knows the 3D position and the faceindex of the point. The face coordinates and normal of the current point are calculated.
[in] | pMesh | the mesh |
[in] | iFaceIndex | the index of a face |
vLocalPosition | 3D position of the point | |
[in] | bRecalculatePosition | if true the position will be recalculated using the plane of the face |
void SetTangentGenerator | ( | TangentGenerator * | pGenerator | ) |
This function overrides the default tangent generator for the surface point.
If the tangent generator is not specified using this function, the surface point will automatically obtain the address of the current tangent generator for the mesh. Since this is not a very fast process, this function can be used to avoid this process if it is called before the tangents are retrieved using the TangentBase function.
[in] | pGenerator | Address of the tangent generator which should be used for this surface point. |
The following function aligns the face coordinates to be in the range 0-1.
The function also modifies the face index, if necessary.
This function mirrors the surface point to the other side of the mesh using topological symmetry (if initialized)
Serialize the SurfacePoint to the given stream.
unsigned int m_iFaceIndex |
float m_fRelativeRange |
Vector m_vLocalNormal |
bool m_bSide |
class TangentGenerator* m_pTG |