Palomino - FX Module

©2004,2009  Jim E. Brooks   http://www.palomino3d.org



Overview

[2008/08]

The fx module (special-effects) provides graphical objects such as Sprite, Texture, ParticleSystem. The FX class contains and makes special-effects (explosions, smoke, etc). FX::Reset() stops special-effects.

Facade classes are used for many graphics primitives. These lessen dependence on a graphics system, can overcome its limitations, and are more convenient to use. For example, the Sprite class hides an osg::AutoTransform and automatically constructs its nodes.


FX container

[2008/11]

The FX class is a container of special-effects objects. Reasons for the FX container are: some FX objects cannot be attached to the scene-graph, a container simplifies destroying all FX objects when program is reset, and particles may out-live the Object that originally spawned them (missile trail can persist after the missile).

Special-effect objects, such as ParticleSystem, schedule their deletion with FX, thus turning into zombies, which FX::Tick() destroys.

Source files with the prefix fx_ are private implementations of the FX class.


Particle System

[2008/11]

ParticleSystemBigParticleSystemExplosionParticleSystem
              SmallParticleSystemTrailParticleSystem

The two main classes are for small and big particles.

SmallParticles

[2008/11]

SmallParticles are lightweight and render quickly, but have limitations.

The update mechanism is SmallParticleFunctor::operator()(const SmallParticle&). ParticleSystem passes every SmallParticle to the functor. SmallParticle is a opaque POD struct that doesn't persist. After calling, modifications made by the functor to a SmallParticle struct will be applied by ParticleSystem to underlying graphical objects (vertex array element).

Implementation

SmallParticles are implemented as OpenGL point sprites. Hardware limits point size (64 pixels max, typically).

BigParticles

[2008/11]

BigParticle is derived from the Sprite class. BigParticle::Tick() is a virtual method, called by ParticleSystem, for doing animation such as altering color, alpha, position, etc.

Custom particle systems can be made by making derivatives of both ParticleSystem and Particle then overriding both of their Tick() methods.
DerivedParticleSystem::Tick() would add more particles.
DerivedParticle::Tick() would animate an individual particle.

Implementing and Using Particle Systems

[2008/11]

The ParticleSystem classes are private implementations of the FX class. FX shall provide interface methods such as FX::MakeExplosion(). Behind-the-scenes, FX:MakeExplosion() calls "new ExplosionParticleSystem" and contains it.


Sprite

[2008/08]

A sprite is 2D textured quad in 3D space aligned to the viewplane. The Sprite class hides an osg::AutoTransform and automatically constructs its nodes.

See Commodore 64 Programmer's Reference Guide.


Texture

[2008/02]

The Texture class abstracts a texture image file and/or a texture object. Texture ctor uses ImageCache to cache texture images.


ImageCache

[2008/02]

Caches 2D image files. Used by Texture class.


Last modified: Sun Nov 22 21:22:58 CST 2009