PixelLightAPI  .
Public Member Functions
PLMesh::MeshMorphTarget Class Reference

A morph target alters the vertex data for each frame. More...

#include <MeshMorphTarget.h>

List of all members.

Public Member Functions

PLMESH_API MeshMorphTarget (Mesh *pMesh=nullptr)
 Constructor.
PLMESH_API ~MeshMorphTarget ()
 Destructor.
PLMESH_API MeshGetMesh () const
 Returns the mesh the morph target belongs to.
PLMESH_API void SetMesh (Mesh *pMesh=nullptr)
 Sets the mesh the morph target belongs to.
PLMESH_API PLCore::String GetName () const
 Returns the name of this morph target.
PLMESH_API void SetName (const PLCore::String &sName)
 Sets the name of this morph target.
PLMESH_API bool IsRelative () const
 Returns whether this morph target is relative to the basis morph target or not.
PLMESH_API void SetRelative (bool bRelative=false)
 Sets whether this morph target is relative to the basis morph target or not.
PLMESH_API PLCore::Array
< PLCore::uint32 > & 
GetVertexIDs ()
 Returns the vertex ID's.
PLMESH_API
PLRenderer::VertexBuffer
GetVertexBuffer () const
 Returns the vertex buffer.
PLMESH_API MeshMorphTargetoperator= (const MeshMorphTarget &cSource)
 Copy operator.
PLMESH_API void BuildTrianglePlaneList ()
 Builds the current triangle planes.
PLMESH_API PLCore::Array
< PLMath::Plane > & 
GetTrianglePlaneList ()
 Gets the triangle plane list.
PLMESH_API bool CalculateNormals ()
 Calculate the vertex normals of the morph target.
PLMESH_API bool CalculateTangentSpaceVectors (bool bTangent=true, bool bBinormal=true)
 Calculates all tangent space vectors of the morph target.
PLMESH_API bool CalculateBoundingBox (PLMath::Vector3 &vMinPos, PLMath::Vector3 &vMaxPos) const
 Calculates the morph target bounding box.
PLMESH_API bool CalculateBoundingSphere (PLMath::Vector3 &vPos, float &fRadius) const
 Calculates the morph target bounding sphere.

Detailed Description

A morph target alters the vertex data for each frame.


Constructor & Destructor Documentation

PLMESH_API PLMesh::MeshMorphTarget::MeshMorphTarget ( Mesh pMesh = nullptr)

Constructor.

Parameters:
[in]pMeshPointer to the owner mesh, can be a null pointer

Destructor.


Member Function Documentation

PLMESH_API Mesh* PLMesh::MeshMorphTarget::GetMesh ( ) const

Returns the mesh the morph target belongs to.

Returns:
Pointer to the owner mesh, can be a null pointer
PLMESH_API void PLMesh::MeshMorphTarget::SetMesh ( Mesh pMesh = nullptr)

Sets the mesh the morph target belongs to.

Parameters:
[in]pMeshPointer to the owner mesh, can be a null pointer

Returns the name of this morph target.

Returns:
Name of this morph target
PLMESH_API void PLMesh::MeshMorphTarget::SetName ( const PLCore::String sName)

Sets the name of this morph target.

Parameters:
[in]sNameName of this morph target
Note:
  • The name muse be unique, if the owner mesh has already a morph target with this name, the given name is changed automatically
PLMESH_API bool PLMesh::MeshMorphTarget::IsRelative ( ) const

Returns whether this morph target is relative to the basis morph target or not.

Returns:
'true' if it's relative, else 'false'
PLMESH_API void PLMesh::MeshMorphTarget::SetRelative ( bool  bRelative = false)

Sets whether this morph target is relative to the basis morph target or not.

Parameters:
[in]bRelative'true' if it's relative, else 'false'
PLMESH_API PLCore::Array<PLCore::uint32>& PLMesh::MeshMorphTarget::GetVertexIDs ( )

Returns the vertex ID's.

Returns:
Vertex ID's
Note:
  • Only used if the morph target is relative to the base morph target
  • If there are vertex ID's they will be used for the vertex buffer to skip null deltas

Returns the vertex buffer.

Returns:
Vertex buffer, can be a null pointer
PLMESH_API MeshMorphTarget& PLMesh::MeshMorphTarget::operator= ( const MeshMorphTarget cSource)

Copy operator.

Parameters:
[in]cSourceSource to copy from
Returns:
This class instance

Builds the current triangle planes.

Note:
  • The triangle planes must be updated after manipulating geometries or vertices!
  • If the triangle list is available (MeshLODLevel::GetTriangleList()) it will be used for faster triangle plane calculation, else the slower GetTriangle() is used instead. If there are vertex ID's, we CAN'T build triangle planes because only a few vertices are influenced by this morph target!

Gets the triangle plane list.

Returns:
Triangle plane list
See also:

Calculate the vertex normals of the morph target.

Returns:
'true' if all went fine, else 'false'
Note:
  • This function will add normals to the vertex buffer if there are no one allocated yet
  • If there are vertex ID's, we CAN'T calculate normals because only a few vertices are influenced by this morph target!
PLMESH_API bool PLMesh::MeshMorphTarget::CalculateTangentSpaceVectors ( bool  bTangent = true,
bool  bBinormal = true 
)

Calculates all tangent space vectors of the morph target.

Parameters:
[in]bTangentCreate tangent vectors?
[in]bBinormalCreate binormal vectors?
Returns:
'true' if all went fine, else 'false' (maybe the mesh has no texture coordinates...)
Note:
  • This function will add tangents and binormals to the vertex buffer if there are no one allocated yet
  • If there are no normals available they will be computed (see CalculateNormals())
  • To save memory one can only hold tangent vectors and compute the binormal for instance within a vertex shader using a cross product of the normal and tangent vector
  • If there are vertex ID's, we CAN'T calculate normals because only a few vertices are influenced by this morph target!
PLMESH_API bool PLMesh::MeshMorphTarget::CalculateBoundingBox ( PLMath::Vector3 vMinPos,
PLMath::Vector3 vMaxPos 
) const

Calculates the morph target bounding box.

Parameters:
[out]vMinPosWill receive the minimum bounding box position
[out]vMaxPosWill receive the maximum bounding box position
Returns:
'true' if all went fine, else 'false'
PLMESH_API bool PLMesh::MeshMorphTarget::CalculateBoundingSphere ( PLMath::Vector3 vPos,
float &  fRadius 
) const

Calculates the morph target bounding sphere.

Parameters:
[out]vPosWill receive the bounding sphere position
[out]fRadiusWill receive the bounding sphere radius
Returns:
'true' if all went fine, else 'false'

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


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:36
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported