Definition in file ALerpParticle.cpp.
#include "AEngine.h"
#include "AState.h"
#include "AUtil.h"
Include dependency graph for ALerpParticle.cpp:

Go to the source code of this file.
Functions | |
| void | flare_init () |
| void | flare_process () |
| void | flare_begin (ATexture texture, int maxParticles) |
| void | flare_addParticle (const Vec3D &pos1, const Vec3D &pos2, const Vec4D multiplier, FLOAT dist, FLOAT size) |
| void | flare_end () |
Variables | |
| const int | MAX_LERP_COUNT = 4096 |
|
||||||||||||||||||||||||
|
Definition at line 101 of file ALerpParticle.cpp. Referenced by BattleGroup::render().
00103 {
00104 if(AS.flare_renderCount >= AS.flare_reservedCount ) return; // no more than you reserved
00105 int index = AS.flare_renderCount;
00106 AS.flare_pVertex[index].pos1 = pos1;
00107 AS.flare_pVertex[index].pos2 = pos2;
00108 AS.flare_pVertex[index].colorMultiplier = multiplier;
00109 AS.flare_pVertex[index].dist = dist;
00110 AS.flare_pVertex[index].size = size;
00111 AS.flare_renderCount++;
00112 }
|
|
||||||||||||
|
Definition at line 74 of file ALerpParticle.cpp. References MAX_LERP_COUNT. Referenced by BattleEntry::render().
00075 {
00076 assert(maxParticles>=0 && maxParticles<MAX_LERP_COUNT);
00077
00078 // check if there's enough space in current VB
00079 HRESULT res;
00080 if( AS.flare_startRenderingIndex + maxParticles < MAX_LERP_COUNT )
00081 {
00082 res = AS.flare_vb->Lock( AS.flare_startRenderingIndex*sizeof(LerpParticleVertex),
00083 maxParticles*sizeof(LerpParticleVertex),
00084 (BYTE**)&AS.flare_pVertex, D3DLOCK_NOOVERWRITE );
00085 if( FAILED(res)) throw Error("Can't Lock flareVB");
00086 }
00087 else // renew VB
00088 {
00089 AS.flare_startRenderingIndex = 0;
00090 res = AS.flare_vb->Lock( AS.flare_startRenderingIndex*sizeof(LerpParticleVertex),
00091 maxParticles*sizeof(LerpParticleVertex),
00092 (BYTE**)&AS.flare_pVertex, D3DLOCK_DISCARD );
00093 if( FAILED(res)) throw Error("Can't Lock/Renew flareVB");
00094 }
00095
00096 AS.flare_reservedCount= maxParticles;
00097 AS.flare_renderCount = 0;
00098 AS.flare_texture = texture;
00099 }
|
|
|
Definition at line 114 of file ALerpParticle.cpp. Referenced by BattleEntry::render().
00115 {
00116 AS.flare_vb->Unlock();
00117 }
|
|
|
Definition at line 29 of file ALerpParticle.cpp. References MAX_LERP_COUNT, util_loadPixelShader(), and util_loadVertexShader(). Referenced by sys_go().
00030 {
00031 int vbByteSize = MAX_LERP_COUNT * sizeof(LerpParticleVertex);
00032 if( FAILED( AS.pDevice->CreateVertexBuffer( vbByteSize, D3DUSAGE_WRITEONLY|D3DUSAGE_DYNAMIC|D3DUSAGE_POINTS,
00033 0, D3DPOOL_DEFAULT, &AS.flare_vb ) ))
00034 throw Error("Can't create flareVB");
00035
00036 AS.flare_startRenderingIndex = 0;
00037 AS.flare_renderCount = 0;
00038
00039 AS.vshader_lerpParticle = util_loadVertexShader( "shaders\\lerpParticle.vso", dwLerpParticleVertexDecl );
00040 AS.pshader_lerpParticle = util_loadPixelShader( "shaders\\lerpParticle.pso" );
00041 }
|
|
|
Definition at line 43 of file ALerpParticle.cpp. References device_setPixelShader(), device_setRenderState(), device_setRenderStateBlendMode(), device_setStreamSource(), device_setTexture(), device_setTextureStageState(), device_setVertexShader(), and Matx. Referenced by processRenderRequests().
00044 {
00045 if( AS.flare_renderCount==0 ) return;
00046 device_setVertexShader( AS.vshader_lerpParticle );
00047 device_setPixelShader( AS.pshader_lerpParticle );
00048 device_setTexture( 3, AS.res_textures[ AS.flare_texture ] );
00049 device_setStreamSource( 0, AS.flare_vb, sizeof(LerpParticleVertex) );
00050
00051 Matx matx;
00052 FLOAT sizeCalcConst[4] = { 3.0f, 640.0f, 0.0f, 0.0f };
00053 D3DXMatrixTranspose( &matx, &AS.camera_world2projMatrix);
00054 AS.pDevice->SetVertexShaderConstant( 0, &matx, 4 ); // world->proj matrix
00055 AS.pDevice->SetVertexShaderConstant( 4, &AS.camera_pos[0], 1 ); // camera pos
00056 AS.pDevice->SetVertexShaderConstant( 5, &sizeCalcConst, 1 ); // constants
00057
00058 device_setRenderStateBlendMode( BlendModes::ADD );
00059
00060 device_setRenderState( D3DRS_ZWRITEENABLE, FALSE );
00061 device_setRenderState( D3DRS_ZENABLE, FALSE );
00062 device_setRenderState( D3DRS_POINTSPRITEENABLE, TRUE );
00063 device_setTextureStageState( 3, D3DTSS_MAGFILTER, D3DTEXF_LINEAR );
00064 device_setTextureStageState( 3, D3DTSS_MINFILTER, D3DTEXF_LINEAR );
00065 device_setTextureStageState( 3, D3DTSS_MIPFILTER, D3DTEXF_POINT );
00066
00067 AS.pDevice->DrawPrimitive( D3DPT_POINTLIST, AS.flare_startRenderingIndex, AS.flare_renderCount );
00068
00069 device_setRenderState( D3DRS_POINTSPRITEENABLE, FALSE );
00070 AS.flare_startRenderingIndex += AS.flare_renderCount;
00071 AS.flare_renderCount = 0;
00072 }
|
|
|
Definition at line 26 of file ALerpParticle.cpp. Referenced by flare_begin(), and flare_init(). |
1.3-rc2