- Cal3D 0.11 API Reference -

coresubmorphtarget.h
1//****************************************************************************//
2// coresubmorphtarget.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_CORESUBMORPHTARGET_H
12#define CAL_CORESUBMORPHTARGET_H
13
14
15#include "cal3d/global.h"
16#include "cal3d/vector.h"
17#include "cal3d/refcounted.h"
18#include "cal3d/refptr.h"
19#include "cal3d/coresubmesh.h"
20
21class CAL3D_API CalCoreSubMorphTarget
22{
23public:friend class CalCoreSubmesh;
25 {
26 CalVector position;
27 CalVector normal;
28 std::vector<CalCoreSubmesh::TextureCoordinate> textureCoords;
29 };
30public:
32 virtual ~CalCoreSubMorphTarget() { }
33 virtual void setCoreSubmesh( CalCoreSubmesh *inCoreSubmesh );
34 const CalCoreSubmesh *getCoreSubmesh() const;
35
36 int getBlendVertexCount() const;
37 unsigned int size();
38
39 inline std::vector<BlendVertex>& getVectorBlendVertex(){ return m_vectorBlendVertex;}
40 inline const std::vector<BlendVertex>& getVectorBlendVertex() const{ return m_vectorBlendVertex;}
41
42 inline BlendVertex const * getBlendVertex(int blendVertexId){ return &m_vectorBlendVertex[blendVertexId];}
43 inline const BlendVertex* getBlendVertex(int blendVertexId) const{ return &m_vectorBlendVertex[blendVertexId];}
44
45 virtual bool reserve(int blendVertexCount);
46
47 bool setBlendVertex(int vertexId, const BlendVertex& vertex);
48 void getBlendVertex( int vertexId, BlendVertex& outVertex ) const;
49
51 inline CalMorphTargetType getMorphTargetType() const { return m_morphTargetType;}
52 inline void setMorphTargetType(CalMorphTargetType c) { m_morphTargetType=c;}
53
55 inline const unsigned int& getMorphID() const{return m_morphTargetID;}
56
58 void setName(const std::string &s){_name=s;}
59 const std::string& getName() const{return _name;}
60protected:
61 inline void setMorphID(const unsigned int &i){m_morphTargetID=i;}
62private:
63 std::string _name;
64 CalCoreSubMorphTarget( const CalCoreSubMorphTarget& inOther ); // unimp
65
66 std::vector<BlendVertex> m_vectorBlendVertex;
67 CalCoreSubmesh *m_coreSubmesh;
68 unsigned int m_morphTargetID;
69 CalMorphTargetType m_morphTargetType;
70};
71
72// The difference map is reference counted because we can use the same difference
73// map on multiple actor heads.
75{
76public:
77 CalSharedDifferenceMap() : m_NextIndex(0),
78 m_vectorVertexIndexSize(0),
79 m_vectorVertexIndexPtr(0),
80 m_vectorBlendVertexPtr(0) { }
81
82 bool reserve(int blendVertexCount);
83 bool appendBlendVertex(int vertexId, const CalCoreSubMorphTarget::BlendVertex& vertex);
84
85 bool getBlendVertex( int vertexId, CalCoreSubMorphTarget::BlendVertex& outVertex ) const;
86
87protected:
89
90private:
91 std::vector<CalCoreSubMorphTarget::BlendVertex> m_vectorBlendVertex;
92 std::vector<int> m_vectorVertexIndex;
93 mutable int m_NextIndex;
94
95 // performance optimization: direct access to vector size and arrays
96 mutable int m_vectorVertexIndexSize;
97 mutable const int *m_vectorVertexIndexPtr;
98 mutable const CalCoreSubMorphTarget::BlendVertex *m_vectorBlendVertexPtr;
99};
101
102
104{
105public:
109
110 virtual bool reserve(int blendVertexCount);
111 virtual void setCoreSubmesh( CalCoreSubmesh* inCoreSubmesh );
112
113 bool appendBlendVertex(int vertexId, const CalCoreSubMorphTarget::BlendVertex& vertex);
114
115private:
117};
118
119#endif
120//****************************************************************************//
Definition coresubmorphtarget.h:104
bool appendBlendVertex(int vertexId, const CalCoreSubMorphTarget::BlendVertex &vertex)
Record one blend vertex.
Definition coresubmorphtarget.cpp:367
virtual void setCoreSubmesh(CalCoreSubmesh *inCoreSubmesh)
Record the core submesh that this morph applies to.
Definition coresubmorphtarget.cpp:328
virtual bool reserve(int blendVertexCount)
Reserves memory for the blend vertices.
Definition coresubmorphtarget.cpp:312
Definition coresubmorphtarget.h:22
void setName(const std::string &s)
Name property (just for convenience )
Definition coresubmorphtarget.h:58
const unsigned int & getMorphID() const
Index of this morph for its target mesh.
Definition coresubmorphtarget.h:55
CalMorphTargetType getMorphTargetType() const
Type of this morph.
Definition coresubmorphtarget.h:51
Definition coresubmesh.h:32
Definition coresubmorphtarget.h:75
bool reserve(int blendVertexCount)
Reserves memory for the blend vertices.
Definition coresubmorphtarget.cpp:184
bool appendBlendVertex(int vertexId, const CalCoreSubMorphTarget::BlendVertex &vertex)
Record one blend vertex.
Definition coresubmorphtarget.cpp:214
bool getBlendVertex(int vertexId, CalCoreSubMorphTarget::BlendVertex &outVertex) const
Retrieve one blend vertex.
Definition coresubmorphtarget.cpp:246
The vector class.
Definition vector.h:37
Derive from RefCounted to make your class have reference-counted lifetime semantics.
Definition refcounted.h:29
A container-safe smart pointer used for refcounted classes.
Definition refptr.h:11
Definition coresubmorphtarget.h:25

Generated by The Cal3D Team with Doxygen 1.10.0