48 using namespace HDK_Sample;
81 SOP_SParticle::myOffsets = 0;
125 myVelocity.
set(ptoff, mySourceVel.
get(srcptoff));
136 myLife.
set(ptoff, 0, 0);
145 float life = myLife.
get(ptoff, 0);
146 float death = myLife.
get(ptoff, 1);
148 myLife.
set(ptoff, life, 0);
158 myVelocity.
set(ptoff, vel);
170 if (myCollision->
sendRay(start, dir, info) > 0)
185 int nbirth = BIRTH(now);
190 for (
int i = 0; i < nbirth; ++i)
244 if (currframe <= reset || !mySystem)
246 myLastCookTime =
reset;
256 myCollision->
init(collision);
258 else myCollision = 0;
281 while (myLastCookTime < currframe)
288 if (myCollision)
delete myCollision;
304 case 0:
return "Particle Source Geometry";
305 case 1:
return "Collision Object";
307 return "Unknown source";
int sendRay(const UT_Vector3 &org, const UT_Vector3 &dir, GU_RayInfo &hitinfo) const
~SOP_SParticle() override
void init(const GU_Detail *gdp, const GA_PrimitiveGroup *group=nullptr, bool picking=false, bool polyline=false, bool harden=false, bool usevisibility=false, bool solidtet=false)
const OP_NodeFlags & flags() const
GA_Attribute * addFloatTuple(GA_AttributeOwner owner, GA_AttributeScope scope, const UT_StringHolder &name, int tuple_size, const GA_Defaults &defaults=GA_Defaults(0.0), const UT_Options *creation_args=0, const GA_AttributeOptions *attribute_options=0, GA_Storage storage=GA_STORE_REAL32, const GA_ReuseStrategy &reuse=GA_ReuseStrategy())
static PRM_Template myTemplateList[]
void notifyGroupParmListeners(int parm_index, int group_type_index, const GU_Detail *pgdp, const GA_Group *group)
int getNumParticles() const
Returns the number of live particles.
void clearAndDestroy()
Clear all the points/primitives out of this detail.
UT_Vector3T< float > UT_Vector3
SOP_SParticle(OP_Network *net, const char *name, OP_Operator *op)
bool addOperator(OP_Operator *op, std::ostream *err=nullptr)
SYS_FORCE_INLINE UT_Vector3 getPos3(GA_Offset ptoff) const
The ptoff passed is the point offset.
PRM_API const PRM_Type PRM_XYZ_J
PRM_API const PRM_Type PRM_INT_J
SYS_FORCE_INLINE bool GAisValid(GA_Size v)
exint GA_Size
Defines the bit width for index and offset types in GA.
GA_ATINumeric * getAttribute() const
GA_ROHandleT< UT_Vector3F > GA_ROHandleV3
void newSopOperator(OP_OperatorTable *table)
#define GA_INVALID_OFFSET
GA_Offset giveBirth()
Resurrect a particle or give birth to a new one.
CH_Manager * getChannelManager()
GA_RWHandleT< UT_Vector3F > GA_RWHandleV3
PRM_API const PRM_Type PRM_INT
OP_ERROR cookMySop(OP_Context &context) override
void deadParticle(GEO_ParticleVertexIndex vtxindex)
const GA_IndexMap & getPointMap() const
fpreal getSample(fpreal t) const
const GU_Detail * inputGeo(int index, OP_Context &)
SYS_FORCE_INLINE T get(GA_Offset off, int comp=0) const
SYS_FORCE_INLINE GA_Offset vertexPoint(GA_Offset vertex) const
Given a vertex, return the point it references.
SYS_API double SYSdrand48()
GLuint const GLchar * name
SYS_FORCE_INLINE bool isInvalid() const
GLenum GLenum GLsizei void * table
SYS_FORCE_INLINE bool isValid() const
const GA_Attribute * findFloatTuple(GA_AttributeOwner owner, GA_AttributeScope scope, const UT_StringRef &name, int min_size=1, int max_size=-1) const
PRM_API PRM_Default PRMoneDefaults[]
SYS_FORCE_INLINE void setPos3(GA_Offset ptoff, const UT_Vector3 &pos)
Set P from a UT_Vector3.
SIM_API const UT_StringHolder force
SYS_FORCE_INLINE void set(GA_Offset off, const T &val) const
void setTimeDep(bool on_off)
SYS_FORCE_INLINE GA_Index indexSize() const
int * allocIndirect(int size=64)
SYS_FORCE_INLINE GEO_Primitive * appendPrimitive(const GA_PrimitiveTypeId &type)
OP_API OP_Director * OPgetDirector()
GA_RWHandleT< fpreal32 > GA_RWHandleF
void deleteDead()
Delete all dead particles.
Data represents a direction vector. Token "vector".
int moveParticle(GA_Offset ptoff, const UT_Vector3 &force)
static OP_Node * myConstructor(OP_Network *, const char *, OP_Operator *)
SYS_FORCE_INLINE UT_StorageMathFloat_t< T > normalize() noexcept
void select(GU_SelectionType stype)
GA_API const UT_StringHolder life
SYS_FORCE_INLINE void setTypeInfo(GA_TypeInfo type)
const char * inputLabel(unsigned idx) const override
SYS_FORCE_INLINE GA_Offset pointOffset(GA_Index index) const
Given a point's index (in append order), return its data offset.
fpreal getTime(fpreal sample) const
void timeStep(fpreal now)
GA_Offset vertexPoint(GA_Size i) const