Linderdaum Engine: clMesh Class Reference
Updated: Mon May 14 2012 05:02:33
clMesh Class Reference

#include <Mesh.h>

List of all members.

Public Member Functions

 clMesh ()
virtual ~clMesh ()
clMeshCloneMesh () const
 Internal copy routine. Temporarily implemented using Save-Load pair.
void MergeRigids (int Idx1, int Idx2)
 Merge some vertex attribs in a mesh. No animation support yet.
void MergeSimilarRigids ()
 Merge all similar (determined by rigid name)
void MergeWith (clMesh *M)
 Add all rigids from another mesh. Won't work (yet) with hierarchical meshes.
void Transform (const LMatrix4 &T)
 Transform every root node of the mesh by the given matrix.
void FlattenMesh ()
 Transform vertices of each rigid to global coordinates.
void CopyMaterialsFrom (const clMesh *M)
bool LoadMesh (const std::string &FileName)
bool SaveMesh (const std::string &FileName)
void SaveToStream (iOStream *Stream) const
bool LoadFromStream (iIStream *Stream)
void SaveToBinaryFile (const std::string &FName) const
void LoadFromBinaryFile (const std::string &FName)
sAnimSequence GetAnimSequenceByName (const std::string &Name) const
clAnimationGetAnimation () const
std::string GetAnimSequenceName (size_t i) const
size_t GetNumAnimSequences () const
void LoadAnimStates (const std::string &FileName)
int AddVertexAttribs (const std::string &Name, clVertexAttribs *Attribs, const LMatrix4 &GlobalTransform, int ParentID, int MaterialID)
 add new part to the mesh and return its ID and take ownership of Attribs
void RemoveVertexAttribs (int RigidID)
 Remove the rigid from mesh. WARNING: no mesh hierarchy checks are done. So if there are child nodes something can crash.
int FindRigidByName (const std::string &Name) const
int AddMaterial (const sMaterialDesc &Material)
 add new material to the mesh and return its ID
void RecalculateLocalFromGlobal ()
 fills the FLocalTransforms array based on FGlobalTransforms
LAABoundingBox GetBoundingBox () const
 recalculate and return AABB for the entire mesh
LAABoundingBox GetCachedBoundingBox () const
 return cached AABB for the entire mesh
void PrecalculateBoundingBoxes ()
size_t GetMaterialsCount () const
sMaterialDesc GetMaterialDesc (int i) const
size_t GetRigidsCount () const
clVertexAttribsGetRigid (size_t i) const
std::string GetRigidName (size_t i) const
int GetParentRef (size_t i) const
int GetRigidMaterial (size_t i) const
const sMaterialDescGetMaterial (size_t i) const
const LMatrix4GetLocalTransform (size_t i) const
iVertexArrayGetVertexArray (size_t i) const
iTextureGetPackedSkeleton (size_t i) const
bool IntersectWithRay (const LVector3 &P, const LVector3 &A, LVector3 &isect) const
 Check intersection with ray and calculate intersection point.
bool IntersectWithRayIdx (const LVector3 &P, const LVector3 &A, LVector3 &isect, int &Rigid) const
 Check intersection with ray and calculate intersection point and return rigid index.

Private Attributes

std::vector< clVertexAttribs * > FRigids
 Collection of rigid parts of the mesh.
std::vector< std::string > FNames
 Names of the rigids.
sAttribStream< LMatrix4FLocalTransforms
 Local transformation for every rigid.
sAttribStream< LMatrix4FGlobalTransforms
 Precached global transformations.
sAttribStream< intFParentRef
 Parent index for every rigid. -1 if none.
sAttribStream< intFMaterialRef
 Material index for every rigid. No multimaterials are possible here.
sAttribStream< sMaterialDescFMaterials
 Collection of mesh materials.
clAnimationFAnimations
 Collection of named animations.
std::vector< iVertexArray * > FVertexArrays
 Precached rendering vertex arrays used by RenderDirect()
std::vector< iTexture * > FPackedSkeletons
LAABoundingBox FAABB
 Precached AABB.
bool FAABBValid

Constructor & Destructor Documentation

clMesh::clMesh ( )
clMesh::~clMesh ( ) [virtual]

Member Function Documentation

int clMesh::AddMaterial ( const sMaterialDesc Material)

add new material to the mesh and return its ID

