mesh_morpher.h
Go to the documentation of this file.00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef NL_MESH_MORPHER_H
00025 #define NL_MESH_MORPHER_H
00026
00027 #include "nel/3d/animated_morph.h"
00028 #include "nel/misc/types_nl.h"
00029 #include "nel/misc/uv.h"
00030 #include "nel/misc/object_vector.h"
00031 #include <vector>
00032
00033 namespace NL3D
00034 {
00035
00036 class CVertexBuffer;
00037 class CRawSkinVertex;
00038
00039
00040 class CBlendShape
00041 {
00042 public:
00043 std::string Name;
00044
00045 std::vector<NLMISC::CVector> deltaPos;
00046 std::vector<NLMISC::CVector> deltaNorm;
00047 std::vector<NLMISC::CVector> deltaTgSpace;
00048 std::vector<NLMISC::CUV> deltaUV;
00049 std::vector<NLMISC::CRGBAF> deltaCol;
00050
00051 std::vector<uint32> VertRefs;
00052
00053 void serial (NLMISC::IStream &f) throw(NLMISC::EStream);
00054 };
00055
00056
00063 class CMeshMorpher
00064 {
00065
00066
00067
00068
00069
00070 typedef enum
00071 {
00072 OriginalAll=0,
00073 OriginalVBDst,
00074 Modified,
00075 } TState;
00076
00077 public:
00078
00079 std::vector<CBlendShape> BlendShapes;
00080
00081 CMeshMorpher();
00082
00083 void init (CVertexBuffer *vbOri, CVertexBuffer *vbDst, bool hasTgSpace);
00084 void initSkinned (CVertexBuffer *vbOri,
00085 CVertexBuffer *vbDst,
00086 bool hasTgSpace,
00087 std::vector<CVector> *vVertices,
00088 std::vector<CVector> *vNormals,
00089 std::vector<CVector> *vTgSpace,
00090 bool bSkinApplied);
00091
00092 void update (std::vector<CAnimatedMorph> *pBSFactor);
00093 void updateSkinned (std::vector<CAnimatedMorph> *pBSFactor);
00094
00095
00096 void updateRawSkin (CVertexBuffer *vbOri,
00097 NLMISC::CObjectVector<CRawSkinVertex*, false> &vertexRemap,
00098 std::vector<CAnimatedMorph> *pBSFactor);
00099
00100 void serial (NLMISC::IStream &f) throw(NLMISC::EStream);
00101
00102 private:
00103
00104 CVertexBuffer *_VBOri;
00105 CVertexBuffer *_VBDst;
00106
00107 std::vector<CVector> *_Vertices;
00108 std::vector<CVector> *_Normals;
00109 std::vector<CVector> *_TgSpace;
00110
00111
00112 bool _SkinApplied : 1;
00113 bool _UseTgSpace : 1;
00114
00115 std::vector<uint8> _Flags;
00116
00117
00118 };
00119
00120 }
00121
00122
00123 #endif // NL_MESH_MORPHER_H
00124
00125