00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __GDT_VertexList_h__
00021 #define __GDT_VertexList_h__
00022
00023 #include "GDT_API.h"
00024 #include "GDT_TokenList.h"
00025
00026 #include <UT/UT_IntArray.h>
00027 #include <UT/UT_PtrArray.h>
00028 #include <GEO/GEO_Detail.h>
00029
00030
00031 class GDT_API GDT_VertexList : public GDT_TokenList
00032 {
00033 public:
00034 GDT_VertexList();
00035 GDT_VertexList(const GDT_VertexList &other);
00036 virtual ~GDT_VertexList() {}
00037
00038
00039 void mergeVertexDeltas(const GDT_VertexList &other,
00040 bool inverse = false);
00041
00042
00043 void applyScaledDelta(GEO_Detail &gdp, GEO_Primitive &prim,
00044 int vtxidx, float scale) const;
00045
00046
00047
00048
00049 void endVertexAttributeChange(const GB_AttributeData &data,
00050 unsigned int prim_index,
00051 unsigned int linear_index_in_prim);
00052
00053
00054
00055
00056 void updateVertexOffsets(const GEO_Detail &gdp);
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 virtual unsigned int getElementCount(const GEO_Detail &gdp) const;
00069 virtual void initIterate() const;
00070 virtual GB_AttributeElem *getNextAttributeElement(GEO_Detail &gdp) const;
00071 virtual GB_AttributeElem *getAttributeElement(GEO_Detail &gdp,
00072 unsigned int index) const;
00073
00074
00075
00076 virtual GB_AttributeDict &getAttributeDict(GEO_Detail &gdp) const
00077 { return gdp.vertexAttribs(); }
00078
00079
00080 virtual int appendGdpAttribute(GEO_Detail &gdp,
00081 const char *name, int size,
00082 GB_AttribType type,
00083 const void *defvalue) const
00084 {
00085 return gdp.vertexAttribs().append(
00086 name, size, type, defvalue);
00087 }
00088
00089 virtual int growGdpAttribute(GEO_Detail &gdp,
00090 const char *name, int oldsize,
00091 GB_AttribType type,
00092 unsigned int addedsize) const
00093 {
00094 return gdp.vertexAttribs().grow(
00095 name, oldsize, type, addedsize);
00096 }
00097
00098 virtual int saveAttribs(ostream &os, int binary = 0) const;
00099 virtual bool loadAttribs(UT_IStream &is, uint size);
00100
00101
00102 virtual void destroy();
00103
00104 protected:
00105
00106 virtual void getAttributeElements(const GEO_Detail &beforegdp,
00107 const GEO_Detail &aftergdp,
00108 unsigned int before_elem_index,
00109 unsigned int after_elem_index,
00110 const GB_AttributeElem *&beforeelem,
00111 const GB_AttributeElem *&afterelem) const;
00112
00113
00114
00115 void buildOffsetArray(const GEO_Detail &gdp,
00116 UT_IntArray &array);
00117
00118
00119
00120
00121
00122 bool calculatePrimVertex(unsigned int idx,
00123 const UT_IntArray &offsets,
00124 unsigned int &primidx,
00125 unsigned int &vertexidx,
00126 int start=0,
00127 int end=-1) const;
00128
00129 private:
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147 UT_IntArray myOffsets;
00148
00149
00150
00151
00152
00153
00154
00155
00156 UT_IntArray myTempOffsets;
00157
00158
00159
00160 mutable unsigned int myNextPrim;
00161 mutable unsigned int myNextVertex;
00162 };
00163 #endif