Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

ParticleShader Class Reference

#include <ParticleShader.h>

Inheritance diagram for ParticleShader:

Inheritance graph
[legend]
Collaboration diagram for ParticleShader:

Collaboration graph
[legend]
List of all members.

Detailed Description

ParticleShader defines how to draw a particle.

Definition at line 17 of file ParticleShader.h.

Public Member Functions

 ParticleShader (Particles *ps=NULL, std::string &name=std::string("ParticleShader"))
 default constructor

virtual void attachAttributes ()
virtual ~ParticleShader ()
virtual void addMeTo (Particles *new_ps)
 Add shader to a particle system.

virtual void setParticleSystem (Particles *new_ps)
 Set the particle system the ParticleStuff points to.

virtual void removeMe ()
 Remove the shader from the current particle system.

virtual void draw ()
 each shader knows how to draw all the particles based on its attributes

virtual void drawParticle (int i)
 each shader knows how to draw a particle based on its attributes

virtual void applyTransformations (int i)
 typically done for all shader that needs to draw each particle.

virtual void drawShape (int i)
 each shader simply make a shape call for each particle

virtual void setColor (int i)
 determine the color

virtual void clear ()

Public Attributes

ParticlePositionposition
ParticleOrientationorient
ParticleMaterialmaterial


Constructor & Destructor Documentation

ParticleShader::ParticleShader Particles ps = NULL,
std::string &  name = std::string("ParticleShader")
 

default constructor

Definition at line 17 of file ParticleShader.cpp.

References material, orient, and position.

virtual ParticleShader::~ParticleShader  )  [inline, virtual]
 

Definition at line 31 of file ParticleShader.h.


Member Function Documentation

void ParticleShader::addMeTo Particles new_ps  )  [virtual]
 

Add shader to a particle system.

Implements ParticleStuff.

Definition at line 67 of file ParticleShader.cpp.

References attachAttributes(), and Particles::shaders.

Referenced by setParticleSystem().

void ParticleShader::applyTransformations int  i  )  [virtual]
 

typically done for all shader that needs to draw each particle.

Definition at line 134 of file ParticleShader.cpp.

References dot(), ParticlePosition::getPosition(), ParticleOrientation::gravity, M_PI, ParticleOrientation::n, orient, and position.

Referenced by drawParticle().

void ParticleShader::attachAttributes  )  [virtual]
 

Reimplemented in ParticleShaderCluster, ParticleShaderCurvature, ParticleShaderDisk, ParticleShaderGradientField, and ParticleShaderTriangle.

Definition at line 34 of file ParticleShader.cpp.

References ParticleStuff::attachAttribute(), Particles::getAttribute(), material, orient, position, and ParticleStuff::ps.

Referenced by addMeTo(), ParticleShaderTriangle::attachAttributes(), ParticleShaderGradientField::attachAttributes(), ParticleShaderDisk::attachAttributes(), ParticleShaderCurvature::attachAttributes(), and ParticleShaderCluster::attachAttributes().

virtual void ParticleShader::clear  )  [inline, virtual]
 

Definition at line 56 of file ParticleShader.h.

void ParticleShader::draw  )  [virtual]
 

each shader knows how to draw all the particles based on its attributes

Reimplemented in ParticleShaderChain, ParticleShaderCluster, ParticleShaderGradientField, ParticleShaderLink, ParticleShaderStroke, and ParticleShaderTriangle.

Definition at line 79 of file ParticleShader.cpp.

References drawParticle(), ParticleStuff::ps, and Particles::size().

void ParticleShader::drawParticle int  i  )  [virtual]
 

each shader knows how to draw a particle based on its attributes

Definition at line 107 of file ParticleShader.cpp.

References applyTransformations(), drawShape(), ParticleStuff::ps, Particles::selectedParticle, and setColor().

Referenced by draw().

virtual void ParticleShader::drawShape int  i  )  [inline, virtual]
 

each shader simply make a shape call for each particle

Reimplemented in ParticleShaderConstMaterial, ParticleShaderCurvature, ParticleShaderCylinder, ParticleShaderDisk, ParticleShaderSphere, and ParticleShaderTeapot.

Definition at line 51 of file ParticleShader.h.

Referenced by drawParticle().

void ParticleShader::removeMe  )  [virtual]
 

Remove the shader from the current particle system.

Implements ParticleStuff.

Definition at line 50 of file ParticleShader.cpp.

References ParticleStuff::name, ParticleStuff::ps, and Particles::shaders.

void ParticleShader::setColor int  i  )  [virtual]
 

determine the color

Definition at line 89 of file ParticleShader.cpp.

References ParticleMaterial::color, ParticleMaterial::getDiffuseBack(), ParticleMaterial::getDiffuseFront(), and material.

Referenced by drawParticle().

void ParticleShader::setParticleSystem Particles new_ps  )  [virtual]
 

Set the particle system the ParticleStuff points to.

Also adds the ParticleStuff to the particle system. If this is a new particle system, this deletes the ParticleStuff from the existing particle system.

2002-10-26 Wen Pure virtual function at the ParticleStuff level. Made concrete in ParticleAttribute, ParticleBehavior, etc. Not pure any more, since all the children do the same thing, it is easier just to inherent this one.

2003-11-05 Wen Very important, every one MUST call this before using this class. This is used to initialize the system. Since the factory can create a ParticleStuff with a ps=NULL, we must handle initialization step as a separate function, in order to not calling the same code twice I decided not to call this function in all the constructors.

Reimplemented from ParticleStuff.

Definition at line 26 of file ParticleShader.cpp.

References addMeTo(), and ParticleStuff::ps.


Member Data Documentation

ParticleMaterial* ParticleShader::material
 

Definition at line 24 of file ParticleShader.h.

Referenced by attachAttributes(), ParticleShaderCurvature::drawShape(), ParticleShaderConstMaterial::drawShape(), ParticleShader(), ParticleShaderCurvature::ParticleShaderCurvature(), and setColor().

ParticleOrientation* ParticleShader::orient
 

Definition at line 23 of file ParticleShader.h.

Referenced by applyTransformations(), attachAttributes(), ParticleShaderStroke::draw(), and ParticleShader().

ParticlePosition* ParticleShader::position
 

Definition at line 22 of file ParticleShader.h.

Referenced by applyTransformations(), attachAttributes(), ParticleShaderTriangle::draw(), ParticleShaderStroke::draw(), ParticleShaderLink::draw(), ParticleShaderChain::draw(), ParticleShaderDisk::drawShape(), ParticleShaderCurvature::drawShape(), ParticleShaderStroke::findChains(), ParticleShaderChain::findChains(), and ParticleShader().


The documentation for this class was generated from the following files:
Generated on Mon Jun 28 15:02:49 2004 for Advanced Surface Library by doxygen 1.3.4