00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __GEO_AttributeHandleList__
00019 #define __GEO_AttributeHandleList__
00020
00021 #include "GEO_API.h"
00022
00023 #include <GB/GB_AttributeListHandle.h>
00024 #include "GEO_Detail.h"
00025 #include "GEO_AttributeFilter.h"
00026
00027 class UT_Matrix;
00028 class GEO_AttributeHandle;
00029 class GEO_Delta;
00030
00031
00032
00033
00034
00035
00036 #define GEO_AHANDLE_LIST_BYPASS_P 0
00037 #define GEO_AHANDLE_LIST_INCLUDE_P 1
00038
00039 class GEO_API GEO_AttributeHandleList : public GB_AttributeListHandle {
00040 public:
00041 GEO_AttributeHandleList();
00042 virtual ~GEO_AttributeHandleList();
00043
00044 GEO_AttributeHandleList *clone() const;
00045
00046 void bindDetail(const GEO_Detail *gdp);
00047 bool isBoundDetail(const GEO_Detail *gdp)
00048 { return gdp == getDetail(); }
00049
00050 bool hasVectorAttributes(GEO_AttributeOwner owner) const;
00051
00052
00053
00054
00055
00056
00057
00058 void clearAllAttributes();
00059
00060 int appendAttributes(GEO_AttributeOwner,
00061 const GEO_AttributeFilter &filter);
00062 int appendAllAttributes(GEO_AttributeOwner owner);
00063 int appendFloatAttributes(GEO_AttributeOwner owner,
00064 int includeP = GEO_AHANDLE_LIST_INCLUDE_P);
00065 int appendAttributesByType(GB_AttribType typ, GEO_AttributeOwner o);
00066 bool appendAttributeByName(const char *name, GEO_AttributeOwner o);
00067 int appendAttributesByPattern(const char *pattern,
00068 GEO_AttributeOwner o);
00069
00070
00071
00072 int removeAttributes(const GEO_AttributeFilter &filter);
00073 int removeMissingAttributes(const GEO_Detail *other);
00074 bool removeAttributeByName(const char *name);
00075
00076 void clearSourceMap();
00077 void appendSourceMap(const GEO_Detail *gdp, GEO_AttributeOwner o);
00078 void appendSourceMap(const GEO_AttributeHandleList &hlist);
00079
00080 GEO_AttributeHandleList &operator=(const GEO_AttributeHandleList &h);
00081
00082 GEO_AttributeHandle *operator[](int i);
00083 const GEO_AttributeHandle *operator[](int i) const;
00084 GEO_AttributeHandle *operator[](const char *name);
00085 const GEO_AttributeHandle *operator[](const char *name) const;
00086
00087
00088 int getFloatCount(bool includePw=true) const;
00089
00090 void floatsToMatrix(UT_Matrix &matrix, int row,
00091 bool includePw=true) const;
00092
00093 void matrixToFloats(const UT_Matrix &matrix, int row,
00094 bool includePw=true);
00095
00096
00097
00098
00099
00100 void setElement(GEO_Primitive *prim, GEO_Vertex *v);
00101 void setElement(const GEO_Primitive *prim, const GEO_Vertex *v);
00102
00103 void add(const GEO_Primitive *p, const GEO_Vertex *v)
00104 { addScale(p, v, 1.0); }
00105 void addScale(const GEO_Primitive *p, const GEO_Vertex *v, fpreal s);
00106 void multiply(const GEO_Primitive *p, const GEO_Vertex *v);
00107 void divide(const GEO_Primitive *p, const GEO_Vertex *v);
00108 void lerp(const GEO_Primitive *p, const GEO_Vertex *v, fpreal w);
00109 void lerp(const GEO_Primitive *p0, const GEO_Vertex *v0,
00110 const GEO_Primitive *p1, const GEO_Vertex *v1,
00111 fpreal weight);
00112 void copyDataFrom(const GEO_Primitive *p, const GEO_Vertex *v);
00113 void copyDataTo(GEO_Primitive *p, GEO_Vertex *v) const;
00114
00115
00116 void setValue(fpreal value);
00117 void multiply(fpreal scale);
00118 void homogenize(fpreal scale);
00119 void dehomogenize(fpreal scale);
00120 void transform(const UT_Matrix4 &xform, const UT_Matrix4 &inverse,
00121 bool keeplengths=false);
00122
00123
00124
00125
00126 void setElement(GEO_Point *ppt);
00127 void setElement(const GEO_Point *ppt);
00128 void setElement(GEO_Vertex *vtx);
00129 void setElement(const GEO_Vertex *vtx);
00130 void setElement(GEO_Primitive *prim);
00131 void setElement(const GEO_Primitive *prim);
00132 void setElement(GEO_Detail *gdp);
00133 void setElement(const GEO_Detail *gdp);
00134
00135
00136 void add(const GEO_Point *ppt) { addScale(ppt, 1.0); }
00137 void addScale(const GEO_Point *ppt, fpreal scale);
00138 void lerp(const GEO_Point *ppt, fpreal w);
00139 void lerp(const GEO_Point *p0, const GEO_Point *p1, fpreal w);
00140 void multiply(const GEO_Point *ppt);
00141 void divide(const GEO_Point *ppt);
00142 void copyDataFrom(const GEO_Point *ppt);
00143 void copyDataTo(GEO_Point *ppt) const;
00144
00145
00146 void add(const GEO_Vertex *ppt) { addScale(ppt, 1.0); }
00147 void addScale(const GEO_Vertex *ppt, fpreal scale);
00148 void lerp(const GEO_Vertex *ppt, fpreal w);
00149 void lerp(const GEO_Vertex *p0, const GEO_Vertex *p1, fpreal w);
00150 void multiply(const GEO_Vertex *ppt);
00151 void divide(const GEO_Vertex *ppt);
00152 void copyDataFrom(const GEO_Vertex *ppt);
00153 void copyDataTo(GEO_Vertex *ppt) const;
00154
00155
00156 void add(const GEO_Primitive *ppt) { addScale(ppt, 1.0); }
00157 void addScale(const GEO_Primitive *ppt, fpreal scale);
00158 void lerp(const GEO_Primitive *ppt, fpreal w);
00159 void lerp(const GEO_Primitive *p0, const GEO_Primitive *p1,fpreal w);
00160 void multiply(const GEO_Primitive *ppt);
00161 void divide(const GEO_Primitive *ppt);
00162 void copyDataFrom(const GEO_Primitive *ppt);
00163 void copyDataTo(GEO_Primitive *ppt) const;
00164
00165
00166 void add(const GEO_Detail *ppt) { addScale(ppt, 1.0); }
00167 void addScale(const GEO_Detail *ppt, fpreal scale);
00168 void lerp(const GEO_Detail *ppt, fpreal w);
00169 void lerp(const GEO_Detail *gdp0, const GEO_Detail *gdp1, fpreal w);
00170 void multiply(const GEO_Detail *ppt);
00171 void divide(const GEO_Detail *ppt);
00172 void copyDataFrom(const GEO_Detail *ppt);
00173 void copyDataTo(GEO_Detail *ppt) const;
00174
00175 void dump(const char *msg="") const;
00176
00177
00178 int appendPointP();
00179 };
00180
00181 #endif