00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __SOP_Lattice_h__
00022 #define __SOP_Lattice_h__
00023
00024 #include "SOP_API.h"
00025 #include <math.h>
00026 #include "SOP_Node.h"
00027
00028 class SOP_API sop_capturedata
00029 {
00030 public:
00031 int index;
00032 float weight;
00033 };
00034
00035 class GEO_PointTree;
00036 class TS_MetaKernel;
00037
00038 class SOP_API SOP_Lattice : public SOP_Node
00039 {
00040 public:
00041 SOP_Lattice(OP_Network *net, const char *name, OP_Operator *entry);
00042 virtual ~SOP_Lattice();
00043
00044 virtual OP_ERROR cookInputGroups(OP_Context &context,
00045 int alone = 0);
00046 virtual int isRefInput(unsigned int i) const;
00047
00048 virtual unsigned disableParms();
00049
00050 virtual bool unloadData();
00051
00052 static OP_Node *myConstructor(OP_Network *net,
00053 const char *name,
00054 OP_Operator *entry);
00055 static PRM_Template myTemplateList[];
00056
00057 enum {
00058 SOP_LATTICE_LATTICE = 0,
00059 SOP_LATTICE_POINTCLOUD = 1
00060 };
00061
00062 protected:
00063 virtual OP_ERROR cookMySop(OP_Context &context);
00064 virtual OP_ERROR cookMyGuide1(OP_Context &context);
00065 virtual OP_ERROR cookMyGuide2(OP_Context &context);
00066 virtual const char *inputLabel(unsigned idx) const;
00067
00068 private:
00069 void getGroups(UT_String &str, float t)
00070 { evalString(str, 0, 0, t); }
00071
00072
00073
00074
00075
00076
00077
00078 void correctOldPoints(const GU_Detail *src, UT_BitArray &curr_pass);
00079
00080 int DEFORMTYPE() { return evalInt(1, 0, 0); }
00081
00082 int DIVSX(float t) { return evalInt(2, 0, t); }
00083 int DIVSY(float t) { return evalInt(2, 1, t); }
00084 int DIVSZ(float t) { return evalInt(2, 2, t); }
00085
00086 int INTERPTYPE() { return evalInt(3, 0, 0); }
00087
00088 void RESTGROUP(UT_String &str, float t)
00089 { evalString(str, 4, 0, t); }
00090
00091 void KERNEL(UT_String &str, float t) { evalString(str, 5, 0, t); }
00092 float RADIUS(float t) { return evalFloat(6, 0, t); }
00093 float NORMTHRESHOLD(void) { return evalFloat(7, 0, 0); }
00094 int VISUALIZE(void) { return evalInt(8, 0, 0); }
00095
00096
00097
00098 OP_ERROR latticeDeform (OP_Context &context);
00099
00100
00101
00102
00103 OP_ERROR pointDeform (OP_Context &context);
00104
00105
00106
00107
00108
00109 void buildPointTree();
00110
00111
00112
00113
00114
00115 void buildCaptureRegions(const GU_Detail *rest,
00116 const TS_MetaKernel *kernel,
00117 const UT_FloatArray &curr_radii);
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127 bool calculateRadii(UT_FloatArray &curr_radii,
00128 const GU_DetailHandle &rest_handle,
00129 float time);
00130
00131
00132
00133
00134
00135
00136 inline void deformSourcePointsForMe(int index, UT_Vector4 *diffarray);
00137
00138
00139
00140
00141
00142
00143 inline void createCaptureRegionForMe(int index, const TS_MetaKernel *kernel,
00144 const UT_FloatArray &curr_radii,
00145 UT_FloatArray &totals,
00146 const GEO_Point *tppt);
00147
00148 int myPastedFlag;
00149
00150 GEO_PointTree *myPointTree;
00151 int myNumRegions;
00152
00153
00154
00155 sop_capturedata **myRegions;
00156
00157 int mySourceCookCount;
00158 int myRestCookCount;
00159
00160
00161
00162
00163
00164
00165
00166
00167 UT_IntArray myRestOffsetArray;
00168
00169 UT_FloatArray myOldRadii;
00170 UT_String myOldMethod;
00171 float myOldThreshold;
00172
00173
00174 UT_BitArray myLatticeDeformHistory;
00175
00176 GU_DetailGroupPair myDetailGroupPair;
00177
00178 const GB_PointGroup *myGroup;
00179 const GB_PointGroup *myRestGroup;
00180 };
00181
00182 #endif
00183