7 #ifndef CAFU_MODEL_HPP_INCLUDED
8 #define CAFU_MODEL_HPP_INCLUDED
10 #include "Templates/Array.hpp"
11 #include "MaterialSystem/MaterialManagerImpl.hpp"
12 #include "MaterialSystem/Mesh.hpp"
13 #include "Math3D/BoundingBox.hpp"
14 #include "Math3D/Matrix.hpp"
15 #include "AnimPose.hpp"
17 #if defined(_WIN32) && _MSC_VER<1600
27 namespace MatSys {
class RenderMaterialT; }
28 namespace ModelEditor {
class CommandAddT; }
30 namespace ModelEditor {
class CommandRenameT; }
31 namespace ModelEditor {
class CommandSetAnimFPST; }
32 namespace ModelEditor {
class CommandSetAnimNextT; }
33 namespace ModelEditor {
class CommandSetMaterialT; }
34 namespace ModelEditor {
class CommandSetMeshTSMethodT; }
35 namespace ModelEditor {
class CommandSetMeshShadowsT; }
36 namespace ModelEditor {
class CommandTransformJointT; }
37 namespace ModelEditor {
class CommandUpdateAnimT; }
38 namespace ModelEditor {
class CommandUpdateChannelT; }
39 namespace ModelEditor {
class CommandUpdateGuiFixtureT; }
40 namespace ModelEditor {
class CommandUpdateTriangleT; }
41 namespace ModelEditor {
class CommandUpdateUVCoordsT; }
76 TriangleT(
unsigned int v0=0,
unsigned int v1=0,
unsigned int v2=0);
101 unsigned int JointIdx;
119 bool AreGeoDups(
unsigned int Vertex1Nr,
unsigned int Vertex2Nr)
const;
163 unsigned int VertexNr;
227 bool IsMember(
unsigned int JointNr)
const;
228 void SetMember(
unsigned int JointNr,
bool Member=
true);
250 void Save(std::ostream& OutStream)
const;
253 const std::string& GetFileName()
const {
return m_FileName; }
261 const CafuModelT* GetDlodModel()
const {
return m_DlodModel; }
262 float GetDlodDist()
const {
return m_DlodDist; }
271 bool IsMeshNrOK(
const GuiFixtureT& GF,
unsigned int PointNr)
const;
274 bool IsVertexNrOK(
const GuiFixtureT& GF,
unsigned int PointNr)
const;
311 const std::string m_FileName;
Definition: Delete.hpp:21
Vector3fT DefaultQtr
The default orientation of the coordinate axes of the joint. Used for all frames in this anim sequenc...
Definition: Model_cmdl.hpp:182
ArrayT< FrameT > Frames
List of keyframes this animation consists of.
Definition: Model_cmdl.hpp:212
std::string Name
Name of this animation sequence.
Definition: Model_cmdl.hpp:207
bool AreGeoDups(unsigned int Vertex1Nr, unsigned int Vertex2Nr) const
Determines whether the two vertices with array indices Vertex1Nr and Vertex2Nr are geometrical duplic...
Definition: Model_cmdl.cpp:92
This struct describes one animation sequence, e.g. "run", "walk", "jump", etc.
Definition: Model_cmdl.hpp:175
This class represents a surface render material.
Definition: RenderMaterial.hpp:25
This class represents a native Cafu model.
Definition: Model_cmdl.hpp:45
The base class for importing additional animations into an existing CafuModelT.
Definition: Loader.hpp:115
A single triangle.
Definition: Model_cmdl.hpp:74
static const unsigned int CMDL_FILE_VERSION
The current version of the cmdl file format.
Definition: Model_cmdl.hpp:286
std::string Name
Name of this mesh.
Definition: Model_cmdl.hpp:130
void Print() const
Prints some model data to stdout, used for debugging.
Definition: Model_cmdl.cpp:948
Definition: UpdateChannel.hpp:18
CafuModelT(ModelLoaderT &Loader)
The constructor.
Definition: Model_cmdl.cpp:266
ArrayT< MatSys::RenderMaterialT * > RenderMaterials
Analogous to Materials, these are the (possibly NULL) render materials for the meshes in this skin...
Definition: Model_cmdl.hpp:146
bool IsVertexNrOK(const GuiFixtureT &GF, unsigned int PointNr) const
Determines if GF.Points[PointNr].VertexNr is a valid index into this model.
Definition: Model_cmdl.cpp:933
const MaterialT * GetMaterial(unsigned long MeshNr, int SkinNr) const
Returns the proper material for the given mesh in the given skin.
Definition: Model_cmdl.cpp:893
unsigned int Flags
If the i-th bit in Flags is not set, DefaultPos[i], DefaultQtr[i-3] and DefaultScale[i-6] are used fo...
Definition: Model_cmdl.hpp:184
Definition: SetMeshTSMethod.hpp:18
bool Polarity
True if this triangle has positive polarity (texture is not mirrored), or false if it has negative po...
Definition: Model_cmdl.hpp:82
unsigned int NumWeights
The number of weights that form this vertex.
Definition: Model_cmdl.hpp:92
ArrayT< WeightT > Weights
List of weights that are attached to the skeleton (hierarchy of bones/joints).
Definition: Model_cmdl.hpp:137
Definition: Model_cmdl.hpp:177
BoundingBox3fT BB
The bounding box of the model in this frame.
Definition: Model_cmdl.hpp:192
Definition: Model_cmdl.hpp:160
std::string GetTSMethod() const
Returns a string representation of the TSMethod enum member.
Definition: Model_cmdl.cpp:121
Definition: UpdateAnim.hpp:18
Definition: SetAnimNext.hpp:17
ArrayT< VertexT > Vertices
List of vertices this mesh consists of.
Definition: Model_cmdl.hpp:136
[NOT YET IMPLEMENTED! At this time, this is the same as GLOBAL.] Like GLOBAL, but takes the given smo...
Definition: Model_cmdl.hpp:70
AnimExprPoolT & GetAnimExprPool() const
This method returns the pool of anim expressions for this model.
Definition: Model_cmdl.hpp:277
unsigned int VertexIdx[3]
The indices to the three vertices that define this triangle.
Definition: Model_cmdl.hpp:78
Vector3fT Qtr
The orientation of the coordinate axes of the joint.
Definition: Model_cmdl.hpp:55
The base class for importing arbitrary model files into Cafu models.
Definition: Loader.hpp:15
std::string Name
The name of this skin.
Definition: Model_cmdl.hpp:144
Vector3fT Scale
The scale of the coordinate axes of the joint.
Definition: Model_cmdl.hpp:56
A keyframe in the animation.
Definition: Model_cmdl.hpp:190
void RecomputeBB(unsigned int FrameNr, const ArrayT< JointT > &Joints, const ArrayT< MeshT > &Meshes)
Recomputes the bounding-box for the specified frame in this animation sequence.
Definition: Model_cmdl.cpp:161
int NeighbIdx[3]
The array indices of the three neighbouring triangles at the edges 01, 12 and 20. -1 indicates no nei...
Definition: Model_cmdl.hpp:81
bool Polarity
True if this vertex belongs to triangles with positive polarity, false if it belongs to triangles wit...
Definition: Model_cmdl.hpp:94
Definition: AnimExpr.hpp:224
unsigned int FirstWeightIdx
The index of the first weight in the Weights array.
Definition: Model_cmdl.hpp:91
Vector3fT Pos
The position of the origin of the joint (relative, in the coordinate system of the parent joint)...
Definition: Model_cmdl.hpp:54
This struct defines a triangle mesh in the model.
Definition: Model_cmdl.hpp:63
This class represents a surface material ("A datastructural representation of a scripts material def...
Definition: Material.hpp:22
AnimPoseT * GetSharedPose(IntrusivePtrT< AnimExpressionT > AE) const
This method is strictly for backwards-compatibility only, do not use in new code! ...
Definition: Model_cmdl.cpp:940
TangentSpaceMethodT TSMethod
How to generate the tangent-space axes at the vertices of this mesh? For meshes with normal-maps...
Definition: Model_cmdl.hpp:133
This command sets a new material for a given mesh in a given skin.
Definition: SetMaterial.hpp:22
MatSys::RenderMaterialT * GetRenderMaterial(unsigned long MeshNr, int SkinNr) const
Returns the proper render material for the given mesh in the given skin.
Definition: Model_cmdl.cpp:910
Definition: UpdateTriangle.hpp:17
void Import(AnimImporterT &Importer)
Imports animations into this model using the given AnimImporterT.
Definition: Model_cmdl.cpp:373
ArrayT< MaterialT * > Materials
For each mesh m, Materials[m] is the material for the mesh in this skin. If Materials[m] is NULL...
Definition: Model_cmdl.hpp:145
Considers all triangles in the mesh to be in the same common smoothing group, and smoothes them globa...
Definition: Model_cmdl.hpp:69
bool CastShadows
Should this mesh cast shadows?
Definition: Model_cmdl.hpp:134
This struct represents a joint in the skeleton / a node in the hierarchy of the model.
Definition: Model_cmdl.hpp:50
uint32_t SmoothGroups
The smoothing groups that this triangle is in: If bit i is set, the triangle is in smoothing group i...
Definition: Model_cmdl.hpp:79
float FPS
Playback rate for this animation sequence.
Definition: Model_cmdl.hpp:208
ArrayT< AnimJointT > AnimJoints
AnimJoints.Size() == m_Joints.Size()
Definition: Model_cmdl.hpp:211
This class implements the MaterialManagerI interface.
Definition: MaterialManagerImpl.hpp:23
MaterialT * Material
The material of this mesh.
Definition: Model_cmdl.hpp:131
TangentSpaceMethodT
The methods that can be used to generate the tangent-space axes at the vertices of a mesh...
Definition: Model_cmdl.hpp:66
bool SkipDraw
True if this triangle should be skipped when drawing the mesh (but not for casting stencil shadows an...
Definition: Model_cmdl.hpp:83
~CafuModelT()
The destructor.
Definition: Model_cmdl.cpp:353
void Save(std::ostream &OutStream) const
Saves the model into the given stream.
Definition: Model_cmdl.cpp:656
int Next
The sequence that should play after this. Use "this" for looping sequences, -1 for none...
Definition: Model_cmdl.hpp:209
Channels allow animations to play only on a subset of the joints, so that multiple animations can pla...
Definition: Model_cmdl.hpp:223
Definition: UpdateUVCoords.hpp:21
Definition: Rename.hpp:18
Vector3fT DefaultScale
The default scale of the coordinate axes of the joint. Used for all frames in this anim sequence unle...
Definition: Model_cmdl.hpp:183
ArrayT< unsigned int > GeoDups
This array contains the indices of vertices that are geometrical duplicates of this vertex...
Definition: Model_cmdl.hpp:95
Definition: UpdateGuiFixture.hpp:18
Definition: Delete.hpp:22
MeshT()
The default constructor.
Definition: Model_cmdl.hpp:108
std::string Name
The name of this channel.
Definition: Model_cmdl.hpp:225
float v
Texture coordinate v.
Definition: Model_cmdl.hpp:90
float u
Texture coordinate u.
Definition: Model_cmdl.hpp:89
A weight is a fixed position in the coordinate system of a joint.
Definition: Model_cmdl.hpp:99
A single vertex.
Definition: Model_cmdl.hpp:87
Definition: SetMeshShadows.hpp:17
This class describes a specific pose of an associated model.
Definition: AnimPose.hpp:35
int Parent
The parent of the root joint is -1.
Definition: Model_cmdl.hpp:53
bool IsMeshNrOK(const GuiFixtureT &GF, unsigned int PointNr) const
Determines if GF.Points[PointNr].MeshNr is a valid index into this model.
Definition: Model_cmdl.cpp:927
Definition: SetAnimFPS.hpp:17
Vector3fT DefaultPos
The default position of the origin of the joint (relative, in the coordinate system of the parent joi...
Definition: Model_cmdl.hpp:181
MatSys::RenderMaterialT * RenderMaterial
The render material used to render this mesh.
Definition: Model_cmdl.hpp:132
bool IsLastFrameDup() const
Returns whether the first frame in the sequence is equal to the last.
Definition: Model_cmdl.cpp:231
std::string Name
The name of the joint.
Definition: Model_cmdl.hpp:52
This struct defines how and where a GUI can be fixed to the model.
Definition: Model_cmdl.hpp:156
This struct describes additional/alternative skins for the meshes of this model.
Definition: Model_cmdl.hpp:142
void SetTSMethod(const std::string &m)
Sets the TSMethod enum member by string.
Definition: Model_cmdl.cpp:134
Hard edges, no smoothing: The tangent-space of the triangle is used as the tangent-space of its verti...
Definition: Model_cmdl.hpp:68
ArrayT< TriangleT > Triangles
List of triangles this mesh consists of.
Definition: Model_cmdl.hpp:135
unsigned int FirstDataIdx
If f is the current frame, this is the index into Frames[f].AnimData[...].
Definition: Model_cmdl.hpp:185