Permalink
Browse files

make plane fading working

  • Loading branch information...
isRyven committed Feb 6, 2019
1 parent d97ae71 commit b1ae2c1d0812e0ca93809ad43737dbef61ca259f
Showing with 26 additions and 7 deletions.
  1. +21 −0 etmain/scripts/legacy_models_mapobjects.shader
  2. +5 −3 src/cgame/cg_ents.c
  3. +0 −1 src/cgame/cg_local.h
  4. +0 −3 src/cgame/cg_main.c
@@ -0,0 +1,21 @@
models/mapobjects/etl_plane/junker88
{
{
map models/mapobjects/etl_plane/junker88.tga
blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
rgbGen identity
alphaGen entity
depthwrite
}
}

models/mapobjects/etl_plane/b-25
{
{
map models/mapobjects/etl_plane/b-25.tga
blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
rgbGen identity
alphaGen entity
depthwrite
}
}
@@ -1679,20 +1679,22 @@ void CG_MovePlane(centity_t *cent)
// fade effect
if (cent->currentState.time)
{
ent.shaderRGBA[3] = (byte)(255.f * (float)(cent->currentState.time2 - cg.time) / (float)(cent->currentState.time2 - cent->currentState.time));
ent.shaderRGBA[3] = (byte)(255.f * (float)(cent->currentState.time2 - cg.time) / (float)(cent->currentState.time2 - cent->currentState.time));
}
else
{
ent.shaderRGBA[3] = 255;
}

// model
// explicit shader to apply fade effect
if (cent->currentState.teamNum == TEAM_AXIS)
{
ent.hModel = cgs.media.airstrikePlane[0];
ent.customShader = cgs.media.airstrikePlaneShader[0];
}
else
{
ent.hModel = cgs.media.airstrikePlane[1];
ent.customShader = cgs.media.airstrikePlaneShader[1];
}

// add to refresh list
@@ -1486,7 +1486,6 @@ typedef struct
qhandle_t mg42muzzleflash;

qhandle_t airstrikePlane[2];
qhandle_t airstrikePlaneShader[2];

qhandle_t waterSplashModel;
qhandle_t waterSplashShader;
@@ -1871,9 +1871,6 @@ static void CG_RegisterGraphics(void)
cgs.media.airstrikePlane[0] = trap_R_RegisterModel("models/mapobjects/etl_plane/junker88.md3"); // axis
cgs.media.airstrikePlane[1] = trap_R_RegisterModel("models/mapobjects/etl_plane/b-25.md3"); // allies

cgs.media.airstrikePlaneShader[0] = trap_R_RegisterShader("models/mapobjects/etl_plane/junker88"); // axis
cgs.media.airstrikePlaneShader[1] = trap_R_RegisterShader("models/mapobjects/etl_plane/b-25"); // allies

// shards
cgs.media.shardGlass1 = trap_R_RegisterModel("models/shards/glass1.md3");
cgs.media.shardGlass2 = trap_R_RegisterModel("models/shards/glass2.md3");

0 comments on commit b1ae2c1

Please sign in to comment.