00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef CAL_SUBMESH_H
00012 #define CAL_SUBMESH_H
00013
00014
00015
00016
00017
00018 #include "cal3d/global.h"
00019 #include "cal3d/vector.h"
00020
00021
00022
00023
00024
00025 class CalCoreSubmesh;
00026
00027
00028
00029
00030
00031
00035 class CAL3D_API CalSubmesh
00036 {
00037
00038 public:
00040 typedef struct
00041 {
00042 CalVector position;
00043 CalVector positionOld;
00044 CalVector force;
00045 } PhysicalProperty;
00046
00048 struct TangentSpace
00049 {
00050 CalVector tangent;
00051 float crossFactor;
00052 };
00053
00054
00056 typedef struct
00057 {
00058 CalIndex vertexId[3];
00059 } Face;
00060
00061
00062 protected:
00063 CalCoreSubmesh *m_pCoreSubmesh;
00064 std::vector<float> m_vectorMorphTargetWeight;
00065 std::vector<CalVector> m_vectorVertex;
00066 std::vector<CalVector> m_vectorNormal;
00067 std::vector<std::vector<TangentSpace> > m_vectorvectorTangentSpace;
00068 std::vector<Face> m_vectorFace;
00069 std::vector<PhysicalProperty> m_vectorPhysicalProperty;
00070 int m_vertexCount;
00071 int m_faceCount;
00072 int m_coreMaterialId;
00073 bool m_bInternalData;
00074
00075
00076 public:
00077 CalSubmesh();
00078 virtual ~CalSubmesh();
00079
00080
00081 public:
00082 bool create(CalCoreSubmesh *pCoreSubmesh);
00083 void destroy();
00084 CalCoreSubmesh *getCoreSubmesh();
00085 int getCoreMaterialId();
00086 int getFaceCount();
00087 int getFaces(CalIndex *pFaceBuffer);
00088 std::vector<CalVector>& getVectorNormal();
00089 std::vector<std::vector<TangentSpace> >& getVectorVectorTangentSpace();
00090 std::vector<PhysicalProperty>& getVectorPhysicalProperty();
00091 std::vector<CalVector>& getVectorVertex();
00092 int getVertexCount();
00093 bool hasInternalData();
00094 void disableInternalData();
00095 void setCoreMaterialId(int coreMaterialId);
00096 void setLodLevel(float lodLevel);
00097 bool isTangentsEnabled(int mapId);
00098 bool enableTangents(int mapId, bool enabled);
00099 std::vector<float>& getVectorWeight();
00100 void setMorphTargetWeight(int blendId,float weight);
00101 float getMorphTargetWeight(int blendId);
00102 float getBaseWeight();
00103 int getMorphTargetWeightCount();
00104 std::vector<float>& getVectorMorphTargetWeight();
00105
00106 };
00107
00108 #endif
00109
00110