©2004,2008 Jim E. Brooks http://www.palomino3d.org
[2008/08]
The fx module 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.
[2008/02]
The FX class is a container of special-effects objects. Reasons for the FX class is that a special container is needed, as some special-effect objects cannot be attached to the scene graph, and the ability to stop and destroy special-effects when program is reset.
Special-effect objects, such as ParticleSystemFX, 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.
[2008/02]
ParticleSystemParticleSystemFX
ExplosionParticleSystemFX
SmokeTrailParticleSystemFX
ParticleSystem class is a container of Particles. ParticleSystem registers a timer-tick functor, then ages and animates every particle. New Particles can be dynamically added (expanding smoke trail, explosions). ParticleSystem will destroy Particles past their lifetime.
Particle is derived from the Sprite class. Particle::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.
[2008/02]
This derivative is meant to be contained by the FX container. ParticleSystemFX itself has lifetime, and when it expires, it schedules its deletion with the FX container.
[2008/02]
ParticleSystem is a generalized base class and unsuited to standing alone. ParticleSystemFX is its derivative, still generalized, but meant to be contained by the FX container. ParticleSystemFX has an expiry/lifetime (as Particles have).
Specialized derivatives for explosions, smoke, etc, should derive from ParticleSystemFX. Note that ParticleSystemFX is an all-private class and its friend its FX. Then, the FX class should be extended with a new method to instantiate it. FX:MakeExplosion() calls "new ExplosionParticleSystemFX" and contains its pointer.
[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.
[2008/02]
The Texture class abstracts a texture image file and/or a texture object. Texture ctor uses ImageCache to cache texture images.
[2008/02]
Caches 2D image files. Used by Texture class.
Last modified: Sat Aug 16 13:07:28 EDT 2008