Cafu Engine
CafuModelT::MeshT Struct Reference

This struct defines a triangle mesh in the model. More...

#include "Model_cmdl.hpp"

Classes

struct  TriangleT
 A single triangle. More...
 
struct  VertexT
 A single vertex. More...
 
struct  WeightT
 A weight is a fixed position in the coordinate system of a joint. More...
 

Public Types

enum  TangentSpaceMethodT { HARD, GLOBAL, SM_GROUPS }
 The methods that can be used to generate the tangent-space axes at the vertices of a mesh. More...
 

Public Member Functions

 MeshT ()
 The default constructor. More...
 
bool AreGeoDups (unsigned int Vertex1Nr, unsigned int Vertex2Nr) const
 Determines whether the two vertices with array indices Vertex1Nr and Vertex2Nr are geometrical duplicates of each other. More...
 
std::string GetTSMethod () const
 Returns a string representation of the TSMethod enum member. More...
 
void SetTSMethod (const std::string &m)
 Sets the TSMethod enum member by string. More...
 

Public Attributes

std::string Name
 Name of this mesh. More...
 
MaterialTMaterial
 The material of this mesh. More...
 
MatSys::RenderMaterialTRenderMaterial
 The render material used to render this mesh. More...
 
TangentSpaceMethodT TSMethod
 How to generate the tangent-space axes at the vertices of this mesh? For meshes with normal-maps, the method should match the one that was used in the program that created the normal-maps. More...
 
bool CastShadows
 Should this mesh cast shadows? More...
 
ArrayT< TriangleTTriangles
 List of triangles this mesh consists of. More...
 
ArrayT< VertexTVertices
 List of vertices this mesh consists of. More...
 
ArrayT< WeightTWeights
 List of weights that are attached to the skeleton (hierarchy of bones/joints). More...
 

Detailed Description

This struct defines a triangle mesh in the model.

A mesh essentially consists of a list of triangles whose vertices are composed of weighted positions that are attached to the joints of the model.

Member Enumeration Documentation

The methods that can be used to generate the tangent-space axes at the vertices of a mesh.

Enumerator
HARD 

Hard edges, no smoothing: The tangent-space of the triangle is used as the tangent-space of its vertices. (Any smoothing groups info, if available, is ignored.)

GLOBAL 

Considers all triangles in the mesh to be in the same common smoothing group, and smoothes them globally. (Any smoothing groups info, if available, is ignored.) This method is equivalent to SM_GROUPS when all triangles are in the same smoothing group. It is also the default method, as it requires no smoothing groups info at all, provides better performance than SM_GROUPS, and was implemented in earlier versions of Cafu.

SM_GROUPS 

[NOT YET IMPLEMENTED! At this time, this is the same as GLOBAL.] Like GLOBAL, but takes the given smoothing groups into account.

Constructor & Destructor Documentation

CafuModelT::MeshT::MeshT ( )
inline

The default constructor.

Member Function Documentation

bool CafuModelT::MeshT::AreGeoDups ( unsigned int  Vertex1Nr,
unsigned int  Vertex2Nr 
) const

Determines whether the two vertices with array indices Vertex1Nr and Vertex2Nr are geometrical duplicates of each other.

Two distinct vertices are geometrical duplicates of each other if (a) they have the same NumWeights and the same FirstWeightIdx, or (b) they have the same NumWeights and the referred weights have the same contents. The two vertices may in general have different uv-coordinates, which are not considered for the geodup property. Note that if Vertex1Nr==Vertex2Nr, true is returned (case (a) above).

Parameters
Vertex1NrArray index of first vertex.
Vertex2NrArray index of second vertex.
Returns
Whether the vertices are geometrical duplicates of each other.
std::string CafuModelT::MeshT::GetTSMethod ( ) const

Returns a string representation of the TSMethod enum member.

void CafuModelT::MeshT::SetTSMethod ( const std::string &  m)

Sets the TSMethod enum member by string.

The given string should be one of the strings returned by GetTSMethod(). If the string does not match a known method, TSMethod is set to GLOBAL.

Parameters
mThe method to set TSMethod to.

Member Data Documentation

bool CafuModelT::MeshT::CastShadows

Should this mesh cast shadows?

MaterialT* CafuModelT::MeshT::Material

The material of this mesh.

std::string CafuModelT::MeshT::Name

Name of this mesh.

MatSys::RenderMaterialT* CafuModelT::MeshT::RenderMaterial

The render material used to render this mesh.

ArrayT<TriangleT> CafuModelT::MeshT::Triangles

List of triangles this mesh consists of.

TangentSpaceMethodT CafuModelT::MeshT::TSMethod

How to generate the tangent-space axes at the vertices of this mesh? For meshes with normal-maps, the method should match the one that was used in the program that created the normal-maps.

ArrayT<VertexT> CafuModelT::MeshT::Vertices

List of vertices this mesh consists of.

ArrayT<WeightT> CafuModelT::MeshT::Weights

List of weights that are attached to the skeleton (hierarchy of bones/joints).


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