00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __GB_AttributeElem_h__
00022 #define __GB_AttributeElem_h__
00023
00024 #include "GB_API.h"
00025 #include <stdlib.h>
00026 #include "GB_AttributeRef.h"
00027 #include "GB_AttributeData.h"
00028
00029 class GB_AttributeMath;
00030 class GB_AttributeDict;
00031
00032 class GB_API GB_AttributeElem
00033 {
00034 public:
00035
00036 void SYS_DEPRECATED copyAttribData(const GB_AttributeElem *src, int sz);
00037
00038
00039
00040
00041
00042 void copyAttribData(const GB_AttributeElem &src,
00043 const GB_AttributeDict &src_dict,
00044 const GB_AttributeDict &dest_dict);
00045
00046
00047
00048 template<typename T>
00049 T *castAttribData(const GB_AttributeRef &n)
00050 { return myAttribData.castAttribData<T>(n); }
00051 template<typename T>
00052 const T *castAttribData(const GB_AttributeRef &n) const
00053 { return myAttribData.castAttribData<const T>(n); }
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 template <typename T>
00069 const T *getPointer(const GB_AttributeRef &h, T *buffer, int cnt) const
00070 { return myAttribData.getPointer<T>(h, buffer, cnt); }
00071 template <typename T>
00072 const T *getPointer(const GB_AttributeRef &h,
00073 GB_AttributeBuffer &buffer, int cnt) const
00074 { return myAttribData.getPointer<T>(h, buffer, cnt); }
00075 template <typename T>
00076 T getValue(const GB_AttributeRef &handle, int index = 0) const
00077 { return myAttribData.getValue<T>(handle, index); }
00078 template <typename T>
00079 void setValue(const GB_AttributeRef &handle, const T&data, int index = 0)
00080 { myAttribData.set<T>(handle, data, index); }
00081 template <typename T>
00082 void get(const GB_AttributeRef &handle, T &data, int index=0) const
00083 { myAttribData.get<T>(handle, data, index); }
00084 template <typename T>
00085 void get(const GB_AttributeRef &handle, T *data, int count) const
00086 { myAttribData.get<T>(handle, data, count); }
00087 template <typename T>
00088 void set(const GB_AttributeRef &handle, const T *data, int count)
00089 { myAttribData.set<T>(handle, data, count); }
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 static const GB_AttributeMath &getMath(const GB_AttributeRef &h);
00101
00102
00103
00104 bool compareAttributeData(const GB_AttributeElem &cmp,
00105 const GB_AttributeDict &table,
00106 fpreal tol = FP32_TOLERANCE) const;
00107
00108
00109 bool hasAllocatedAttributeValues() const;
00110
00111
00112 void allocateAttributeValues(const GB_AttributeDict &dict,
00113 bool set_to_default_values=false);
00114
00115
00116
00117 void copyAttributeValues(const GB_AttributeElem &src,
00118 const GB_AttributeDict &dict);
00119
00120 void scaleAttributeValues(fpreal scale,
00121 const GB_AttributeDict &dict);
00122
00123
00124 void addAttributeValues(const GB_AttributeElem &src,
00125 const GB_AttributeDict &dict,
00126 fpreal scale=1);
00127
00128
00129 void lerpAttributeValues(const GB_AttributeElem &v0,
00130 const GB_AttributeElem &v1,
00131 fpreal bias,
00132 const GB_AttributeDict &dict);
00133
00134
00135 void baryAttributeValues(const GB_AttributeElem &v0,
00136 const GB_AttributeElem &v1,
00137 const GB_AttributeElem &v2,
00138 fpreal u, fpreal v,
00139 const GB_AttributeDict &dict);
00140
00141
00142 void bilinearAttributeValues(const GB_AttributeElem &u0v0,
00143 const GB_AttributeElem &u1v0,
00144 const GB_AttributeElem &u0v1,
00145 const GB_AttributeElem &u1v1,
00146 fpreal u, fpreal v,
00147 const GB_AttributeDict &dict);
00148
00149 #if !defined(HDK_RELAXED_GB)
00150 private:
00151 #endif
00152
00153
00154
00155 const void SYS_DEPRECATED *getAttribData(int n) const
00156 { return myAttribData.castAttribData<const void>(
00157 GB_AttributeRef(n)); }
00158
00159
00160
00161 const GB_AttributeData &getAttrib() const { return myAttribData; }
00162 GB_AttributeData &getAttrib() { return myAttribData; }
00163
00164 protected:
00165 friend class GB_AttributeTable;
00166 friend class GB_AttributeDict;
00167
00168
00169 friend class GEO_Point;
00170 friend class GEO_Vertex;
00171 friend class GEO_PointAttribDict;
00172 friend class GEO_VertexAttribDict;
00173 friend class GEO_PrimAttribDict;
00174 friend class GEO_Primitive;
00175 friend class GEO_Face;
00176 friend class GEO_Curve;
00177 friend class GEO_Hull;
00178 friend class GEO_TPSurf;
00179 friend class GEO_TriMesh;
00180 friend class GEO_Detail;
00181 friend class GEO_MetaExpression;
00182 friend class GEO_PrimPoly;
00183 friend class GEO_PrimNURBCurve;
00184 friend class GEO_PrimRBezCurve;
00185 friend class GEO_PrimNURBSurf;
00186 friend class GEO_PrimRBezSurf;
00187 friend class GEO_PrimTriBezier;
00188
00189 friend class GU_TPSurf;
00190 friend class GU_Curve;
00191 friend class GU_PrimNURBCurve;
00192 friend class GU_PrimNURBSurf;
00193 friend class GU_PrimPasteDAG;
00194 friend class GU_PrimTriBezier;
00195
00196 friend class gq_StitchAccess;
00197
00198 friend class GDT_Detail;
00199
00200 friend class GQ_Detail;
00201 friend class GQ_PolyBevel;
00202
00203 friend class POP_AttribMap;
00204 friend class pop_GenVarAccess;
00205 friend class POP_GenVar;
00206 friend class POP_Softbody;
00207
00208 friend class sop_CaptureOverrideAccess;
00209
00210 friend class POP_Split;
00211
00212 private:
00213
00214 GB_AttributeData myAttribData;
00215 static GB_AttributeMath *theMath;
00216 };
00217
00218 #endif