- Cal3D 0.9 API Reference -

Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

# 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 // Includes                                                                   //
    00016 //****************************************************************************//
    00017
    00018 #include "cal3d/global.h"
    00019 #include "cal3d/vector.h"
    00020
    00021 //****************************************************************************//
    00022 // Forward declarations                                                       //
    00023 //****************************************************************************//
    00024
    00025 class CalCoreSubMorphTarget;
    00026
    00027 //****************************************************************************//
    00028 // Class declaration                                                          //
    00029 //****************************************************************************//
    00030
    00031  /*****************************************************************************/
    00035 class CAL3D_API CalCoreSubmesh
    00036 {
    00037 // misc
    00038 public:
    00040   typedef struct
    00041   {
    00042     float u, v;
    00043   } TextureCoordinate;
    00044
    00045   typedef struct
    00046   {
    00047     CalVector tangent;
    00048     float crossFactor;  // To get the binormal, use ((N x T) * crossFactor)
    00049   } TangentSpace;
    00050
    00051
    00053   typedef struct
    00054   {
    00055     int boneId;
    00056     float weight;
    00057   } Influence;
    00058
    00060   typedef struct
    00061   {
    00062     float weight;
    00063   } PhysicalProperty;
    00064
    00066   typedef struct
    00067   {
    00068     CalVector position;
    00069     CalVector normal;
    00070     std::vector<Influence> vectorInfluence;
    00071     int collapseId;
    00072     int faceCollapseCount;
    00073   } Vertex;
    00074
    00076   typedef struct
    00077   {
    00078       CalIndex vertexId[3];
    00079   } Face;
    00080
    00082   typedef struct
    00083   {
    00084     int vertexId[2];
    00085     float springCoefficient;
    00086     float idleLength;
    00087   } Spring;
    00088
    00089 // member variables
    00090 protected:
    00091   std::vector<Vertex> m_vectorVertex;
    00092   std::vector<bool> m_vectorTangentsEnabled;
    00093   std::vector<std::vector<TangentSpace> > m_vectorvectorTangentSpace;
    00094   std::vector<std::vector<TextureCoordinate> > m_vectorvectorTextureCoordinate;
    00095   std::vector<PhysicalProperty> m_vectorPhysicalProperty;
    00096   std::vector<Face> m_vectorFace;
    00097   std::vector<Spring> m_vectorSpring;
    00098   std::vector<CalCoreSubMorphTarget *> m_vectorCoreSubMorphTarget;
    00099   int m_coreMaterialThreadId;
    00100   int m_lodCount;
    00101
    00102 // constructors/destructor
    00103 public:
    00104   CalCoreSubmesh();
    00105   virtual ~CalCoreSubmesh();
    00106
    00107 // member functions
    00108 public:
    00109   bool create();
    00110   void destroy();
    00111   int getCoreMaterialThreadId();
    00112   int getFaceCount();
    00113   int getLodCount();
    00114   int getSpringCount();
    00115   std::vector<Face>& getVectorFace();
    00116   std::vector<PhysicalProperty>& getVectorPhysicalProperty();
    00117   std::vector<Spring>& getVectorSpring();
    00118   std::vector<std::vector<TangentSpace> >& getVectorVectorTangentSpace();
    00119   std::vector<std::vector<TextureCoordinate> >& getVectorVectorTextureCoordinate();
    00120   std::vector<Vertex>& getVectorVertex();
    00121   int getVertexCount();
    00122   bool isTangentsEnabled(int mapId);
    00123   bool enableTangents(int mapId, bool enabled);
    00124   bool reserve(int vertexCount, int textureCoordinateCount, int faceCount, int springCount);
    00125   void setCoreMaterialThreadId(int coreMaterialThreadId);
    00126   bool setFace(int faceId, const Face& face);
    00127   void setLodCount(int lodCount);
    00128   bool setPhysicalProperty(int vertexId, const PhysicalProperty& physicalProperty);
    00129   bool setSpring(int springId, const Spring& spring);
    00130   bool setTangentSpace(int vertexId, int textureCoordinateId, const CalVector& tangent, float crossFactor);
    00131   bool setTextureCoordinate(int vertexId, int textureCoordinateId, const TextureCoordinate& textureCoordinate);
    00132   bool setVertex(int vertexId, const Vertex& vertex);
    00133   int addCoreSubMorphTarget(CalCoreSubMorphTarget *pCoreSubMorphTarget);
    00134   CalCoreSubMorphTarget *getCoreSubMorphTarget(int id);
    00135   int getCoreSubMorphTargetCount();
    00136   std::vector<CalCoreSubMorphTarget *>& getVectorCoreSubMorphTarget();
    00137 protected:
    00138   void UpdateTangentVector(int v0, int v1, int v2, int channel);
    00139 };
    00140
    00141 #endif
    00142
    00143 //****************************************************************************//

Generated at Wed Apr 7 16:57:16 2004 by The Cal3D Team with 1.3.6 © 1997-2001 Dimitri van Heesch