fixed RB_CalcTurbulentTexCoords by using the correct vertex offset

it got broken with db4fb31658
This commit is contained in:
myT 2020-10-27 00:30:13 +01:00
parent 55ed0e80af
commit 3e0f5b2760
2 changed files with 7 additions and 4 deletions

View file

@ -25,6 +25,8 @@ chg: with r_backend GL3, depth fade with MSAA now requires GLSL 4.00 at a minimu
chg: with r_backend GL3, alpha to coverage now requires GLSL 4.00 at a minimum
fix: batched surfaces with "tcMod turb" would generate incorrect texture coordinates
fix: throwing a fatal error when com_soundMegs is too low to load a map instead of freezing
fix: /video produced .avi files that started with silence when they were not first in the sequence

View file

@ -830,10 +830,11 @@ static void RB_CalcEnvironmentTexCoords( float *st, int firstVertex, int numVert
}
static void RB_CalcTurbulentTexCoords( const waveForm_t *wf, float *st, int numVertexes )
static void RB_CalcTurbulentTexCoords( const waveForm_t *wf, float *st, int firstVertex, int numVertexes )
{
int i;
double now;
vec4_t* const v = &tess.xyz[firstVertex];
now = ( wf->phase + tess.shaderTime * wf->frequency );
@ -842,8 +843,8 @@ static void RB_CalcTurbulentTexCoords( const waveForm_t *wf, float *st, int numV
float s = st[0];
float t = st[1];
st[0] = s + tr.sinTable[ ( ( int ) ( ( ( tess.xyz[i][0] + tess.xyz[i][2] )* 1.0/128 * 0.125 + now ) * FUNCTABLE_SIZE ) ) & ( FUNCTABLE_MASK ) ] * wf->amplitude;
st[1] = t + tr.sinTable[ ( ( int ) ( ( tess.xyz[i][1] * 1.0/128 * 0.125 + now ) * FUNCTABLE_SIZE ) ) & ( FUNCTABLE_MASK ) ] * wf->amplitude;
st[0] = s + tr.sinTable[ ( ( int ) ( ( ( v[i][0] + v[i][2] )* 1.0/128 * 0.125 + now ) * FUNCTABLE_SIZE ) ) & ( FUNCTABLE_MASK ) ] * wf->amplitude;
st[1] = t + tr.sinTable[ ( ( int ) ( ( v[i][1] * 1.0/128 * 0.125 + now ) * FUNCTABLE_SIZE ) ) & ( FUNCTABLE_MASK ) ] * wf->amplitude;
}
}
@ -1231,7 +1232,7 @@ void R_ComputeTexCoords( const shaderStage_t* pStage, stageVars_t& svars, int fi
break;
case TMOD_TURBULENT:
RB_CalcTurbulentTexCoords( &pStage->texMods[i].wave, (float*)&svars.texcoords[firstVertex], numVertexes );
RB_CalcTurbulentTexCoords( &pStage->texMods[i].wave, (float*)&svars.texcoords[firstVertex], firstVertex, numVertexes );
break;
case TMOD_ENTITY_TRANSLATE: