Open main menu

CDOT Wiki β

Changes

DPS905 Kaitlyn ParticleEffects

830 bytes added, 21:41, 13 April 2011
[A] - INSTALLATION
* For DPS905, Professor Chris Szalwinski
**************************************************************************************************
 
[[Image:Kaitlyn_particles_April2011_v01.jpg]]
* [http://matrix.senecac.on.ca/~dacallow/DPS905/ParticleVertexList.cpp ParticleVertexList.cpp]
* [http://matrix.senecac.on.ca/~dacallow/DPS905/ParticleVertexList.h ParticleVertexList.h]
 (OPTIONAL)* A Optionally, you can get a simple texture for you to try making particle effects with * here: [http://matrix.senecac.on.ca/~dacallow/DPS905/bubble.tga bubble.tga]
5) Modify Display.cpp
* Inside Add an include at the top..  #include "ParticleVertexList.h" // for access to ParticleVertexList::connectDevice()  * Then add inside of the method: bool Display::setup(void* hwnd)
near line 360 (beneath the comment "// setup successful") add...
'''scene->draw(PARTICLES);'''
hud->draw(HUD_ALPHA);
 
 
 
10) Modify iVertexList.h
 
* Add to Class iVertexList
 
virtual void clear() = 0;
 
* Add to the bottom of the file iVertexList.h
 
extern "C"
iVertexList* CreateParticleVertexList(PrimitiveType t, int np, bool flip = false);
 
 
 
11) Modify VertexList.h
 
* Add to Class VertexList
 
void clear() {nVertices = 0;} /* added for particle effects */
 
* At the bottom of VertexList.h add to the Class StockMesh
 
void clear() {}
<div id="using"></div>
 
== [B] - HOW TO USE ==
To create a particle:
# 1) Include in ParticleGenerator.h# 2) Use the following suggested code(maybe in Design.cpp inside Design::initialize(int now)):
//VARIABLES
iParticleGeneratoriObject* particleEffect1 = CreateParticleGenerator(generatorlifespan, particlelifespan, particlespawnrate, spawndispersion, theta, startingspeed, startcolour, endcolour, frequencycolour, startsize, endsize, frequencysize, startgravity, endgravity, frequencygravityvertical, frequencygravityhorizontal, startalpha, endalpha, frequencyalpha, &c, &p);
//Add your desired texture on
particleEffect1->attach(particle_texture,0);
//Position your particlegenerator
particleEffect1->translate(250,70,250);
//((ParticleGenerator*)particleEffect1)->AttractTo(someObject,250.0f);
//((ParticleGenerator*)particleEffect1)->AttractTo(&Vector(50,50,50),250.0f);
 
 
3) Add inside Design.cpp in the Design::Update(int now) method your particle generator's update method.
 
particleEffect1->update(now);
'''PLEASE NOTE:''' The following is not working / implemented at this time: frequency, alpha transparency
7
edits