- Cal3D 0.11 API Reference -

coresubmesh.h

00001 //****************************************************************************//
00002 // coresubmesh.h                                                              //
00003 // Copyright (C) 2001, 2002 Bruno 'Beosil' Heidelberger                       //
00004 //****************************************************************************//
00005 // This library is free software; you can redistribute it and/or modify it    //
00006 // under the terms of the GNU Lesser General Public License as published by   //
00007 // the Free Software Foundation; either version 2.1 of the License, or (at    //
00008 // your option) any later version.                                            //
00009 //****************************************************************************//
00010 
00011 #ifndef CAL_CORESUBMESH_H
00012 #define CAL_CORESUBMESH_H
00013 
00014 
00015 #include "cal3d/global.h"
00016 #include "cal3d/vector.h"
00017 
00018 
00019 class CalCoreSubMorphTarget;
00020 
00021 
00022 class CAL3D_API CalCoreSubmesh
00023 {
00024 public:
00025   struct TextureCoordinate
00026   {
00027     float u, v;
00028   };
00029 
00030   struct TangentSpace
00031   {
00032     CalVector tangent;
00033     float crossFactor;  // To get the binormal, use ((N x T) * crossFactor)
00034   };
00035 
00036   struct Influence
00037   {
00038     int boneId;
00039     float weight;
00040   };
00041 
00042   struct PhysicalProperty
00043   {
00044     float weight;
00045   };
00046 
00047   struct Vertex
00048   {
00049     CalVector position;
00050     CalVector normal;
00051     std::vector<Influence> vectorInfluence;
00052     int collapseId;
00053     int faceCollapseCount;
00054   };
00055 
00056   struct Face
00057   {
00058     CalIndex vertexId[3];
00059   };
00060   
00062   struct Spring
00063   {
00064     int vertexId[2];
00065     float springCoefficient;
00066     float idleLength;
00067   };
00068 
00069 public:
00070   CalCoreSubmesh();
00071   ~CalCoreSubmesh();
00072 
00073   int getCoreMaterialThreadId();
00074   int getFaceCount();
00075   int getLodCount();
00076   int getSpringCount();
00077   std::vector<Face>& getVectorFace();
00078   std::vector<PhysicalProperty>& getVectorPhysicalProperty();
00079   std::vector<Spring>& getVectorSpring();
00080   std::vector<std::vector<TangentSpace> >& getVectorVectorTangentSpace();
00081   std::vector<std::vector<TextureCoordinate> >& getVectorVectorTextureCoordinate();
00082   std::vector<Vertex>& getVectorVertex();
00083   int getVertexCount();
00084   bool isTangentsEnabled(int mapId);
00085   bool enableTangents(int mapId, bool enabled);
00086   bool reserve(int vertexCount, int textureCoordinateCount, int faceCount, int springCount);
00087   void setCoreMaterialThreadId(int coreMaterialThreadId);
00088   bool setFace(int faceId, const Face& face);
00089   void setLodCount(int lodCount);
00090   bool setPhysicalProperty(int vertexId, const PhysicalProperty& physicalProperty);
00091   bool setSpring(int springId, const Spring& spring);
00092   bool setTangentSpace(int vertexId, int textureCoordinateId, const CalVector& tangent, float crossFactor);
00093   bool setTextureCoordinate(int vertexId, int textureCoordinateId, const TextureCoordinate& textureCoordinate);
00094   bool setVertex(int vertexId, const Vertex& vertex);
00095   int addCoreSubMorphTarget(CalCoreSubMorphTarget *pCoreSubMorphTarget);
00096   CalCoreSubMorphTarget *getCoreSubMorphTarget(int id);
00097   int getCoreSubMorphTargetCount();
00098   std::vector<CalCoreSubMorphTarget *>& getVectorCoreSubMorphTarget();
00099   void scale(float factor);
00100 
00101 private:
00102   void UpdateTangentVector(int v0, int v1, int v2, int channel);
00103 
00104 private:
00105   std::vector<Vertex> m_vectorVertex;
00106   std::vector<bool> m_vectorTangentsEnabled;
00107   std::vector<std::vector<TangentSpace> > m_vectorvectorTangentSpace;
00108   std::vector<std::vector<TextureCoordinate> > m_vectorvectorTextureCoordinate;
00109   std::vector<PhysicalProperty> m_vectorPhysicalProperty;
00110   std::vector<Face> m_vectorFace;
00111   std::vector<Spring> m_vectorSpring;
00112   std::vector<CalCoreSubMorphTarget *> m_vectorCoreSubMorphTarget;
00113   int m_coreMaterialThreadId;
00114   int m_lodCount;
00115 };
00116 
00117 #endif
00118 
00119 //****************************************************************************//

Generated at Thu Jun 29 19:03:59 2006 by The Cal3D Team with Doxygen 1.4.6