diff --git a/AUTHORS b/AUTHORS
index fc741763c..0c6449599 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -45,6 +45,9 @@ Ben Discoe
- png plugin.
- fixes to OBJ plugin.
+Maroc Jez
+ - osgParticle
+
Byan Woods
- Port to MacOS, various code changes to support this.
- Metrowerks CodeWarrior makefiles.
diff --git a/Make/makedirdefs b/Make/makedirdefs
index 91e83f387..10281c222 100644
--- a/Make/makedirdefs
+++ b/Make/makedirdefs
@@ -11,6 +11,7 @@ SRC_DIRS = \
osgUtil\
osgDB\
osgGA\
+ osgParticle\
osgGLUT\
osgPlugins\
osgText\
@@ -74,6 +75,7 @@ DEMOS_DIRS = \
osgcube\
osghud\
osgimpostor\
+ osgparticle\
osgreflect\
osgscribe\
osgstereoimage\
diff --git a/VisualStudio/Demos/osgparticle/osgparticle.dsp b/VisualStudio/Demos/osgparticle/osgparticle.dsp
new file mode 100644
index 000000000..900a2b6df
--- /dev/null
+++ b/VisualStudio/Demos/osgparticle/osgparticle.dsp
@@ -0,0 +1,95 @@
+# Microsoft Developer Studio Project File - Name="Demo osgparticle" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Demo osgparticle - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "osgparticle.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "osgparticle.mak" CFG="Demo osgparticle - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Demo osgparticle - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Demo osgparticle - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Demo osgparticle - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+# ADD RSC /l 0x809 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 /nologo /subsystem:console /pdb:none /machine:I386 /out:"../../../bin/osgparticle.exe" /libpath:"../../../lib"
+
+!ELSEIF "$(CFG)" == "Demo osgparticle - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /vd0 /GR /GX /Zi /Od /I "../../../include" /D "_CONSOLE" /D "_MBCS" /D "FL_DLL" /D "WIN32" /D "_DEBUG" /FR /YX /FD /c
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0x809 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 glut32.lib glu32.lib opengl32.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcmt" /out:"../../../bin/osgparticled.exe" /pdbtype:sept /libpath:"../../../lib"
+# SUBTRACT LINK32 /incremental:no
+
+!ENDIF
+
+# Begin Target
+
+# Name "Demo osgparticle - Win32 Release"
+# Name "Demo osgparticle - Win32 Debug"
+# Begin Source File
+
+SOURCE=..\..\..\src\Demos\osgparticle\osgparticle.cpp
+# End Source File
+# End Target
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Project
diff --git a/VisualStudio/VisualStudio.dsw b/VisualStudio/VisualStudio.dsw
index 171b581a9..38bd25249 100644
--- a/VisualStudio/VisualStudio.dsw
+++ b/VisualStudio/VisualStudio.dsw
@@ -182,6 +182,42 @@ Package=<4>
+Project: "Core osgParticle"=.\osgParticle\osgParticle.dsp - Package Owner=<4>
+
+
+
+Package=<5>
+
+{{{
+
+}}}
+
+
+
+Package=<4>
+
+{{{
+
+ Begin Project Dependency
+
+ Project_Dep_Name Core osg
+
+ End Project Dependency
+
+ Begin Project Dependency
+
+ Project_Dep_Name Core osgDB
+
+ End Project Dependency
+
+}}}
+
+
+
+###############################################################################
+
+
+
Project: "Core osgUtil"=.\osgUtil\osgUtil.dsp - Package Owner=<4>
@@ -1106,6 +1142,66 @@ Package=<4>
+Project: "Demo sgv"=.\Demos\sgv\sgv.dsp - Package Owner=<4>
+
+
+
+Package=<5>
+
+{{{
+
+}}}
+
+
+
+Package=<4>
+
+{{{
+
+ Begin Project Dependency
+
+ Project_Dep_Name Core osg
+
+ End Project Dependency
+
+ Begin Project Dependency
+
+ Project_Dep_Name Core osgDB
+
+ End Project Dependency
+
+ Begin Project Dependency
+
+ Project_Dep_Name Core osgGA
+
+ End Project Dependency
+
+ Begin Project Dependency
+
+ Project_Dep_Name Core osgParticle
+
+ End Project Dependency
+
+ Begin Project Dependency
+
+ Project_Dep_Name Core osgGLUT
+
+ End Project Dependency
+
+ Begin Project Dependency
+
+ Project_Dep_Name Core osgUtil
+
+ End Project Dependency
+
+}}}
+
+
+
+###############################################################################
+
+
+
Project: "osgPlugin 3ds"=.\osgPlugins\lib3ds\lib3ds.dsp - Package Owner=<4>
diff --git a/VisualStudio/osgParticle/osgParticle.dsp b/VisualStudio/osgParticle/osgParticle.dsp
new file mode 100644
index 000000000..5d6338867
--- /dev/null
+++ b/VisualStudio/osgParticle/osgParticle.dsp
@@ -0,0 +1,680 @@
+# Microsoft Developer Studio Project File - Name="Core osgParticle" - Package Owner=<4>
+
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+
+# ** DO NOT EDIT **
+
+
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+
+
+CFG=Core osgParticle - Win32 Release
+
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+
+!MESSAGE use the Export Makefile command and run
+
+!MESSAGE
+
+!MESSAGE NMAKE /f "osgParticle.mak".
+
+!MESSAGE
+
+!MESSAGE You can specify a configuration when running NMAKE
+
+!MESSAGE by defining the macro CFG on the command line. For example:
+
+!MESSAGE
+
+!MESSAGE NMAKE /f "osgParticle.mak" CFG="Core osgParticle - Win32 Release"
+
+!MESSAGE
+
+!MESSAGE Possible choices for configuration are:
+
+!MESSAGE
+
+!MESSAGE "Core osgParticle - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+
+!MESSAGE "Core osgParticle - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+
+!MESSAGE
+
+
+
+# Begin Project
+
+# PROP AllowPerConfigDependencies 0
+
+# PROP Scc_ProjName ""
+
+# PROP Scc_LocalPath ""
+
+CPP=cl.exe
+
+MTL=midl.exe
+
+RSC=rc.exe
+
+
+
+!IF "$(CFG)" == "Core osgParticle - Win32 Release"
+
+
+
+# PROP BASE Use_MFC 0
+
+# PROP BASE Use_Debug_Libraries 0
+
+# PROP BASE Output_Dir "../../lib"
+
+# PROP BASE Intermediate_Dir "Release"
+
+# PROP BASE Target_Dir ""
+
+# PROP Use_MFC 0
+
+# PROP Use_Debug_Libraries 0
+
+# PROP Output_Dir "../../lib"
+
+# PROP Intermediate_Dir "Release"
+
+# PROP Ignore_Export_Lib 0
+
+# PROP Target_Dir ""
+
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "FTGL_LIBRARY_STATIC" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
+
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "../../include" /D "NDEBUG" /D "_MBCS" /D "_USRDLL" /D "osgParticle_LIBRARY" /D "FTGL_LIBRARY_STATIC" /D "WIN32" /D "_WINDOWS" /YX /FD /c
+
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+
+# ADD RSC /l 0x809 /d "NDEBUG"
+
+BSC32=bscmake.exe
+
+# ADD BASE BSC32 /nologo
+
+# ADD BSC32 /nologo
+
+LINK32=link.exe
+
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+
+# ADD LINK32 glu32.lib opengl32.lib /nologo /dll /pdb:none /machine:I386 /out:"../../bin/osgParticle.dll" /libpath:"../../lib"
+
+
+
+!ELSEIF "$(CFG)" == "Core osgParticle - Win32 Debug"
+
+
+
+# PROP BASE Use_MFC 0
+
+# PROP BASE Use_Debug_Libraries 1
+
+# PROP BASE Output_Dir "Debug"
+
+# PROP BASE Intermediate_Dir "Debug"
+
+# PROP BASE Target_Dir ""
+
+# PROP Use_MFC 0
+
+# PROP Use_Debug_Libraries 1
+
+# PROP Output_Dir "../../lib"
+
+# PROP Intermediate_Dir "Debug"
+
+# PROP Ignore_Export_Lib 0
+
+# PROP Target_Dir ""
+
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "FTGL_LIBRARY_STATIC" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c
+
+# ADD CPP /nologo /MDd /W3 /Gm /vmg /vd0 /GR /GX /Zi /Od /I "../../include" /D "osgParticle_LIBRARY" /D "FTGL_LIBRARY_STATIC" /D "_WINDOWS" /D "WIN32" /D "_DEBUG" /YX /FD /GZ /c
+
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+
+# ADD RSC /l 0x809 /d "_DEBUG"
+
+BSC32=bscmake.exe
+
+# ADD BASE BSC32 /nologo
+
+# ADD BSC32 /nologo
+
+LINK32=link.exe
+
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+
+# ADD LINK32 glu32.lib opengl32.lib /nologo /dll /debug /machine:I386 /out:"../../bin/osgParticled.dll" /pdbtype:sept /libpath:"../../lib"
+
+# SUBTRACT LINK32 /pdb:none
+
+
+
+!ENDIF
+
+
+
+# Begin Target
+
+
+
+# Name "Core osgParticle - Win32 Release"
+
+# Name "Core osgParticle - Win32 Debug"
+
+# Begin Group "Source Files"
+
+
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\Emitter.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\FluidFrictionOperator.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\IO_AccelOperator.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\IO_CenteredPlacer.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\IO_Emitter.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\IO_FluidFrictionOperator.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\IO_ForceOperator.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\IO_LinearInterpolator.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\IO_ModularEmitter.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\IO_ModularProgram.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\IO_MultiSegmentPlacer.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\IO_Particle.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\IO_ParticleProcessor.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\IO_ParticleSystem.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\IO_ParticleSystemUpdater.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\IO_PointPlacer.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\IO_Program.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\IO_RadialShooter.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\IO_RandomRateCounter.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\IO_SectorPlacer.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\IO_SegmentPlacer.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\IO_VariableRateCounter.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\ModularEmitter.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\ModularProgram.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\MultiSegmentPlacer.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\Particle.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\ParticleProcessor.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\ParticleSystem.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\ParticleSystemUpdater.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\Program.cpp
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\src\osgParticle\Version.cpp
+
+# End Source File
+
+# End Group
+
+# Begin Group "Header Files"
+
+
+
+# PROP Default_Filter ";h;hpp;hxx;hm;inl"
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\AccelOperator
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\CenteredPlacer
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\Counter
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\Emitter
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\Export
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\FluidFrictionOperator
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\ForceOperator
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\Interpolator
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\LinearInterpolator
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\ModularEmitter
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\ModularProgram
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\MultiSegmentPlacer
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\Operator
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\Particle
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\ParticleProcessor
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\ParticleSystem
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\ParticleSystemUpdater
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\Placer
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\PointPlacer
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\Program
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\RadialShooter
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\RandomRateCounter
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\SectorPlacer
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\SegmentPlacer
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\Shooter
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\VariableRateCounter
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\Version
+
+# End Source File
+
+# Begin Source File
+
+
+
+SOURCE=..\..\include\osgParticle\range
+
+# End Source File
+
+# End Group
+
+# Begin Group "Resource Files"
+
+
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+
+# End Group
+
+# End Target
+
+# End Project
+
diff --git a/doc/doc++/osgParticle/AccelOperator.html b/doc/doc++/osgParticle/AccelOperator.html
new file mode 100644
index 000000000..fd22394ca
--- /dev/null
+++ b/doc/doc++/osgParticle/AccelOperator.html
@@ -0,0 +1,132 @@
+
+
+
+
+ class osgParticle::AccelOperator
+
+
+
+
+An operator class that applies a constant acceleration to the particles
+
+
+Inheritance:
+
+
+
+
+
+Public Methods
-
+
META_Object(AccelOperator)
+-
+
inline AccelOperator()
+-
+
inline AccelOperator(const AccelOperator ©, const osg::CopyOp ©op)
+-
+
inline const osg::Vec3& getAcceleration() const
+ - Get the acceleration vector
+
-
+
inline void setAcceleration(const osg::Vec3 &v)
+ - Set the acceleration vector
+
-
+
inline void setToGravity(float scale)
+ - Quickly set the acceleration vector to the gravity on earth (0, 0, -981).
+
-
+
inline void operate(Particle* P, double dt)
+ - Apply the acceleration to a particle.
+
-
+
inline void beginOperate(Program* prg)
+ - Perform some initializations.
+
+
+
+Protected Methods
-
+
virtual ~AccelOperator()
+-
+
AccelOperator& operator=(const AccelOperator &)
+
+
+
+
+
+
+Public Methods
-
+
virtual const char* className() const
+-
+
virtual bool isSameKindAs(const osg::Object* obj) const
+-
+
virtual void endOperate()
+-
+
inline bool isEnabled() const
+-
+
inline void setEnabled(bool v)
+
+
+
+
+
+
+Documentation
+An operator class that applies a constant acceleration to the particles
+
+
+
+
+
META_Object(AccelOperator)
+
+
+
+
virtual ~AccelOperator()
+
+
+
+
AccelOperator& operator=(const AccelOperator &)
+
+
+
+
inline AccelOperator()
+
+
+
+
inline AccelOperator(const AccelOperator ©, const osg::CopyOp ©op)
+
+
+
+
inline const osg::Vec3& getAcceleration() const
+- Get the acceleration vector
+
+
+
+
inline void setAcceleration(const osg::Vec3 &v)
+- Set the acceleration vector
+
+
+
+
inline void setToGravity(float scale)
+- Quickly set the acceleration vector to the gravity on earth (0, 0, -981).
+The acceleration will be multiplied by the
scale parameter.
+
+
+
+
inline void operate(Particle* P, double dt)
+- Apply the acceleration to a particle. Do not call this method manually.
+
+
+
+
inline void beginOperate(Program* prg)
+- Perform some initializations. Do not call this method manually.
+
+
+
- This class has no child classes.
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/CenteredPlacer.html b/doc/doc++/osgParticle/CenteredPlacer.html
new file mode 100644
index 000000000..df21597b8
--- /dev/null
+++ b/doc/doc++/osgParticle/CenteredPlacer.html
@@ -0,0 +1,115 @@
+
+
+
+
+ class osgParticle::CenteredPlacer
+
+
+
+
+An abstract placer base class for placers which need a center point
+
+
+Inheritance:
+
+
+
+
+
+Public Methods
-
+
virtual const char* className() const
+-
+
virtual bool isSameKindAs(const osg::Object* obj) const
+-
+
inline CenteredPlacer()
+-
+
inline CenteredPlacer(const CenteredPlacer ©, const osg::CopyOp ©op)
+-
+
inline const osg::Vec3& getCenter() const
+ - Get the center point
+
-
+
inline void setCenter(const osg::Vec3 &v)
+ - Set the center point
+
-
+
inline void setCenter(float x, float y, float z)
+ - Set the center point
+
+
+
+Protected Methods
-
+
virtual ~CenteredPlacer()
+
+
+
+
Inherited from Placer:
+
+
+Public Methods
-
+
virtual void place(Particle* P) const
+
+
+
+Protected Methods
-
+
Placer& operator=(const Placer &)
+
+
+
+
+
+
+Documentation
+An abstract placer base class for placers which need a center point
+
+
+
+
+
virtual const char* className() const
+
+
+
+
virtual bool isSameKindAs(const osg::Object* obj) const
+
+
+
+
virtual ~CenteredPlacer()
+
+
+
+
inline CenteredPlacer()
+
+
+
+
inline CenteredPlacer(const CenteredPlacer ©, const osg::CopyOp ©op)
+
+
+
+
inline const osg::Vec3& getCenter() const
+- Get the center point
+
+
+
+
inline void setCenter(const osg::Vec3 &v)
+- Set the center point
+
+
+
+
inline void setCenter(float x, float y, float z)
+- Set the center point
+
+
+- Direct child classes:
+
- SectorPlacer
+PointPlacer
+
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/ClassGraph.class b/doc/doc++/osgParticle/ClassGraph.class
new file mode 100644
index 000000000..4f41a1fb2
Binary files /dev/null and b/doc/doc++/osgParticle/ClassGraph.class differ
diff --git a/doc/doc++/osgParticle/ClassGraphPanel.class b/doc/doc++/osgParticle/ClassGraphPanel.class
new file mode 100644
index 000000000..4f3ea86bb
Binary files /dev/null and b/doc/doc++/osgParticle/ClassGraphPanel.class differ
diff --git a/doc/doc++/osgParticle/ClassLayout.class b/doc/doc++/osgParticle/ClassLayout.class
new file mode 100644
index 000000000..69a6f494e
Binary files /dev/null and b/doc/doc++/osgParticle/ClassLayout.class differ
diff --git a/doc/doc++/osgParticle/Counter.html b/doc/doc++/osgParticle/Counter.html
new file mode 100644
index 000000000..d5ecf1d82
--- /dev/null
+++ b/doc/doc++/osgParticle/Counter.html
@@ -0,0 +1,87 @@
+
+
+
+
+ class osgParticle::Counter
+
+
+
+
+
+
+Inheritance:
+
+
+
+
+
+Public Methods
-
+
virtual const char* className() const
+-
+
virtual bool isSameKindAs(const osg::Object* obj) const
+-
+
virtual int numParticlesToCreate(double dt) const = 0
+-
+
inline Counter()
+-
+
inline Counter(const Counter ©, const osg::CopyOp ©op)
+
+
+
+Protected Methods
-
+
~Counter()
+-
+
Counter& operator=(const Counter &)
+
+
+
+
+
+
+Documentation
+
+
+
+
+
virtual const char* className() const
+
+
+
+
virtual bool isSameKindAs(const osg::Object* obj) const
+
+
+
+
virtual int numParticlesToCreate(double dt) const = 0
+
+
+
+
~Counter()
+
+
+
+
Counter& operator=(const Counter &)
+
+
+
+
inline Counter()
+
+
+
+
inline Counter(const Counter ©, const osg::CopyOp ©op)
+
+
+- Direct child classes:
+
- VariableRateCounter
+
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/Emitter.html b/doc/doc++/osgParticle/Emitter.html
new file mode 100644
index 000000000..0c80c46e2
--- /dev/null
+++ b/doc/doc++/osgParticle/Emitter.html
@@ -0,0 +1,181 @@
+
+
+
+
+ class OSGPARTICLE_EXPORT osgParticle::Emitter
+
+
+
+
+An abstract base class for particle emitters.
+
+
+Inheritance:
+
+
+
+
+
+Public Methods
-
+
Emitter()
+-
+
Emitter(const Emitter ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
+-
+
virtual const char* className() const
+-
+
virtual bool isSameKindAs(const osg::Object* obj)
+-
+
virtual void accept(osg::NodeVisitor& nv)
+-
+
inline const Particle& getParticleTemplate() const
+ - Get the particle template
+
-
+
inline void setParticleTemplate(const Particle &p)
+ - Set the particle template (particle is copied)
+
-
+
inline bool getUseDefaultTemplate() const
+ - Return whether the particle system's default template should be used
+
-
+
inline void setUseDefaultTemplate(bool v)
+ - Set whether the default particle template should be used.
+
-
+
inline void process(double dt)
+
+
+
+Protected Methods
-
+
virtual ~Emitter()
+-
+
Emitter& operator=(const Emitter &)
+-
+
virtual void emit(double dt) = 0
+
+
+
+
+
+
+Public Methods
-
+
inline ReferenceFrame getReferenceFrame() const
+-
+
void traverse(osg::NodeVisitor &nv)
+-
+
inline ParticleProcessor::ReferenceFrame getReferenceFrame() const
+-
+
inline void setReferenceFrame(ReferenceFrame rf)
+-
+
inline bool isEnabled() const
+-
+
inline void setEnabled(bool v)
+-
+
inline ParticleSystem* getParticleSystem()
+-
+
inline const ParticleSystem* getParticleSystem() const
+-
+
inline void setParticleSystem(ParticleSystem* ps)
+-
+
inline const bool computeBound() const
+-
+
inline const osg::Matrix& getLocalToWorldMatrix()
+-
+
inline const osg::Matrix& getWorldToLocalMatrix()
+-
+
inline osg::Vec3 transformLocalToWorld(const osg::Vec3 &P)
+-
+
inline osg::Vec3 transformWorldToLocal(const osg::Vec3 &P)
+-
+
inline osg::Vec3 rotateLocalToWorld(const osg::Vec3 &P)
+-
+
inline osg::Vec3 rotateWorldToLocal(const osg::Vec3 &P)
+
+
+
+Public Members
-
+
enum ReferenceFrame
+
+
+
+
+
+
+Documentation
+An abstract base class for particle emitters.
+Descendant classes must override the emit() method to generate new particles by
+calling the ParticleSystem::createParticle() method on the particle system associated
+to the emitter.
+
+
+
+
+
Emitter()
+
+
+
+
Emitter(const Emitter ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
+
+
+
+
virtual const char* className() const
+
+
+
+
virtual bool isSameKindAs(const osg::Object* obj)
+
+
+
+
virtual void accept(osg::NodeVisitor& nv)
+
+
+
+
virtual ~Emitter()
+
+
+
+
Emitter& operator=(const Emitter &)
+
+
+
+
virtual void emit(double dt) = 0
+
+
+
+
inline const Particle& getParticleTemplate() const
+- Get the particle template
+
+
+
+
inline void setParticleTemplate(const Particle &p)
+- Set the particle template (particle is copied)
+
+
+
+
inline bool getUseDefaultTemplate() const
+- Return whether the particle system's default template should be used
+
+
+
+
inline void setUseDefaultTemplate(bool v)
+- Set whether the default particle template should be used.
+When this flag is true, the particle template is ignored, and the
+particle system's default template is used instead.
+
+
+
+
inline void process(double dt)
+
+
+- Direct child classes:
+
- ModularEmitter
+
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/FluidFrictionOperator.html b/doc/doc++/osgParticle/FluidFrictionOperator.html
new file mode 100644
index 000000000..116125b27
--- /dev/null
+++ b/doc/doc++/osgParticle/FluidFrictionOperator.html
@@ -0,0 +1,175 @@
+
+
+
+
+ class OSGPARTICLE_EXPORT osgParticle::FluidFrictionOperator
+
+
+
+
+An operator that simulates the friction of a fluid.
+
+
+Inheritance:
+
+
+
+
+
+Public Methods
-
+
FluidFrictionOperator()
+-
+
FluidFrictionOperator(const FluidFrictionOperator ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
+-
+
META_Object(FluidFrictionOperator)
+-
+
void operate(Particle* P, double dt)
+ - Apply the friction forces to a particle.
+
-
+
inline float getFluidDensity() const
+ - Get the density of the fluid
+
-
+
inline float getFluidViscosity() const
+ - Get the viscosity of the fluid
+
-
+
inline void setFluidDensity(float d)
+ - Set the density of the fluid
+
-
+
inline void setFluidViscosity(float v)
+ - Set the viscosity of the fluid
+
-
+
inline void setFluidToAir()
+ - Set the fluid parameters as for air (20°C temperature)
+
-
+
inline void setFluidToWater()
+ - Set the fluid parameters as for pure water (20°C temperature)
+
-
+
inline float getOverrideRadius() const
+ - Get the overriden radius value
+
-
+
inline void setOverrideRadius(float r)
+ - Set the overriden radius value (pass 0 if you want to use particle's radius)
+
-
+
inline void beginOperate(Program* prg)
+ - Perform some initializations.
+
+
+
+Protected Methods
-
+
virtual ~FluidFrictionOperator()
+-
+
FluidFrictionOperator& operator=(const FluidFrictionOperator &)
+
+
+
+
+
+
+Public Methods
-
+
virtual const char* className() const
+-
+
virtual bool isSameKindAs(const osg::Object* obj) const
+-
+
virtual void endOperate()
+-
+
inline bool isEnabled() const
+-
+
inline void setEnabled(bool v)
+
+
+
+
+
+
+Documentation
+An operator that simulates the friction of a fluid.
+By using this operator you can let the particles move in a fluid of a given density
+and viscosity. There are two functions to quickly setup the parameters for pure water
+and air. You can decide whether to compute the forces using the particle's physical
+radius or another value, by calling the setOverrideRadius() method.
+
+
+
+
+
FluidFrictionOperator()
+
+
+
+
FluidFrictionOperator(const FluidFrictionOperator ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
+
+
+
+
META_Object(FluidFrictionOperator)
+
+
+
+
void operate(Particle* P, double dt)
+- Apply the friction forces to a particle. Do not call this method manually.
+
+
+
+
virtual ~FluidFrictionOperator()
+
+
+
+
FluidFrictionOperator& operator=(const FluidFrictionOperator &)
+
+
+
+
inline float getFluidDensity() const
+- Get the density of the fluid
+
+
+
+
inline float getFluidViscosity() const
+- Get the viscosity of the fluid
+
+
+
+
inline void setFluidDensity(float d)
+- Set the density of the fluid
+
+
+
+
inline void setFluidViscosity(float v)
+- Set the viscosity of the fluid
+
+
+
+
inline void setFluidToAir()
+- Set the fluid parameters as for air (20°C temperature)
+
+
+
+
inline void setFluidToWater()
+- Set the fluid parameters as for pure water (20°C temperature)
+
+
+
+
inline float getOverrideRadius() const
+- Get the overriden radius value
+
+
+
+
inline void setOverrideRadius(float r)
+- Set the overriden radius value (pass 0 if you want to use particle's radius)
+
+
+
+
inline void beginOperate(Program* prg)
+- Perform some initializations. Do not call this method manually.
+
+
+
- This class has no child classes.
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/ForceOperator.html b/doc/doc++/osgParticle/ForceOperator.html
new file mode 100644
index 000000000..69a4da911
--- /dev/null
+++ b/doc/doc++/osgParticle/ForceOperator.html
@@ -0,0 +1,125 @@
+
+
+
+
+ class osgParticle::ForceOperator
+
+
+
+
+An operator that applies a constant force to the particles.
+
+
+Inheritance:
+
+
+
+
+
+Public Methods
-
+
META_Object(ForceOperator)
+-
+
inline ForceOperator()
+-
+
inline ForceOperator(const ForceOperator ©, const osg::CopyOp ©op)
+-
+
inline const osg::Vec3& getForce() const
+ - Get the force vector
+
-
+
inline void setForce(const osg::Vec3 &v)
+ - Set the force vector
+
-
+
inline void operate(Particle* P, double dt)
+ - Apply the force to a particle.
+
-
+
inline void beginOperate(Program* prg)
+ - Perform some initialization.
+
+
+
+Protected Methods
-
+
virtual ~ForceOperator()
+-
+
ForceOperator& operator=(const ForceOperator &)
+
+
+
+
+
+
+Public Methods
-
+
virtual const char* className() const
+-
+
virtual bool isSameKindAs(const osg::Object* obj) const
+-
+
virtual void endOperate()
+-
+
inline bool isEnabled() const
+-
+
inline void setEnabled(bool v)
+
+
+
+
+
+
+Documentation
+An operator that applies a constant force to the particles.
+Remember that if the mass of particles is expressed in kg and the lengths are
+expressed in meters, then the force should be expressed in Newtons.
+
+
+
+
+
META_Object(ForceOperator)
+
+
+
+
virtual ~ForceOperator()
+
+
+
+
ForceOperator& operator=(const ForceOperator &)
+
+
+
+
inline ForceOperator()
+
+
+
+
inline ForceOperator(const ForceOperator ©, const osg::CopyOp ©op)
+
+
+
+
inline const osg::Vec3& getForce() const
+- Get the force vector
+
+
+
+
inline void setForce(const osg::Vec3 &v)
+- Set the force vector
+
+
+
+
inline void operate(Particle* P, double dt)
+- Apply the force to a particle. Do not call this method manually.
+
+
+
+
inline void beginOperate(Program* prg)
+- Perform some initialization. Do not call this method manually.
+
+
+
- This class has no child classes.
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/General.html b/doc/doc++/osgParticle/General.html
new file mode 100644
index 000000000..88a7b3e58
--- /dev/null
+++ b/doc/doc++/osgParticle/General.html
@@ -0,0 +1,112 @@
+
+
+
+
+ General Bits
+
+
+
+
+
+-
+
+
#define
+OSGPARTICLE_ACCELOPERATOR_-
+
+
#define
+OSGPARTICLE_CENTEREDPLACER_-
+
+
#define
+OSGPARTICLE_COUNTER_-
+
+
#define
+OSGPARTICLE_EMITTER_-
+
+
#define
+OSGPARTICLE_EXPORT_-
+
+
#define
+OSGPARTICLE_EXPORT(dllexport)-
+
+
#define
+OSGPARTICLE_EXPORT(dllimport)-
+
+
#define
+OSGPARTICLE_EXPORT-
+
+
#define
+OSGPARTICLE_FLUIDFRICTIONOPERATOR_-
+
+
#define
+OSGPARTICLE_FORCEOPERATOR_-
+
+
#define
+OSGPARTICLE_INTERPOLATOR_-
+
+
#define
+OSGPARTICLE_LINEARINTERPOLATOR_-
+
+
#define
+OSGPARTICLE_MODULAREMITTER_-
+
+
#define
+OSGPARTICLE_MODULARPROGRAM_-
+
+
#define
+OSGPARTICLE_MULTISEGMENTPLACER_-
+
+
#define
+OSGPARTICLE_OPERATOR_-
+
+
#define
+OSGPARTICLE_PARTICLE_-
+
+
#define
+OSGPARTICLE_PARTICLEPROCESSOR_-
+
+
#define
+OSGPARTICLE_PARTICLESYSTEM_-
+
+
#define
+OSGPARTICLE_PARTICLESYSTEMUPDATER_-
+
+
#define
+OSGPARTICLE_PLACER_-
+
+
#define
+OSGPARTICLE_POINTPLACER_-
+
+
#define
+OSGPARTICLE_PROGRAM_-
+
+
#define
+OSGPARTICLE_RADIALSHOOTER_-
+
+
#define
+OSGPARTICLE_RANDOMRATECOUNTER_-
+
+
#define
+OSGPARTICLE_RANGE_-
+
+
#define
+OSGPARTICLE_SEGMENTPLACER_-
+
+
#define
+OSGPARTICLE_SHOOTER_-
+
+
#define
+OSGPARTICLE_VARIABLERATECOUNTER_-
+
+
#define
+OSGPARTICLE_VERSION_-
+
+
OSGPARTICLE_EXPORT const char*
+osgParticleGetVersion()-
+
+
OSGPARTICLE_EXPORT const char*
+osgParticleGetLibraryName()
+Alphabetic index Hierarchy of classes
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/HIER.html b/doc/doc++/osgParticle/HIER.html
new file mode 100644
index 000000000..eae34bc74
--- /dev/null
+++ b/doc/doc++/osgParticle/HIER.html
@@ -0,0 +1,61 @@
+
+
+
+
+ Hierarchy of Classes
+
+
+
+Hierarchy of Classes
+
+Alphabetic index
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/HIERjava.html b/doc/doc++/osgParticle/HIERjava.html
new file mode 100644
index 000000000..9f8422945
--- /dev/null
+++ b/doc/doc++/osgParticle/HIERjava.html
@@ -0,0 +1,79 @@
+
+
+
+
+ Hierarchy of Classes
+
+
+
+Hierarchy of classes
+
+
+
+
+
+
+
+
+
+
+
+ alphabetic index
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/Interpolator.html b/doc/doc++/osgParticle/Interpolator.html
new file mode 100644
index 000000000..dd0c3fcc2
--- /dev/null
+++ b/doc/doc++/osgParticle/Interpolator.html
@@ -0,0 +1,115 @@
+
+
+
+
+ class osgParticle::Interpolator
+
+
+
+
+An abstract base class for implementing interpolators
+
+
+Inheritance:
+
+
+
+
+
+Public Methods
-
+
Interpolator()
+-
+
Interpolator(const Interpolator ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
+-
+
virtual const char* className() const
+-
+
virtual bool isSameKindAs(const osg::Object* obj) const
+-
+
virtual float interpolate(float t, float y1, float y2) const = 0
+ - Interpolate between floats.
+
-
+
virtual osg::Vec2 interpolate(float t, const osg::Vec2 &y1, const osg::Vec2 &y2) const
+ - Interpolate between 2-dimensional vectors.
+
-
+
virtual osg::Vec3 interpolate(float t, const osg::Vec3 &y1, const osg::Vec3 &y2) const
+ - Interpolate between 3-dimensional vectors.
+
-
+
virtual osg::Vec4 interpolate(float t, const osg::Vec4 &y1, const osg::Vec4 &y2) const
+ - Interpolate between 4-dimensional vectors.
+
-
+
template<class T_> T_ interpolate(float t, const range<T_> &r) const
+
+
+
+Protected Methods
-
+
virtual ~Interpolator()
+
+
+
+
+
+
+Documentation
+An abstract base class for implementing interpolators
+
+
+
+
+
Interpolator()
+
+
+
+
Interpolator(const Interpolator ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
+
+
+
+
virtual const char* className() const
+
+
+
+
virtual bool isSameKindAs(const osg::Object* obj) const
+
+
+
+
virtual float interpolate(float t, float y1, float y2) const = 0
+- Interpolate between floats. Must be overriden in descendant classes.
+
+
+
+
virtual osg::Vec2 interpolate(float t, const osg::Vec2 &y1, const osg::Vec2 &y2) const
+- Interpolate between 2-dimensional vectors. Default behavior is to interpolate each component separately.
+
+
+
+
virtual osg::Vec3 interpolate(float t, const osg::Vec3 &y1, const osg::Vec3 &y2) const
+- Interpolate between 3-dimensional vectors. Default behavior is to interpolate each component separately.
+
+
+
+
virtual osg::Vec4 interpolate(float t, const osg::Vec4 &y1, const osg::Vec4 &y2) const
+- Interpolate between 4-dimensional vectors. Default behavior is to interpolate each component separately.
+
+
+
+
template<class T_> T_ interpolate(float t, const range<T_> &r) const
+
+
+
+
virtual ~Interpolator()
+
+
+- Direct child classes:
+
- LinearInterpolator
+
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/LinearInterpolator.html b/doc/doc++/osgParticle/LinearInterpolator.html
new file mode 100644
index 000000000..b3f4d709d
--- /dev/null
+++ b/doc/doc++/osgParticle/LinearInterpolator.html
@@ -0,0 +1,85 @@
+
+
+
+
+ class osgParticle::LinearInterpolator
+
+
+
+
+A linear interpolator
+
+
+Inheritance:
+
+
+
+
+
+Public Methods
-
+
LinearInterpolator()
+-
+
LinearInterpolator(const LinearInterpolator ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
+-
+
META_Object(LinearInterpolator)
+-
+
virtual float interpolate(float t, float y1, float y2) const
+
+
+
+Protected Methods
-
+
virtual ~LinearInterpolator()
+
+
+
+
+
+
+Public Methods
-
+
virtual const char* className() const
+-
+
virtual bool isSameKindAs(const osg::Object* obj) const
+
+
+
+
+
+
+Documentation
+A linear interpolator
+
+
+
+
+
LinearInterpolator()
+
+
+
+
LinearInterpolator(const LinearInterpolator ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
+
+
+
+
META_Object(LinearInterpolator)
+
+
+
+
virtual float interpolate(float t, float y1, float y2) const
+
+
+
+
virtual ~LinearInterpolator()
+
+
+
- This class has no child classes.
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/ModularEmitter.html b/doc/doc++/osgParticle/ModularEmitter.html
new file mode 100644
index 000000000..08a19237a
--- /dev/null
+++ b/doc/doc++/osgParticle/ModularEmitter.html
@@ -0,0 +1,223 @@
+
+
+
+
+ class OSGPARTICLE_EXPORT osgParticle::ModularEmitter
+
+
+
+
+An emitter class that holds three objects to control the creation of particles.
+
+
+Inheritance:
+
+
+
+
+
+Public Methods
-
+
ModularEmitter()
+-
+
ModularEmitter(const ModularEmitter ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
+-
+
META_Node(ModularEmitter)
+-
+
inline Counter* getCounter()
+ - Get the counter object
+
-
+
inline const Counter* getCounter() const
+ - Get the const Counter object
+
-
+
inline void setCounter(Counter* c)
+ - Set the Counter object
+
-
+
inline Placer* getPlacer()
+ - Get the Placer object
+
-
+
inline const Placer* getPlacer() const
+ - Get the const Placer object.
+
-
+
inline void setPlacer(Placer* p)
+ - Set the Placer object
+
-
+
inline Shooter* getShooter()
+ - Get the Shooter object
+
-
+
inline const Shooter* getShooter() const
+ - Get the const Shooter object
+
-
+
inline void setShooter(Shooter* s)
+ - Set the Shooter object
+
+
+
+Protected Methods
-
+
virtual ~ModularEmitter()
+-
+
ModularEmitter& operator=(const ModularEmitter &)
+-
+
void emit(double dt)
+
+
+
+
Inherited from Emitter:
+
+
+Public Methods
-
+
virtual const char* className() const
+-
+
virtual bool isSameKindAs(const osg::Object* obj)
+-
+
virtual void accept(osg::NodeVisitor& nv)
+-
+
inline const Particle& getParticleTemplate() const
+-
+
inline void setParticleTemplate(const Particle &p)
+-
+
inline bool getUseDefaultTemplate() const
+-
+
inline void setUseDefaultTemplate(bool v)
+-
+
inline void process(double dt)
+
+
+
+
+
+
+Public Methods
-
+
inline ReferenceFrame getReferenceFrame() const
+-
+
void traverse(osg::NodeVisitor &nv)
+-
+
inline ParticleProcessor::ReferenceFrame getReferenceFrame() const
+-
+
inline void setReferenceFrame(ReferenceFrame rf)
+-
+
inline bool isEnabled() const
+-
+
inline void setEnabled(bool v)
+-
+
inline ParticleSystem* getParticleSystem()
+-
+
inline const ParticleSystem* getParticleSystem() const
+-
+
inline void setParticleSystem(ParticleSystem* ps)
+-
+
inline const bool computeBound() const
+-
+
inline const osg::Matrix& getLocalToWorldMatrix()
+-
+
inline const osg::Matrix& getWorldToLocalMatrix()
+-
+
inline osg::Vec3 transformLocalToWorld(const osg::Vec3 &P)
+-
+
inline osg::Vec3 transformWorldToLocal(const osg::Vec3 &P)
+-
+
inline osg::Vec3 rotateLocalToWorld(const osg::Vec3 &P)
+-
+
inline osg::Vec3 rotateWorldToLocal(const osg::Vec3 &P)
+
+
+
+Public Members
-
+
enum ReferenceFrame
+
+
+
+
+
+
+Documentation
+An emitter class that holds three objects to control the creation of particles.
+These objects are a counter, a placer and a shooter.
+The counter controls the number of particles to be emitted at each frame;
+the placer must initialize the particle's position vector, while the shooter initializes
+its velocity vector.
+You can use the predefined counter/placer/shooter classes, or you can create your own.
+
+
+
+
+
ModularEmitter()
+
+
+
+
ModularEmitter(const ModularEmitter ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
+
+
+
+
META_Node(ModularEmitter)
+
+
+
+
virtual ~ModularEmitter()
+
+
+
+
ModularEmitter& operator=(const ModularEmitter &)
+
+
+
+
void emit(double dt)
+
+
+
+
inline Counter* getCounter()
+- Get the counter object
+
+
+
+
inline const Counter* getCounter() const
+- Get the const Counter object
+
+
+
+
inline void setCounter(Counter* c)
+- Set the Counter object
+
+
+
+
inline Placer* getPlacer()
+- Get the Placer object
+
+
+
+
inline const Placer* getPlacer() const
+- Get the const Placer object.
+
+
+
+
inline void setPlacer(Placer* p)
+- Set the Placer object
+
+
+
+
inline Shooter* getShooter()
+- Get the Shooter object
+
+
+
+
inline const Shooter* getShooter() const
+- Get the const Shooter object
+
+
+
+
inline void setShooter(Shooter* s)
+- Set the Shooter object
+
+
+
- This class has no child classes.
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/ModularProgram.html b/doc/doc++/osgParticle/ModularProgram.html
new file mode 100644
index 000000000..9a811e9bd
--- /dev/null
+++ b/doc/doc++/osgParticle/ModularProgram.html
@@ -0,0 +1,181 @@
+
+
+
+
+ class OSGPARTICLE_EXPORT osgParticle::ModularProgram
+
+
+
+
+A program class for performing operations on particles using a sequence of operators.
+
+
+Inheritance:
+
+
+
+
+
+Public Methods
-
+
ModularProgram()
+-
+
ModularProgram(const ModularProgram ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
+-
+
META_Node(ModularProgram)
+-
+
inline int numOperators() const
+ - Get the number of operators
+
-
+
inline void addOperator(Operator* o)
+ - Add an operator to the list.
+
-
+
inline Operator* getOperator(int i)
+ - Get a pointer to an operator in the list
+
-
+
inline const Operator* getOperator(int i) const
+ - Get a const pointer to an operator in the list
+
-
+
inline void removeOperator(int i)
+ - Remove an operator from the list
+
+
+
+Protected Methods
-
+
virtual ~ModularProgram()
+-
+
ModularProgram& operator=(const ModularProgram &)
+-
+
void execute(double dt)
+
+
+
+
Inherited from Program:
+
+
+Public Methods
-
+
virtual const char* className() const
+-
+
virtual bool isSameKindAs(const osg::Object* obj)
+-
+
virtual void accept(osg::NodeVisitor& nv)
+-
+
inline void process(double dt)
+
+
+
+
+
+
+Public Methods
-
+
inline ReferenceFrame getReferenceFrame() const
+-
+
void traverse(osg::NodeVisitor &nv)
+-
+
inline ParticleProcessor::ReferenceFrame getReferenceFrame() const
+-
+
inline void setReferenceFrame(ReferenceFrame rf)
+-
+
inline bool isEnabled() const
+-
+
inline void setEnabled(bool v)
+-
+
inline ParticleSystem* getParticleSystem()
+-
+
inline const ParticleSystem* getParticleSystem() const
+-
+
inline void setParticleSystem(ParticleSystem* ps)
+-
+
inline const bool computeBound() const
+-
+
inline const osg::Matrix& getLocalToWorldMatrix()
+-
+
inline const osg::Matrix& getWorldToLocalMatrix()
+-
+
inline osg::Vec3 transformLocalToWorld(const osg::Vec3 &P)
+-
+
inline osg::Vec3 transformWorldToLocal(const osg::Vec3 &P)
+-
+
inline osg::Vec3 rotateLocalToWorld(const osg::Vec3 &P)
+-
+
inline osg::Vec3 rotateWorldToLocal(const osg::Vec3 &P)
+
+
+
+Public Members
-
+
enum ReferenceFrame
+
+
+
+
+
+
+Documentation
+A program class for performing operations on particles using a sequence of operators.
+To use a ModularProgram you have to create some Operator objects and
+add them to the program.
+All operators will be applied to each particle in the same order they've been added to the program.
+
+
+
+
+
ModularProgram()
+
+
+
+
ModularProgram(const ModularProgram ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
+
+
+
+
META_Node(ModularProgram)
+
+
+
+
virtual ~ModularProgram()
+
+
+
+
ModularProgram& operator=(const ModularProgram &)
+
+
+
+
void execute(double dt)
+
+
+
+
inline int numOperators() const
+- Get the number of operators
+
+
+
+
inline void addOperator(Operator* o)
+- Add an operator to the list.
+
+
+
+
inline Operator* getOperator(int i)
+- Get a pointer to an operator in the list
+
+
+
+
inline const Operator* getOperator(int i) const
+- Get a const pointer to an operator in the list
+
+
+
+
inline void removeOperator(int i)
+- Remove an operator from the list
+
+
+
- This class has no child classes.
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/MultiSegmentPlacer.html b/doc/doc++/osgParticle/MultiSegmentPlacer.html
new file mode 100644
index 000000000..95ad68feb
--- /dev/null
+++ b/doc/doc++/osgParticle/MultiSegmentPlacer.html
@@ -0,0 +1,151 @@
+
+
+
+
+ class OSGPARTICLE_EXPORT osgParticle::MultiSegmentPlacer
+
+
+
+
+A polyline-shaped particle placer.
+
+
+Inheritance:
+
+
+
+
+
+Public Methods
-
+
MultiSegmentPlacer()
+-
+
MultiSegmentPlacer(const MultiSegmentPlacer ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
+-
+
META_Object(MultiSegmentPlacer)
+-
+
void place(Particle* P) const
+ - Place a partice.
+
-
+
inline int numVertices() const
+ - Get the number of vertices which define the segments
+
-
+
inline const osg::Vec3& getVertex(int i) const
+ - Get a vertex
+
-
+
inline void setVertex(int i, const osg::Vec3 &v)
+ - Set a vertex
+
-
+
inline void setVertex(int i, float x, float y, float z)
+ - Set a vertex
+
-
+
inline void addVertex(const osg::Vec3 &v)
+ - Add a vertex
+
-
+
inline void addVertex(float x, float y, float z)
+ - Add a vertex
+
-
+
inline void removeVertex(int i)
+ - Remove a vertex
+
+
+
+Protected Methods
-
+
virtual ~MultiSegmentPlacer()
+-
+
MultiSegmentPlacer& operator=(const MultiSegmentPlacer &)
+
+
+
+
Inherited from Placer:
+
+
+Public Methods
-
+
virtual const char* className() const
+-
+
virtual bool isSameKindAs(const osg::Object* obj) const
+
+
+
+
+
+
+Documentation
+A polyline-shaped particle placer.
+This placer class sets the position of incoming particles by choosing a random point on the
+specified sequence of connected segments.
+
+
+
+
+
MultiSegmentPlacer()
+
+
+
+
MultiSegmentPlacer(const MultiSegmentPlacer ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
+
+
+
+
META_Object(MultiSegmentPlacer)
+
+
+
+
void place(Particle* P) const
+- Place a partice. Called automatically by
ModularEmitter, do not call this method manually.
+
+
+
+
virtual ~MultiSegmentPlacer()
+
+
+
+
MultiSegmentPlacer& operator=(const MultiSegmentPlacer &)
+
+
+
+
inline int numVertices() const
+- Get the number of vertices which define the segments
+
+
+
+
inline const osg::Vec3& getVertex(int i) const
+- Get a vertex
+
+
+
+
inline void setVertex(int i, const osg::Vec3 &v)
+- Set a vertex
+
+
+
+
inline void setVertex(int i, float x, float y, float z)
+- Set a vertex
+
+
+
+
inline void addVertex(const osg::Vec3 &v)
+- Add a vertex
+
+
+
+
inline void addVertex(float x, float y, float z)
+- Add a vertex
+
+
+
+
inline void removeVertex(int i)
+- Remove a vertex
+
+
+
- This class has no child classes.
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/NavigatorButton.class b/doc/doc++/osgParticle/NavigatorButton.class
new file mode 100644
index 000000000..fad9c3f2d
Binary files /dev/null and b/doc/doc++/osgParticle/NavigatorButton.class differ
diff --git a/doc/doc++/osgParticle/OSGPARTICLE_SECTORPLACER_.html b/doc/doc++/osgParticle/OSGPARTICLE_SECTORPLACER_.html
new file mode 100644
index 000000000..4cd4167ae
--- /dev/null
+++ b/doc/doc++/osgParticle/OSGPARTICLE_SECTORPLACER_.html
@@ -0,0 +1,20 @@
+
+
+
+
+ #define OSGPARTICLE_SECTORPLACER_
+
+
+
+
+Range of osg::Vec4s
+
+
+
+Documentation
+Range of osg::Vec4s
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/Operator.html b/doc/doc++/osgParticle/Operator.html
new file mode 100644
index 000000000..ddfae931f
--- /dev/null
+++ b/doc/doc++/osgParticle/Operator.html
@@ -0,0 +1,135 @@
+
+
+
+
+ class osgParticle::Operator
+
+
+
+
+An abstract base class used by ModularProgram to perform operations on particles before they are updated.
+
+
+Inheritance:
+
+
+
+
+
+Public Methods
-
+
virtual const char* className() const
+-
+
virtual bool isSameKindAs(const osg::Object* obj) const
+-
+
virtual void operate(Particle* P, double dt) = 0
+ - Do something on a particle.
+
-
+
virtual void beginOperate(Program* )
+ - Do something before processing particles via the
operate() method.
+ -
+
virtual void endOperate()
+ - Do something after all particles have been processed
+
-
+
inline Operator()
+-
+
inline Operator(const Operator ©, const osg::CopyOp ©op)
+-
+
inline bool isEnabled() const
+ - Get whether this operator is enabled
+
-
+
inline void setEnabled(bool v)
+ - Enable or disable this operator
+
+
+
+Protected Methods
-
+
virtual ~Operator()
+-
+
Operator& operator=(const Operator &)
+
+
+
+
+
+
+Documentation
+An abstract base class used by ModularProgram to perform operations on particles before they are updated.
+To implement a new operator, derive from this class and override the operate() method.
+You should also override the beginOperate() method to query the calling program for the reference frame
+used, and initialize the right transformations if needed.
+
+
+
+
+
virtual const char* className() const
+
+
+
+
virtual bool isSameKindAs(const osg::Object* obj) const
+
+
+
+
virtual void operate(Particle* P, double dt) = 0
+- Do something on a particle.
+This method is called by
ModularProgram objects to perform some operations
+on the particles. You must override it in descendant classes. Common operations
+consist of modifying the particle's velocity vector. The dt parameter is
+the time elapsed from last operation.
+
+
+
+
virtual void beginOperate(Program* )
+- Do something before processing particles via the
operate() method.
+Overriding this method could be necessary to query the calling Program object
+for the current reference frame. If the reference frame is RELATIVE_TO_PARENTS, then your
+class should prepare itself to do all operations in local coordinates.
+
+
+
+
virtual void endOperate()
+- Do something after all particles have been processed
+
+
+
+
virtual ~Operator()
+
+
+
+
Operator& operator=(const Operator &)
+
+
+
+
inline Operator()
+
+
+
+
inline Operator(const Operator ©, const osg::CopyOp ©op)
+
+
+
+
inline bool isEnabled() const
+- Get whether this operator is enabled
+
+
+
+
inline void setEnabled(bool v)
+- Enable or disable this operator
+
+
+- Direct child classes:
+
- ForceOperator
+FluidFrictionOperator
+AccelOperator
+
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/Particle.html b/doc/doc++/osgParticle/Particle.html
new file mode 100644
index 000000000..c26bff23b
--- /dev/null
+++ b/doc/doc++/osgParticle/Particle.html
@@ -0,0 +1,377 @@
+
+
+
+
+ class OSGPARTICLE_EXPORT osgParticle::Particle
+
+
+
+
+Implementation of a particle.
+
+
+
+
+Public Methods
-
+
Particle()
+-
+
inline Shape getShape() const
+ - Get the shape of the particle
+
-
+
bool update(double dt)
+ - Update the particle (don't call this method manually).
+
-
+
void render(const osg::Matrix &modelview, float scale = 1.0f) const
+ - Render the particle.
+
-
+
inline Particle::Shape getShape() const
+-
+
inline void setShape(Shape s)
+ - Set the shape of the particle
+
-
+
inline bool isAlive() const
+ - Get whether the particle is still alive
+
-
+
inline double getLifeTime() const
+ - Get the life time of the particle (in seconds)
+
-
+
inline double getAge() const
+ - Get the age of the particle (in seconds)
+
-
+
inline float getRadius() const
+ - Get the physical radius of the particle.
+
-
+
inline void setRadius(float r)
+ - Set the physical radius of the particle.
+
-
+
inline const rangef& getSizeRange() const
+ - Get the minimum and maximum values for polygon size
+
-
+
inline const rangef& getAlphaRange() const
+ - Get the minimum and maximum values for alpha
+
-
+
inline const rangev4& getColorRange() const
+ - Get the minimum and maximum values for color
+
-
+
inline const Interpolator* getSizeInterpolator() const
+ - Get the interpolator for computing the size of polygons
+
-
+
inline const Interpolator* getAlphaInterpolator() const
+ - Get the interpolator for computing alpha values
+
-
+
inline const Interpolator* getColorInterpolator() const
+ - Get the interpolator for computing color values
+
-
+
inline const osg::Vec3& getPosition() const
+ - Get the position vector
+
-
+
inline const osg::Vec3& getVelocity() const
+ - Get the velocity vector.
+
-
+
inline const osg::Vec3& getPreviousPosition() const
+ - Get the previous position (the position before last update)
+
-
+
inline void kill()
+ - Kill the particle on next update NOTE: after calling this function, the
isAlive() method will still return true until the particle is updated again
+ -
+
inline void setLifeTime(double t)
+ - Set the life time of the particle
+
-
+
inline void setSizeRange(const rangef &r)
+ - Set the minimum and maximum values for polygon size
+
-
+
inline void setAlphaRange(const rangef &r)
+ - Set the minimum and maximum values for alpha
+
-
+
inline void setColorRange(const rangev4 &r)
+ - Set the minimum and maximum values for color
+
-
+
inline void setSizeInterpolator(Interpolator* ri)
+ - Set the interpolator for computing size values
+
-
+
inline void setAlphaInterpolator(Interpolator* ai)
+ - Set the interpolator for computing alpha values.
+
-
+
inline void setColorInterpolator(Interpolator* ci)
+ - Set the interpolator for computing color values
+
-
+
inline void setPosition(const osg::Vec3 &p)
+ - Set the position vector.
+
-
+
inline void setVelocity(const osg::Vec3 &v)
+ - Set the velocity vector.
+
-
+
inline void addVelocity(const osg::Vec3 &v)
+ - Add a vector to the velocity vector
+
-
+
inline void transformPositionVelocity(const osg::Matrix &xform)
+ - Transform position and velocity vectors by a matrix
+
-
+
inline float getMass() const
+ - Get the mass of the particle.
+
-
+
inline float getMassInv() const
+ - Get
1 / getMass()
+ -
+
inline void setMass(float m)
+ - Set the mass of the particle.
+
-
+
inline void beginRender()
+ - Perform some pre-rendering tasks.
+
-
+
inline void endRender()
+ - Perform some post-rendering tasks.
+
+
+
+Public Members
-
+
enum Shape
+
+
+
+
+
+
+Documentation
+Implementation of a particle.
+Objects of this class are particles, they have some graphical properties
+and some physical properties. Particles are created by emitters and then placed
+into Particle Systems, where they live and get updated at each frame.
+Particles can either live forever (lifeTime < 0), or die after a specified
+time (lifeTime >= 0). For each property which is defined as a range of values, a
+"current" value will be evaluated at each frame by interpolating the min
+and max values so that curr_value = min when t == 0, and
+curr_value = max when t == lifeTime.
+You may customize the interpolator objects to achieve any kind of transition.
+If you want the particle to live forever, set its lifetime to any value <= 0;
+in that case, no interpolation is done to compute real-time properties, and only
+minimum values are used.
+
+
+
+
+
enum Shape
+
+
+
+
+
POINT
+
+
+
+
QUAD
+
+
+
+
QUAD_TRIANGLESTRIP
+
+
+
+
HEXAGON
+
+
+
+
+
Particle()
+
+
+
+
inline Shape getShape() const
+- Get the shape of the particle
+
+
+
+
bool update(double dt)
+- Update the particle (don't call this method manually).
+This method is called automatically by
ParticleSystem::update(); it
+updates the graphical properties of the particle for the current time,
+checks whether the particle is still alive, and then updates its position
+by computing P = P + V * dt (where P is the position and V is the velocity).
+
+
+
+
void render(const osg::Matrix &modelview, float scale = 1.0f) const
+- Render the particle. Called automatically by particle systems.
+
+
+
+
inline Particle::Shape getShape() const
+
+
+
+
inline void setShape(Shape s)
+- Set the shape of the particle
+
+
+
+
inline bool isAlive() const
+- Get whether the particle is still alive
+
+
+
+
inline double getLifeTime() const
+- Get the life time of the particle (in seconds)
+
+
+
+
inline double getAge() const
+- Get the age of the particle (in seconds)
+
+
+
+
inline float getRadius() const
+- Get the physical radius of the particle.
+For built-in operators to work correctly, lengths must be expressed in meters.
+
+
+
+
inline void setRadius(float r)
+- Set the physical radius of the particle.
+For built-in operators to work correctly, lengths must be expressed in meters.
+
+
+
+
inline const rangef& getSizeRange() const
+- Get the minimum and maximum values for polygon size
+
+
+
+
inline const rangef& getAlphaRange() const
+- Get the minimum and maximum values for alpha
+
+
+
+
inline const rangev4& getColorRange() const
+- Get the minimum and maximum values for color
+
+
+
+
inline const Interpolator* getSizeInterpolator() const
+- Get the interpolator for computing the size of polygons
+
+
+
+
inline const Interpolator* getAlphaInterpolator() const
+- Get the interpolator for computing alpha values
+
+
+
+
inline const Interpolator* getColorInterpolator() const
+- Get the interpolator for computing color values
+
+
+
+
inline const osg::Vec3& getPosition() const
+- Get the position vector
+
+
+
+
inline const osg::Vec3& getVelocity() const
+- Get the velocity vector.
+For built-in operators to work correctly, remember that velocity components are expressed
+in meters per second.
+
+
+
+
inline const osg::Vec3& getPreviousPosition() const
+- Get the previous position (the position before last update)
+
+
+
+
inline void kill()
+- Kill the particle on next update
+NOTE: after calling this function, the
isAlive() method will still
+return true until the particle is updated again
+
+
+
+
inline void setLifeTime(double t)
+- Set the life time of the particle
+
+
+
+
inline void setSizeRange(const rangef &r)
+- Set the minimum and maximum values for polygon size
+
+
+
+
inline void setAlphaRange(const rangef &r)
+- Set the minimum and maximum values for alpha
+
+
+
+
inline void setColorRange(const rangev4 &r)
+- Set the minimum and maximum values for color
+
+
+
+
inline void setSizeInterpolator(Interpolator* ri)
+- Set the interpolator for computing size values
+
+
+
+
inline void setAlphaInterpolator(Interpolator* ai)
+- Set the interpolator for computing alpha values.
+
+
+
+
inline void setColorInterpolator(Interpolator* ci)
+- Set the interpolator for computing color values
+
+
+
+
inline void setPosition(const osg::Vec3 &p)
+- Set the position vector.
+
+
+
+
inline void setVelocity(const osg::Vec3 &v)
+- Set the velocity vector.
+For built-in operators to work correctly, remember that velocity components are expressed
+in meters per second.
+
+
+
+
inline void addVelocity(const osg::Vec3 &v)
+- Add a vector to the velocity vector
+
+
+
+
inline void transformPositionVelocity(const osg::Matrix &xform)
+- Transform position and velocity vectors by a matrix
+
+
+
+
inline float getMass() const
+- Get the mass of the particle.
+For built-in operators to work correctly, remember that the mass is expressed in kg.
+
+
+
+
inline float getMassInv() const
+- Get
1 / getMass()
+
+
+
+
inline void setMass(float m)
+- Set the mass of the particle.
+For built-in operators to work correctly, remember that the mass is expressed in kg.
+
+
+
+
inline void beginRender()
+- Perform some pre-rendering tasks. Called automatically by particle systems.
+
+
+
+
inline void endRender()
+- Perform some post-rendering tasks. Called automatically by particle systems.
+
+
+
- This class has no child classes.
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/ParticleProcessor.html b/doc/doc++/osgParticle/ParticleProcessor.html
new file mode 100644
index 000000000..9a78e2fde
--- /dev/null
+++ b/doc/doc++/osgParticle/ParticleProcessor.html
@@ -0,0 +1,241 @@
+
+
+
+
+ class OSGPARTICLE_EXPORT osgParticle::ParticleProcessor
+
+
+
+
+A common base interface for those classes which need to do something on particles.
+
+
+Inheritance:
+
+
+
+
+
+Public Methods
-
+
ParticleProcessor()
+-
+
ParticleProcessor(const ParticleProcessor ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
+-
+
virtual const char* className() const
+-
+
virtual bool isSameKindAs(const osg::Object* obj)
+-
+
virtual void accept(osg::NodeVisitor& nv)
+-
+
inline ReferenceFrame getReferenceFrame() const
+ - Get the reference frame
+
-
+
void traverse(osg::NodeVisitor &nv)
+-
+
inline ParticleProcessor::ReferenceFrame getReferenceFrame() const
+-
+
inline void setReferenceFrame(ReferenceFrame rf)
+ - Set the reference frame
+
-
+
inline bool isEnabled() const
+ - Get whether this processor is enabled or not
+
-
+
inline void setEnabled(bool v)
+ - Set whether this processor is enabled or not
+
-
+
inline ParticleSystem* getParticleSystem()
+ - Get a pointer to the destination particle system
+
-
+
inline const ParticleSystem* getParticleSystem() const
+ - Get a const pointer to the destination particle system
+
-
+
inline void setParticleSystem(ParticleSystem* ps)
+ - Set the destination particle system
+
-
+
inline const bool computeBound() const
+-
+
inline const osg::Matrix& getLocalToWorldMatrix()
+ - Get the current local-to-world transformation matrix (valid only during cull traversal)
+
-
+
inline const osg::Matrix& getWorldToLocalMatrix()
+ - Get the current world-to-local transformation matrix (valid only during cull traversal)
+
-
+
inline osg::Vec3 transformLocalToWorld(const osg::Vec3 &P)
+ - Transform a point from local to world coordinates (valid only during cull traversal)
+
-
+
inline osg::Vec3 transformWorldToLocal(const osg::Vec3 &P)
+ - Transform a point from world to local coordinates (valid only during cull traversal)
+
-
+
inline osg::Vec3 rotateLocalToWorld(const osg::Vec3 &P)
+ - Transform a vector from local to world coordinates, discarding translation (valid only during cull traversal)
+
-
+
inline osg::Vec3 rotateWorldToLocal(const osg::Vec3 &P)
+ - Transform a vector from world to local coordinates, discarding translation (valid only during cull traversal)
+
+
+
+Public Members
-
+
enum ReferenceFrame
+
+
+
+Protected Methods
-
+
virtual ~ParticleProcessor()
+-
+
ParticleProcessor& operator=(const ParticleProcessor &)
+-
+
virtual void process(double dt) = 0
+
+
+
+
+
+
+Documentation
+A common base interface for those classes which need to do something on particles. Such classes
+are, for example, Emitter (particle generation) and Program (particle animation).
+This class holds some properties, like a reference frame and a reference to a ParticleSystem;
+descendant classes should process the particles taking into account the reference frame, computing the right
+transformations when needed.
+
+
+
+
+
enum ReferenceFrame
+
+
+
+
+
RELATIVE_TO_PARENTS
+
+
+
+
RELATIVE_TO_ABSOLUTE
+
+
+
+
+
ParticleProcessor()
+
+
+
+
ParticleProcessor(const ParticleProcessor ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
+
+
+
+
virtual const char* className() const
+
+
+
+
virtual bool isSameKindAs(const osg::Object* obj)
+
+
+
+
virtual void accept(osg::NodeVisitor& nv)
+
+
+
+
inline ReferenceFrame getReferenceFrame() const
+- Get the reference frame
+
+
+
+
void traverse(osg::NodeVisitor &nv)
+
+
+
+
virtual ~ParticleProcessor()
+
+
+
+
ParticleProcessor& operator=(const ParticleProcessor &)
+
+
+
+
virtual void process(double dt) = 0
+
+
+
+
inline ParticleProcessor::ReferenceFrame getReferenceFrame() const
+
+
+
+
inline void setReferenceFrame(ReferenceFrame rf)
+- Set the reference frame
+
+
+
+
inline bool isEnabled() const
+- Get whether this processor is enabled or not
+
+
+
+
inline void setEnabled(bool v)
+- Set whether this processor is enabled or not
+
+
+
+
inline ParticleSystem* getParticleSystem()
+- Get a pointer to the destination particle system
+
+
+
+
inline const ParticleSystem* getParticleSystem() const
+- Get a const pointer to the destination particle system
+
+
+
+
inline void setParticleSystem(ParticleSystem* ps)
+- Set the destination particle system
+
+
+
+
inline const bool computeBound() const
+
+
+
+
inline const osg::Matrix& getLocalToWorldMatrix()
+- Get the current local-to-world transformation matrix (valid only during cull traversal)
+
+
+
+
inline const osg::Matrix& getWorldToLocalMatrix()
+- Get the current world-to-local transformation matrix (valid only during cull traversal)
+
+
+
+
inline osg::Vec3 transformLocalToWorld(const osg::Vec3 &P)
+- Transform a point from local to world coordinates (valid only during cull traversal)
+
+
+
+
inline osg::Vec3 transformWorldToLocal(const osg::Vec3 &P)
+- Transform a point from world to local coordinates (valid only during cull traversal)
+
+
+
+
inline osg::Vec3 rotateLocalToWorld(const osg::Vec3 &P)
+- Transform a vector from local to world coordinates, discarding translation (valid only during cull traversal)
+
+
+
+
inline osg::Vec3 rotateWorldToLocal(const osg::Vec3 &P)
+- Transform a vector from world to local coordinates, discarding translation (valid only during cull traversal)
+
+
+- Direct child classes:
+
- Program
+Emitter
+
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/ParticleSystem.html b/doc/doc++/osgParticle/ParticleSystem.html
new file mode 100644
index 000000000..429997e0f
--- /dev/null
+++ b/doc/doc++/osgParticle/ParticleSystem.html
@@ -0,0 +1,311 @@
+
+
+
+
+ class OSGPARTICLE_EXPORT osgParticle::ParticleSystem
+
+
+
+
+The heart of this class library; its purpose is to hold a set of particles and manage particle creation, update, rendering and destruction.
+
+
+Inheritance:
+
+
+
+
+
+Public Methods
-
+
ParticleSystem()
+-
+
ParticleSystem(const ParticleSystem ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
+-
+
META_Object(ParticleSystem)
+-
+
inline virtual Particle* createParticle(const Particle* ptemplate)
+ - Create a new particle from the specified template (or the default one if
ptemplate is null)
+ -
+
inline virtual void destroyParticle(int i)
+ - Destroy the i-th particle
+
-
+
void setDefaultAttributes(const std::string &texturefile = "", bool emissive_particles = true, bool lighting = false)
+ - A useful method to set the most common
StateAttribute's in one call.
+ -
+
virtual void update(double dt)
+ - Update the particles.
+
-
+
inline virtual bool getStats(osg::Statistics &stats)
+-
+
inline bool isFrozen() const
+ - Return true if the particle system is frozen
+
-
+
inline void setFrozen(bool v)
+ - Set or reset the frozen state.
+
-
+
inline const osg::BoundingBox& getDefaultBoundingBox() const
+ - Get the default bounding box
+
-
+
inline void setDefaultBoundingBox(const osg::BoundingBox &bbox)
+ - Set the default bounding box.
+
-
+
inline bool getDoublePassRendering() const
+ - Get the double pass rendering flag
+
-
+
inline void setDoublePassRendering(bool v)
+ - Set the double pass rendering flag.
+
-
+
inline int numParticles() const
+ - Get the number of allocated particles (alive + dead)
+
-
+
inline int numDeadParticles() const
+ - Get the number of dead particles
+
-
+
inline Particle* getParticle(int i)
+ - Get a pointer to the i-th particle
+
-
+
inline const Particle* getParticle(int i) const
+ - Get a const pointer to the i-th particle
+
-
+
inline void destroyParticle(int i)
+-
+
inline int getLastFrameNumber() const
+ - Get the last frame number
+
-
+
inline const bool computeBound() const
+-
+
inline bool getStats(osg::Statistics &stats)
+-
+
inline void update_bounds(const osg::Vec3 &p)
+-
+
inline const Particle& getDefaultParticleTemplate() const
+ - Get a reference to the default particle template
+
-
+
inline void setDefaultParticleTemplate(const Particle &p)
+ - Set the default particle template (particle is copied)
+
-
+
inline bool getFreezeOnCull() const
+ - Get whether the particle system can freeze when culled
+
-
+
inline void setFreezeOnCull(bool v)
+ - Set whether the particle system can freeze when culled (default is true)
+
-
+
inline int getLevelOfDetail() const
+ - (EXPERIMENTAL) Get the level of detail
+
-
+
inline void setLevelOfDetail(int v)
+ - (EXPERIMENTAL) Set the level of detail.
+
-
+
inline Particle* createParticle(const Particle* ptemplate)
+
+
+
+Protected Methods
-
+
virtual ~ParticleSystem()
+-
+
ParticleSystem& operator=(const ParticleSystem &)
+-
+
inline virtual const bool computeBound() const
+-
+
virtual void drawImmediateMode(osg::State &state)
+-
+
void single_pass_render(const osg::Matrix &modelview)
+
+
+
+
+
+
+Documentation
+The heart of this class library; its purpose is to hold a set of particles and manage particle creation, update, rendering and destruction.
+You can add this drawable to any Geode as you usually do with other
+Drawable classes. Each instance of ParticleSystem is a separate set of
+particles; it provides the interface for creating particles and iterating
+through them (see the Emitter and Program classes).
+
+
+
+
+
ParticleSystem()
+
+
+
+
ParticleSystem(const ParticleSystem ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
+
+
+
+
META_Object(ParticleSystem)
+
+
+
+
inline virtual Particle* createParticle(const Particle* ptemplate)
+- Create a new particle from the specified template (or the default one if
ptemplate is null)
+
+
+
+
inline virtual void destroyParticle(int i)
+- Destroy the i-th particle
+
+
+
+
void setDefaultAttributes(const std::string &texturefile = "", bool emissive_particles = true, bool lighting = false)
+- A useful method to set the most common
StateAttribute's in one call.
+If texturefile is empty, then texturing is turned off.
+
+
+
+
virtual void update(double dt)
+- Update the particles. Don't call this directly, use a
ParticleSystemUpdater instead.
+
+
+
+
inline virtual bool getStats(osg::Statistics &stats)
+
+
+
+
virtual ~ParticleSystem()
+
+
+
+
ParticleSystem& operator=(const ParticleSystem &)
+
+
+
+
inline virtual const bool computeBound() const
+
+
+
+
virtual void drawImmediateMode(osg::State &state)
+
+
+
+
void single_pass_render(const osg::Matrix &modelview)
+
+
+
+
inline bool isFrozen() const
+- Return true if the particle system is frozen
+
+
+
+
inline void setFrozen(bool v)
+- Set or reset the frozen state.
+When the particle system is frozen, emitters and programs won't do anything on it.
+
+
+
+
inline const osg::BoundingBox& getDefaultBoundingBox() const
+- Get the default bounding box
+
+
+
+
inline void setDefaultBoundingBox(const osg::BoundingBox &bbox)
+- Set the default bounding box.
+The default bounding box is used when a real bounding box cannot be computed, for example
+because no particles has been updated yet.
+
+
+
+
inline bool getDoublePassRendering() const
+- Get the double pass rendering flag
+
+
+
+
inline void setDoublePassRendering(bool v)
+- Set the double pass rendering flag.
+Double pass rendering avoids overdraw problems between particle systems
+and other opaque objects. If you can render all the particle systems after
+the opaque objects, then double pass is not necessary and can be turned off (best choice).
+If you set the default attributes with
setDefaultAttributes, then the particle
+system will fall into a transparent bin.
+
+
+
+
inline int numParticles() const
+- Get the number of allocated particles (alive + dead)
+
+
+
+
inline int numDeadParticles() const
+- Get the number of dead particles
+
+
+
+
inline Particle* getParticle(int i)
+- Get a pointer to the i-th particle
+
+
+
+
inline const Particle* getParticle(int i) const
+- Get a const pointer to the i-th particle
+
+
+
+
inline void destroyParticle(int i)
+
+
+
+
inline int getLastFrameNumber() const
+- Get the last frame number
+
+
+
+
inline const bool computeBound() const
+
+
+
+
inline bool getStats(osg::Statistics &stats)
+
+
+
+
inline void update_bounds(const osg::Vec3 &p)
+
+
+
+
inline const Particle& getDefaultParticleTemplate() const
+- Get a reference to the default particle template
+
+
+
+
inline void setDefaultParticleTemplate(const Particle &p)
+- Set the default particle template (particle is copied)
+
+
+
+
inline bool getFreezeOnCull() const
+- Get whether the particle system can freeze when culled
+
+
+
+
inline void setFreezeOnCull(bool v)
+- Set whether the particle system can freeze when culled (default is true)
+
+
+
+
inline int getLevelOfDetail() const
+- (EXPERIMENTAL) Get the level of detail
+
+
+
+
inline void setLevelOfDetail(int v)
+- (EXPERIMENTAL) Set the level of detail. The total number of particles is divided by the detail value to
+get the actual number of particles to be drawn. This value must be greater than zero.
+
+
+
+
inline Particle* createParticle(const Particle* ptemplate)
+
+
+
- This class has no child classes.
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/ParticleSystemUpdater.html b/doc/doc++/osgParticle/ParticleSystemUpdater.html
new file mode 100644
index 000000000..d27a75837
--- /dev/null
+++ b/doc/doc++/osgParticle/ParticleSystemUpdater.html
@@ -0,0 +1,152 @@
+
+
+
+
+ class OSGPARTICLE_EXPORT osgParticle::ParticleSystemUpdater
+
+
+
+
+A useful node class for updating particle systems automatically.
+
+
+Inheritance:
+
+
+
+
+
+Public Methods
-
+
ParticleSystemUpdater()
+-
+
ParticleSystemUpdater(const ParticleSystemUpdater ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
+-
+
META_Node(ParticleSystemUpdater)
+-
+
virtual void traverse(osg::NodeVisitor &nv)
+-
+
inline const bool computeBound() const
+-
+
inline int numParticleSystems() const
+ - Return the number of particle systems on the list
+
-
+
inline void addParticleSystem(ParticleSystem* ps)
+ - Add a particle system to the list
+
-
+
inline const ParticleSystem* getParticleSystem(int i) const
+ - Get a const particle system from the list
+
-
+
inline ParticleSystem* getParticleSystem(int i)
+ - Get a particle system from the list
+
-
+
inline void removeParticleSystem(int i)
+ - Remove a particle system from the list (by index)
+
-
+
inline int findParticleSystem(ParticleSystem* ps) const
+ - Find a particle system
+
-
+
inline bool removeParticleSystem(ParticleSystem* ps)
+ - Remove a particle system from the list (by pointer)
+
+
+
+Protected Methods
-
+
virtual ~ParticleSystemUpdater()
+-
+
ParticleSystemUpdater& operator=(const ParticleSystemUpdater &)
+-
+
inline virtual const bool computeBound() const
+
+
+
+
+
+
+Documentation
+A useful node class for updating particle systems automatically.
+When a ParticleSystemUpdater is traversed by a cull visitor, it calls the
+update() method on the specified particle systems. You should place this updater
+AFTER other nodes like emitters and programs.
+
+
+
+
+
ParticleSystemUpdater()
+
+
+
+
ParticleSystemUpdater(const ParticleSystemUpdater ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
+
+
+
+
META_Node(ParticleSystemUpdater)
+
+
+
+
virtual void traverse(osg::NodeVisitor &nv)
+
+
+
+
virtual ~ParticleSystemUpdater()
+
+
+
+
ParticleSystemUpdater& operator=(const ParticleSystemUpdater &)
+
+
+
+
inline virtual const bool computeBound() const
+
+
+
+
inline const bool computeBound() const
+
+
+
+
inline int numParticleSystems() const
+- Return the number of particle systems on the list
+
+
+
+
inline void addParticleSystem(ParticleSystem* ps)
+- Add a particle system to the list
+
+
+
+
inline const ParticleSystem* getParticleSystem(int i) const
+- Get a const particle system from the list
+
+
+
+
inline ParticleSystem* getParticleSystem(int i)
+- Get a particle system from the list
+
+
+
+
inline void removeParticleSystem(int i)
+- Remove a particle system from the list (by index)
+
+
+
+
inline int findParticleSystem(ParticleSystem* ps) const
+- Find a particle system
+
+
+
+
inline bool removeParticleSystem(ParticleSystem* ps)
+- Remove a particle system from the list (by pointer)
+
+
+
- This class has no child classes.
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/Placer.html b/doc/doc++/osgParticle/Placer.html
new file mode 100644
index 000000000..d373f0acb
--- /dev/null
+++ b/doc/doc++/osgParticle/Placer.html
@@ -0,0 +1,95 @@
+
+
+
+
+ class osgParticle::Placer
+
+
+
+
+An abstract base class for implementing particle placers.
+
+
+Inheritance:
+
+
+
+
+
+Public Methods
-
+
virtual const char* className() const
+-
+
virtual bool isSameKindAs(const osg::Object* obj) const
+-
+
virtual void place(Particle* P) const = 0
+ - Place a particle.
+
-
+
inline Placer()
+-
+
inline Placer(const Placer ©, const osg::CopyOp ©op)
+
+
+
+Protected Methods
-
+
~Placer()
+-
+
Placer& operator=(const Placer &)
+
+
+
+
+
+
+Documentation
+An abstract base class for implementing particle placers. A placer is an object which take
+a particle as input, and places it somewhere by setting its position vector. Placer objects are
+used by the ModularEmitter class as part of the particle emission process.
+
+
+
+
+
virtual const char* className() const
+
+
+
+
virtual bool isSameKindAs(const osg::Object* obj) const
+
+
+
+
virtual void place(Particle* P) const = 0
+- Place a particle. Must be implemented in descendant classes.
+
+
+
+
~Placer()
+
+
+
+
Placer& operator=(const Placer &)
+
+
+
+
inline Placer()
+
+
+
+
inline Placer(const Placer ©, const osg::CopyOp ©op)
+
+
+- Direct child classes:
+
- SegmentPlacer
+MultiSegmentPlacer
+CenteredPlacer
+
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/PointPlacer.html b/doc/doc++/osgParticle/PointPlacer.html
new file mode 100644
index 000000000..16d226752
--- /dev/null
+++ b/doc/doc++/osgParticle/PointPlacer.html
@@ -0,0 +1,106 @@
+
+
+
+
+ class osgParticle::PointPlacer
+
+
+
+
+A point-shaped particle placer.
+
+
+Inheritance:
+
+
+
+
+
+Public Methods
-
+
META_Object(PointPlacer)
+-
+
inline PointPlacer()
+-
+
inline PointPlacer(const PointPlacer ©, const osg::CopyOp ©op)
+-
+
inline void place(Particle* P) const
+ - Place a particle.
+
+
+
+Protected Methods
-
+
virtual ~PointPlacer()
+-
+
PointPlacer& operator=(const PointPlacer &)
+
+
+
+
+
+
+Public Methods
-
+
virtual const char* className() const
+-
+
virtual bool isSameKindAs(const osg::Object* obj) const
+-
+
inline const osg::Vec3& getCenter() const
+-
+
inline void setCenter(const osg::Vec3 &v)
+-
+
inline void setCenter(float x, float y, float z)
+
+
+
+
Inherited from Placer:
+
+
+
+
+
+Documentation
+A point-shaped particle placer.
+This placer class uses the center point defined in its base class CenteredPlacer
+to place there all incoming particles.
+
+
+
+
+
META_Object(PointPlacer)
+
+
+
+
virtual ~PointPlacer()
+
+
+
+
PointPlacer& operator=(const PointPlacer &)
+
+
+
+
inline PointPlacer()
+
+
+
+
inline PointPlacer(const PointPlacer ©, const osg::CopyOp ©op)
+
+
+
+
inline void place(Particle* P) const
+- Place a particle.
+This method is called automatically by
ModularEmitter and should not be called
+manually.
+
+
+
- This class has no child classes.
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/Program.html b/doc/doc++/osgParticle/Program.html
new file mode 100644
index 000000000..c6fcf982d
--- /dev/null
+++ b/doc/doc++/osgParticle/Program.html
@@ -0,0 +1,152 @@
+
+
+
+
+ class OSGPARTICLE_EXPORT osgParticle::Program
+
+
+
+
+An abstract ParticleProcessor descendant for modifying particles "on the fly" during the cull traversal.
+
+
+Inheritance:
+
+
+
+
+
+Public Methods
-
+
Program()
+-
+
Program(const Program ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
+-
+
virtual const char* className() const
+-
+
virtual bool isSameKindAs(const osg::Object* obj)
+-
+
virtual void accept(osg::NodeVisitor& nv)
+-
+
inline void process(double dt)
+ - Implementation of
ParticleProcessor::process().
+
+
+
+Protected Methods
-
+
virtual ~Program()
+-
+
Program& operator=(const Program &)
+-
+
virtual void execute(double dt) = 0
+ - Execute the program on the particle system.
+
+
+
+
+
+
+Public Methods
-
+
inline ReferenceFrame getReferenceFrame() const
+-
+
void traverse(osg::NodeVisitor &nv)
+-
+
inline ParticleProcessor::ReferenceFrame getReferenceFrame() const
+-
+
inline void setReferenceFrame(ReferenceFrame rf)
+-
+
inline bool isEnabled() const
+-
+
inline void setEnabled(bool v)
+-
+
inline ParticleSystem* getParticleSystem()
+-
+
inline const ParticleSystem* getParticleSystem() const
+-
+
inline void setParticleSystem(ParticleSystem* ps)
+-
+
inline const bool computeBound() const
+-
+
inline const osg::Matrix& getLocalToWorldMatrix()
+-
+
inline const osg::Matrix& getWorldToLocalMatrix()
+-
+
inline osg::Vec3 transformLocalToWorld(const osg::Vec3 &P)
+-
+
inline osg::Vec3 transformWorldToLocal(const osg::Vec3 &P)
+-
+
inline osg::Vec3 rotateLocalToWorld(const osg::Vec3 &P)
+-
+
inline osg::Vec3 rotateWorldToLocal(const osg::Vec3 &P)
+
+
+
+Public Members
-
+
enum ReferenceFrame
+
+
+
+
+
+
+Documentation
+An abstract ParticleProcessor descendant for modifying particles "on the fly"
+during the cull traversal.
+Descendants of this class must implement the execute() method, which should iterate
+through all particles in the linked particle system and modify them somehow
+(usually updating their velocity vector).
+
+
+
+
+
Program()
+
+
+
+
Program(const Program ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
+
+
+
+
virtual const char* className() const
+
+
+
+
virtual bool isSameKindAs(const osg::Object* obj)
+
+
+
+
virtual void accept(osg::NodeVisitor& nv)
+
+
+
+
virtual ~Program()
+
+
+
+
Program& operator=(const Program &)
+
+
+
+
virtual void execute(double dt) = 0
+- Execute the program on the particle system. Must be overriden in descendant classes.
+
+
+
+
inline void process(double dt)
+- Implementation of
ParticleProcessor::process(). Do not call this method by yourself.
+
+
+- Direct child classes:
+
- ModularProgram
+
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/RadialShooter.html b/doc/doc++/osgParticle/RadialShooter.html
new file mode 100644
index 000000000..09da7b6a1
--- /dev/null
+++ b/doc/doc++/osgParticle/RadialShooter.html
@@ -0,0 +1,170 @@
+
+
+
+
+ class osgParticle::RadialShooter
+
+
+
+
+A shooter class that shoots particles radially.
+
+
+Inheritance:
+
+
+
+
+
+Public Methods
-
+
META_Object(RadialShooter)
+-
+
inline RadialShooter()
+-
+
inline RadialShooter(const RadialShooter ©, const osg::CopyOp ©op)
+-
+
inline const rangef& getThetaRange() const
+ - Get the range of possible values for theta angle
+
-
+
inline const rangef& getPhiRange() const
+ - Get the range of possible values for phi angle
+
-
+
inline const rangef& getInitialSpeedRange() const
+ - Get the range of possible values for initial speed of particles
+
-
+
inline void setThetaRange(const rangef &r)
+ - Set the range of possible values for theta angle
+
-
+
inline void setThetaRange(float r1, float r2)
+ - Set the range of possible values for theta angle
+
-
+
inline void setPhiRange(const rangef &r)
+ - Set the range of possible values for phi angle
+
-
+
inline void setPhiRange(float r1, float r2)
+ - Set the range of possible values for phi angle
+
-
+
inline void setInitialSpeedRange(const rangef &r)
+ - Set the range of possible values for initial speed of particles
+
-
+
inline void setInitialSpeedRange(float r1, float r2)
+ - Set the range of possible values for initial speed of particles
+
-
+
inline void shoot(Particle* P) const
+ - Shoot a particle.
+
+
+
+Protected Methods
-
+
virtual ~RadialShooter()
+-
+
RadialShooter& operator=(const RadialShooter &)
+
+
+
+
Inherited from Shooter:
+
+
+Public Methods
-
+
virtual const char* className() const
+-
+
virtual bool isSameKindAs(const osg::Object* obj) const
+
+
+
+
+
+
+Documentation
+A shooter class that shoots particles radially.
+This shooter computes the velocity vector of incoming particles by choosing a
+random direction and a random speed. Both direction and speed are chosen within
+specified ranges. The direction is defined by two angles: theta, which
+is the angle between the velocity vector and the Z axis, and phi, which is
+the angle between the X axis and the velocity vector projected onto the X-Y plane.
+
+
+
+
+
META_Object(RadialShooter)
+
+
+
+
virtual ~RadialShooter()
+
+
+
+
RadialShooter& operator=(const RadialShooter &)
+
+
+
+
inline RadialShooter()
+
+
+
+
inline RadialShooter(const RadialShooter ©, const osg::CopyOp ©op)
+
+
+
+
inline const rangef& getThetaRange() const
+- Get the range of possible values for theta angle
+
+
+
+
inline const rangef& getPhiRange() const
+- Get the range of possible values for phi angle
+
+
+
+
inline const rangef& getInitialSpeedRange() const
+- Get the range of possible values for initial speed of particles
+
+
+
+
inline void setThetaRange(const rangef &r)
+- Set the range of possible values for theta angle
+
+
+
+
inline void setThetaRange(float r1, float r2)
+- Set the range of possible values for theta angle
+
+
+
+
inline void setPhiRange(const rangef &r)
+- Set the range of possible values for phi angle
+
+
+
+
inline void setPhiRange(float r1, float r2)
+- Set the range of possible values for phi angle
+
+
+
+
inline void setInitialSpeedRange(const rangef &r)
+- Set the range of possible values for initial speed of particles
+
+
+
+
inline void setInitialSpeedRange(float r1, float r2)
+- Set the range of possible values for initial speed of particles
+
+
+
+
inline void shoot(Particle* P) const
+- Shoot a particle. Do not call this method manually.
+
+
+
- This class has no child classes.
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/RandomRateCounter.html b/doc/doc++/osgParticle/RandomRateCounter.html
new file mode 100644
index 000000000..c660b86df
--- /dev/null
+++ b/doc/doc++/osgParticle/RandomRateCounter.html
@@ -0,0 +1,99 @@
+
+
+
+
+ class osgParticle::RandomRateCounter
+
+
+
+
+
+
+Inheritance:
+
+
+
+
+
+Public Methods
-
+
META_Object(RandomRateCounter)
+-
+
inline RandomRateCounter()
+-
+
inline RandomRateCounter(const RandomRateCounter ©, const osg::CopyOp ©op)
+-
+
inline int numParticlesToCreate(double dt) const
+ - Return the number of particles to be created in this frame
+
+
+
+Protected Methods
-
+
virtual ~RandomRateCounter()
+
+
+
+
+
+
+Public Methods
-
+
virtual const char* className() const
+-
+
virtual bool isSameKindAs(const osg::Object* obj) const
+-
+
inline const rangef& getRateRange() const
+-
+
inline void setRateRange(const rangef &r)
+-
+
inline void setRateRange(float minrange, float maxrange)
+
+
+
+
Inherited from Counter:
+
+
+Protected Methods
-
+
Counter& operator=(const Counter &)
+
+
+
+
+
+
+Documentation
+
+
+
+
+
META_Object(RandomRateCounter)
+
+
+
+
virtual ~RandomRateCounter()
+
+
+
+
inline RandomRateCounter()
+
+
+
+
inline RandomRateCounter(const RandomRateCounter ©, const osg::CopyOp ©op)
+
+
+
+
inline int numParticlesToCreate(double dt) const
+- Return the number of particles to be created in this frame
+
+
+
- This class has no child classes.
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/SectorPlacer.html b/doc/doc++/osgParticle/SectorPlacer.html
new file mode 100644
index 000000000..a7ca2e509
--- /dev/null
+++ b/doc/doc++/osgParticle/SectorPlacer.html
@@ -0,0 +1,154 @@
+
+
+
+
+ class osgParticle::SectorPlacer
+
+
+
+
+A sector-shaped particle placer.
+
+
+Inheritance:
+
+
+
+
+
+Public Methods
-
+
META_Object(SectorPlacer)
+-
+
inline SectorPlacer()
+-
+
inline SectorPlacer(const SectorPlacer ©, const osg::CopyOp ©op)
+-
+
inline const rangef& getRadiusRange() const
+ - Get the range of possible values for radius
+
-
+
inline const rangef& getPhiRange() const
+ - Get the range of possible values for the central angle
+
-
+
inline void setRadiusRange(const rangef &r)
+ - Set the range of possible values for radius
+
-
+
inline void setRadiusRange(float r1, float r2)
+ - Set the range of possible values for radius
+
-
+
inline void setPhiRange(const rangef &r)
+ - Set the range of possible values for the central angle
+
-
+
inline void setPhiRange(float r1, float r2)
+ - Set the range of possible values for the central angle
+
-
+
inline void place(Particle* P) const
+ - Place a particle.
+
+
+
+Protected Methods
-
+
virtual ~SectorPlacer()
+-
+
SectorPlacer& operator=(const SectorPlacer &)
+
+
+
+
+
+
+Public Methods
-
+
virtual const char* className() const
+-
+
virtual bool isSameKindAs(const osg::Object* obj) const
+-
+
inline const osg::Vec3& getCenter() const
+-
+
inline void setCenter(const osg::Vec3 &v)
+-
+
inline void setCenter(float x, float y, float z)
+
+
+
+
Inherited from Placer:
+
+
+
+
+
+Documentation
+A sector-shaped particle placer.
+This placer sets the initial position of incoming particle by choosing a random position
+within a circular sector; this sector is defined by three parameters: a center point,
+which is inherited directly from osgParticle::CenteredPlacer, a range of values
+for radius, and a range of values for the central angle (sometimes called phi).
+
+
+
+
+
META_Object(SectorPlacer)
+
+
+
+
virtual ~SectorPlacer()
+
+
+
+
SectorPlacer& operator=(const SectorPlacer &)
+
+
+
+
inline SectorPlacer()
+
+
+
+
inline SectorPlacer(const SectorPlacer ©, const osg::CopyOp ©op)
+
+
+
+
inline const rangef& getRadiusRange() const
+- Get the range of possible values for radius
+
+
+
+
inline const rangef& getPhiRange() const
+- Get the range of possible values for the central angle
+
+
+
+
inline void setRadiusRange(const rangef &r)
+- Set the range of possible values for radius
+
+
+
+
inline void setRadiusRange(float r1, float r2)
+- Set the range of possible values for radius
+
+
+
+
inline void setPhiRange(const rangef &r)
+- Set the range of possible values for the central angle
+
+
+
+
inline void setPhiRange(float r1, float r2)
+- Set the range of possible values for the central angle
+
+
+
+
inline void place(Particle* P) const
+- Place a particle. Do not call it manually.
+
+
+
- This class has no child classes.
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/SegmentPlacer.html b/doc/doc++/osgParticle/SegmentPlacer.html
new file mode 100644
index 000000000..027a8ea22
--- /dev/null
+++ b/doc/doc++/osgParticle/SegmentPlacer.html
@@ -0,0 +1,152 @@
+
+
+
+
+ class osgParticle::SegmentPlacer
+
+
+
+
+A segment-shaped particle placer.
+
+
+Inheritance:
+
+
+
+
+
+Public Methods
-
+
META_Object(SegmentPlacer)
+-
+
inline SegmentPlacer()
+-
+
inline SegmentPlacer(const SegmentPlacer ©, const osg::CopyOp ©op)
+-
+
inline const osg::Vec3& getVertexA() const
+ - get vertex A
+
-
+
inline const osg::Vec3& getVertexB() const
+ - get vertex B
+
-
+
inline void setSegment(const osg::Vec3 &A, const osg::Vec3 &B)
+ - Set both vertices
+
-
+
inline void place(Particle* P) const
+ - Place a particle.
+
-
+
inline void setVertexA(const osg::Vec3 &v)
+ - Set vertex A of the segment as a vector
+
-
+
inline void setVertexA(float x, float y, float z)
+ - Set vertex A of the segment as three floats
+
-
+
inline void setVertexB(const osg::Vec3 &v)
+ - Set vertex B of the segment as a vector
+
-
+
inline void setVertexB(float x, float y, float z)
+ - Set vertex B of the segment as three floats
+
+
+
+Protected Methods
-
+
virtual ~SegmentPlacer()
+-
+
SegmentPlacer& operator=(const SegmentPlacer &)
+
+
+
+
Inherited from Placer:
+
+
+Public Methods
-
+
virtual const char* className() const
+-
+
virtual bool isSameKindAs(const osg::Object* obj) const
+
+
+
+
+
+
+Documentation
+A segment-shaped particle placer.
+To use this placer you have to define a segment, by setting its two vertices (A and B);
+when an emitter requests a SegmentPlacer to place a particle, the position is chosen randomly
+within that segment.
+
+
+
+
+
META_Object(SegmentPlacer)
+
+
+
+
virtual ~SegmentPlacer()
+
+
+
+
SegmentPlacer& operator=(const SegmentPlacer &)
+
+
+
+
inline SegmentPlacer()
+
+
+
+
inline SegmentPlacer(const SegmentPlacer ©, const osg::CopyOp ©op)
+
+
+
+
inline const osg::Vec3& getVertexA() const
+- get vertex A
+
+
+
+
inline const osg::Vec3& getVertexB() const
+- get vertex B
+
+
+
+
inline void setSegment(const osg::Vec3 &A, const osg::Vec3 &B)
+- Set both vertices
+
+
+
+
inline void place(Particle* P) const
+- Place a particle. This method is called by
ModularEmitter, do not call it manually.
+
+
+
+
inline void setVertexA(const osg::Vec3 &v)
+- Set vertex A of the segment as a vector
+
+
+
+
inline void setVertexA(float x, float y, float z)
+- Set vertex A of the segment as three floats
+
+
+
+
inline void setVertexB(const osg::Vec3 &v)
+- Set vertex B of the segment as a vector
+
+
+
+
inline void setVertexB(float x, float y, float z)
+- Set vertex B of the segment as three floats
+
+
+
- This class has no child classes.
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/Shooter.html b/doc/doc++/osgParticle/Shooter.html
new file mode 100644
index 000000000..a7085030d
--- /dev/null
+++ b/doc/doc++/osgParticle/Shooter.html
@@ -0,0 +1,94 @@
+
+
+
+
+ class osgParticle::Shooter
+
+
+
+
+An abstract base class used by ModularEmitter to "shoot" the particles after they have been placed.
+
+
+Inheritance:
+
+
+
+
+
+Public Methods
-
+
virtual const char* className() const
+-
+
virtual bool isSameKindAs(const osg::Object* obj) const
+-
+
virtual void shoot(Particle* P) const = 0
+ - Shoot a particle.
+
-
+
inline Shooter()
+-
+
inline Shooter(const Shooter ©, const osg::CopyOp ©op)
+
+
+
+Protected Methods
-
+
virtual ~Shooter()
+-
+
Shooter& operator=(const Shooter &)
+
+
+
+
+
+
+Documentation
+An abstract base class used by ModularEmitter to "shoot" the particles after they have been placed.
+Descendants of this class must override the shoot() method.
+
+
+
+
+
virtual const char* className() const
+
+
+
+
virtual bool isSameKindAs(const osg::Object* obj) const
+
+
+
+
virtual void shoot(Particle* P) const = 0
+- Shoot a particle. Must be overriden by descendants.
+This method should only set the velocity vector of particle
P, leaving other
+attributes unchanged.
+
+
+
+
virtual ~Shooter()
+
+
+
+
Shooter& operator=(const Shooter &)
+
+
+
+
inline Shooter()
+
+
+
+
inline Shooter(const Shooter ©, const osg::CopyOp ©op)
+
+
+- Direct child classes:
+
- RadialShooter
+
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/VariableRateCounter.html b/doc/doc++/osgParticle/VariableRateCounter.html
new file mode 100644
index 000000000..34e6f504d
--- /dev/null
+++ b/doc/doc++/osgParticle/VariableRateCounter.html
@@ -0,0 +1,106 @@
+
+
+
+
+ class osgParticle::VariableRateCounter
+
+
+
+
+
+
+Inheritance:
+
+
+
+
+
+Public Methods
-
+
virtual const char* className() const
+-
+
virtual bool isSameKindAs(const osg::Object* obj) const
+-
+
inline VariableRateCounter()
+-
+
inline VariableRateCounter(const VariableRateCounter ©, const osg::CopyOp ©op)
+-
+
inline const rangef& getRateRange() const
+-
+
inline void setRateRange(const rangef &r)
+-
+
inline void setRateRange(float minrange, float maxrange)
+
+
+
+Protected Methods
-
+
virtual ~VariableRateCounter()
+
+
+
+
Inherited from Counter:
+
+
+Public Methods
-
+
virtual int numParticlesToCreate(double dt) const
+
+
+
+Protected Methods
-
+
Counter& operator=(const Counter &)
+
+
+
+
+
+
+Documentation
+
+
+
+
+
virtual const char* className() const
+
+
+
+
virtual bool isSameKindAs(const osg::Object* obj) const
+
+
+
+
virtual ~VariableRateCounter()
+
+
+
+
inline VariableRateCounter()
+
+
+
+
inline VariableRateCounter(const VariableRateCounter ©, const osg::CopyOp ©op)
+
+
+
+
inline const rangef& getRateRange() const
+
+
+
+
inline void setRateRange(const rangef &r)
+
+
+
+
inline void setRateRange(float minrange, float maxrange)
+
+
+- Direct child classes:
+
- RandomRateCounter
+
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/icon1.gif b/doc/doc++/osgParticle/icon1.gif
new file mode 100644
index 000000000..f78f30eb9
Binary files /dev/null and b/doc/doc++/osgParticle/icon1.gif differ
diff --git a/doc/doc++/osgParticle/icon2.gif b/doc/doc++/osgParticle/icon2.gif
new file mode 100644
index 000000000..6cbe01a83
Binary files /dev/null and b/doc/doc++/osgParticle/icon2.gif differ
diff --git a/doc/doc++/osgParticle/index.html b/doc/doc++/osgParticle/index.html
new file mode 100644
index 000000000..259425da5
--- /dev/null
+++ b/doc/doc++/osgParticle/index.html
@@ -0,0 +1,61 @@
+
+
+
+
+ Table of Contents
+
+
+
+
+Table of Contents
+Namespaces
+
+Functions
+
+Macros
+
+Hierarchy of classes
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/osgParticle.html b/doc/doc++/osgParticle/osgParticle.html
new file mode 100644
index 000000000..8b7568865
--- /dev/null
+++ b/doc/doc++/osgParticle/osgParticle.html
@@ -0,0 +1,109 @@
+
+
+
+
+ namespace osgParticle
+
+
+
+
+
+
+
+ -
+class AccelOperator: public Operator
+
- An operator class that applies a constant acceleration to the particles
+
-
+class CenteredPlacer: public Placer
+
- An abstract placer base class for placers which need a center point
+
-
+class Counter: public osg::Object
+
-
+class OSGPARTICLE_EXPORT Emitter: public ParticleProcessor
+
- An abstract base class for particle emitters.
+
-
+class OSGPARTICLE_EXPORT FluidFrictionOperator: public Operator
+
- An operator that simulates the friction of a fluid.
+
-
+class ForceOperator: public Operator
+
- An operator that applies a constant force to the particles.
+
-
+class Interpolator: public osg::Object
+
- An abstract base class for implementing interpolators
+
-
+class LinearInterpolator: public Interpolator
+
- A linear interpolator
+
-
+class OSGPARTICLE_EXPORT ModularEmitter: public Emitter
+
- An emitter class that holds three objects to control the creation of particles.
+
-
+class OSGPARTICLE_EXPORT ModularProgram: public Program
+
- A program class for performing operations on particles using a sequence of operators.
+
-
+class OSGPARTICLE_EXPORT MultiSegmentPlacer: public Placer
+
- A polyline-shaped particle placer.
+
-
+class Operator: public osg::Object
+
- An abstract base class used by
ModularProgram to perform operations on particles before they are updated.
+ -
+class OSGPARTICLE_EXPORT Particle
+
- Implementation of a particle.
+
-
+class OSGPARTICLE_EXPORT ParticleProcessor: public osg::Node
+
- A common base interface for those classes which need to do something on particles.
+
-
+class OSGPARTICLE_EXPORT ParticleSystem: public osg::Drawable
+
- The heart of this class library; its purpose is to hold a set of particles and manage particle creation, update, rendering and destruction.
+
-
+class OSGPARTICLE_EXPORT ParticleSystemUpdater: public osg::Node
+
- A useful node class for updating particle systems automatically.
+
-
+class Placer: public osg::Object
+
- An abstract base class for implementing particle placers.
+
-
+class PointPlacer: public CenteredPlacer
+
- A point-shaped particle placer.
+
-
+class OSGPARTICLE_EXPORT Program: public ParticleProcessor
+
- An abstract
ParticleProcessor descendant for modifying particles "on the fly" during the cull traversal.
+ -
+class RadialShooter: public Shooter
+
- A shooter class that shoots particles radially.
+
-
+class RandomRateCounter: public VariableRateCounter
+
-
+template<class T_> struct range
+
- A simple struct template useful to store ranges of values as min/max pairs.
+
-
+typedef range<float> rangef
+
- Range of floats
+
-
+typedef range<osg::Vec2> rangev2
+
- Range of osg::Vec2s
+
-
+typedef range<osg::Vec3> rangev3
+
- Range of osg::Vec3s
+
-
+class SectorPlacer: public CenteredPlacer
+
- A sector-shaped particle placer.
+
-
+class SegmentPlacer: public Placer
+
- A segment-shaped particle placer.
+
-
+class Shooter: public osg::Object
+
- An abstract base class used by ModularEmitter to "shoot" the particles after they have been placed.
+
-
+class VariableRateCounter: public Counter
+
+
+
+
+
+Documentation
+
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/range.html b/doc/doc++/osgParticle/range.html
new file mode 100644
index 000000000..240ee7e4b
--- /dev/null
+++ b/doc/doc++/osgParticle/range.html
@@ -0,0 +1,81 @@
+
+
+
+
+ template struct osgParticle::range
+
+
+
+
+ A simple struct template useful to store ranges of values as min/max pairs.
+
+
+
+ -
+
T_ min
+ - Lower bound
+
-
+
T_ max
+ - Higher bound
+
-
+
range()
+ - Construct the object by calling default constructors for min and max
+
-
+
range(const T_ &mn, const T_ &mx)
+ - Construct and initialize min and max directly
+
-
+
void set(const T_ &mn, const T_ &mx)
+ - Set min and max
+
-
+
T_ get_random() const
+ - Get a random value between min and max
+
+
+
+
+
+Documentation
+
+A simple struct template useful to store ranges of values as min/max pairs.
+This struct template helps storing min/max ranges for values of any kind; class T_ is
+the type of values to be stored, and it must support operations T_ + T_, T_ - T_,
+and T_ * float, otherwise the get_random() method will not compile.
+This struct could be extended to customize the random number generator (now it uses only
+std::rand()).
+
+
+
+
+
T_ min
+- Lower bound
+
+
+
+
T_ max
+- Higher bound
+
+
+
+
range()
+- Construct the object by calling default constructors for min and max
+
+
+
+
range(const T_ &mn, const T_ &mx)
+- Construct and initialize min and max directly
+
+
+
+
void set(const T_ &mn, const T_ &mx)
+- Set min and max
+
+
+
+
T_ get_random() const
+- Get a random value between min and max
+
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/rangef.html b/doc/doc++/osgParticle/rangef.html
new file mode 100644
index 000000000..b8ff0f3d1
--- /dev/null
+++ b/doc/doc++/osgParticle/rangef.html
@@ -0,0 +1,20 @@
+
+
+
+
+ typedef range osgParticle::rangef
+
+
+
+
+Range of floats
+
+
+
+Documentation
+Range of floats
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/rangev2.html b/doc/doc++/osgParticle/rangev2.html
new file mode 100644
index 000000000..6b8584fa3
--- /dev/null
+++ b/doc/doc++/osgParticle/rangev2.html
@@ -0,0 +1,20 @@
+
+
+
+
+ typedef range osgParticle::rangev2
+
+
+
+
+Range of osg::Vec2s
+
+
+
+Documentation
+Range of osg::Vec2s
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/doc++/osgParticle/rangev3.html b/doc/doc++/osgParticle/rangev3.html
new file mode 100644
index 000000000..c3b60d379
--- /dev/null
+++ b/doc/doc++/osgParticle/rangev3.html
@@ -0,0 +1,20 @@
+
+
+
+
+ typedef range osgParticle::rangev3
+
+
+
+
+Range of osg::Vec3s
+
+
+
+Documentation
+Range of osg::Vec3s
+
Alphabetic index HTML hierarchy of classes or Java
+
+This page was generated with the help of DOC++.
+
+
diff --git a/doc/documentation.html b/doc/documentation.html
index 8b3fa5550..4cfb1b14b 100644
--- a/doc/documentation.html
+++ b/doc/documentation.html
@@ -38,6 +38,8 @@ core scene graph reference guide.
scene graph utilities reference guide.
osgDB/
scene graph database utilities reference guide.
+
osgParticle/
+scene graph particle reference guide.
osgText/
scene graph text reference guide.
osgGLUT/
diff --git a/include/osgParticle/AccelOperator b/include/osgParticle/AccelOperator
new file mode 100644
index 000000000..da70dbb4b
--- /dev/null
+++ b/include/osgParticle/AccelOperator
@@ -0,0 +1,99 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_ACCELOPERATOR_
+#define OSGPARTICLE_ACCELOPERATOR_ 1
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+namespace osgParticle
+{
+
+ /** An operator class that applies a constant acceleration to the particles.
+ */
+ class AccelOperator: public Operator {
+ public:
+ inline AccelOperator();
+ inline AccelOperator(const AccelOperator ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
+
+ META_Object(AccelOperator);
+
+ /// Get the acceleration vector.
+ inline const osg::Vec3 &getAcceleration() const;
+
+ /// Set the acceleration vector.
+ inline void setAcceleration(const osg::Vec3 &v);
+
+ /** Quickly set the acceleration vector to the gravity on earth (0, 0, -9.81).
+ The acceleration will be multiplied by the scale parameter.
+ */
+ inline void setToGravity(float scale = 1);
+
+ /// Apply the acceleration to a particle. Do not call this method manually.
+ inline void operate(Particle *P, double dt);
+
+ /// Perform some initializations. Do not call this method manually.
+ inline void beginOperate(Program *prg);
+
+ protected:
+ virtual ~AccelOperator() {}
+ AccelOperator &operator=(const AccelOperator &) { return *this; }
+
+ private:
+ osg::Vec3 accel_;
+ osg::Vec3 xf_accel_;
+ };
+
+ // INLINE FUNCTIONS
+
+ inline AccelOperator::AccelOperator()
+ : Operator(), accel_(0, 0, 0)
+ {
+ }
+
+ inline AccelOperator::AccelOperator(const AccelOperator ©, const osg::CopyOp ©op)
+ : Operator(copy, copyop), accel_(copy.accel_)
+ {
+ }
+
+ inline const osg::Vec3 &AccelOperator::getAcceleration() const
+ {
+ return accel_;
+ }
+
+ inline void AccelOperator::setAcceleration(const osg::Vec3 &v)
+ {
+ accel_ = v;
+ }
+
+ inline void AccelOperator::setToGravity(float scale)
+ {
+ accel_.set(0, 0, -9.80665f * scale);
+ }
+
+ inline void AccelOperator::operate(Particle *P, double dt)
+ {
+ P->addVelocity(xf_accel_ * dt);
+ }
+
+ inline void AccelOperator::beginOperate(Program *prg)
+ {
+ if (prg->getReferenceFrame() == ModularProgram::RELATIVE_TO_PARENTS) {
+ xf_accel_ = prg->rotateLocalToWorld(accel_);
+ } else {
+ xf_accel_ = accel_;
+ }
+ }
+
+}
+
+
+#endif
diff --git a/include/osgParticle/CenteredPlacer b/include/osgParticle/CenteredPlacer
new file mode 100644
index 000000000..b950f44e8
--- /dev/null
+++ b/include/osgParticle/CenteredPlacer
@@ -0,0 +1,74 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_CENTEREDPLACER_
+#define OSGPARTICLE_CENTEREDPLACER_ 1
+
+#include
+
+#include
+#include
+#include
+
+namespace osgParticle
+{
+
+ /** An abstract placer base class for placers which need a center point.
+ */
+ class CenteredPlacer: public Placer {
+ public:
+ inline CenteredPlacer();
+ inline CenteredPlacer(const CenteredPlacer ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
+
+ virtual const char *className() const { return "CenteredPlacer"; }
+ virtual bool isSameKindAs(const osg::Object *obj) const { return dynamic_cast(obj) != 0; }
+
+ /// Get the center point.
+ inline const osg::Vec3 &getCenter() const;
+
+ /// Set the center point.
+ inline void setCenter(const osg::Vec3 &v);
+
+ /// Set the center point.
+ inline void setCenter(float x, float y, float z);
+
+ protected:
+ virtual ~CenteredPlacer() {}
+
+ private:
+ osg::Vec3 center_;
+ };
+
+ // INLINE FUNCTIONS
+
+ inline CenteredPlacer::CenteredPlacer()
+ : Placer(), center_(0, 0, 0)
+ {
+ }
+
+ inline CenteredPlacer::CenteredPlacer(const CenteredPlacer ©, const osg::CopyOp ©op)
+ : Placer(copy, copyop), center_(copy.center_)
+ {
+ }
+
+ inline const osg::Vec3 &CenteredPlacer::getCenter() const
+ {
+ return center_;
+ }
+
+ inline void CenteredPlacer::setCenter(const osg::Vec3 &v)
+ {
+ center_ = v;
+ }
+
+ inline void CenteredPlacer::setCenter(float x, float y, float z)
+ {
+ center_.set(x, y, z);
+ }
+
+}
+
+
+#endif
diff --git a/include/osgParticle/Counter b/include/osgParticle/Counter
new file mode 100644
index 000000000..c75db1823
--- /dev/null
+++ b/include/osgParticle/Counter
@@ -0,0 +1,44 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_COUNTER_
+#define OSGPARTICLE_COUNTER_ 1
+
+#include
+#include
+
+namespace osgParticle
+{
+
+ class Counter: public osg::Object {
+ public:
+ inline Counter();
+ inline Counter(const Counter ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
+
+ virtual const char *className() const { return "Counter"; }
+ virtual bool isSameKindAs(const osg::Object *obj) const { return dynamic_cast(obj) != 0; }
+
+ virtual int numParticlesToCreate(double dt) const = 0;
+
+ protected:
+ ~Counter() {}
+ Counter &operator=(const Counter &) { return *this; }
+ };
+
+ // INLINE FUNCTIONS
+
+ inline Counter::Counter()
+ : osg::Object()
+ {
+ }
+
+ inline Counter::Counter(const Counter ©, const osg::CopyOp ©op)
+ : osg::Object(copy, copyop)
+ {
+ }
+
+}
+
+#endif
diff --git a/include/osgParticle/Emitter b/include/osgParticle/Emitter
new file mode 100644
index 000000000..2754985f8
--- /dev/null
+++ b/include/osgParticle/Emitter
@@ -0,0 +1,96 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_EMITTER_
+#define OSGPARTICLE_EMITTER_ 1
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+namespace osgParticle
+{
+
+ /** An abstract base class for particle emitters.
+ Descendant classes must override the emit() method to generate new particles by
+ calling the ParticleSystem::createParticle() method on the particle system associated
+ to the emitter.
+ */
+ class OSGPARTICLE_EXPORT Emitter: public ParticleProcessor {
+ public:
+ Emitter();
+ Emitter(const Emitter ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
+
+ virtual const char *className() const { return "Emitter"; }
+ virtual bool isSameKindAs(const osg::Object *obj) { return dynamic_cast(obj) != 0; }
+ virtual void accept(osg::NodeVisitor& nv) { if (nv.validNodeMask(*this)) { nv.pushOntoNodePath(this); nv.apply(*this); nv.popFromNodePath(); } }
+
+ /// Get the particle template.
+ inline const Particle &getParticleTemplate() const;
+
+ /// Set the particle template (particle is copied).
+ inline void setParticleTemplate(const Particle &p);
+
+ /// Return whether the particle system's default template should be used.
+ inline bool getUseDefaultTemplate() const;
+
+ /** Set whether the default particle template should be used.
+ When this flag is true, the particle template is ignored, and the
+ particle system's default template is used instead.
+ */
+ inline void setUseDefaultTemplate(bool v);
+
+ protected:
+ virtual ~Emitter() {}
+ Emitter &operator=(const Emitter &) { return *this; }
+
+ inline void process(double dt);
+
+ virtual void emit(double dt) = 0;
+
+ private:
+ bool usedeftemp_;
+ Particle ptemp_;
+ };
+
+ // INLINE FUNCTIONS
+
+ inline const Particle &Emitter::getParticleTemplate() const
+ {
+ return ptemp_;
+ }
+
+ inline void Emitter::setParticleTemplate(const Particle &p)
+ {
+ ptemp_ = p;
+ usedeftemp_ = false;
+ }
+
+ inline bool Emitter::getUseDefaultTemplate() const
+ {
+ return usedeftemp_;
+ }
+
+ inline void Emitter::setUseDefaultTemplate(bool v)
+ {
+ usedeftemp_ = v;
+ }
+
+ inline void Emitter::process(double dt)
+ {
+ emit(dt);
+ }
+
+
+}
+
+
+#endif
+
diff --git a/include/osgParticle/Export b/include/osgParticle/Export
new file mode 100644
index 000000000..605fa23a3
--- /dev/null
+++ b/include/osgParticle/Export
@@ -0,0 +1,30 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_EXPORT_
+#define OSGPARTICLE_EXPORT_ 1
+
+#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
+ #pragma warning( disable : 4244 )
+ #pragma warning( disable : 4251 )
+ #pragma warning( disable : 4275 )
+ #pragma warning( disable : 4786 )
+ #pragma warning( disable : 4290 )
+#endif
+
+
+#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined( __BCPLUSPLUS__) || defined( __MWERKS__)
+ # ifdef OSGPARTICLE_LIBRARY
+ # define OSGPARTICLE_EXPORT __declspec(dllexport)
+ # else
+ # define OSGPARTICLE_EXPORT __declspec(dllimport)
+ # endif /* OSGPARTICLE_LIBRARY */
+#else
+ # define OSGPARTICLE_EXPORT
+#endif
+
+
+
+#endif
diff --git a/include/osgParticle/FluidFrictionOperator b/include/osgParticle/FluidFrictionOperator
new file mode 100644
index 000000000..fb2a681d9
--- /dev/null
+++ b/include/osgParticle/FluidFrictionOperator
@@ -0,0 +1,132 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_FLUIDFRICTIONOPERATOR_
+#define OSGPARTICLE_FLUIDFRICTIONOPERATOR_ 1
+
+#include
+#include
+
+#include
+#include
+#include
+
+namespace osgParticle
+{
+
+ class Particle;
+
+ /** An operator that simulates the friction of a fluid.
+ By using this operator you can let the particles move in a fluid of a given density
+ and viscosity. There are two functions to quickly setup the parameters for pure water
+ and air. You can decide whether to compute the forces using the particle's physical
+ radius or another value, by calling the setOverrideRadius() method.
+ */
+ class OSGPARTICLE_EXPORT FluidFrictionOperator: public Operator {
+ public:
+
+ FluidFrictionOperator();
+ FluidFrictionOperator(const FluidFrictionOperator ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
+
+ META_Object(FluidFrictionOperator);
+
+ /// Get the density of the fluid.
+ inline float getFluidDensity() const;
+
+ /// Set the density of the fluid.
+ inline void setFluidDensity(float d);
+
+ /// Get the viscosity of the fluid.
+ inline float getFluidViscosity() const;
+
+ /// Set the viscosity of the fluid.
+ inline void setFluidViscosity(float v);
+
+ /// Get the overriden radius value.
+ inline float getOverrideRadius() const;
+
+ /// Set the overriden radius value (pass 0 if you want to use particle's radius).
+ inline void setOverrideRadius(float r);
+
+ /// Set the fluid parameters as for air (20°C temperature).
+ inline void setFluidToAir();
+
+ /// Set the fluid parameters as for pure water (20°C temperature).
+ inline void setFluidToWater();
+
+ /// Apply the friction forces to a particle. Do not call this method manually.
+ void operate(Particle *P, double dt);
+
+ /// Perform some initializations. Do not call this method manually.
+ inline void beginOperate(Program *prg);
+
+ protected:
+ virtual ~FluidFrictionOperator() {}
+ FluidFrictionOperator &operator=(const FluidFrictionOperator &) { return *this; }
+
+ private:
+ float A_;
+ float B_;
+ float density_;
+ float viscosity_;
+ float ovr_rad_;
+ Program *current_program_;
+ };
+
+ // INLINE FUNCTIONS
+
+ inline float FluidFrictionOperator::getFluidDensity() const
+ {
+ return density_;
+ }
+
+ inline float FluidFrictionOperator::getFluidViscosity() const
+ {
+ return viscosity_;
+ }
+
+ inline void FluidFrictionOperator::setFluidDensity(float d)
+ {
+ density_ = d;
+ B_ = 0.2f * osg::PI * density_;
+ }
+
+ inline void FluidFrictionOperator::setFluidViscosity(float v)
+ {
+ viscosity_ = v;
+ A_ = 6 * osg::PI * viscosity_;
+ }
+
+ inline void FluidFrictionOperator::setFluidToAir()
+ {
+ setFluidViscosity(1.8e-5f);
+ setFluidDensity(1.2929f);
+ }
+
+ inline void FluidFrictionOperator::setFluidToWater()
+ {
+ setFluidViscosity(1.002e-3f);
+ setFluidDensity(1.0f);
+ }
+
+ inline float FluidFrictionOperator::getOverrideRadius() const
+ {
+ return ovr_rad_;
+ }
+
+ inline void FluidFrictionOperator::setOverrideRadius(float r)
+ {
+ ovr_rad_ = r;
+ }
+
+ inline void FluidFrictionOperator::beginOperate(Program *prg)
+ {
+ current_program_ = prg;
+ }
+
+}
+
+
+#endif
diff --git a/include/osgParticle/ForceOperator b/include/osgParticle/ForceOperator
new file mode 100644
index 000000000..6da553c38
--- /dev/null
+++ b/include/osgParticle/ForceOperator
@@ -0,0 +1,89 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_FORCEOPERATOR_
+#define OSGPARTICLE_FORCEOPERATOR_ 1
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+namespace osgParticle
+{
+
+ /** An operator that applies a constant force to the particles.
+ Remember that if the mass of particles is expressed in kg and the lengths are
+ expressed in meters, then the force should be expressed in Newtons.
+ */
+ class ForceOperator: public Operator {
+ public:
+ inline ForceOperator();
+ inline ForceOperator(const ForceOperator ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
+
+ META_Object(ForceOperator);
+
+ /// Get the force vector.
+ inline const osg::Vec3 &getForce() const;
+
+ /// Set the force vector.
+ inline void setForce(const osg::Vec3 &f);
+
+ /// Apply the force to a particle. Do not call this method manually.
+ inline void operate(Particle *P, double dt);
+
+ /// Perform some initialization. Do not call this method manually.
+ inline void beginOperate(Program *prg);
+
+ protected:
+ virtual ~ForceOperator() {};
+ ForceOperator &operator=(const ForceOperator &) { return *this; }
+
+ private:
+ osg::Vec3 force_;
+ osg::Vec3 xf_force_;
+ };
+
+ // INLINE FUNCTIONS
+
+ inline ForceOperator::ForceOperator()
+ : Operator(), force_(0, 0, 0)
+ {
+ }
+
+ inline ForceOperator::ForceOperator(const ForceOperator ©, const osg::CopyOp ©op)
+ : Operator(copy, copyop), force_(copy.force_)
+ {
+ }
+
+ inline const osg::Vec3 &ForceOperator::getForce() const
+ {
+ return force_;
+ }
+
+ inline void ForceOperator::setForce(const osg::Vec3 &v)
+ {
+ force_ = v;
+ }
+
+ inline void ForceOperator::operate(Particle *P, double dt)
+ {
+ P->addVelocity(xf_force_ * (P->getMassInv() * dt));
+ }
+
+ inline void ForceOperator::beginOperate(Program *prg)
+ {
+ if (prg->getReferenceFrame() == ModularProgram::RELATIVE_TO_PARENTS) {
+ xf_force_ = prg->rotateLocalToWorld(force_);
+ } else {
+ xf_force_ = force_;
+ }
+ }
+}
+
+#endif
diff --git a/include/osgParticle/Interpolator b/include/osgParticle/Interpolator
new file mode 100644
index 000000000..a3bc28b31
--- /dev/null
+++ b/include/osgParticle/Interpolator
@@ -0,0 +1,77 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_INTERPOLATOR_
+#define OSGPARTICLE_INTERPOLATOR_
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+namespace osgParticle
+{
+
+ /// An abstract base class for implementing interpolators.
+ class Interpolator : public osg::Object {
+ public:
+ Interpolator()
+ : osg::Object() {}
+
+ Interpolator(const Interpolator ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
+ : osg::Object(copy, copyop) {}
+
+ virtual const char *className() const { return "Interpolator"; }
+ virtual bool isSameKindAs(const osg::Object *obj) const { return dynamic_cast(obj) != 0; }
+
+ /// Interpolate between floats. Must be overriden in descendant classes.
+ virtual float interpolate(float t, float y1, float y2) const = 0;
+
+ /// Interpolate between 2-dimensional vectors. Default behavior is to interpolate each component separately.
+ virtual osg::Vec2 interpolate(float t, const osg::Vec2 &y1, const osg::Vec2 &y2) const
+ {
+ return osg::Vec2(
+ interpolate(t, y1.x(), y2.x()),
+ interpolate(t, y1.y(), y2.y())
+ );
+ }
+
+ /// Interpolate between 3-dimensional vectors. Default behavior is to interpolate each component separately.
+ virtual osg::Vec3 interpolate(float t, const osg::Vec3 &y1, const osg::Vec3 &y2) const
+ {
+ return osg::Vec3(
+ interpolate(t, y1.x(), y2.x()),
+ interpolate(t, y1.y(), y2.y()),
+ interpolate(t, y1.z(), y2.z())
+ );
+ }
+
+ /// Interpolate between 4-dimensional vectors. Default behavior is to interpolate each component separately.
+ virtual osg::Vec4 interpolate(float t, const osg::Vec4 &y1, const osg::Vec4 &y2) const
+ {
+ return osg::Vec4(
+ interpolate(t, y1.x(), y2.x()),
+ interpolate(t, y1.y(), y2.y()),
+ interpolate(t, y1.z(), y2.z()),
+ interpolate(t, y1.w(), y2.w())
+ );
+ }
+
+ template
+ T_ interpolate(float t, const range &r) const
+ {
+ return interpolate(t, r.min, r.max);
+ }
+
+ protected:
+ virtual ~Interpolator() {}
+ };
+
+}
+
+#endif
diff --git a/include/osgParticle/LinearInterpolator b/include/osgParticle/LinearInterpolator
new file mode 100644
index 000000000..a31ff5c03
--- /dev/null
+++ b/include/osgParticle/LinearInterpolator
@@ -0,0 +1,41 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_LINEARINTERPOLATOR_
+#define OSGPARTICLE_LINEARINTERPOLATOR_
+
+#include
+
+#include
+#include
+#include
+#include
+
+namespace osgParticle
+{
+
+ /// A linear interpolator.
+ class LinearInterpolator: public Interpolator {
+ public:
+ LinearInterpolator()
+ : Interpolator() {}
+
+ LinearInterpolator(const LinearInterpolator ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
+ : Interpolator(copy, copyop) {}
+
+ META_Object(LinearInterpolator);
+
+ virtual float interpolate(float t, float y1, float y2) const
+ {
+ return y1 + (y2 - y1) * t;
+ }
+
+ protected:
+ virtual ~LinearInterpolator() {}
+ };
+
+}
+
+#endif
diff --git a/include/osgParticle/ModularEmitter b/include/osgParticle/ModularEmitter
new file mode 100644
index 000000000..1c254ca87
--- /dev/null
+++ b/include/osgParticle/ModularEmitter
@@ -0,0 +1,130 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_MODULAREMITTER_
+#define OSGPARTICLE_MODULAREMITTER_ 1
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+namespace osgParticle
+{
+
+ /** An emitter class that holds three objects to control the creation of particles.
+ These objects are a counter, a placer and a shooter.
+ The counter controls the number of particles to be emitted at each frame;
+ the placer must initialize the particle's position vector, while the shooter initializes
+ its velocity vector.
+ You can use the predefined counter/placer/shooter classes, or you can create your own.
+ */
+ class OSGPARTICLE_EXPORT ModularEmitter: public Emitter {
+ public:
+ ModularEmitter();
+ ModularEmitter(const ModularEmitter ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
+
+ META_Node(ModularEmitter);
+
+ /// Get the counter object.
+ inline Counter *getCounter();
+
+ /// Get the const Counter object.
+ inline const Counter *getCounter() const;
+
+ /// Set the Counter object.
+ inline void setCounter(Counter *c);
+
+ /// Get the Placer object.
+ inline Placer *getPlacer();
+
+ /// Get the const Placer object.
+ inline const Placer *getPlacer() const;
+
+ /// Set the Placer object.
+ inline void setPlacer(Placer *p);
+
+ /// Get the Shooter object.
+ inline Shooter *getShooter();
+
+ /// Get the const Shooter object.
+ inline const Shooter *getShooter() const;
+
+ /// Set the Shooter object.
+ inline void setShooter(Shooter *s);
+
+ protected:
+ virtual ~ModularEmitter() {}
+ ModularEmitter &operator=(const ModularEmitter &) { return *this; }
+
+ void emit(double dt);
+
+ private:
+ osg::ref_ptr counter_;
+ osg::ref_ptr placer_;
+ osg::ref_ptr shooter_;
+ };
+
+ // INLINE FUNCTIONS
+
+ inline Counter *ModularEmitter::getCounter()
+ {
+ return counter_.get();
+ }
+
+ inline const Counter *ModularEmitter::getCounter() const
+ {
+ return counter_.get();
+ }
+
+ inline void ModularEmitter::setCounter(Counter *c)
+ {
+ counter_ = c;
+ }
+
+ inline Placer *ModularEmitter::getPlacer()
+ {
+ return placer_.get();
+ }
+
+ inline const Placer *ModularEmitter::getPlacer() const
+ {
+ return placer_.get();
+ }
+
+ inline void ModularEmitter::setPlacer(Placer *p)
+ {
+ placer_ = p;
+ }
+
+ inline Shooter *ModularEmitter::getShooter()
+ {
+ return shooter_.get();
+ }
+
+ inline const Shooter *ModularEmitter::getShooter() const
+ {
+ return shooter_.get();
+ }
+
+ inline void ModularEmitter::setShooter(Shooter *s)
+ {
+ shooter_ = s;
+ }
+
+}
+
+#endif
diff --git a/include/osgParticle/ModularProgram b/include/osgParticle/ModularProgram
new file mode 100644
index 000000000..f4da376c7
--- /dev/null
+++ b/include/osgParticle/ModularProgram
@@ -0,0 +1,90 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_MODULARPROGRAM_
+#define OSGPARTICLE_MODULARPROGRAM_ 1
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+namespace osgParticle
+{
+
+ /** A program class for performing operations on particles using a sequence of operators.
+ To use a ModularProgram you have to create some Operator objects and
+ add them to the program.
+ All operators will be applied to each particle in the same order they've been added to the program.
+ */
+ class OSGPARTICLE_EXPORT ModularProgram: public Program {
+ public:
+ ModularProgram();
+ ModularProgram(const ModularProgram ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
+
+ META_Node(ModularProgram);
+
+ /// Get the number of operators.
+ inline int numOperators() const;
+
+ /// Add an operator to the list.
+ inline void addOperator(Operator *o);
+
+ /// Get a pointer to an operator in the list.
+ inline Operator *getOperator(int i);
+
+ /// Get a const pointer to an operator in the list.
+ inline const Operator *getOperator(int i) const;
+
+ /// Remove an operator from the list.
+ inline void removeOperator(int i);
+
+ protected:
+ virtual ~ModularProgram() {}
+ ModularProgram &operator=(const ModularProgram &) { return *this; }
+
+ void execute(double dt);
+
+ private:
+ typedef std::vector > Operator_vector;
+
+ Operator_vector operators_;
+ };
+
+ // INLINE FUNCTIONS
+
+ inline int ModularProgram::numOperators() const
+ {
+ return static_cast(operators_.size());
+ }
+
+ inline void ModularProgram::addOperator(Operator *o)
+ {
+ operators_.push_back(o);
+ }
+
+ inline Operator *ModularProgram::getOperator(int i)
+ {
+ return operators_[i].get();
+ }
+
+ inline const Operator *ModularProgram::getOperator(int i) const
+ {
+ return operators_[i].get();
+ }
+
+ inline void ModularProgram::removeOperator(int i)
+ {
+ operators_.erase(operators_.begin()+i);
+ }
+
+
+}
+
+#endif
diff --git a/include/osgParticle/MultiSegmentPlacer b/include/osgParticle/MultiSegmentPlacer
new file mode 100644
index 000000000..8ecbca9cb
--- /dev/null
+++ b/include/osgParticle/MultiSegmentPlacer
@@ -0,0 +1,119 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_MULTISEGMENTPLACER_
+#define OSGPARTICLE_MULTISEGMENTPLACER_ 1
+
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+namespace osgParticle {
+
+ /** A polyline-shaped particle placer.
+ This placer class sets the position of incoming particles by choosing a random point on the
+ specified sequence of connected segments.
+ */
+ class OSGPARTICLE_EXPORT MultiSegmentPlacer: public Placer {
+ public:
+ MultiSegmentPlacer();
+ MultiSegmentPlacer(const MultiSegmentPlacer ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
+
+ META_Object(MultiSegmentPlacer);
+
+ /// Get the number of vertices which define the segments.
+ inline int numVertices() const;
+
+ /// Get a vertex.
+ inline const osg::Vec3 &getVertex(int i) const;
+
+ /// Set a vertex.
+ inline void setVertex(int i, const osg::Vec3 &v);
+
+ /// Set a vertex.
+ inline void setVertex(int i, float x, float y, float z);
+
+ /// Add a vertex.
+ inline void addVertex(const osg::Vec3 &v);
+
+ /// Add a vertex.
+ inline void addVertex(float x, float y, float z);
+
+ /// Remove a vertex.
+ inline void removeVertex(int i);
+
+ /// Place a partice. Called automatically by ModularEmitter, do not call this method manually.
+ void place(Particle *P) const;
+
+ protected:
+ virtual ~MultiSegmentPlacer() {}
+ MultiSegmentPlacer &operator=(const MultiSegmentPlacer &) { return *this; }
+
+ private:
+ typedef std::pair Vertex_data;
+ typedef std::vector Vertex_vector;
+
+ Vertex_vector vx_;
+ float total_length_;
+
+ void recompute_length();
+ };
+
+ // INLINE FUNCTIONS
+
+
+ inline int MultiSegmentPlacer::numVertices() const
+ {
+ return static_cast(vx_.size());
+ }
+
+ inline const osg::Vec3 &MultiSegmentPlacer::getVertex(int i) const
+ {
+ return vx_[i].first;
+ }
+
+ inline void MultiSegmentPlacer::setVertex(int i, const osg::Vec3 &v)
+ {
+ vx_[i].first = v;
+ recompute_length();
+ }
+
+ inline void MultiSegmentPlacer::setVertex(int i, float x, float y, float z)
+ {
+ vx_[i].first.set(x, y, z);
+ recompute_length();
+ }
+
+ inline void MultiSegmentPlacer::addVertex(const osg::Vec3 &v)
+ {
+ float l = 0;
+ if (vx_.size() > 0) {
+ l = (v - vx_.back().first).length();
+ }
+ total_length_ += l;
+ vx_.push_back(std::make_pair(v, total_length_));
+ }
+
+ inline void MultiSegmentPlacer::addVertex(float x, float y, float z)
+ {
+ addVertex(osg::Vec3(x, y, z));
+ }
+
+ inline void MultiSegmentPlacer::removeVertex(int i)
+ {
+ vx_.erase(vx_.begin()+i);
+ recompute_length();
+ }
+
+}
+#endif
diff --git a/include/osgParticle/Operator b/include/osgParticle/Operator
new file mode 100644
index 000000000..09bc364cb
--- /dev/null
+++ b/include/osgParticle/Operator
@@ -0,0 +1,91 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_OPERATOR_
+#define OSGPARTICLE_OPERATOR_ 1
+
+#include
+
+#include
+#include
+#include
+
+namespace osgParticle
+{
+
+ // forward declaration to avoid including the whole header file
+ class Particle;
+
+ /** An abstract base class used by ModularProgram to perform operations on particles before they are updated.
+ To implement a new operator, derive from this class and override the operate() method.
+ You should also override the beginOperate() method to query the calling program for the reference frame
+ used, and initialize the right transformations if needed.
+ */
+ class Operator: public osg::Object {
+ public:
+ inline Operator();
+ inline Operator(const Operator ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
+
+ virtual const char *className() const { return "Operator"; }
+ virtual bool isSameKindAs(const osg::Object *obj) const { return dynamic_cast(obj) != 0; }
+
+ /// Get whether this operator is enabled.
+ inline bool isEnabled() const;
+
+ /// Enable or disable this operator.
+ inline void setEnabled(bool v);
+
+ /** Do something on a particle.
+ This method is called by ModularProgram objects to perform some operations
+ on the particles. You must override it in descendant classes. Common operations
+ consist of modifying the particle's velocity vector. The dt parameter is
+ the time elapsed from last operation.
+ */
+ virtual void operate(Particle *P, double dt) = 0;
+
+ /** Do something before processing particles via the operate() method.
+ Overriding this method could be necessary to query the calling Program object
+ for the current reference frame. If the reference frame is RELATIVE_TO_PARENTS, then your
+ class should prepare itself to do all operations in local coordinates.
+ */
+ virtual void beginOperate(Program *) {}
+
+ /// Do something after all particles have been processed.
+ virtual void endOperate() {}
+
+ protected:
+ virtual ~Operator() {}
+ Operator &operator=(const Operator &) { return *this; }
+
+ private:
+ bool enabled_;
+ };
+
+ // INLINE FUNCTIONS
+
+ inline Operator::Operator()
+ : osg::Object(), enabled_(true)
+ {
+ }
+
+ inline Operator::Operator(const Operator ©, const osg::CopyOp ©op)
+ : osg::Object(copy, copyop), enabled_(copy.enabled_)
+ {
+ }
+
+ inline bool Operator::isEnabled() const
+ {
+ return enabled_;
+ }
+
+ inline void Operator::setEnabled(bool v)
+ {
+ enabled_ = v;
+ }
+
+
+}
+
+#endif
diff --git a/include/osgParticle/Particle b/include/osgParticle/Particle
new file mode 100644
index 000000000..1de466d9e
--- /dev/null
+++ b/include/osgParticle/Particle
@@ -0,0 +1,399 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_PARTICLE_
+#define OSGPARTICLE_PARTICLE_ 1
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+namespace osgParticle
+{
+
+ /** Implementation of a particle.
+ Objects of this class are particles, they have some graphical properties
+ and some physical properties. Particles are created by emitters and then placed
+ into Particle Systems, where they live and get updated at each frame.
+ Particles can either live forever (lifeTime < 0), or die after a specified
+ time (lifeTime >= 0). For each property which is defined as a range of values, a
+ "current" value will be evaluated at each frame by interpolating the min
+ and max values so that curr_value = min when t == 0, and
+ curr_value = max when t == lifeTime.
+ You may customize the interpolator objects to achieve any kind of transition.
+ If you want the particle to live forever, set its lifetime to any value <= 0;
+ in that case, no interpolation is done to compute real-time properties, and only
+ minimum values are used.
+ */
+ class OSGPARTICLE_EXPORT Particle {
+ public:
+
+ enum Shape {
+ POINT, // uses GL_POINTS as primitive
+ QUAD, // uses GL_QUADS as primitive
+ QUAD_TRIANGLESTRIP, // uses GL_TRIANGLE_STRIP as primitive, but each particle needs a glBegin/glEnd pair
+ HEXAGON // may save some filling time, but uses more triangles
+ };
+
+ Particle();
+
+ /// Get the shape of the particle.
+ inline Shape getShape() const;
+
+ /// Set the shape of the particle.
+ inline void setShape(Shape s);
+
+ /// Get whether the particle is still alive.
+ inline bool isAlive() const;
+
+ /// Get the life time of the particle (in seconds).
+ inline double getLifeTime() const;
+
+ /// Get the age of the particle (in seconds).
+ inline double getAge() const;
+
+ /// Get the minimum and maximum values for polygon size.
+ inline const rangef &getSizeRange() const;
+
+ /// Get the minimum and maximum values for alpha.
+ inline const rangef &getAlphaRange() const;
+
+ /// Get the minimum and maximum values for color.
+ inline const rangev4 &getColorRange() const;
+
+ /// Get the interpolator for computing the size of polygons.
+ inline const Interpolator *getSizeInterpolator() const;
+
+ /// Get the interpolator for computing alpha values.
+ inline const Interpolator *getAlphaInterpolator() const;
+
+ /// Get the interpolator for computing color values.
+ inline const Interpolator *getColorInterpolator() const;
+
+ /** Get the physical radius of the particle.
+ For built-in operators to work correctly, lengths must be expressed in meters.
+ */
+ inline float getRadius() const;
+
+ /** Get the mass of the particle.
+ For built-in operators to work correctly, remember that the mass is expressed in kg.
+ */
+ inline float getMass() const;
+
+ /// Get 1 / getMass().
+ inline float getMassInv() const;
+
+ /// Get the position vector.
+ inline const osg::Vec3 &getPosition() const;
+
+ /** Get the velocity vector.
+ For built-in operators to work correctly, remember that velocity components are expressed
+ in meters per second.
+ */
+ inline const osg::Vec3 &getVelocity() const;
+
+ /// Get the previous position (the position before last update).
+ inline const osg::Vec3 &getPreviousPosition() const;
+
+ /** Kill the particle on next update
+ NOTE: after calling this function, the isAlive() method will still
+ return true until the particle is updated again.
+ */
+ inline void kill();
+
+ /// Set the life time of the particle.
+ inline void setLifeTime(double t);
+
+ /// Set the minimum and maximum values for polygon size.
+ inline void setSizeRange(const rangef &r);
+
+ /// Set the minimum and maximum values for alpha.
+ inline void setAlphaRange(const rangef &r);
+
+ /// Set the minimum and maximum values for color.
+ inline void setColorRange(const rangev4 &r);
+
+ /// Set the interpolator for computing size values.
+ inline void setSizeInterpolator(Interpolator *ri);
+
+ /// Set the interpolator for computing alpha values.
+ inline void setAlphaInterpolator(Interpolator *ai);
+
+ /// Set the interpolator for computing color values.
+ inline void setColorInterpolator(Interpolator *ci);
+
+ /** Set the physical radius of the particle.
+ For built-in operators to work correctly, lengths must be expressed in meters.
+ */
+ inline void setRadius(float r);
+
+ /** Set the mass of the particle.
+ For built-in operators to work correctly, remember that the mass is expressed in kg.
+ */
+ inline void setMass(float m);
+
+ /// Set the position vector.
+ inline void setPosition(const osg::Vec3 &p);
+
+ /** Set the velocity vector.
+ For built-in operators to work correctly, remember that velocity components are expressed
+ in meters per second.
+ */
+ inline void setVelocity(const osg::Vec3 &v);
+
+ /// Add a vector to the velocity vector.
+ inline void addVelocity(const osg::Vec3 &dv);
+
+ /// Transform position and velocity vectors by a matrix.
+ inline void transformPositionVelocity(const osg::Matrix &xform);
+
+ /** Update the particle (don't call this method manually).
+ This method is called automatically by ParticleSystem::update(); it
+ updates the graphical properties of the particle for the current time,
+ checks whether the particle is still alive, and then updates its position
+ by computing P = P + V * dt (where P is the position and V is the velocity).
+ */
+ bool update(double dt);
+
+ /// Perform some pre-rendering tasks. Called automatically by particle systems.
+ inline void beginRender();
+
+ /// Render the particle. Called automatically by particle systems.
+ void render(const osg::Matrix &modelview, float scale = 1.0f) const;
+
+ /// Perform some post-rendering tasks. Called automatically by particle systems.
+ inline void endRender();
+
+ private:
+ Shape shape_;
+
+ rangef sr_;
+ rangef ar_;
+ rangev4 cr_;
+
+ osg::ref_ptr si_;
+ osg::ref_ptr ai_;
+ osg::ref_ptr ci_;
+
+ bool alive_;
+ bool mustdie_;
+ double lifetime_;
+
+ float radius_;
+ float mass_;
+ float massinv_;
+ osg::Vec3 prev_pos_;
+ osg::Vec3 position_;
+ osg::Vec3 velocity_;
+
+ double t0_;
+
+ float current_size_;
+ float current_alpha_;
+ osg::Vec4 current_color_;
+ };
+
+ // INLINE FUNCTIONS
+
+ inline Particle::Shape Particle::getShape() const
+ {
+ return shape_;
+ }
+
+ inline void Particle::setShape(Shape s)
+ {
+ shape_ = s;
+ }
+
+ inline bool Particle::isAlive() const
+ {
+ return alive_;
+ }
+
+ inline double Particle::getLifeTime() const
+ {
+ return lifetime_;
+ }
+
+ inline double Particle::getAge() const
+ {
+ return t0_;
+ }
+
+ inline float Particle::getRadius() const
+ {
+ return radius_;
+ }
+
+ inline void Particle::setRadius(float r)
+ {
+ radius_ = r;
+ }
+
+ inline const rangef &Particle::getSizeRange() const
+ {
+ return sr_;
+ }
+
+ inline const rangef &Particle::getAlphaRange() const
+ {
+ return ar_;
+ }
+
+ inline const rangev4 &Particle::getColorRange() const
+ {
+ return cr_;
+ }
+
+ inline const Interpolator *Particle::getSizeInterpolator() const
+ {
+ return si_.get();
+ }
+
+ inline const Interpolator *Particle::getAlphaInterpolator() const
+ {
+ return ai_.get();
+ }
+
+ inline const Interpolator *Particle::getColorInterpolator() const
+ {
+ return ci_.get();
+ }
+
+ inline const osg::Vec3 &Particle::getPosition() const
+ {
+ return position_;
+ }
+
+ inline const osg::Vec3 &Particle::getVelocity() const
+ {
+ return velocity_;
+ }
+
+ inline const osg::Vec3 &Particle::getPreviousPosition() const
+ {
+ return prev_pos_;
+ }
+
+ inline void Particle::kill()
+ {
+ mustdie_ = true;
+ }
+
+ inline void Particle::setLifeTime(double t)
+ {
+ lifetime_ = t;
+ }
+
+ inline void Particle::setSizeRange(const rangef &r)
+ {
+ sr_ = r;
+ }
+
+ inline void Particle::setAlphaRange(const rangef &r)
+ {
+ ar_ = r;
+ }
+
+ inline void Particle::setColorRange(const rangev4 &r)
+ {
+ cr_ = r;
+ }
+
+ inline void Particle::setSizeInterpolator(Interpolator *ri)
+ {
+ si_ = ri;
+ }
+
+ inline void Particle::setAlphaInterpolator(Interpolator *ai)
+ {
+ ai_ = ai;
+ }
+
+ inline void Particle::setColorInterpolator(Interpolator *ci)
+ {
+ ci_ = ci;
+ }
+
+ inline void Particle::setPosition(const osg::Vec3 &p)
+ {
+ position_ = p;
+ }
+
+ inline void Particle::setVelocity(const osg::Vec3 &v)
+ {
+ velocity_ = v;
+ }
+
+ inline void Particle::addVelocity(const osg::Vec3 &v)
+ {
+ velocity_ += v;
+ }
+
+ inline void Particle::transformPositionVelocity(const osg::Matrix &xform)
+ {
+ // this should be optimized!
+
+ osg::Vec3 p1 = position_ + velocity_;
+
+ position_ = xform.preMult(position_);
+ p1 = xform.preMult(p1);
+
+ velocity_ = p1 - position_;
+ }
+
+ inline float Particle::getMass() const
+ {
+ return mass_;
+ }
+
+ inline float Particle::getMassInv() const
+ {
+ return massinv_;
+ }
+
+ inline void Particle::setMass(float m)
+ {
+ mass_ = m;
+ massinv_ = 1 / m;
+ }
+
+ inline void Particle::beginRender()
+ {
+ switch (shape_)
+ {
+ case POINT:
+ glBegin(GL_POINTS);
+ break;
+ case QUAD:
+ glBegin(GL_QUADS);
+ break;
+ default: ;
+ }
+ }
+
+ inline void Particle::endRender()
+ {
+ switch (shape_)
+ {
+ case POINT:
+ case QUAD:
+ glEnd();
+ break;
+ default: ;
+ }
+ }
+
+
+}
+
+#endif
+
diff --git a/include/osgParticle/ParticleProcessor b/include/osgParticle/ParticleProcessor
new file mode 100644
index 000000000..8a193100d
--- /dev/null
+++ b/include/osgParticle/ParticleProcessor
@@ -0,0 +1,195 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_PARTICLEPROCESSOR_
+#define OSGPARTICLE_PARTICLEPROCESSOR_ 1
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace osgParticle
+{
+
+ /** A common base interface for those classes which need to do something on particles. Such classes
+ are, for example, Emitter (particle generation) and Program (particle animation).
+ This class holds some properties, like a reference frame and a reference to a ParticleSystem;
+ descendant classes should process the particles taking into account the reference frame, computing the right
+ transformations when needed.
+ */
+ class OSGPARTICLE_EXPORT ParticleProcessor: public osg::Node {
+ public:
+
+ enum ReferenceFrame {
+ RELATIVE_TO_PARENTS,
+ RELATIVE_TO_ABSOLUTE
+ };
+
+ ParticleProcessor();
+ ParticleProcessor(const ParticleProcessor ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
+
+ virtual const char *className() const { return "ParticleProcessor"; }
+ virtual bool isSameKindAs(const osg::Object *obj) { return dynamic_cast(obj) != 0; }
+ virtual void accept(osg::NodeVisitor& nv) { if (nv.validNodeMask(*this)) { nv.pushOntoNodePath(this); nv.apply(*this); nv.popFromNodePath(); } }
+
+ /// Get the reference frame.
+ inline ReferenceFrame getReferenceFrame() const;
+
+ /// Set the reference frame.
+ inline void setReferenceFrame(ReferenceFrame rf);
+
+ /// Get whether this processor is enabled or not.
+ inline bool isEnabled() const;
+
+ /// Set whether this processor is enabled or not.
+ inline void setEnabled(bool v);
+
+ /// Get a pointer to the destination particle system.
+ inline ParticleSystem *getParticleSystem();
+
+ /// Get a const pointer to the destination particle system.
+ inline const ParticleSystem *getParticleSystem() const;
+
+ /// Set the destination particle system.
+ inline void setParticleSystem(ParticleSystem *ps);
+
+ void traverse(osg::NodeVisitor &nv);
+
+ /// Get the current local-to-world transformation matrix (valid only during cull traversal).
+ inline const osg::Matrix &getLocalToWorldMatrix();
+
+ /// Get the current world-to-local transformation matrix (valid only during cull traversal).
+ inline const osg::Matrix &getWorldToLocalMatrix();
+
+ /// Transform a point from local to world coordinates (valid only during cull traversal).
+ inline osg::Vec3 transformLocalToWorld(const osg::Vec3 &P);
+
+ /// Transform a vector from local to world coordinates, discarding translation (valid only during cull traversal).
+ inline osg::Vec3 rotateLocalToWorld(const osg::Vec3 &P);
+
+ /// Transform a point from world to local coordinates (valid only during cull traversal).
+ inline osg::Vec3 transformWorldToLocal(const osg::Vec3 &P);
+
+ /// Transform a vector from world to local coordinates, discarding translation (valid only during cull traversal).
+ inline osg::Vec3 rotateWorldToLocal(const osg::Vec3 &P);
+
+ protected:
+ virtual ~ParticleProcessor() {}
+ ParticleProcessor &operator=(const ParticleProcessor &) { return *this; }
+
+ inline const bool computeBound() const;
+
+ virtual void process(double dt) = 0;
+
+ private:
+ ReferenceFrame rf_;
+ bool enabled_;
+ double t0_;
+ osg::ref_ptr ps_;
+ bool need_ltw_matrix_;
+ bool need_wtl_matrix_;
+ osg::Matrix ltw_matrix_;
+ osg::Matrix wtl_matrix_;
+ osg::NodeVisitor *current_nodevisitor_;
+ };
+
+ // INLINE FUNCTIONS
+
+ inline ParticleProcessor::ReferenceFrame ParticleProcessor::getReferenceFrame() const
+ {
+ return rf_;
+ }
+
+ inline void ParticleProcessor::setReferenceFrame(ReferenceFrame rf)
+ {
+ rf_ = rf;
+ }
+
+ inline bool ParticleProcessor::isEnabled() const
+ {
+ return enabled_;
+ }
+
+ inline void ParticleProcessor::setEnabled(bool v)
+ {
+ enabled_ = v;
+ if (enabled_) t0_ = -1;
+ }
+
+ inline ParticleSystem *ParticleProcessor::getParticleSystem()
+ {
+ return ps_.get();
+ }
+
+ inline const ParticleSystem *ParticleProcessor::getParticleSystem() const
+ {
+ return ps_.get();
+ }
+
+ inline void ParticleProcessor::setParticleSystem(ParticleSystem *ps)
+ {
+ ps_ = ps;
+ }
+
+ inline const bool ParticleProcessor::computeBound() const
+ {
+ _bsphere.init();
+ _bsphere_computed = true;
+ return true;
+ }
+
+ inline const osg::Matrix &ParticleProcessor::getLocalToWorldMatrix()
+ {
+ if (need_ltw_matrix_) {
+ ltw_matrix_ = osg::Matrix::identity();
+ current_nodevisitor_->getLocalToWorldMatrix(ltw_matrix_, this);
+ need_ltw_matrix_ = false;
+ }
+ return ltw_matrix_;
+ }
+
+ inline const osg::Matrix &ParticleProcessor::getWorldToLocalMatrix()
+ {
+ if (need_wtl_matrix_) {
+ wtl_matrix_ = osg::Matrix::identity();
+ current_nodevisitor_->getWorldToLocalMatrix(wtl_matrix_, this);
+ need_wtl_matrix_ = false;
+ }
+ return wtl_matrix_;
+ }
+
+ inline osg::Vec3 ParticleProcessor::transformLocalToWorld(const osg::Vec3 &P)
+ {
+ return getLocalToWorldMatrix().preMult(P);
+ }
+
+ inline osg::Vec3 ParticleProcessor::transformWorldToLocal(const osg::Vec3 &P)
+ {
+ return getWorldToLocalMatrix().preMult(P);
+ }
+
+ inline osg::Vec3 ParticleProcessor::rotateLocalToWorld(const osg::Vec3 &P)
+ {
+ return getLocalToWorldMatrix().preMult(P) -
+ getLocalToWorldMatrix().preMult(osg::Vec3(0, 0, 0));
+ }
+
+ inline osg::Vec3 ParticleProcessor::rotateWorldToLocal(const osg::Vec3 &P)
+ {
+ return getWorldToLocalMatrix().preMult(P) -
+ getWorldToLocalMatrix().preMult(osg::Vec3(0, 0, 0));
+ }
+
+}
+
+
+#endif
diff --git a/include/osgParticle/ParticleSystem b/include/osgParticle/ParticleSystem
new file mode 100644
index 000000000..a06d3a7c7
--- /dev/null
+++ b/include/osgParticle/ParticleSystem
@@ -0,0 +1,318 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_PARTICLESYSTEM_
+#define OSGPARTICLE_PARTICLESYSTEM_ 1
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace osgParticle
+{
+
+ /** The heart of this class library; its purpose is to hold a set of particles and manage particle creation, update, rendering and destruction.
+ You can add this drawable to any Geode as you usually do with other
+ Drawable classes. Each instance of ParticleSystem is a separate set of
+ particles; it provides the interface for creating particles and iterating
+ through them (see the Emitter and Program classes).
+ */
+ class OSGPARTICLE_EXPORT ParticleSystem: public osg::Drawable {
+ public:
+
+ ParticleSystem();
+ ParticleSystem(const ParticleSystem ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
+
+ META_Object(ParticleSystem);
+
+ /// Get the default bounding box
+ inline const osg::BoundingBox &getDefaultBoundingBox() const;
+
+ /** Set the default bounding box.
+ The default bounding box is used when a real bounding box cannot be computed, for example
+ because no particles has been updated yet.
+ */
+ inline void setDefaultBoundingBox(const osg::BoundingBox &bbox);
+
+ /// Get the double pass rendering flag.
+ inline bool getDoublePassRendering() const;
+
+ /** Set the double pass rendering flag.
+ Double pass rendering avoids overdraw problems between particle systems
+ and other opaque objects. If you can render all the particle systems after
+ the opaque objects, then double pass is not necessary and can be turned off (best choice).
+ If you set the default attributes with setDefaultAttributes, then the particle
+ system will fall into a transparent bin.
+ */
+ inline void setDoublePassRendering(bool v);
+
+ /// Return true if the particle system is frozen.
+ inline bool isFrozen() const;
+
+ /** Set or reset the frozen state.
+ When the particle system is frozen, emitters and programs won't do anything on it.
+ */
+ inline void setFrozen(bool v);
+
+ /// Get the number of allocated particles (alive + dead).
+ inline int numParticles() const;
+
+ /// Get the number of dead particles.
+ inline int numDeadParticles() const;
+
+ /// Get a pointer to the i-th particle.
+ inline Particle *getParticle(int i);
+
+ /// Get a const pointer to the i-th particle.
+ inline const Particle *getParticle(int i) const;
+
+ /// Create a new particle from the specified template (or the default one if ptemplate is null).
+ inline virtual Particle *createParticle(const Particle *ptemplate);
+
+ /// Destroy the i-th particle.
+ inline virtual void destroyParticle(int i);
+
+ /// Get the last frame number.
+ inline int getLastFrameNumber() const;
+
+ /// Get a reference to the default particle template.
+ inline const Particle &getDefaultParticleTemplate() const;
+
+ /// Set the default particle template (particle is copied).
+ inline void setDefaultParticleTemplate(const Particle &p);
+
+ /// Get whether the particle system can freeze when culled
+ inline bool getFreezeOnCull() const;
+
+ /// Set whether the particle system can freeze when culled (default is true)
+ inline void setFreezeOnCull(bool v);
+
+ /** A useful method to set the most common StateAttribute's in one call.
+ If texturefile is empty, then texturing is turned off.
+ */
+ void setDefaultAttributes(const std::string &texturefile = "", bool emissive_particles = true, bool lighting = false);
+
+ /// (EXPERIMENTAL) Get the level of detail.
+ inline int getLevelOfDetail() const;
+
+ /** (EXPERIMENTAL) Set the level of detail. The total number of particles is divided by the detail value to
+ get the actual number of particles to be drawn. This value must be greater than zero.
+ */
+ inline void setLevelOfDetail(int v);
+
+ /// Update the particles. Don't call this directly, use a ParticleSystemUpdater instead.
+ virtual void update(double dt);
+
+ inline virtual bool getStats(osg::Statistics &stats);
+
+ protected:
+ virtual ~ParticleSystem();
+
+ ParticleSystem &operator=(const ParticleSystem &) { return *this; }
+
+ inline virtual const bool computeBound() const;
+ virtual void drawImmediateMode(osg::State &state);
+ inline void update_bounds(const osg::Vec3 &p);
+ void single_pass_render(const osg::Matrix &modelview);
+
+ private:
+ typedef std::vector Particle_vector;
+ typedef std::stack Death_stack;
+
+ Particle_vector particles_;
+ Death_stack deadparts_;
+
+ osg::BoundingBox def_bbox_;
+
+ bool doublepass_;
+ bool frozen_;
+ int display_list_id_;
+
+ osg::Vec3 bmin_;
+ osg::Vec3 bmax_;
+
+ bool reset_bounds_flag_;
+ bool bounds_computed_;
+
+ Particle def_ptemp_;
+ int last_frame_;
+ bool freeze_on_cull_;
+
+ int detail_;
+ int draw_count_;
+
+ };
+
+ // INLINE FUNCTIONS
+
+ inline bool ParticleSystem::isFrozen() const
+ {
+ return frozen_;
+ }
+
+ inline void ParticleSystem::setFrozen(bool v)
+ {
+ frozen_ = v;
+ }
+
+ inline const osg::BoundingBox &ParticleSystem::getDefaultBoundingBox() const
+ {
+ return def_bbox_;
+ }
+
+ inline void ParticleSystem::setDefaultBoundingBox(const osg::BoundingBox &bbox)
+ {
+ def_bbox_ = bbox;
+ }
+
+ inline bool ParticleSystem::getDoublePassRendering() const
+ {
+ return doublepass_;
+ }
+
+ inline void ParticleSystem::setDoublePassRendering(bool v)
+ {
+ doublepass_ = v;
+ }
+
+ inline int ParticleSystem::numParticles() const
+ {
+ return static_cast(particles_.size());
+ }
+
+ inline int ParticleSystem::numDeadParticles() const
+ {
+ return static_cast(deadparts_.size());
+ }
+
+ inline Particle *ParticleSystem::getParticle(int i)
+ {
+ return &particles_[i];
+ }
+
+ inline const Particle *ParticleSystem::getParticle(int i) const
+ {
+ return &particles_[i];
+ }
+
+ inline void ParticleSystem::destroyParticle(int i)
+ {
+ particles_[i].kill();
+ }
+
+ inline int ParticleSystem::getLastFrameNumber() const
+ {
+ return last_frame_;
+ }
+
+ inline const bool ParticleSystem::computeBound() const
+ {
+ if (!bounds_computed_) {
+ _bbox = def_bbox_;
+ } else {
+ _bbox._min = bmin_;
+ _bbox._max = bmax_;
+ }
+ _bbox_computed = true;
+ return true;
+ }
+
+ inline bool ParticleSystem::getStats(osg::Statistics &stats)
+ {
+ stats.addNumPrims(draw_count_);
+ return true;
+ }
+
+ inline void ParticleSystem::update_bounds(const osg::Vec3 &p)
+ {
+ if (reset_bounds_flag_) {
+ reset_bounds_flag_ = false;
+ bmin_ = p;
+ bmax_ = p;
+ } else {
+ if (p.x() < bmin_.x()) bmin_.x() = p.x();
+ if (p.y() < bmin_.y()) bmin_.y() = p.y();
+ if (p.z() < bmin_.z()) bmin_.z() = p.z();
+ if (p.x() > bmax_.x()) bmax_.x() = p.x();
+ if (p.y() > bmax_.y()) bmax_.y() = p.y();
+ if (p.z() > bmax_.z()) bmax_.z() = p.z();
+
+ if (!bounds_computed_)
+ bounds_computed_ = true;
+ }
+ }
+
+ inline const Particle &ParticleSystem::getDefaultParticleTemplate() const
+ {
+ return def_ptemp_;
+ }
+
+ inline void ParticleSystem::setDefaultParticleTemplate(const Particle &p)
+ {
+ def_ptemp_ = p;
+ }
+
+ inline bool ParticleSystem::getFreezeOnCull() const
+ {
+ return freeze_on_cull_;
+ }
+
+ inline void ParticleSystem::setFreezeOnCull(bool v)
+ {
+ freeze_on_cull_ = v;
+ }
+
+ inline int ParticleSystem::getLevelOfDetail() const
+ {
+ return detail_;
+ }
+
+ inline void ParticleSystem::setLevelOfDetail(int v)
+ {
+ if (v < 1) v = 1;
+ detail_ = v;
+ }
+
+ // I'm not sure this function should be inlined...
+
+ inline Particle *ParticleSystem::createParticle(const Particle *ptemplate)
+ {
+ // is there any dead particle?
+ if (!deadparts_.empty()) {
+
+ // retrieve a pointer to the last dead particle
+ Particle *P = deadparts_.top();
+
+ // create a new (alive) particle in the same place
+ *P = Particle(ptemplate? *ptemplate: def_ptemp_);
+
+ // remove the pointer from the death stack
+ deadparts_.pop();
+ return P;
+
+ } else {
+
+ // add a new particle to the vector
+ particles_.push_back(Particle(ptemplate? *ptemplate: def_ptemp_));
+ return &particles_.back();
+ }
+ }
+
+
+}
+
+#endif
diff --git a/include/osgParticle/ParticleSystemUpdater b/include/osgParticle/ParticleSystemUpdater
new file mode 100644
index 000000000..2f23341b1
--- /dev/null
+++ b/include/osgParticle/ParticleSystemUpdater
@@ -0,0 +1,128 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_PARTICLESYSTEMUPDATER_
+#define OSGPARTICLE_PARTICLESYSTEMUPDATER_ 1
+
+#include
+#include
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+namespace osgParticle
+{
+
+ /** A useful node class for updating particle systems automatically.
+ When a ParticleSystemUpdater is traversed by a cull visitor, it calls the
+ update() method on the specified particle systems. You should place this updater
+ AFTER other nodes like emitters and programs.
+ */
+ class OSGPARTICLE_EXPORT ParticleSystemUpdater: public osg::Node {
+ public:
+ ParticleSystemUpdater();
+ ParticleSystemUpdater(const ParticleSystemUpdater ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
+
+ META_Node(ParticleSystemUpdater);
+
+ /// Return the number of particle systems on the list.
+ inline int numParticleSystems() const;
+
+ /// Add a particle system to the list.
+ inline void addParticleSystem(ParticleSystem *ps);
+
+ /// Get a const particle system from the list.
+ inline const ParticleSystem *getParticleSystem(int i) const;
+
+ /// Get a particle system from the list.
+ inline ParticleSystem *getParticleSystem(int i);
+
+ /// Find a particle system.
+ inline int findParticleSystem(ParticleSystem *ps) const;
+
+ /// Remove a particle system from the list (by index).
+ inline void removeParticleSystem(int i);
+
+ /// Remove a particle system from the list (by pointer).
+ inline bool removeParticleSystem(ParticleSystem *ps);
+
+ virtual void traverse(osg::NodeVisitor &nv);
+
+ protected:
+ virtual ~ParticleSystemUpdater() {}
+ ParticleSystemUpdater &operator=(const ParticleSystemUpdater &) { return *this; }
+
+ inline virtual const bool computeBound() const;
+
+ private:
+ typedef std::vector > ParticleSystem_Vector;
+
+ ParticleSystem_Vector psv_;
+ double t0_;
+ };
+
+ // INLINE FUNCTIONS
+
+ inline const bool ParticleSystemUpdater::computeBound() const
+ {
+ _bsphere.init();
+ _bsphere_computed = true;
+ return true;
+ }
+
+ inline int ParticleSystemUpdater::numParticleSystems() const
+ {
+ return static_cast(psv_.size());
+ }
+
+ inline void ParticleSystemUpdater::addParticleSystem(ParticleSystem *ps)
+ {
+ psv_.push_back(ps);
+ }
+
+ inline const ParticleSystem *ParticleSystemUpdater::getParticleSystem(int i) const
+ {
+ return psv_[i].get();
+ }
+
+ inline ParticleSystem *ParticleSystemUpdater::getParticleSystem(int i)
+ {
+ return psv_[i].get();
+ }
+
+ inline void ParticleSystemUpdater::removeParticleSystem(int i)
+ {
+ psv_.erase(psv_.begin()+i);
+ }
+
+ inline int ParticleSystemUpdater::findParticleSystem(ParticleSystem *ps) const
+ {
+ ParticleSystem_Vector::const_iterator i;
+ int j = 0;
+ for (i=psv_.begin(); i!=psv_.end(); ++i, ++j) {
+ if (i->get() == ps) return j;
+ }
+ return -1;
+ }
+
+ inline bool ParticleSystemUpdater::removeParticleSystem(ParticleSystem *ps)
+ {
+ int i = findParticleSystem(ps);
+ if (i == -1) return false;
+ removeParticleSystem(i);
+ return true;
+ }
+
+
+}
+
+#endif
diff --git a/include/osgParticle/Placer b/include/osgParticle/Placer
new file mode 100644
index 000000000..d96dbf90e
--- /dev/null
+++ b/include/osgParticle/Placer
@@ -0,0 +1,51 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_PLACER_
+#define OSGPARTICLE_PLACER_ 1
+
+#include
+#include
+
+namespace osgParticle
+{
+
+ class Particle;
+
+ /** An abstract base class for implementing particle placers. A placer is an object which take
+ a particle as input, and places it somewhere by setting its position vector. Placer objects are
+ used by the ModularEmitter class as part of the particle emission process.
+ */
+ class Placer: public osg::Object {
+ public:
+ inline Placer();
+ inline Placer(const Placer ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
+
+ virtual const char *className() const { return "Placer"; }
+ virtual bool isSameKindAs(const osg::Object *obj) const { return dynamic_cast(obj) != 0; }
+
+ /// Place a particle. Must be implemented in descendant classes.
+ virtual void place(Particle *P) const = 0;
+
+ protected:
+ ~Placer() {}
+ Placer &operator=(const Placer &) { return *this; }
+ };
+
+ // INLINE FUNCTIONS
+
+ inline Placer::Placer()
+ : osg::Object()
+ {
+ }
+
+ inline Placer::Placer(const Placer ©, const osg::CopyOp ©op)
+ : osg::Object(copy, copyop)
+ {
+ }
+
+}
+
+#endif
diff --git a/include/osgParticle/PointPlacer b/include/osgParticle/PointPlacer
new file mode 100644
index 000000000..1143712c3
--- /dev/null
+++ b/include/osgParticle/PointPlacer
@@ -0,0 +1,61 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_POINTPLACER_
+#define OSGPARTICLE_POINTPLACER_ 1
+
+#include
+#include
+
+#include
+#include
+
+namespace osgParticle
+{
+
+ /** A point-shaped particle placer.
+ This placer class uses the center point defined in its base class CenteredPlacer
+ to place there all incoming particles.
+ */
+ class PointPlacer: public CenteredPlacer {
+ public:
+ inline PointPlacer();
+ inline PointPlacer(const PointPlacer ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
+
+ META_Object(PointPlacer);
+
+ /** Place a particle.
+ This method is called automatically by ModularEmitter and should not be called
+ manually.
+ */
+ inline void place(Particle *P) const;
+
+ protected:
+ virtual ~PointPlacer() {}
+ PointPlacer &operator=(const PointPlacer &) { return *this; }
+ };
+
+ // INLINE FUNCTIONS
+
+ inline PointPlacer::PointPlacer()
+ : CenteredPlacer()
+ {
+ }
+
+ inline PointPlacer::PointPlacer(const PointPlacer ©, const osg::CopyOp ©op)
+ : CenteredPlacer(copy, copyop)
+ {
+ }
+
+ inline void PointPlacer::place(Particle *P) const
+ {
+ P->setPosition(getCenter());
+ }
+
+
+}
+
+
+#endif
diff --git a/include/osgParticle/Program b/include/osgParticle/Program
new file mode 100644
index 000000000..cfce7ff8b
--- /dev/null
+++ b/include/osgParticle/Program
@@ -0,0 +1,57 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_PROGRAM_
+#define OSGPARTICLE_PROGRAM_ 1
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+namespace osgParticle
+{
+
+ /** An abstract ParticleProcessor descendant for modifying particles "on the fly"
+ during the cull traversal.
+ Descendants of this class must implement the execute() method, which should iterate
+ through all particles in the linked particle system and modify them somehow
+ (usually updating their velocity vector).
+ */
+ class OSGPARTICLE_EXPORT Program: public ParticleProcessor {
+ public:
+ Program();
+ Program(const Program ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
+
+ virtual const char *className() const { return "Program"; }
+ virtual bool isSameKindAs(const osg::Object *obj) { return dynamic_cast(obj) != 0; }
+ virtual void accept(osg::NodeVisitor& nv) { if (nv.validNodeMask(*this)) { nv.pushOntoNodePath(this); nv.apply(*this); nv.popFromNodePath(); } }
+
+ protected:
+ virtual ~Program() {}
+ Program &operator=(const Program &) { return *this; }
+
+ /// Implementation of ParticleProcessor::process(). Do not call this method by yourself.
+ inline void process(double dt);
+
+ /// Execute the program on the particle system. Must be overriden in descendant classes.
+ virtual void execute(double dt) = 0;
+
+ private:
+ };
+
+ // INLINE FUNCTIONS
+
+ inline void Program::process(double dt)
+ {
+ execute(dt);
+ }
+
+}
+
+#endif
diff --git a/include/osgParticle/RadialShooter b/include/osgParticle/RadialShooter
new file mode 100644
index 000000000..4bb851f40
--- /dev/null
+++ b/include/osgParticle/RadialShooter
@@ -0,0 +1,156 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_RADIALSHOOTER_
+#define OSGPARTICLE_RADIALSHOOTER_ 1
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+namespace osgParticle
+{
+
+ /** A shooter class that shoots particles radially.
+ This shooter computes the velocity vector of incoming particles by choosing a
+ random direction and a random speed. Both direction and speed are chosen within
+ specified ranges. The direction is defined by two angles: theta, which
+ is the angle between the velocity vector and the Z axis, and phi, which is
+ the angle between the X axis and the velocity vector projected onto the X-Y plane.
+ */
+ class RadialShooter: public Shooter {
+ public:
+ inline RadialShooter();
+ inline RadialShooter(const RadialShooter ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
+
+ META_Object(RadialShooter);
+
+ /// Get the range of possible values for theta angle.
+ inline const rangef &getThetaRange() const;
+
+ /// Set the range of possible values for theta angle.
+ inline void setThetaRange(const rangef &r);
+
+ /// Set the range of possible values for theta angle.
+ inline void setThetaRange(float r1, float r2);
+
+ /// Get the range of possible values for phi angle.
+ inline const rangef &getPhiRange() const;
+
+ /// Set the range of possible values for phi angle.
+ inline void setPhiRange(const rangef &r);
+
+ /// Set the range of possible values for phi angle.
+ inline void setPhiRange(float r1, float r2);
+
+ /// Get the range of possible values for initial speed of particles.
+ inline const rangef &getInitialSpeedRange() const;
+
+ /// Set the range of possible values for initial speed of particles.
+ inline void setInitialSpeedRange(const rangef &r);
+
+ /// Set the range of possible values for initial speed of particles.
+ inline void setInitialSpeedRange(float r1, float r2);
+
+ /// Shoot a particle. Do not call this method manually.
+ inline void shoot(Particle *P) const;
+
+ protected:
+ virtual ~RadialShooter() {}
+ RadialShooter &operator=(const RadialShooter &) { return *this; }
+
+ private:
+ rangef theta_range_;
+ rangef phi_range_;
+ rangef speed_range_;
+ };
+
+ // INLINE FUNCTIONS
+
+ inline RadialShooter::RadialShooter()
+ : Shooter(),
+ theta_range_(0, 0.5f*osg::PI_4),
+ phi_range_(0, 2*osg::PI),
+ speed_range_(10, 10)
+ {
+ }
+
+ inline RadialShooter::RadialShooter(const RadialShooter ©, const osg::CopyOp ©op)
+ : Shooter(copy, copyop),
+ theta_range_(copy.theta_range_),
+ phi_range_(copy.phi_range_),
+ speed_range_(copy.speed_range_)
+ {
+ }
+
+ inline const rangef &RadialShooter::getThetaRange() const
+ {
+ return theta_range_;
+ }
+
+ inline const rangef &RadialShooter::getPhiRange() const
+ {
+ return phi_range_;
+ }
+
+ inline const rangef &RadialShooter::getInitialSpeedRange() const
+ {
+ return speed_range_;
+ }
+
+ inline void RadialShooter::setThetaRange(const rangef &r)
+ {
+ theta_range_ = r;
+ }
+
+ inline void RadialShooter::setThetaRange(float r1, float r2)
+ {
+ theta_range_.min = r1;
+ theta_range_.max = r2;
+ }
+
+ inline void RadialShooter::setPhiRange(const rangef &r)
+ {
+ phi_range_ = r;
+ }
+
+ inline void RadialShooter::setPhiRange(float r1, float r2)
+ {
+ phi_range_.min = r1;
+ phi_range_.max = r2;
+ }
+
+ inline void RadialShooter::setInitialSpeedRange(const rangef &r)
+ {
+ speed_range_ = r;
+ }
+
+ inline void RadialShooter::setInitialSpeedRange(float r1, float r2)
+ {
+ speed_range_.min = r1;
+ speed_range_.max = r2;
+ }
+
+ inline void RadialShooter::shoot(Particle *P) const
+ {
+ float theta = theta_range_.get_random();
+ float phi = phi_range_.get_random();
+ float speed = speed_range_.get_random();
+
+ P->setVelocity(osg::Vec3(
+ speed * sinf(theta) * cosf(phi),
+ speed * sinf(theta) * sinf(phi),
+ speed * cosf(theta)
+ ));
+ }
+
+}
+
+
+#endif
diff --git a/include/osgParticle/RandomRateCounter b/include/osgParticle/RandomRateCounter
new file mode 100644
index 000000000..937017420
--- /dev/null
+++ b/include/osgParticle/RandomRateCounter
@@ -0,0 +1,57 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_RANDOMRATECOUNTER_
+#define OSGPARTICLE_RANDOMRATECOUNTER_ 1
+
+#include
+
+#include
+#include
+
+namespace osgParticle
+{
+
+ class RandomRateCounter: public VariableRateCounter {
+ public:
+ inline RandomRateCounter();
+ inline RandomRateCounter(const RandomRateCounter ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
+
+ META_Object(RandomRateCounter);
+
+ /// Return the number of particles to be created in this frame
+ inline int numParticlesToCreate(double dt) const;
+
+ protected:
+ virtual ~RandomRateCounter() {}
+
+ private:
+ mutable float np_;
+ };
+
+ // INLINE FUNCTIONS
+
+ inline RandomRateCounter::RandomRateCounter()
+ : VariableRateCounter(), np_(0)
+ {
+ }
+
+ inline RandomRateCounter::RandomRateCounter(const RandomRateCounter ©, const osg::CopyOp ©op)
+ : VariableRateCounter(copy, copyop), np_(copy.np_)
+ {
+ }
+
+ inline int RandomRateCounter::numParticlesToCreate(double dt) const
+ {
+ np_ += dt * getRateRange().get_random();
+ int n = static_cast(np_);
+ np_ -= n;
+ return n;
+ }
+
+}
+
+
+#endif
diff --git a/include/osgParticle/SectorPlacer b/include/osgParticle/SectorPlacer
new file mode 100644
index 000000000..225f09dac
--- /dev/null
+++ b/include/osgParticle/SectorPlacer
@@ -0,0 +1,124 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_SECTORPLACER_
+#define OSGPARTICLE_SECTORPLACER_ 1
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+namespace osgParticle
+{
+
+ /** A sector-shaped particle placer.
+ This placer sets the initial position of incoming particle by choosing a random position
+ within a circular sector; this sector is defined by three parameters: a center point,
+ which is inherited directly from osgParticle::CenteredPlacer, a range of values
+ for radius, and a range of values for the central angle (sometimes called phi).
+ */
+ class SectorPlacer: public CenteredPlacer {
+ public:
+ inline SectorPlacer();
+ inline SectorPlacer(const SectorPlacer ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
+
+ /// Get the range of possible values for radius.
+ inline const rangef &getRadiusRange() const;
+
+ /// Set the range of possible values for radius.
+ inline void setRadiusRange(const rangef &r);
+
+ /// Set the range of possible values for radius.
+ inline void setRadiusRange(float r1, float r2);
+
+ /// Get the range of possible values for the central angle.
+ inline const rangef &getPhiRange() const;
+
+ /// Set the range of possible values for the central angle.
+ inline void setPhiRange(const rangef &r);
+
+ /// Set the range of possible values for the central angle.
+ inline void setPhiRange(float r1, float r2);
+
+ META_Object(SectorPlacer);
+
+ /// Place a particle. Do not call it manually.
+ inline void place(Particle *P) const;
+
+ protected:
+ virtual ~SectorPlacer() {}
+ SectorPlacer &operator=(const SectorPlacer &) { return *this; }
+
+ private:
+ rangef rad_range_;
+ rangef phi_range_;
+ };
+
+ // INLINE FUNCTIONS
+
+ inline SectorPlacer::SectorPlacer()
+ : CenteredPlacer(), rad_range_(0, 1), phi_range_(0, osg::PI*2)
+ {
+ }
+
+ inline SectorPlacer::SectorPlacer(const SectorPlacer ©, const osg::CopyOp ©op)
+ : CenteredPlacer(copy, copyop), rad_range_(copy.rad_range_), phi_range_(copy.phi_range_)
+ {
+ }
+
+ inline const rangef &SectorPlacer::getRadiusRange() const
+ {
+ return rad_range_;
+ }
+
+ inline const rangef &SectorPlacer::getPhiRange() const
+ {
+ return phi_range_;
+ }
+
+ inline void SectorPlacer::setRadiusRange(const rangef &r)
+ {
+ rad_range_ = r;
+ }
+
+ inline void SectorPlacer::setRadiusRange(float r1, float r2)
+ {
+ rad_range_.min = r1;
+ rad_range_.max = r2;
+ }
+
+ inline void SectorPlacer::setPhiRange(const rangef &r)
+ {
+ phi_range_ = r;
+ }
+
+ inline void SectorPlacer::setPhiRange(float r1, float r2)
+ {
+ phi_range_.min = r1;
+ phi_range_.max = r2;
+ }
+
+ inline void SectorPlacer::place(Particle *P) const
+ {
+ float rad = rad_range_.get_random();
+ float phi = phi_range_.get_random();
+
+ osg::Vec3 pos(
+ getCenter().x() + rad * cosf(phi),
+ getCenter().y() + rad * sinf(phi),
+ getCenter().z());
+
+ P->setPosition(pos);
+ }
+
+
+}
+
+#endif
diff --git a/include/osgParticle/SegmentPlacer b/include/osgParticle/SegmentPlacer
new file mode 100644
index 000000000..381bcd1c8
--- /dev/null
+++ b/include/osgParticle/SegmentPlacer
@@ -0,0 +1,118 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_SEGMENTPLACER_
+#define OSGPARTICLE_SEGMENTPLACER_ 1
+
+#include
+#include
+
+#include
+#include
+#include
+
+namespace osgParticle {
+
+ /** A segment-shaped particle placer.
+ To use this placer you have to define a segment, by setting its two vertices (A and B);
+ when an emitter requests a SegmentPlacer to place a particle, the position is chosen randomly
+ within that segment.
+ */
+ class SegmentPlacer: public Placer {
+ public:
+ inline SegmentPlacer();
+ inline SegmentPlacer(const SegmentPlacer ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
+
+ META_Object(SegmentPlacer);
+
+ /// get vertex A.
+ inline const osg::Vec3 &getVertexA() const;
+
+ /// Set vertex A of the segment as a vector.
+ inline void setVertexA(const osg::Vec3 &v);
+
+ /// Set vertex A of the segment as three floats.
+ inline void setVertexA(float x, float y, float z);
+
+ /// get vertex B.
+ inline const osg::Vec3 &getVertexB() const;
+
+ /// Set vertex B of the segment as a vector.
+ inline void setVertexB(const osg::Vec3 &v);
+
+ /// Set vertex B of the segment as three floats.
+ inline void setVertexB(float x, float y, float z);
+
+ /// Set both vertices.
+ inline void setSegment(const osg::Vec3 &A, const osg::Vec3 &B);
+
+ /// Place a particle. This method is called by ModularEmitter, do not call it manually.
+ inline void place(Particle *P) const;
+
+ protected:
+ virtual ~SegmentPlacer() {}
+ SegmentPlacer &operator=(const SegmentPlacer &) { return *this; }
+
+ private:
+ osg::Vec3 A_;
+ osg::Vec3 B_;
+ };
+
+ // INLINE FUNCTIONS
+
+ inline SegmentPlacer::SegmentPlacer()
+ : Placer(), A_(-1, 0, 0), B_(1, 0, 0)
+ {
+ }
+
+ inline SegmentPlacer::SegmentPlacer(const SegmentPlacer ©, const osg::CopyOp ©op)
+ : Placer(copy, copyop), A_(copy.A_), B_(copy.B_)
+ {
+ }
+
+ inline const osg::Vec3 &SegmentPlacer::getVertexA() const
+ {
+ return A_;
+ }
+
+ inline const osg::Vec3 &SegmentPlacer::getVertexB() const
+ {
+ return B_;
+ }
+
+ inline void SegmentPlacer::setSegment(const osg::Vec3 &A, const osg::Vec3 &B)
+ {
+ A_ = A;
+ B_ = B;
+ }
+
+ inline void SegmentPlacer::place(Particle *P) const
+ {
+ P->setPosition(rangev3(A_, B_).get_random());
+ }
+
+ inline void SegmentPlacer::setVertexA(const osg::Vec3 &v)
+ {
+ A_ = v;
+ }
+
+ inline void SegmentPlacer::setVertexA(float x, float y, float z)
+ {
+ A_.set(x, y, z);
+ }
+
+ inline void SegmentPlacer::setVertexB(const osg::Vec3 &v)
+ {
+ B_ = v;
+ }
+
+ inline void SegmentPlacer::setVertexB(float x, float y, float z)
+ {
+ B_.set(x, y, z);
+ }
+
+}
+
+#endif
diff --git a/include/osgParticle/Shooter b/include/osgParticle/Shooter
new file mode 100644
index 000000000..b1ee010e2
--- /dev/null
+++ b/include/osgParticle/Shooter
@@ -0,0 +1,53 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_SHOOTER_
+#define OSGPARTICLE_SHOOTER_ 1
+
+#include
+#include
+
+namespace osgParticle
+{
+
+ class Particle;
+
+ /** An abstract base class used by ModularEmitter to "shoot" the particles after they have been placed.
+ Descendants of this class must override the shoot() method.
+ */
+ class Shooter: public osg::Object {
+ public:
+ inline Shooter();
+ inline Shooter(const Shooter ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
+
+ virtual const char *className() const { return "Shooter"; }
+ virtual bool isSameKindAs(const osg::Object *obj) const { return dynamic_cast(obj) != 0; }
+
+ /** Shoot a particle. Must be overriden by descendants.
+ This method should only set the velocity vector of particle P, leaving other
+ attributes unchanged.
+ */
+ virtual void shoot(Particle *P) const = 0;
+
+ protected:
+ virtual ~Shooter() {}
+ Shooter &operator=(const Shooter &) { return *this; }
+ };
+
+ // INLINE FUNCTIONS
+
+ inline Shooter::Shooter()
+ : osg::Object()
+ {
+ }
+
+ inline Shooter::Shooter(const Shooter ©, const osg::CopyOp ©op)
+ : osg::Object(copy, copyop)
+ {
+ }
+
+}
+
+#endif
diff --git a/include/osgParticle/VariableRateCounter b/include/osgParticle/VariableRateCounter
new file mode 100644
index 000000000..727b7ba0e
--- /dev/null
+++ b/include/osgParticle/VariableRateCounter
@@ -0,0 +1,67 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_VARIABLERATECOUNTER_
+#define OSGPARTICLE_VARIABLERATECOUNTER_ 1
+
+#include
+#include
+
+#include
+#include
+
+namespace osgParticle
+{
+
+ class VariableRateCounter: public Counter {
+ public:
+ inline VariableRateCounter();
+ inline VariableRateCounter(const VariableRateCounter ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY);
+
+ virtual const char *className() const { return "VariableRateCounter"; }
+ virtual bool isSameKindAs(const osg::Object *obj) const { return dynamic_cast(obj) != 0; }
+
+ inline const rangef &getRateRange() const;
+ inline void setRateRange(const rangef &r);
+ inline void setRateRange(float minrange, float maxrange);
+
+ protected:
+ virtual ~VariableRateCounter() {}
+
+ private:
+ rangef rate_range_;
+ };
+
+ // INLINE FUNCTIONS
+
+ inline VariableRateCounter::VariableRateCounter()
+ : Counter(), rate_range_(1, 1)
+ {
+ }
+
+ inline VariableRateCounter::VariableRateCounter(const VariableRateCounter ©, const osg::CopyOp ©op)
+ : Counter(copy, copyop), rate_range_(copy.rate_range_)
+ {
+ }
+
+ inline const rangef &VariableRateCounter::getRateRange() const
+ {
+ return rate_range_;
+ }
+
+ inline void VariableRateCounter::setRateRange(const rangef &r)
+ {
+ rate_range_ = r;
+ }
+
+ inline void VariableRateCounter::setRateRange(float minrange, float maxrange)
+ {
+ rate_range_.set(minrange, maxrange);
+ }
+
+}
+
+
+#endif
diff --git a/include/osgParticle/Version b/include/osgParticle/Version
new file mode 100644
index 000000000..5ff598bc6
--- /dev/null
+++ b/include/osgParticle/Version
@@ -0,0 +1,19 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_VERSION_
+#define OSGPARTICLE_VERSION_ 1
+
+#include
+
+extern "C" {
+
+OSGPARTICLE_EXPORT const char* osgParticleGetVersion();
+OSGPARTICLE_EXPORT const char* osgParticleGetLibraryName();
+
+}
+
+#endif
+
diff --git a/include/osgParticle/range b/include/osgParticle/range
new file mode 100644
index 000000000..d3bc93a4c
--- /dev/null
+++ b/include/osgParticle/range
@@ -0,0 +1,65 @@
+//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
+//Distributed under the terms of the GNU Library General Public License (LGPL)
+//as published by the Free Software Foundation.
+//osgParticle - Copyright (C) 2002 Marco Jez
+
+#ifndef OSGPARTICLE_RANGE_
+#define OSGPARTICLE_RANGE_ 1
+
+#include
+
+#include
+#include
+#include
+
+namespace osgParticle
+{
+
+ /**
+ A simple struct template useful to store ranges of values as min/max pairs.
+ This struct template helps storing min/max ranges for values of any kind; class T_ is
+ the type of values to be stored, and it must support operations T_ + T_, T_ - T_,
+ and T_ * float, otherwise the get_random() method will not compile.
+ This struct could be extended to customize the random number generator (now it uses only
+ std::rand()).
+ */
+ template struct range {
+
+ /// Lower bound.
+ T_ min;
+
+ /// Higher bound.
+ T_ max;
+
+ /// Construct the object by calling default constructors for min and max.
+ range() : min(T_()), max(T_()) {}
+
+ /// Construct and initialize min and max directly.
+ range(const T_ &mn, const T_ &mx) : min(mn), max(mx) {}
+
+ /// Set min and max.
+ void set(const T_ &mn, const T_ &mx) { min = mn; max = mx; }
+
+ /// Get a random value between min and max.
+ T_ get_random() const
+ {
+ return min + (max - min) * std::rand() / RAND_MAX;
+ }
+
+ };
+
+ /// Range of floats.
+ typedef range rangef;
+
+ /// Range of osg::Vec2s.
+ typedef range rangev2;
+
+ /// Range of osg::Vec3s.
+ typedef range rangev3;
+
+ /// Range of osg::Vec4s.
+ typedef range rangev4;
+
+}
+
+#endif
diff --git a/src/Demos/osgparticle/Makefile b/src/Demos/osgparticle/Makefile
new file mode 100644
index 000000000..648e825cd
--- /dev/null
+++ b/src/Demos/osgparticle/Makefile
@@ -0,0 +1,16 @@
+TOPDIR = ../../..
+include $(TOPDIR)/Make/makedefs
+
+CXXFILES =\
+ osgparticle.cpp\
+
+LIBS += $(OSG_LIBS) $(GLUT_LIB) $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) -losgParticle
+
+INSTFILES = \
+ $(CXXFILES)\
+ Makefile.inst=Makefile
+
+EXEC = osgparticle
+
+include $(TOPDIR)/Make/makerules
+
diff --git a/src/Demos/osgparticle/Makefile.inst b/src/Demos/osgparticle/Makefile.inst
new file mode 100644
index 000000000..066678e60
--- /dev/null
+++ b/src/Demos/osgparticle/Makefile.inst
@@ -0,0 +1,13 @@
+TOPDIR = ../..
+include $(TOPDIR)/Make/makedefs
+
+CXXFILES =\
+ osgparticle.cpp\
+
+LIBS += $(OSG_LIBS) $(GLUT_LIB) $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) -losgParticle
+
+EXEC = osgparticle
+
+
+include $(TOPDIR)/Make/makerules
+
diff --git a/src/Demos/osgparticle/osgparticle.cpp b/src/Demos/osgparticle/osgparticle.cpp
new file mode 100644
index 000000000..79194b794
--- /dev/null
+++ b/src/Demos/osgparticle/osgparticle.cpp
@@ -0,0 +1,120 @@
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+// ----------------------------------------------------------------------------------
+// These lines are necessary under Windows because if we don't instantiate at least
+// one object of osgParticle, the library will not be linked to the exe even if we
+// add it to the dependancies list, leading to failure when importing .osg files.
+
+#ifdef WIN32
+
+#include
+osgParticle::Particle dummy_Particle__;
+
+#endif
+
+// ----------------------------------------------------------------------------------
+
+void write_usage(std::ostream& out,const std::string& name)
+{
+ out << std::endl;
+ out <<"usage:"<< std::endl;
+ out <<" "< commandLine;
+ for(int i=1;i
+#include
+
+#include
+
+osgParticle::Emitter::Emitter()
+: ParticleProcessor(),
+ usedeftemp_(true)
+{
+}
+
+osgParticle::Emitter::Emitter(const Emitter ©, const osg::CopyOp ©op)
+: ParticleProcessor(copy, copyop),
+ usedeftemp_(copy.usedeftemp_),
+ ptemp_(copy.ptemp_)
+{
+}
diff --git a/src/osgParticle/FluidFrictionOperator.cpp b/src/osgParticle/FluidFrictionOperator.cpp
new file mode 100644
index 000000000..6ac4309d9
--- /dev/null
+++ b/src/osgParticle/FluidFrictionOperator.cpp
@@ -0,0 +1,38 @@
+#include
+#include
+#include
+#include
+#include
+
+osgParticle::FluidFrictionOperator::FluidFrictionOperator()
+: Operator(), ovr_rad_(0)
+{
+ setFluidToAir();
+}
+
+osgParticle::FluidFrictionOperator::FluidFrictionOperator(const FluidFrictionOperator ©, const osg::CopyOp ©op)
+: Operator(copy, copyop),
+ A_(copy.A_),
+ B_(copy.B_),
+ density_(copy.density_),
+ viscosity_(copy.viscosity_),
+ ovr_rad_(copy.ovr_rad_)
+{
+}
+
+void osgParticle::FluidFrictionOperator::operate(Particle *P, double dt)
+{
+ float r = (ovr_rad_ > 0)? ovr_rad_ : P->getRadius();
+ osg::Vec3 v = P->getVelocity();
+
+ float vm = v.normalize();
+ float R = A_ * r * vm + B_ * r * r * vm * vm;
+
+ osg::Vec3 Fr(-R * v.x(), -R * v.y(), -R * v.z());
+
+ if (current_program_->getReferenceFrame() == ModularProgram::RELATIVE_TO_PARENTS) {
+ Fr = current_program_->rotateLocalToWorld(Fr);
+ }
+
+ P->addVelocity(Fr * (P->getMassInv() * dt));
+}
diff --git a/src/osgParticle/IO_AccelOperator.cpp b/src/osgParticle/IO_AccelOperator.cpp
new file mode 100644
index 000000000..dbde4c3de
--- /dev/null
+++ b/src/osgParticle/IO_AccelOperator.cpp
@@ -0,0 +1,48 @@
+
+#include
+
+#include
+#include
+#include
+
+#include
+
+#include
+
+bool AccelOperator_readLocalData(osg::Object &obj, osgDB::Input &fr);
+bool AccelOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
+
+osgDB::RegisterDotOsgWrapperProxy AccelOperator_Proxy
+(
+ osgNew osgParticle::AccelOperator,
+ "AccelOperator",
+ "Object Operator AccelOperator",
+ AccelOperator_readLocalData,
+ AccelOperator_writeLocalData
+);
+
+bool AccelOperator_readLocalData(osg::Object &obj, osgDB::Input &fr)
+{
+ osgParticle::AccelOperator &aop = static_cast(obj);
+ bool itAdvanced = false;
+
+ osg::Vec3 a;
+
+ if (fr[0].matchWord("acceleration")) {
+ if (fr[1].getFloat(a.x()) && fr[2].getFloat(a.y()) && fr[3].getFloat(a.z())) {
+ aop.setAcceleration(a);
+ fr += 4;
+ itAdvanced = true;
+ }
+ }
+
+ return itAdvanced;
+}
+
+bool AccelOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
+{
+ const osgParticle::AccelOperator &aop = static_cast(obj);
+ osg::Vec3 a = aop.getAcceleration();
+ fw.indent() << "acceleration " << a.x() << " " << a.y() << " " << a.z() << std::endl;
+ return true;
+}
diff --git a/src/osgParticle/IO_CenteredPlacer.cpp b/src/osgParticle/IO_CenteredPlacer.cpp
new file mode 100644
index 000000000..498dc06e6
--- /dev/null
+++ b/src/osgParticle/IO_CenteredPlacer.cpp
@@ -0,0 +1,49 @@
+
+#include
+
+#include
+#include
+#include
+
+#include
+
+#include
+
+bool CenteredPlacer_readLocalData(osg::Object &obj, osgDB::Input &fr);
+bool CenteredPlacer_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
+
+osgDB::RegisterDotOsgWrapperProxy CenteredPlacer_Proxy
+(
+ 0,
+ "CenteredPlacer",
+ "Object Placer CenteredPlacer",
+ CenteredPlacer_readLocalData,
+ CenteredPlacer_writeLocalData
+);
+
+bool CenteredPlacer_readLocalData(osg::Object &obj, osgDB::Input &fr)
+{
+ osgParticle::CenteredPlacer &myobj = static_cast(obj);
+ bool itAdvanced = false;
+
+ osg::Vec3 v;
+ if (fr[0].matchWord("center")) {
+ if (fr[1].getFloat(v.x()) && fr[2].getFloat(v.y()) && fr[3].getFloat(v.z())) {
+ myobj.setCenter(v);
+ fr += 4;
+ itAdvanced = true;
+ }
+ }
+
+ return itAdvanced;
+}
+
+bool CenteredPlacer_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
+{
+ const osgParticle::CenteredPlacer &myobj = static_cast(obj);
+
+ osg::Vec3 v = myobj.getCenter();
+ fw.indent() << "center " << v.x() << " " << v.y() << " " << v.z() << std::endl;
+
+ return true;
+}
diff --git a/src/osgParticle/IO_Emitter.cpp b/src/osgParticle/IO_Emitter.cpp
new file mode 100644
index 000000000..c197acd9d
--- /dev/null
+++ b/src/osgParticle/IO_Emitter.cpp
@@ -0,0 +1,70 @@
+
+#include
+
+#include
+
+#include
+#include
+#include
+
+extern bool read_particle(osgDB::Input &fr, osgParticle::Particle &P);
+extern void write_particle(const osgParticle::Particle &P, osgDB::Output &fw);
+
+bool Emitter_readLocalData(osg::Object &obj, osgDB::Input &fr);
+bool Emitter_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
+
+osgDB::RegisterDotOsgWrapperProxy Emitter_Proxy
+(
+ 0,
+ "Emitter",
+ "Object Node ParticleProcessor Emitter",
+ Emitter_readLocalData,
+ Emitter_writeLocalData
+);
+
+bool Emitter_readLocalData(osg::Object &obj, osgDB::Input &fr)
+{
+ osgParticle::Emitter &myobj = static_cast(obj);
+ bool itAdvanced = false;
+
+ if (fr[0].matchWord("useDefaultTemplate")) {
+ if (fr[1].matchWord("TRUE")) {
+ myobj.setUseDefaultTemplate(true);
+ fr += 2;
+ itAdvanced = true;
+ }
+ if (fr[1].matchWord("FALSE")) {
+ myobj.setUseDefaultTemplate(false);
+ fr += 2;
+ itAdvanced = true;
+ }
+ }
+
+ if (fr[0].matchWord("particleTemplate")) {
+ ++fr;
+ itAdvanced = true;
+ osgParticle::Particle P;
+ if (read_particle(fr, P)) {
+ myobj.setParticleTemplate(P);
+ }
+ }
+
+ return itAdvanced;
+}
+
+bool Emitter_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
+{
+ const osgParticle::Emitter &myobj = static_cast(obj);
+
+ fw.indent() << "useDefaultTemplate ";
+ if (!myobj.getUseDefaultTemplate()) {
+ fw << "FALSE" << std::endl;
+ fw.indent() << "particleTemplate ";
+ write_particle(myobj.getParticleTemplate(), fw);
+ fw << std::endl;
+ } else {
+ fw << "TRUE" << std::endl;
+ }
+
+ return true;
+}
diff --git a/src/osgParticle/IO_FluidFrictionOperator.cpp b/src/osgParticle/IO_FluidFrictionOperator.cpp
new file mode 100644
index 000000000..8a9de1b43
--- /dev/null
+++ b/src/osgParticle/IO_FluidFrictionOperator.cpp
@@ -0,0 +1,63 @@
+
+#include
+
+#include
+#include
+#include
+
+#include
+
+bool FluidFrictionOperator_readLocalData(osg::Object &obj, osgDB::Input &fr);
+bool FluidFrictionOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
+
+osgDB::RegisterDotOsgWrapperProxy FluidFrictionOperator_Proxy
+(
+ osgNew osgParticle::FluidFrictionOperator,
+ "FluidFrictionOperator",
+ "Object Operator FluidFrictionOperator",
+ FluidFrictionOperator_readLocalData,
+ FluidFrictionOperator_writeLocalData
+);
+
+bool FluidFrictionOperator_readLocalData(osg::Object &obj, osgDB::Input &fr)
+{
+ osgParticle::FluidFrictionOperator &aop = static_cast(obj);
+ bool itAdvanced = false;
+
+ float f;
+
+ if (fr[0].matchWord("fluidDensity")) {
+ if (fr[1].getFloat(f)) {
+ aop.setFluidDensity(f);
+ fr += 2;
+ itAdvanced = true;
+ }
+ }
+
+ if (fr[0].matchWord("fluidViscosity")) {
+ if (fr[1].getFloat(f)) {
+ aop.setFluidViscosity(f);
+ fr += 2;
+ itAdvanced = true;
+ }
+ }
+
+ if (fr[0].matchWord("overrideRadius")) {
+ if (fr[1].getFloat(f)) {
+ aop.setOverrideRadius(f);
+ fr += 2;
+ itAdvanced = true;
+ }
+ }
+
+ return itAdvanced;
+}
+
+bool FluidFrictionOperator_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
+{
+ const osgParticle::FluidFrictionOperator &aop = static_cast(obj);
+ fw.indent() << "fluidDensity " << aop.getFluidDensity() << std::endl;
+ fw.indent() << "fluidViscosity " << aop.getFluidViscosity() << std::endl;
+ fw.indent() << "overrideRadius " << aop.getOverrideRadius();
+ return true;
+}
diff --git a/src/osgParticle/IO_ForceOperator.cpp b/src/osgParticle/IO_ForceOperator.cpp
new file mode 100644
index 000000000..220f6aea0
--- /dev/null
+++ b/src/osgParticle/IO_ForceOperator.cpp
@@ -0,0 +1,48 @@
+
+#include
+
+#include
+#include
+#include