Time for action - building a fountain in the scene
We will demonstrate how to implement a basic particle fountain. The simulation of a fountain can be described as follows: firstly, the water emitted from a point rises with a certain initial speed; then the speed decreases due to gravity of the earth, until reaching the highest point; after that, the water drops fall down onto the ground or into the pool. To achieve this, an
osgParticle::ParticleSystem node, along with an emitter and a program processor, should be created and added to the scene graph.
- Include the necessary headers:
#include <osg/MatrixTransform> #include <osg/Point> #include <osg/PointSprite> #include <osg/Texture2D> #include <osg/BlendFunc> #include <osgDB/ReadFile> #include <osgGA/StateSetManipulator> ...