00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef __POP_GenVar_h__
00015 #define __POP_GenVar_h__
00016
00017 #include "POP_API.h"
00018 #include "POP_Node.h"
00019
00020
00021
00022
00023 class POP_API POP_GenVar : public POP_Node
00024 {
00025 public:
00026
00027 static CH_LocalVariable myVariables[];
00028 static OP_VariablePair myVariablePair;
00029
00030 static OP_TemplatePair myTemplatePair;
00031
00032 protected:
00033 POP_GenVar (OP_Network* net, const char* name,
00034 OP_Operator* entry);
00035 virtual ~POP_GenVar (void);
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 void birthFromPoints (int doVar, POP_ContextData* data,
00103 GU_Detail* gdp, GB_PointGroup* group,
00104 UT_Matrix4* xform, UT_Matrix3* xformv,
00105 POP_AttribMap* map,
00106 GB_AttributeData* inherit,
00107 GB_AttributeData* split,
00108 POP_IntFunc originIndex, int originUse,
00109 float* born, GEO_PrimParticle* part,
00110 GB_PointGroup* birthGroup,
00111 POP_FloatFunc lifetime,
00112 POP_FloatFunc probability,
00113 POP_BirthAttribFunc birthAttrib,
00114 int doRandom,
00115 POP_JitterFunc jitter = 0,
00116 int maxAttempts=100);
00117
00118 void birthFromPointVelocity (int doVar, POP_ContextData *data,
00119 GU_Detail *gdp, GB_PointGroup *group,
00120 UT_Matrix4 *xform, UT_Matrix3 *xformv,
00121 POP_AttribMap *map,
00122 GB_AttributeData *inherit,
00123 GB_AttributeData *split,
00124 POP_IntFunc originIndex, int originUse,
00125 float *born, GEO_PrimParticle *part,
00126 GB_PointGroup *birthGroup,
00127 POP_FloatFunc lifetime,
00128 POP_BirthAttribFunc birthAttrib,
00129 UT_Vector3 birthVelocity,
00130 UT_Vector3 birthAcceleration,
00131 fpreal velocityScale,
00132 fpreal particleSpacing);
00133
00134 void birthFromPrimitives (int doVar, POP_ContextData* data,
00135 GU_Detail* gdp, GB_PrimitiveGroup* group,
00136 UT_Matrix4* xform, UT_Matrix3* xformv,
00137 POP_AttribMap* map,
00138 GB_AttributeData* inherit,
00139 GB_AttributeData* split,
00140 POP_IntFunc originIndex, int originUse,
00141 float* born, GEO_PrimParticle* part,
00142 GB_PointGroup* birthGroup,
00143 POP_FloatFunc lifetime,
00144 POP_FloatFunc probability,
00145 POP_BirthAttribFunc birthAttrib,
00146 int whereFrom, int checkTrim,
00147 POP_JitterFunc jitter = 0,
00148 int doRandom = 0, int maxAttempts = 100);
00149
00150 void birthFromMetaPrim (int doVar, POP_ContextData* data,
00151 GU_Detail* gdp, GB_PrimitiveGroup* group,
00152 UT_Matrix4* xform, UT_Matrix3* xformv,
00153 POP_AttribMap* map,
00154 GB_AttributeData* inherit,
00155 GB_AttributeData* split,
00156 POP_IntFunc originIndex, int originUse,
00157 float* born, GEO_PrimParticle* part,
00158 GB_PointGroup* birthGroup,
00159 POP_FloatFunc lifetime,
00160 POP_BirthAttribFunc birthAttrib,
00161 float threshold, float densityMin,
00162 int useDensityProb,
00163 POP_JitterFunc jitter = 0,
00164 int maxAttempts = 100);
00165
00166 void birthFromDetail (int doVar, POP_ContextData* data,
00167 GU_Detail* gdp,
00168 UT_Matrix4* xform, UT_Matrix3* xformv,
00169 POP_AttribMap* map,
00170 GB_AttributeData* inherit,
00171 GB_AttributeData* split,
00172 POP_IntFunc originIndex, int originUse,
00173 float* born, GEO_PrimParticle* part,
00174 GB_PointGroup* birthGroup,
00175 POP_FloatFunc lifetime,
00176 POP_BirthAttribFunc birthAttrib,
00177 GU_RayIntersect* intersector,
00178 POP_JitterFunc jitter = 0,
00179 int maxAttempts = 100);
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199 void birthNonUniformlyFromRandomPrimitives (int doVar,
00200 POP_ContextData* data,
00201 GU_Detail* gdp, GB_PrimitiveGroup* group,
00202 UT_Matrix4* xform, UT_Matrix3* xformv,
00203 POP_AttribMap* map,
00204 GB_AttributeData* inherit,
00205 GB_AttributeData* split,
00206 POP_IntFunc originIndex, int originUse,
00207 float* born, GEO_PrimParticle* part,
00208 GB_PointGroup* birthGroup,
00209 POP_FloatFunc lifetime,
00210 POP_FloatFunc probability,
00211 POP_BirthAttribFunc birthAttrib,
00212 int whereFrom, int checkTrim,
00213 POP_JitterFunc jitter,
00214 const UT_String &distribAttrib,
00215 int maxAttempts);
00216
00217
00218
00219
00220
00221 void buildVectorTransform (UT_Matrix3& xformv,
00222 const UT_Matrix4& xform);
00223
00224 virtual float getVariableValue (int index, int thread);
00225
00226 void setupVars (POP_ContextData* data,
00227 GU_Detail* gdp,
00228 const GB_Group* source = 0);
00229
00230
00231
00232
00233
00234 bool hasSourceAttributeVars() const;
00235 void refreshSourceAttributeVars(GU_Detail *gdp);
00236
00237 virtual int isVarDependent (GU_Detail* gdp, POP_FParam param,
00238 float t, int thread);
00239 virtual int isVarDependent (GU_Detail* gdp, POP_IParam param,
00240 float t, int thread);
00241 virtual int isVarDependent (GU_Detail* gdp, POP_SParam param,
00242 float t, int thread);
00243 virtual int isVarDependent (GU_Detail* gdp, EV_EXPRESSION* expr,
00244 int thread);
00245
00246 void allowVar (int val) { myAllowGeneratorVar = val; };
00247 int isAllowVar() const { return myAllowGeneratorVar; }
00248
00249 int isVarTest() const { return myVarTest; }
00250 void setVarDependent(int val) { myVarDependent = val; }
00251
00252 void clearLastEmissionTime() { myLastEmissionTime = FP32_REAL_MAX; }
00253
00254 UT_Vector4* mySourcePos;
00255 GB_AttributeData* mySourceAtt;
00256 int mySourceIter;
00257 float mySourceU;
00258 float mySourceV;
00259 const GB_Element* mySourceElem;
00260 UT_Vector3* mySourceNml;
00261
00262 private:
00263
00264 void computeBBox (void);
00265
00266 int myNumParticles;
00267 int myNumPoints;
00268 int myNumPrims;
00269 int myNumGroupEntries;
00270 GU_Detail* myBBGdp;
00271 UT_Vector3 myBBOrigin;
00272 UT_Vector3 myBBScale;
00273 float myTimeInc;
00274
00275
00276
00277 fpreal myLastEmissionTime;
00278
00279 int myAllowGeneratorVar;
00280 int myVarDependent;
00281 int myVarTest;
00282
00283 int myAlphaOffset;
00284 int myDiffuseOffset;
00285 int myDistanceOffset;
00286 int myDragOffset;
00287 int myMassOffset;
00288 int myNormalOffset;
00289 int myScaleOffset;
00290 int mySpringKOffset;
00291 int myTensionOffset;
00292 int myTextureOffset;
00293 int myUpOffset;
00294 int myVelocityOffset;
00295 };
00296
00297 #endif