- 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:
25 {
26 CalVector position;
27 CalVector normal;
28 std::vector<CalCoreSubmesh::TextureCoordinate> textureCoords;
29 bool create() { return true; }
30 bool destroy() { return true; }
31 };
32
33public:
35 virtual ~CalCoreSubMorphTarget() { }
36
37 virtual void setCoreSubmesh( CalCoreSubmesh *inCoreSubmesh );
38 const CalCoreSubmesh *getCoreSubmesh() const;
39
40 int getBlendVertexCount() const;
41 unsigned int size();
42 typedef std::vector<BlendVertex *> VectorBlendVertex;
43
44 std::vector<BlendVertex *>& getVectorBlendVertex();
45 inline bool hasBlendVertex( int blendVertexId ) {
46 return m_vectorBlendVertex[blendVertexId] != NULL;
47 }
48 inline BlendVertex const * getBlendVertex( int blendVertexId ) {
49 return m_vectorBlendVertex[blendVertexId];
50 }
51
52 inline const BlendVertex* getBlendVertex( int blendVertexId ) const {
53 return m_vectorBlendVertex[blendVertexId];
54 }
55
56 const std::vector<BlendVertex*>& getVectorBlendVertex() const;
57 virtual bool reserve(int blendVertexCount);
58 bool setBlendVertex(int vertexId, const BlendVertex& vertex);
59
60 void getBlendVertex( int vertexId, BlendVertex& outVertex ) const;
61 CalMorphTargetType morphTargetType() const;
62
63 void setName( std::string );
64 std::string name() const;
65
66private:
67 CalCoreSubMorphTarget( const CalCoreSubMorphTarget& inOther ); // unimp
68
69 std::vector<BlendVertex*> m_vectorBlendVertex;
70 CalCoreSubmesh *m_coreSubmesh;
71 std::string m_morphTargetName;
72 CalMorphTargetType m_morphTargetType;
73};
74
75// The difference map is reference counted because we can use the same difference
76// map on multiple actor heads.
78{
79public:
80 CalSharedDifferenceMap() : m_NextIndex(0),
81 m_vectorVertexIndexSize(0),
82 m_vectorVertexIndexPtr(0),
83 m_vectorBlendVertexPtr(0) { }
84
85 bool reserve(int blendVertexCount);
86 bool appendBlendVertex(int vertexId, const CalCoreSubMorphTarget::BlendVertex& vertex);
87
88 bool getBlendVertex( int vertexId, CalCoreSubMorphTarget::BlendVertex& outVertex ) const;
89
90protected:
92
93private:
94 std::vector<CalCoreSubMorphTarget::BlendVertex> m_vectorBlendVertex;
95 std::vector<int> m_vectorVertexIndex;
96 mutable int m_NextIndex;
97
98 // performance optimization: direct access to vector size and arrays
99 mutable int m_vectorVertexIndexSize;
100 mutable const int *m_vectorVertexIndexPtr;
101 mutable const CalCoreSubMorphTarget::BlendVertex *m_vectorBlendVertexPtr;
102};
104
105
107{
108public:
112
113 virtual bool reserve(int blendVertexCount);
114 virtual void setCoreSubmesh( CalCoreSubmesh* inCoreSubmesh );
115
116 bool appendBlendVertex(int vertexId, const CalCoreSubMorphTarget::BlendVertex& vertex);
117
118private:
120};
121
122#endif
123//****************************************************************************//
Definition coresubmorphtarget.h:107
bool appendBlendVertex(int vertexId, const CalCoreSubMorphTarget::BlendVertex &vertex)
Record one blend vertex.
Definition coresubmorphtarget.cpp:402
virtual void setCoreSubmesh(CalCoreSubmesh *inCoreSubmesh)
Record the core submesh that this morph applies to.
Definition coresubmorphtarget.cpp:363
virtual bool reserve(int blendVertexCount)
Reserves memory for the blend vertices.
Definition coresubmorphtarget.cpp:347
Definition coresubmorphtarget.h:22
Definition coresubmesh.h:32
Definition coresubmorphtarget.h:78
bool reserve(int blendVertexCount)
Reserves memory for the blend vertices.
Definition coresubmorphtarget.cpp:219
bool appendBlendVertex(int vertexId, const CalCoreSubMorphTarget::BlendVertex &vertex)
Record one blend vertex.
Definition coresubmorphtarget.cpp:249
bool getBlendVertex(int vertexId, CalCoreSubMorphTarget::BlendVertex &outVertex) const
Retrieve one blend vertex.
Definition coresubmorphtarget.cpp:281
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.12.0