int clMesh::AddVertexAttribs ( const std::string &  Name,
clVertexAttribs Attribs,
const LMatrix4 GlobalTransform,
int  ParentID,
int  MaterialID 
)

add new part to the mesh and return its ID and take ownership of Attribs

clMesh * clMesh::CloneMesh ( ) const

Internal copy routine. Temporarily implemented using Save-Load pair.

void clMesh::CopyMaterialsFrom ( const clMesh M)
int clMesh::FindRigidByName ( const std::string &  Name) const
void clMesh::FlattenMesh ( )

Transform vertices of each rigid to global coordinates.

clAnimation* clMesh::GetAnimation ( ) const [inline]
sAnimSequence clMesh::GetAnimSequenceByName ( const std::string &  Name) const
std::string clMesh::GetAnimSequenceName ( size_t  i) const
LAABoundingBox clMesh::GetBoundingBox ( ) const

recalculate and return AABB for the entire mesh

LAABoundingBox clMesh::GetCachedBoundingBox ( ) const

return cached AABB for the entire mesh

const LMatrix4& clMesh::GetLocalTransform ( size_t  i) const [inline]
const sMaterialDesc* clMesh::GetMaterial ( size_t  i) const [inline]
sMaterialDesc clMesh::GetMaterialDesc ( int  i) const [inline]
size_t clMesh::GetMaterialsCount ( ) const [inline]
size_t clMesh::GetNumAnimSequences ( ) const
iTexture * clMesh::GetPackedSkeleton ( size_t  i) const
int clMesh::GetParentRef ( size_t  i) const [inline]
clVertexAttribs* clMesh::GetRigid ( size_t  i) const [inline]
int clMesh::GetRigidMaterial ( size_t  i) const [inline]
std::string clMesh::GetRigidName ( size_t  i) const [inline]
size_t clMesh::GetRigidsCount ( ) const [inline]
iVertexArray * clMesh::GetVertexArray ( size_t  i) const
bool clMesh::IntersectWithRay ( const LVector3 P,
const LVector3 A,
LVector3 isect 
) const

Check intersection with ray and calculate intersection point.

bool clMesh::IntersectWithRayIdx ( const LVector3 P,
const LVector3 A,
LVector3 isect,
int Rigid 
) const

Check intersection with ray and calculate intersection point and return rigid index.

void clMesh::LoadAnimStates ( const std::string &  FileName)
void clMesh::LoadFromBinaryFile ( const std::string &  FName)
bool clMesh::LoadFromStream ( iIStream Stream)
bool clMesh::LoadMesh ( const std::string &  FileName)
void clMesh::MergeRigids ( int  Idx1,
int  Idx2 
)

Merge some vertex attribs in a mesh. No animation support yet.

void clMesh::MergeSimilarRigids ( )

Merge all similar (determined by rigid name)

While there are still items to merge

void clMesh::MergeWith ( clMesh M)

Add all rigids from another mesh. Won't work (yet) with hierarchical meshes.

void clMesh::PrecalculateBoundingBoxes ( )
void clMesh::RecalculateLocalFromGlobal ( )

fills the FLocalTransforms array based on FGlobalTransforms

void clMesh::RemoveVertexAttribs ( int  RigidID)

Remove the rigid from mesh. WARNING: no mesh hierarchy checks are done. So if there are child nodes something can crash.

bool clMesh::SaveMesh ( const std::string &  FileName)
void clMesh::SaveToBinaryFile ( const std::string &  FName) const
void clMesh::SaveToStream ( iOStream Stream) const
void clMesh::Transform ( const LMatrix4 T)

Transform every root node of the mesh by the given matrix.


Member Data Documentation

LAABoundingBox clMesh::FAABB [mutable, private]

Precached AABB.

bool clMesh::FAABBValid [mutable, private]

Collection of named animations.

Precached global transformations.

Local transformation for every rigid.

Material index for every rigid. No multimaterials are possible here.

Collection of mesh materials.

std::vector< std::string > clMesh::FNames [private]

Names of the rigids.

std::vector<iTexture*> clMesh::FPackedSkeletons [mutable, private]

Parent index for every rigid. -1 if none.

std::vector<clVertexAttribs*> clMesh::FRigids [private]

Collection of rigid parts of the mesh.

std::vector<iVertexArray*> clMesh::FVertexArrays [mutable, private]

Precached rendering vertex arrays used by RenderDirect()


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