- Cal3D 0.11 API Reference -

coresubmesh.h
1//****************************************************************************//
2// coresubmesh.h //
3// Copyright (C) 2001, 2002 Bruno 'Beosil' Heidelberger //
4//****************************************************************************//
5// This library is free software; you can redistribute it and/or modify it //
6// under the terms of the GNU Lesser General Public License as published by //
7// the Free Software Foundation; either version 2.1 of the License, or (at //
8// your option) any later version. //
9//****************************************************************************//
10
11#ifndef CAL_CORESUBMESH_H
12#define CAL_CORESUBMESH_H
13
14
15#include "cal3d/global.h"
16#include "cal3d/vector.h"
17
18
20
21
22class CAL3D_API CalCoreSubmesh
23{
24public:
26 {
27 float u, v;
28 };
29
31 {
32 CalVector tangent;
33 float crossFactor; // To get the binormal, use ((N x T) * crossFactor)
34 };
35
36 struct Influence
37 {
38 int boneId;
39 float weight;
40 };
41
43 {
44 float weight;
45 };
46
47 struct Vertex
48 {
49 CalVector position;
50 CalVector normal;
51 std::vector<Influence> vectorInfluence;
52 int collapseId;
53 int faceCollapseCount;
54 };
55
56 struct Face
57 {
58 CalIndex vertexId[3];
59 };
60
62 struct Spring
63 {
64 int vertexId[2];
65 float springCoefficient;
66 float idleLength;
67 };
68
69public:
72
74 int getFaceCount();
75 int getLodCount();
76 int getSpringCount();
77 std::vector<Face>& getVectorFace();
78 std::vector<PhysicalProperty>& getVectorPhysicalProperty();
79 std::vector<Spring>& getVectorSpring();
80 std::vector<std::vector<TangentSpace> >& getVectorVectorTangentSpace();
81 std::vector<std::vector<TextureCoordinate> >& getVectorVectorTextureCoordinate();
82 std::vector<Vertex>& getVectorVertex();
83 int getVertexCount();
84 bool isTangentsEnabled(int mapId);
85 bool enableTangents(int mapId, bool enabled);
86 bool reserve(int vertexCount, int textureCoordinateCount, int faceCount, int springCount);
87 void setCoreMaterialThreadId(int coreMaterialThreadId);
88 bool setFace(int faceId, const Face& face);
89 void setLodCount(int lodCount);
90 bool setPhysicalProperty(int vertexId, const PhysicalProperty& physicalProperty);
91 bool setSpring(int springId, const Spring& spring);
92 bool setTangentSpace(int vertexId, int textureCoordinateId, const CalVector& tangent, float crossFactor);
93 bool setTextureCoordinate(int vertexId, int textureCoordinateId, const TextureCoordinate& textureCoordinate);
94 bool setVertex(int vertexId, const Vertex& vertex);
95 int addCoreSubMorphTarget(CalCoreSubMorphTarget *pCoreSubMorphTarget);
98 std::vector<CalCoreSubMorphTarget *>& getVectorCoreSubMorphTarget();
99 void scale(float factor);
100
101private:
102 void UpdateTangentVector(int v0, int v1, int v2, int channel);
103
104private:
105 std::vector<Vertex> m_vectorVertex;
106 std::vector<bool> m_vectorTangentsEnabled;
107 std::vector<std::vector<TangentSpace> > m_vectorvectorTangentSpace;
108 std::vector<std::vector<TextureCoordinate> > m_vectorvectorTextureCoordinate;
109 std::vector<PhysicalProperty> m_vectorPhysicalProperty;
110 std::vector<Face> m_vectorFace;
111 std::vector<Spring> m_vectorSpring;
112 std::vector<CalCoreSubMorphTarget *> m_vectorCoreSubMorphTarget;
113 int m_coreMaterialThreadId;
114 int m_lodCount;
115};
116
117#endif
118
119//****************************************************************************//
Definition coresubmorphtarget.h:20
bool setSpring(int springId, const Spring &spring)
Sets a specified spring.
Definition coresubmesh.cpp:496
bool reserve(int vertexCount, int textureCoordinateCount, int faceCount, int springCount)
Reserves memory for the vertices, faces and texture coordinates.
Definition coresubmesh.cpp:334
int getCoreMaterialThreadId()
Returns the ID of the core material thread.
Definition coresubmesh.cpp:67
int addCoreSubMorphTarget(CalCoreSubMorphTarget *pCoreSubMorphTarget)
Adds a core sub morph target.
Definition coresubmesh.cpp:564
bool enableTangents(int mapId, bool enabled)
Enables (and calculates) or disables the storage of tangent spaces.
Definition coresubmesh.cpp:173
bool setTextureCoordinate(int vertexId, int textureCoordinateId, const TextureCoordinate &textureCoordinate)
Sets a specified texture coordinate.
Definition coresubmesh.cpp:520
int getLodCount()
Returns the number of LOD steps.
Definition coresubmesh.cpp:93
std::vector< Vertex > & getVectorVertex()
Returns the vertex vector.
Definition coresubmesh.cpp:296
CalCoreSubmesh()
Constructs the core submesh instance.
Definition coresubmesh.cpp:28
void setLodCount(int lodCount)
Sets the number of LOD steps.
Definition coresubmesh.cpp:427
void scale(float factor)
Scale the Submesh.
Definition coresubmesh.cpp:635
bool setPhysicalProperty(int vertexId, const PhysicalProperty &physicalProperty)
Sets a specified physical property.
Definition coresubmesh.cpp:474
CalCoreSubMorphTarget * getCoreSubMorphTarget(int id)
Provides access to a core sub morph target.
Definition coresubmesh.cpp:587
std::vector< Spring > & getVectorSpring()
Returns the spring vector.
Definition coresubmesh.cpp:251
bool setTangentSpace(int vertexId, int textureCoordinateId, const CalVector &tangent, float crossFactor)
Sets the tangent vector associated with a specified texture coordinate pair.
Definition coresubmesh.cpp:448
int getVertexCount()
Returns the number of vertices.
Definition coresubmesh.cpp:309
std::vector< CalCoreSubMorphTarget * > & getVectorCoreSubMorphTarget()
Returns the core sub morph target vector.
Definition coresubmesh.cpp:620
int getFaceCount()
Returns the number of faces.
Definition coresubmesh.cpp:80
std::vector< std::vector< TextureCoordinate > > & getVectorVectorTextureCoordinate()
Returns the texture coordinate vector-vector.
Definition coresubmesh.cpp:266
int getCoreSubMorphTargetCount()
Returns the number of core sub morph targets.
Definition coresubmesh.cpp:606
void setCoreMaterialThreadId(int coreMaterialThreadId)
Sets the ID of the core material thread.
Definition coresubmesh.cpp:392
std::vector< PhysicalProperty > & getVectorPhysicalProperty()
Returns the physical property vector.
Definition coresubmesh.cpp:237
std::vector< std::vector< TangentSpace > > & getVectorVectorTangentSpace()
Returns the tangent space vector-vector.
Definition coresubmesh.cpp:281
bool setVertex(int vertexId, const Vertex &vertex)
Sets a specified vertex.
Definition coresubmesh.cpp:543
bool isTangentsEnabled(int mapId)
Returns true if tangent vectors are enabled.
Definition coresubmesh.cpp:119
bool setFace(int faceId, const Face &face)
Sets a specified face.
Definition coresubmesh.cpp:410
std::vector< Face > & getVectorFace()
Returns the face vector.
Definition coresubmesh.cpp:223
int getSpringCount()
Returns the number of springs.
Definition coresubmesh.cpp:106
The vector class.
Definition vector.h:37
Definition coresubmesh.h:57
Definition coresubmesh.h:37
Definition coresubmesh.h:43
The core submesh Spring.
Definition coresubmesh.h:63
Definition coresubmesh.h:31
Definition coresubmesh.h:26
Definition coresubmesh.h:48

Generated by The Cal3D Team with Doxygen 1.15.0