OpenSceneGraph 3.6.5
SinkOperator
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13// Written by Wang Rui, (C) 2010
14
15#ifndef OSGPARTICLE_SINKOPERATOR
16#define OSGPARTICLE_SINKOPERATOR
17
18#include <osgParticle/Particle>
20
21namespace osgParticle
22{
23
24
29{
30public:
33
37
41
43
46
49
52
55
57 void beginOperate( Program* prg );
58
59protected:
60 virtual ~SinkOperator() {}
61 SinkOperator& operator=( const SinkOperator& ) { return *this; }
62
63 virtual void handlePoint( const Domain& domain, Particle* P, double dt );
64 virtual void handleLineSegment( const Domain& domain, Particle* P, double dt );
65 virtual void handleTriangle( const Domain& domain, Particle* P, double dt );
66 virtual void handleRectangle( const Domain& domain, Particle* P, double dt );
67 virtual void handlePlane( const Domain& domain, Particle* P, double dt );
68 virtual void handleSphere( const Domain& domain, Particle* P, double dt );
69 virtual void handleBox( const Domain& domain, Particle* P, double dt );
70 virtual void handleDisk( const Domain& domain, Particle* P, double dt );
71
72 inline const osg::Vec3& getValue( Particle* P );
73 inline void kill( Particle* P, bool insideDomain );
74
77};
78
79// INLINE METHODS
80
82{
83 switch ( _sinkTarget )
84 {
85 case SINK_VELOCITY: return P->getVelocity();
87 case SINK_POSITION: default: return P->getPosition();
88 }
89}
90
91inline void SinkOperator::kill( Particle* P, bool insideDomain )
92{
93 if ( !((_sinkStrategy==SINK_INSIDE) ^ insideDomain) )
94 P->kill();
95}
96
97
98}
99
100#endif
Vec3f Vec3
Definition Vec3:21
The osgParticle library is a NodeKit that extends the core scene graph to support particle effects.
Definition AccelOperator:27
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
DomainOperator()
Definition DomainOperator:60
Definition DomainOperator:34
Implementation of a particle.
Definition Particle:47
void kill()
Kill the particle on next update NOTE: after calling this function, the isAlive() method will still r...
Definition Particle:443
const osg::Vec3 & getPosition() const
Get the position vector.
Definition Particle:403
const osg::Vec3 & getVelocity() const
Get the velocity vector.
Definition Particle:408
const osg::Vec3 & getAngularVelocity() const
Get the rotational velocity vector.
Definition Particle:423
An abstract ParticleProcessor descendant for modifying particles "on the fly" during the cull travers...
Definition Program:36
virtual void handleLineSegment(const Domain &domain, Particle *P, double dt)
virtual void handleBox(const Domain &domain, Particle *P, double dt)
SinkOperator(const SinkOperator &copy, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
Definition SinkOperator:38
META_Object(osgParticle, SinkOperator)
SinkTarget
Definition SinkOperator:31
@ SINK_POSITION
Definition SinkOperator:31
@ SINK_ANGULAR_VELOCITY
Definition SinkOperator:31
@ SINK_VELOCITY
Definition SinkOperator:31
void setSinkTarget(SinkTarget so)
Set the sink strategy.
Definition SinkOperator:45
SinkOperator()
Definition SinkOperator:34
SinkOperator & operator=(const SinkOperator &)
Definition SinkOperator:61
virtual void handleRectangle(const Domain &domain, Particle *P, double dt)
void kill(Particle *P, bool insideDomain)
Definition SinkOperator:91
const osg::Vec3 & getValue(Particle *P)
Definition SinkOperator:81
void setSinkStrategy(SinkStrategy ss)
Set the sink strategy.
Definition SinkOperator:51
virtual ~SinkOperator()
Definition SinkOperator:60
void beginOperate(Program *prg)
Perform some initializations. Do not call this method manually.
SinkTarget _sinkTarget
Definition SinkOperator:75
SinkStrategy getSinkStrategy() const
Get the sink strategy.
Definition SinkOperator:54
SinkStrategy _sinkStrategy
Definition SinkOperator:76
virtual void handlePlane(const Domain &domain, Particle *P, double dt)
virtual void handleDisk(const Domain &domain, Particle *P, double dt)
SinkStrategy
Definition SinkOperator:32
@ SINK_OUTSIDE
Definition SinkOperator:32
@ SINK_INSIDE
Definition SinkOperator:32
virtual void handleSphere(const Domain &domain, Particle *P, double dt)
virtual void handleTriangle(const Domain &domain, Particle *P, double dt)
SinkTarget getSinkTarget() const
Get the sink strategy.
Definition SinkOperator:48
virtual void handlePoint(const Domain &domain, Particle *P, double dt)
#define OSGPARTICLE_EXPORT
Definition Export:40

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.