/* Author     : Josh Grant
   Date       : October 20th, 2000
   Class      : SoParticle
   Description: The class was designed to hold all the necessary information
                needed to animate a sphere moving in 3D space.  The class is
		a subclass of SoSeparator giving it the ability to be added
		directly to an Open Inventor scene graph.  Everytime an
		SoMovingSphere is created, pointers to an SoTransform,
		SoMaterial, and SoSphere are created.  They are used to
		modify the translation, color, and radius of the sphere.
		Every variable that needs to be modified can be done so with
		any one of the setXXX...() or getXXX...() functions.

		An SoMovingSphere scene graph

		                        SoMovingSphere
                                              |
			    ______________________________________
		            |                 |                  |
		       SoTransform        SoMaterial         SoSphere

		Example instantiation:
		  SoSeparator *root  = new SoSeparator();
		  SoMovingSphere *ms = new SoMovingSphere();
		  ms->setRadius(0.5);
		  ms->setLocation(SbVec3f(1.0, 0.4, 3.2));
		  ms->setColor(SbColor(0.0, 0.0, 1.0);
		  ms->setVelocity(SbVec3f(0.02, 0.05, -0.05);
		  root->addChild(ms);

		In order to actually get the sphere to move subsequent calls
		to moveSphere must be made, otherwise the sphere will remain
		stationary.  A good way to accomplish this is to create an
		SoTimerSensor with the moveSphere function called within
		the function pointed to by the Sensor.
*/

#ifndef _SO_PARTICLE_
#define _SO_PARTICLE_

#include <Inventor/nodes/SoSeparator.h>
#include <Inventor/fields/SoSFFloat.h>
#include <Inventor/fields/SoMFColor.h>
#include <Inventor/fields/SoSFVec3f.h>
#include <Inventor/fields/SoSFBool.h>
#include <Inventor/nodes/SoSphere.h>
#include <Inventor/nodes/SoMaterial.h>
#include <Inventor/nodes/SoTransform.h>
#include <Inventor/nodes/SoComplexity.h>

class SoParticle : public SoSeparator {

public:
  // Fields
  SbVec3f            velocity;
  float              mass;

  // Constructor
  SoParticle();
  ~SoParticle();

  void               setRadius  (float rad);
  void               setLocation(const SbVec3f &loc);
  float              getRadius  ();
  SbVec3f &          getLocation();
  void               moveParticle();

private:
  SoSFFloat          radius;
  SbVec3f            location;
  
  SoTransform        *transform;
  SoSphere           *sphere;
};

#endif /* _SO_PARTICLE_ */
