Renderer-based particle system (#25)

* A WIP particle system

* - Some more particle refactoring
- an attempt to fix things that went wrong
- trying to integrate fog onto particles (which is currently wrong)
- qpal.h committed (oops)
- Attempt to separate particle rendering from particle moving for future optimization/refactor
This commit is contained in:
leilei-
2016-11-01 03:30:15 -04:00
committed by GitHub
parent cc41c5793e
commit 245fea051e
14 changed files with 3530 additions and 16 deletions

View File

@@ -1742,6 +1742,7 @@ Q3ROAOBJ = \
\
$(B)/renderer_oa/tr_bloom.o \
$(B)/renderer_oa/tr_extensions.o \
$(B)/renderer_oa/tr_particles.o \
\
$(B)/renderergl1/sdl_gamma.o \
$(B)/renderergl1/sdl_glimp.o
@@ -1816,6 +1817,7 @@ Q3RSOFTOBJ = \
\
$(B)/renderer_oa/tr_bloom.o \
$(B)/renderer_oa/tr_extensions.o \
$(B)/renderer_oa/tr_particles.o \
\
$(B)/renderersoft/sdl_gamma.o \
$(B)/renderersoft/sdl_glimp.o

View File

@@ -182,7 +182,8 @@ typedef enum {
CG_CEIL,
CG_TESTPRINTINT,
CG_TESTPRINTFLOAT,
CG_ACOS
CG_ACOS,
CG_R_LFX_PARTICLEEFFECT // leilei - particle effects
} cgameImport_t;

View File

@@ -103,4 +103,4 @@ equ ceil -109
equ testPrintInt -110
equ testPrintFloat -111
equ acos -112
equ trap_R_LFX_ParticleEffect -113

View File

@@ -634,6 +634,9 @@ intptr_t CL_CgameSystemCalls( intptr_t *args ) {
return FloatAsInt( ceil( VMF(1) ) );
case CG_ACOS:
return FloatAsInt( Q_acos( VMF(1) ) );
case CG_R_LFX_PARTICLEEFFECT:
re.LFX_ParticleEffect( args[1], VMA(2), VMA(3));
return 0;
case CG_PC_ADD_GLOBAL_DEFINE:
return botlib_export->PC_AddGlobalDefine( VMA(1) );

260
code/renderer_oa/qpal.h Normal file
View File

@@ -0,0 +1,260 @@
// Quake palette for the Qarticles
static float qpalette[256][3] = {
{0.000000, 0.000000, 0.000000},
{0.058824, 0.058824, 0.058824},
{0.121569, 0.121569, 0.121569},
{0.184314, 0.184314, 0.184314},
{0.247059, 0.247059, 0.247059},
{0.294118, 0.294118, 0.294118},
{0.356863, 0.356863, 0.356863},
{0.419608, 0.419608, 0.419608},
{0.482353, 0.482353, 0.482353},
{0.545098, 0.545098, 0.545098},
{0.607843, 0.607843, 0.607843},
{0.670588, 0.670588, 0.670588},
{0.733333, 0.733333, 0.733333},
{0.796078, 0.796078, 0.796078},
{0.858824, 0.858824, 0.858824},
{0.921569, 0.921569, 0.921569},
{0.058824, 0.043137, 0.027451},
{0.090196, 0.058824, 0.043137},
{0.121569, 0.090196, 0.043137},
{0.152941, 0.105882, 0.058824},
{0.184314, 0.137255, 0.074510},
{0.215686, 0.168627, 0.090196},
{0.247059, 0.184314, 0.090196},
{0.294118, 0.215686, 0.105882},
{0.325490, 0.231373, 0.105882},
{0.356863, 0.262745, 0.121569},
{0.388235, 0.294118, 0.121569},
{0.419608, 0.325490, 0.121569},
{0.450980, 0.341176, 0.121569},
{0.482353, 0.372549, 0.137255},
{0.513725, 0.403922, 0.137255},
{0.560784, 0.435294, 0.137255},
{0.043137, 0.043137, 0.058824},
{0.074510, 0.074510, 0.105882},
{0.105882, 0.105882, 0.152941},
{0.152941, 0.152941, 0.200000},
{0.184314, 0.184314, 0.247059},
{0.215686, 0.215686, 0.294118},
{0.247059, 0.247059, 0.341176},
{0.278431, 0.278431, 0.403922},
{0.309804, 0.309804, 0.450980},
{0.356863, 0.356863, 0.498039},
{0.388235, 0.388235, 0.545098},
{0.419608, 0.419608, 0.592157},
{0.450980, 0.450980, 0.639216},
{0.482353, 0.482353, 0.686275},
{0.513725, 0.513725, 0.733333},
{0.545098, 0.545098, 0.796078},
{0.000000, 0.000000, 0.000000},
{0.027451, 0.027451, 0.000000},
{0.043137, 0.043137, 0.000000},
{0.074510, 0.074510, 0.000000},
{0.105882, 0.105882, 0.000000},
{0.137255, 0.137255, 0.000000},
{0.168627, 0.168627, 0.027451},
{0.184314, 0.184314, 0.027451},
{0.215686, 0.215686, 0.027451},
{0.247059, 0.247059, 0.027451},
{0.278431, 0.278431, 0.027451},
{0.294118, 0.294118, 0.043137},
{0.325490, 0.325490, 0.043137},
{0.356863, 0.356863, 0.043137},
{0.388235, 0.388235, 0.043137},
{0.419608, 0.419608, 0.058824},
{0.027451, 0.000000, 0.000000},
{0.058824, 0.000000, 0.000000},
{0.090196, 0.000000, 0.000000},
{0.121569, 0.000000, 0.000000},
{0.152941, 0.000000, 0.000000},
{0.184314, 0.000000, 0.000000},
{0.215686, 0.000000, 0.000000},
{0.247059, 0.000000, 0.000000},
{0.278431, 0.000000, 0.000000},
{0.309804, 0.000000, 0.000000},
{0.341176, 0.000000, 0.000000},
{0.372549, 0.000000, 0.000000},
{0.403922, 0.000000, 0.000000},
{0.435294, 0.000000, 0.000000},
{0.466667, 0.000000, 0.000000},
{0.498039, 0.000000, 0.000000},
{0.074510, 0.074510, 0.000000},
{0.105882, 0.105882, 0.000000},
{0.137255, 0.137255, 0.000000},
{0.184314, 0.168627, 0.000000},
{0.215686, 0.184314, 0.000000},
{0.262745, 0.215686, 0.000000},
{0.294118, 0.231373, 0.027451},
{0.341176, 0.262745, 0.027451},
{0.372549, 0.278431, 0.027451},
{0.419608, 0.294118, 0.043137},
{0.466667, 0.325490, 0.058824},
{0.513725, 0.341176, 0.074510},
{0.545098, 0.356863, 0.074510},
{0.592157, 0.372549, 0.105882},
{0.639216, 0.388235, 0.121569},
{0.686275, 0.403922, 0.137255},
{0.137255, 0.074510, 0.027451},
{0.184314, 0.090196, 0.043137},
{0.231373, 0.121569, 0.058824},
{0.294118, 0.137255, 0.074510},
{0.341176, 0.168627, 0.090196},
{0.388235, 0.184314, 0.121569},
{0.450980, 0.215686, 0.137255},
{0.498039, 0.231373, 0.168627},
{0.560784, 0.262745, 0.200000},
{0.623529, 0.309804, 0.200000},
{0.686275, 0.388235, 0.184314},
{0.749020, 0.466667, 0.184314},
{0.811765, 0.560784, 0.168627},
{0.874510, 0.670588, 0.152941},
{0.937255, 0.796078, 0.121569},
{1.000000, 0.952941, 0.105882},
{0.043137, 0.027451, 0.000000},
{0.105882, 0.074510, 0.000000},
{0.168627, 0.137255, 0.058824},
{0.215686, 0.168627, 0.074510},
{0.278431, 0.200000, 0.105882},
{0.325490, 0.215686, 0.137255},
{0.388235, 0.247059, 0.168627},
{0.435294, 0.278431, 0.200000},
{0.498039, 0.325490, 0.247059},
{0.545098, 0.372549, 0.278431},
{0.607843, 0.419608, 0.325490},
{0.654902, 0.482353, 0.372549},
{0.717647, 0.529412, 0.419608},
{0.764706, 0.576471, 0.482353},
{0.827451, 0.639216, 0.545098},
{0.890196, 0.701961, 0.592157},
{0.670588, 0.545098, 0.639216},
{0.623529, 0.498039, 0.592157},
{0.576471, 0.450980, 0.529412},
{0.545098, 0.403922, 0.482353},
{0.498039, 0.356863, 0.435294},
{0.466667, 0.325490, 0.388235},
{0.419608, 0.294118, 0.341176},
{0.372549, 0.247059, 0.294118},
{0.341176, 0.215686, 0.262745},
{0.294118, 0.184314, 0.215686},
{0.262745, 0.152941, 0.184314},
{0.215686, 0.121569, 0.137255},
{0.168627, 0.090196, 0.105882},
{0.137255, 0.074510, 0.074510},
{0.090196, 0.043137, 0.043137},
{0.058824, 0.027451, 0.027451},
{0.733333, 0.450980, 0.623529},
{0.686275, 0.419608, 0.560784},
{0.639216, 0.372549, 0.513725},
{0.592157, 0.341176, 0.466667},
{0.545098, 0.309804, 0.419608},
{0.498039, 0.294118, 0.372549},
{0.450980, 0.262745, 0.325490},
{0.419608, 0.231373, 0.294118},
{0.372549, 0.200000, 0.247059},
{0.325490, 0.168627, 0.215686},
{0.278431, 0.137255, 0.168627},
{0.231373, 0.121569, 0.137255},
{0.184314, 0.090196, 0.105882},
{0.137255, 0.074510, 0.074510},
{0.090196, 0.043137, 0.043137},
{0.058824, 0.027451, 0.027451},
{0.858824, 0.764706, 0.733333},
{0.796078, 0.701961, 0.654902},
{0.749020, 0.639216, 0.607843},
{0.686275, 0.592157, 0.545098},
{0.639216, 0.529412, 0.482353},
{0.592157, 0.482353, 0.435294},
{0.529412, 0.435294, 0.372549},
{0.482353, 0.388235, 0.325490},
{0.419608, 0.341176, 0.278431},
{0.372549, 0.294118, 0.231373},
{0.325490, 0.247059, 0.200000},
{0.262745, 0.200000, 0.152941},
{0.215686, 0.168627, 0.121569},
{0.152941, 0.121569, 0.090196},
{0.105882, 0.074510, 0.058824},
{0.058824, 0.043137, 0.027451},
{0.435294, 0.513725, 0.482353},
{0.403922, 0.482353, 0.435294},
{0.372549, 0.450980, 0.403922},
{0.341176, 0.419608, 0.372549},
{0.309804, 0.388235, 0.341176},
{0.278431, 0.356863, 0.309804},
{0.247059, 0.325490, 0.278431},
{0.215686, 0.294118, 0.247059},
{0.184314, 0.262745, 0.215686},
{0.168627, 0.231373, 0.184314},
{0.137255, 0.200000, 0.152941},
{0.121569, 0.168627, 0.121569},
{0.090196, 0.137255, 0.090196},
{0.058824, 0.105882, 0.074510},
{0.043137, 0.074510, 0.043137},
{0.027451, 0.043137, 0.027451},
{1.000000, 0.952941, 0.105882},
{0.937255, 0.874510, 0.090196},
{0.858824, 0.796078, 0.074510},
{0.796078, 0.717647, 0.058824},
{0.733333, 0.654902, 0.058824},
{0.670588, 0.592157, 0.043137},
{0.607843, 0.513725, 0.027451},
{0.545098, 0.450980, 0.027451},
{0.482353, 0.388235, 0.027451},
{0.419608, 0.325490, 0.000000},
{0.356863, 0.278431, 0.000000},
{0.294118, 0.215686, 0.000000},
{0.231373, 0.168627, 0.000000},
{0.168627, 0.121569, 0.000000},
{0.105882, 0.058824, 0.000000},
{0.043137, 0.027451, 0.000000},
{0.000000, 0.000000, 1.000000},
{0.043137, 0.043137, 0.937255},
{0.074510, 0.074510, 0.874510},
{0.105882, 0.105882, 0.811765},
{0.137255, 0.137255, 0.749020},
{0.168627, 0.168627, 0.686275},
{0.184314, 0.184314, 0.623529},
{0.184314, 0.184314, 0.560784},
{0.184314, 0.184314, 0.498039},
{0.184314, 0.184314, 0.435294},
{0.184314, 0.184314, 0.372549},
{0.168627, 0.168627, 0.309804},
{0.137255, 0.137255, 0.247059},
{0.105882, 0.105882, 0.184314},
{0.074510, 0.074510, 0.121569},
{0.043137, 0.043137, 0.058824},
{0.168627, 0.000000, 0.000000},
{0.231373, 0.000000, 0.000000},
{0.294118, 0.027451, 0.000000},
{0.372549, 0.027451, 0.000000},
{0.435294, 0.058824, 0.000000},
{0.498039, 0.090196, 0.027451},
{0.576471, 0.121569, 0.027451},
{0.639216, 0.152941, 0.043137},
{0.717647, 0.200000, 0.058824},
{0.764706, 0.294118, 0.105882},
{0.811765, 0.388235, 0.168627},
{0.858824, 0.498039, 0.231373},
{0.890196, 0.592157, 0.309804},
{0.905882, 0.670588, 0.372549},
{0.937255, 0.749020, 0.466667},
{0.968627, 0.827451, 0.545098},
{0.654902, 0.482353, 0.231373},
{0.717647, 0.607843, 0.215686},
{0.780392, 0.764706, 0.215686},
{0.905882, 0.890196, 0.341176},
{0.498039, 0.749020, 1.000000},
{0.670588, 0.905882, 1.000000},
{0.843137, 1.000000, 1.000000},
{0.403922, 0.000000, 0.000000},
{0.545098, 0.000000, 0.000000},
{0.701961, 0.000000, 0.000000},
{0.843137, 0.000000, 0.000000},
{1.000000, 0.000000, 0.000000},
{1.000000, 0.952941, 0.576471},
{1.000000, 0.968627, 0.780392},
{1.000000, 1.000000, 1.000000},
{0.623529, 0.356863, 0.325490}
};

View File

@@ -1035,6 +1035,10 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
// darken down any stencil shadows
RB_ShadowFinish();
// add the particles
//R_AddParticles ();
R_RenderParticles ();
// add light flares on lights that aren't obscured
RB_RenderFlares();
@@ -1543,15 +1547,19 @@ float mblur_timelast;
float time_now;
float time_last;
float mbluracc;
int mblurredframes;
int mblurredframestotal;
void RB_AccumBlurValue (void)
{
int ah, tim, oltim;
oltim = time_last * 10;
tim = time_now * 10;
// calculate how much we need, determined by motion blur fps
mblur_time = time_now - time_last;
mbluracc = (mblur_time) / 32;
mbluracc *= -1;
mbluracc += 1.0f;
mbluracc /= 2;
};
void RB_DrawAccumBlur (void)
@@ -1568,8 +1576,8 @@ void RB_DrawAccumBlur (void)
accblur = mbluracc;
//ri.Printf( PRINT_WARNING, "accum value %f\n", mbluracc );
if (accblur > 1.0f)
accblur = 0.5f;
// if (accblur > 1.0f)
// accblur = 0.5f;
if (accblur <= 0.0f)
{
@@ -1586,6 +1594,7 @@ void RB_DrawAccumBlur (void)
}
else
{
qglAccum (GL_LOAD, 1.0f);
qglAccum (GL_MULT, accblur); // scale contents of accumulation buffer
qglAccum (GL_ACCUM, 1.0f - accblur); // add screen contents
qglAccum (GL_RETURN, 1.0f); // read result back
@@ -1603,7 +1612,6 @@ RB_SwapBuffers
const void *RB_SwapBuffers( const void *data ) {
const swapBuffersCommand_t *cmd;
// finish any 2D drawing if needed
if ( tess.numIndexes ) {
@@ -1637,7 +1645,9 @@ const void *RB_SwapBuffers( const void *data ) {
if (r_motionblur->integer == 1){
RB_DrawAccumBlur ();
}
R_BrightScreen(); // leilei - alternate brightness - do it here so we hit evereything that represents our video buffer
@@ -1695,7 +1705,13 @@ const void *RB_SwapBuffers( const void *data ) {
backEnd.donentsc = qfalse;
backEnd.donetv = qfalse;
backEnd.doneraa = qfalse;
backEnd.doneParticles = qfalse;
// leilei - only reset this every 15hz to keep it fast and synchronized
if (backEnd.refdef.time > backEnd.flareTestTime){
backEnd.doneFlareTests = qfalse;
backEnd.flareTestTime = backEnd.refdef.time + 100.0f;
}
// leilei - artificial slowness (mapper debug) - this might be windows only
#ifdef _WIN32
@@ -1749,11 +1765,9 @@ void RB_ExecuteRenderCommands( const void *data ) {
case RC_STRETCH_PIC:
//Check if it's time for BLOOM!
leifxmode = 0;
R_WaterScreen(); // do this first
R_PostprocessScreen();
R_BloomScreen();
R_FilmScreen();
R_AnimeScreen();
data = RB_StretchPic( data );
break;
case RC_DRAW_SURFS:
@@ -1765,12 +1779,9 @@ void RB_ExecuteRenderCommands( const void *data ) {
case RC_SWAP_BUFFERS:
//Check if it's time for BLOOM!
leifxmode = 0;
R_WaterScreen(); // do this first
R_PostprocessScreen();
R_BloomScreen();
R_FilmScreen();
R_AnimeScreen();
data = RB_SwapBuffers( data );
break;
case RC_SCREENSHOT:

View File

@@ -196,6 +196,7 @@ cvar_t *r_flareMethod; // method of flare intensity
cvar_t *r_flareQuality; // testing quality of the flares.
cvar_t *r_flareSun; // type of flare to use for the sun
cvar_t *r_flareDelay; // time delay for medium quality flare testing
cvar_t *r_flaresMotionBlur; // Stretch blur
cvar_t *r_specMode;
//cvar_t *r_waveMode;
@@ -210,6 +211,7 @@ cvar_t *r_mockvr; // Leilei - for debugging PVR only!
cvar_t *r_parseStageSimple; // Leilei - for debugging PVR only!
cvar_t *r_leifx; // Leilei - leifx nostalgia filter
cvar_t *r_modelshader; // Leilei
cvar_t *r_particles; // Leilei - particle effects motif
cvar_t *r_ntsc; // Leilei - ntsc / composite signals
//cvar_t *r_tvMode; // Leilei - tv fake mode
@@ -1314,7 +1316,7 @@ void R_Register( void )
r_lensReflection2 = ri.Cvar_Get( "r_lensReflection2", "0" , CVAR_ARCHIVE); // fuzzy reflection
r_lensReflectionBrightness = ri.Cvar_Get( "r_lensReflectionBrightness", "0.5" , CVAR_ARCHIVE);
r_flareQuality = ri.Cvar_Get( "r_flareQuality", "1" , CVAR_ARCHIVE); // use medium flares for default
r_flareQuality = ri.Cvar_Get( "r_flareQuality", "4" , CVAR_ARCHIVE); // use high flares for default (lower settings stutter vsync or clip too badly)
r_flareMethod = ri.Cvar_Get( "r_flareMethod", "0" , CVAR_ARCHIVE);
r_flaresDlight = ri.Cvar_Get( "r_flaresDlight", "0" , CVAR_ARCHIVE ); // dynamic light flares
r_flaresDlightShrink = ri.Cvar_Get( "r_flaresDlightShrink", "1" , CVAR_ARCHIVE ); // dynamic light flares shrinking when close (reducing muzzleflash blindness)
@@ -1324,6 +1326,9 @@ void R_Register( void )
r_flareSun = ri.Cvar_Get( "r_flareSun", "0" , CVAR_ARCHIVE); // it's 0 because mappers expect 0.
r_flareDelay = ri.Cvar_Get( "r_flareDelay", "100" , CVAR_CHEAT); // update delay for flare pixel read checking.
r_flaresMotionBlur = ri.Cvar_Get( "r_flaresMotionBlur", "0" , CVAR_ARCHIVE ); // fake motion blur on flares
r_mockvr = ri.Cvar_Get( "r_mockvr", "0" , CVAR_CHEAT);
r_parseStageSimple = ri.Cvar_Get( "r_parseStageSimple", "0" , CVAR_CHEAT);
@@ -1345,6 +1350,7 @@ void R_Register( void )
r_anime = ri.Cvar_Get( "r_anime", "0" , CVAR_ARCHIVE | CVAR_LATCH);
r_palletize = ri.Cvar_Get( "r_palletize", "0" , CVAR_ARCHIVE | CVAR_LATCH);
r_leidebug = ri.Cvar_Get( "r_leidebug", "0" , CVAR_CHEAT);
r_particles = ri.Cvar_Get( "r_particles", "0" , CVAR_ARCHIVE | CVAR_LATCH);
r_leidebugeye = ri.Cvar_Get( "r_leidebugeye", "0" , CVAR_CHEAT);
r_slowness = ri.Cvar_Get( "r_slowness", "0" , CVAR_ARCHIVE); // it's 0 because you want it to be the fastest possible by default.
r_slowness_cpu = ri.Cvar_Get( "r_slowness_cpu", "300" , CVAR_ARCHIVE); // it's 0 because you want it to be the fastest possible by default.
@@ -1557,7 +1563,7 @@ void R_GLSL_Init(void) {
}
#endif
}
extern qboolean initparticles;
/*
===============
@@ -1650,7 +1656,8 @@ void R_Init( void ) {
R_ModelInit();
R_InitFreeType();
err = qglGetError();
if ( err != GL_NO_ERROR )
ri.Printf (PRINT_ALL, "glGetError() = 0x%x\n", err);
@@ -1763,6 +1770,7 @@ refexport_t *GetRefAPI ( int apiVersion, refimport_t *rimp ) {
re.ClearScene = RE_ClearScene;
re.AddRefEntityToScene = RE_AddRefEntityToScene;
re.AddPolyToScene = RE_AddPolyToScene;
re.LFX_ParticleEffect = LFX_ParticleEffect;
re.LightForPoint = R_LightForPoint;
re.AddLightToScene = RE_AddLightToScene;
re.AddAdditiveLightToScene = RE_AddAdditiveLightToScene;

View File

@@ -153,7 +153,8 @@ typedef enum {
DEFORM_TEXT4,
DEFORM_TEXT5,
DEFORM_TEXT6,
DEFORM_TEXT7
DEFORM_TEXT7,
DEFORM_LFX
} deform_t;
typedef enum {
@@ -221,6 +222,25 @@ typedef struct {
float frequency;
} waveForm_t;
typedef struct {
int lfxtype; // ... later
/*
int amount;
int radiusmode;
float radius
float minsize
float maxsize
float r
vec3_t vel;
vec3_t org;
float spread;
int blend;
int shader;
*/
} lfx_t;
// leilei - texture atlases
typedef struct {
float width; // columns
@@ -257,6 +277,8 @@ typedef struct {
float bulgeWidth;
float bulgeHeight;
float bulgeSpeed;
lfx_t deformationLfx;
} deformStage_t;
@@ -1090,6 +1112,9 @@ typedef struct {
qboolean donentsc; // leilei - done ntsc'ing this frame
qboolean donepalette; // leilei - done animeing this frame
qboolean doneSurfaces; // done any 3d surfaces already
qboolean doneParticles; // done any particle movement
qboolean doneFlareTests; // leilei - done testing flares
float flareTestTime;
trRefEntity_t entity2D; // currentEntity will point at this when doing 2D rendering
} backEndState_t;
@@ -1232,6 +1257,8 @@ typedef struct {
qboolean placeholderFogAvail;
qboolean placeholderAvail;
} trGlobals_t;
extern backEndState_t backEnd;
@@ -1369,6 +1396,8 @@ extern cvar_t *r_flaresDlightShrink;
extern cvar_t *r_flaresDlightFade;
extern cvar_t *r_flaresDlightOpacity;
extern cvar_t *r_flaresDlightScale;
extern cvar_t *r_flaresMotionBlur;
//extern cvar_t *r_flaresSurfradii;
extern cvar_t *r_alternateBrightness; // leilei - alternate brightness
@@ -1395,6 +1424,7 @@ extern cvar_t *r_anime; // Leilei - anime filter
extern cvar_t *r_palletize; // Leilei - anime filter
extern cvar_t *r_leidebug; // Leilei - debug only!
extern cvar_t *r_leidebugeye; // Leilei - debug only!
extern cvar_t *r_particles; // Leilei - particles!
extern cvar_t *r_iconmip; // leilei - icon mip - picmip for 2d icons
extern cvar_t *r_iconBits; // leilei - icon color depth for 2d icons
@@ -1580,6 +1610,10 @@ typedef struct shaderCommands_s
int numPasses;
void (*currentStageIteratorFunc)( void );
shaderStage_t **xstages;
// lfx stuf
float lfxTime;
float lfxTimeNext;
} shaderCommands_t;
extern shaderCommands_t tess;
@@ -2335,5 +2369,22 @@ extern int voodootype; // 0 - none 1 - Voodoo Graphics 2 - Voodoo2, 3 - Voodoo B
void RB_UpdateMotionBlur (void);
void R_MotionBlur_BackupScreen(int which);
void R_AddParticles (void);
void R_RenderParticles (void);
void R_ClearParticles (void);
void R_LFX_Spark (vec3_t org, vec3_t dir, float spread, float speed, vec4_t color1, vec4_t color2, vec4_t color3, vec4_t color4, vec4_t color5, int count, int duration, float scaleup, int blendfunc);
void R_LFX_Smoke (vec3_t org, vec3_t dir, float spread, float speed, vec4_t color1, vec4_t color2, vec4_t color3, vec4_t color4, vec4_t color5, int count, int duration, float scaleup, int blendfunc);
void R_LFX_Smoke2 (vec3_t org, vec3_t dir, float spread, float speed, vec4_t color1, vec4_t color2, vec4_t color3, vec4_t color4, vec4_t color5, int count, int duration, float scale, float scaleup, int blendfunc);
void R_LFX_Shock (vec3_t org, vec3_t dir, float spread, float speed, vec4_t color1, vec4_t color2, vec4_t color3, vec4_t color4, vec4_t color5, int count, int duration, float scaleup, int blendfunc);
void R_LFX_Burst (vec3_t org, vec3_t dir, float spread, float speed, vec4_t color1, vec4_t color2, vec4_t color3, vec4_t color4, vec4_t color5, int count, int duration, float scaleup, int blendfunc);
void R_LFX_PushSmoke (vec3_t there, float force);
void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count);
void R_QarticleExplosion(vec3_t org);
void R_LFX_Blood (vec3_t org, vec3_t dir, float pressure) ;
void LFX_ShaderInit(void);
void LFX_ParticleEffect (int effect, vec3_t org, vec3_t dir);
#endif //TR_LOCAL_H

File diff suppressed because it is too large Load Diff

View File

@@ -6212,6 +6212,9 @@ static void CreateExternalShaders( void ) {
if(!tr.placeholderFogShader->defaultShader) tr.placeholderFogAvail = 1;
// leilei - lfx shaders
LFX_ShaderInit();
}
/*

View File

@@ -69,6 +69,8 @@ typedef struct {
void (*AddAdditiveLightToScene)( const vec3_t org, float intensity, float r, float g, float b );
void (*RenderScene)( const refdef_t *fd );
void (*LFX_ParticleEffect)( int effect, const vec3_t origin, const vec3_t velocity ); // leilei - particles
void (*SetColor)( const float *rgba ); // NULL = 1,1,1,1
void (*DrawStretchPic) ( float x, float y, float w, float h,
float s1, float t1, float s2, float t2, qhandle_t hShader ); // 0 = white

View File

@@ -1348,6 +1348,7 @@ refexport_t *GetRefAPI ( int apiVersion, refimport_t *rimp ) {
re.ClearScene = RE_ClearScene;
re.AddRefEntityToScene = RE_AddRefEntityToScene;
re.AddPolyToScene = RE_AddPolyToScene;
re.LFX_ParticleEffect = NULL;
re.LightForPoint = R_LightForPoint;
re.AddLightToScene = RE_AddLightToScene;
re.AddAdditiveLightToScene = RE_AddAdditiveLightToScene;

View File

@@ -1558,6 +1558,7 @@ refexport_t *GetRefAPI ( int apiVersion, refimport_t *rimp ) {
re.ClearScene = RE_ClearScene;
re.AddRefEntityToScene = RE_AddRefEntityToScene;
re.AddPolyToScene = RE_AddPolyToScene;
re.LFX_ParticleEffect = NULL;
re.LightForPoint = R_LightForPoint;
re.AddLightToScene = RE_AddLightToScene;
re.AddAdditiveLightToScene = RE_AddAdditiveLightToScene;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB