diff options
author | Chris Xiong <chirs241097@gmail.com> | 2016-05-15 23:53:05 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2016-05-15 23:53:05 +0800 |
commit | 9dd9574270473021cb92c285fe1d39354d31b106 (patch) | |
tree | a505293d7e46083e7363e897eb7611f26e685bf9 /visualization/extrasmeltutils.cpp | |
parent | 2c975039ea25cc2c6ebdd3372b454db4766b813d (diff) | |
download | QMidiPlayer-9dd9574270473021cb92c285fe1d39354d31b106.tar.xz |
Initial stubs for the particle system.
Use layouts in the effects window.
Diffstat (limited to 'visualization/extrasmeltutils.cpp')
-rw-r--r-- | visualization/extrasmeltutils.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/visualization/extrasmeltutils.cpp b/visualization/extrasmeltutils.cpp index d77cc4b..160f7d6 100644 --- a/visualization/extrasmeltutils.cpp +++ b/visualization/extrasmeltutils.cpp @@ -1,6 +1,7 @@ #include <cstdarg> #include "extrasmeltutils.hpp" SMELT* smEntity3DBuffer::sm=NULL; +SMELT* smParticle::sm=NULL; smVertex makeVertex(float x,float y,float z,DWORD color,float tx,float ty) {smVertex v;v.x=x;v.y=y;v.z=z;v.col=color;v.tx=tx;v.ty=ty;return v;} void smEntity3D::addVerices(int n,...) @@ -59,3 +60,35 @@ void smEntity3DBuffer::drawBatch() sm->smDrawCustomIndexedVertices(&vertices[0],&indices[0],vertices.size(),indices.size(),BLEND_ALPHABLEND,0); vertices.clear();indices.clear(); } +smParticle::smParticle(){sm=smGetInterface(SMELT_APILEVEL);} +smParticle::~smParticle(){sm->smRelease();} +void smParticle::render() +{sm->smRenderQuad(&q);} +void smParticle::update() +{ + clifespan+=sm->smGetDelta(); + vel=vel+accel;pos=pos+vel;rotv=rotv+rota;rot=rot+rotv; + size=clifespan/lifespan*(finalsize-initsize)+initsize; + color=ARGB( + (DWORD)(clifespan/lifespan*(GETA(finalcolor)-GETA(initcolor)+GETA(initcolor))), + (DWORD)(clifespan/lifespan*(GETR(finalcolor)-GETR(initcolor)+GETR(initcolor))), + (DWORD)(clifespan/lifespan*(GETG(finalcolor)-GETG(initcolor)+GETG(initcolor))), + (DWORD)(clifespan/lifespan*(GETB(finalcolor)-GETB(initcolor)+GETB(initcolor)))); + //set up the quad +} +smParticleSystem::smParticleSystem(){particles.clear();posGenerator=NULL;} +smParticleSystem::~smParticleSystem() +{for(int i=0;i<particles.size();++i)delete particles[i];particles.clear();} +void smParticleSystem::setParticleSystemInfo(smParticleSystemInfo _psinfo) +{psinfo=_psinfo;} +void smParticleSystem::setPos(smvec3d _pos){pos=_pos;} +void smParticleSystem::setPSEmissionPosGen(smPSEmissionPositionGenerator *_gen) +{posGenerator=_gen;} +void smParticleSystem::startPS() +{} +void smParticleSystem::stopPS() +{} +void smParticleSystem::updatePS() +{} +void smParticleSystem::renderPS() +{} |