mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-25 14:00:58 +00:00
renders: Move scroll logic to R_FlowingScroll
This commit is contained in:
parent
dbccc9353f
commit
eb344a030e
44 changed files with 258 additions and 237 deletions
1
Makefile
1
Makefile
|
@ -1218,6 +1218,7 @@ REFSOFT_OBJS_ := \
|
|||
src/client/refresh/files/pcx.o \
|
||||
src/client/refresh/files/stb.o \
|
||||
src/client/refresh/files/wal.o \
|
||||
src/client/refresh/files/warp.o \
|
||||
src/client/refresh/files/pvs.o \
|
||||
src/common/shared/shared.o \
|
||||
src/common/shared/utils.o \
|
||||
|
|
|
@ -12,13 +12,13 @@ Alpha windows 64 bit [binaries](https://github.com/yquake2/yquake2remaster/relea
|
|||
|
||||
State:
|
||||
* GL1/GLES3/GL3/GL4/VK:
|
||||
* base1: no known issies
|
||||
* base2: no known issies
|
||||
* base1: no known issues,
|
||||
* base2: no known issues,
|
||||
* q64/outpost: flow surface and scale textures unsupported,
|
||||
* mguhub: loaded, sometimes broken logic for surface fall in next maps.
|
||||
* SOFT:
|
||||
* base1: broken wall light
|
||||
* base2: broken wall light
|
||||
* base1: broken wall light and wall glitch,
|
||||
* base2: broken wall light and wall glitch,
|
||||
* q64/outpost: flow surface and scale textures unsupported,
|
||||
* mguhub: broken wall light, sometimes broken logic for surface fall
|
||||
in next maps.
|
||||
|
|
|
@ -380,3 +380,38 @@ R_MakeSkyVec(float s, float t, int axis, mvtx_t* vert, qboolean farsee,
|
|||
|
||||
vert->lmTexCoord[0] = vert->lmTexCoord[1] = 0.0f;
|
||||
}
|
||||
|
||||
void
|
||||
R_FlowingScroll(const refdef_t *r_newrefdef, int flags, float *sscroll, float *tscroll)
|
||||
{
|
||||
float multiply = 0.0;
|
||||
|
||||
*sscroll = 0;
|
||||
*tscroll = 0;
|
||||
|
||||
if (flags & SURF_DRAWTURB)
|
||||
{
|
||||
if (flags & SURF_FLOWING)
|
||||
{
|
||||
multiply = 0.5; // mod 2
|
||||
}
|
||||
}
|
||||
else if (flags & SURF_FLOWING)
|
||||
{
|
||||
if (flags & SURF_WARP)
|
||||
{
|
||||
multiply = 0.25; // mod 4
|
||||
}
|
||||
else
|
||||
{
|
||||
multiply = 0.77; // mod 100
|
||||
}
|
||||
}
|
||||
|
||||
*sscroll = -64.0f * ((r_newrefdef->time * multiply) - (int)(r_newrefdef->time * multiply));
|
||||
|
||||
if (*sscroll == 0.0)
|
||||
{
|
||||
*sscroll = -64.0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,26 +61,21 @@ R_DrawGLFlowingPoly(msurface_t *fa)
|
|||
int i;
|
||||
mvtx_t* vert;
|
||||
mpoly_t *p;
|
||||
float scroll;
|
||||
float sscroll, tscroll;
|
||||
|
||||
p = fa->polys;
|
||||
|
||||
scroll = -64 * ((r_newrefdef.time / 40.0) - (int)(r_newrefdef.time / 40.0));
|
||||
R_FlowingScroll(&r_newrefdef, fa->texinfo->flags, &sscroll, &tscroll);
|
||||
|
||||
if (scroll == 0.0)
|
||||
{
|
||||
scroll = -64.0;
|
||||
}
|
||||
|
||||
YQ2_VLA(GLfloat, tex, 2*p->numverts);
|
||||
YQ2_VLA(GLfloat, tex, 2 * p->numverts);
|
||||
unsigned int index_tex = 0;
|
||||
|
||||
vert = p->verts;
|
||||
|
||||
for ( i = 0; i < p->numverts; i++, vert++)
|
||||
{
|
||||
tex[index_tex++] = vert->texCoord[0] + scroll;
|
||||
tex[index_tex++] = vert->texCoord[1];
|
||||
tex[index_tex++] = vert->texCoord[0] + sscroll;
|
||||
tex[index_tex++] = vert->texCoord[1] + tscroll;
|
||||
}
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
|
@ -464,7 +459,7 @@ R_RenderBrushPoly(const entity_t *currententity, msurface_t *fa)
|
|||
R_TexEnv(GL_REPLACE);
|
||||
}
|
||||
|
||||
if (fa->texinfo->flags & SURF_FLOWING)
|
||||
if (fa->texinfo->flags & SURF_SCROLL)
|
||||
{
|
||||
R_DrawGLFlowingPoly(fa);
|
||||
}
|
||||
|
@ -583,7 +578,7 @@ R_DrawAlphaSurfaces(void)
|
|||
{
|
||||
R_EmitWaterPolys(s);
|
||||
}
|
||||
else if (s->texinfo->flags & SURF_FLOWING)
|
||||
else if (s->texinfo->flags & SURF_SCROLL)
|
||||
{
|
||||
R_DrawGLFlowingPoly(s);
|
||||
}
|
||||
|
|
|
@ -70,17 +70,9 @@ R_EmitWaterPolys(msurface_t *fa)
|
|||
mvtx_t *v;
|
||||
int i;
|
||||
float s, t, os, ot;
|
||||
float scroll;
|
||||
float rdt = r_newrefdef.time;
|
||||
float sscroll, tscroll;
|
||||
|
||||
if (fa->texinfo->flags & SURF_FLOWING)
|
||||
{
|
||||
scroll = -64 * ((r_newrefdef.time * 0.5) - (int)(r_newrefdef.time * 0.5));
|
||||
}
|
||||
else
|
||||
{
|
||||
scroll = 0;
|
||||
}
|
||||
R_FlowingScroll(&r_newrefdef, fa->texinfo->flags, &sscroll, &tscroll);
|
||||
|
||||
// workaround for lack of VLAs (=> our workaround uses alloca() which is bad in loops)
|
||||
#ifdef _MSC_VER
|
||||
|
@ -108,10 +100,11 @@ R_EmitWaterPolys(msurface_t *fa)
|
|||
ot = v->texCoord[1];
|
||||
|
||||
s = os + r_turbsin [ (int) ( ( ot * 0.125 + r_newrefdef.time ) * TURBSCALE ) & 255 ];
|
||||
s += scroll;
|
||||
s += sscroll;
|
||||
tex[index_tex++] = s * ( 1.0 / 64 );
|
||||
|
||||
t = ot + r_turbsin [ (int) ( ( os * 0.125 + rdt ) * TURBSCALE ) & 255 ];
|
||||
t = ot + r_turbsin [ (int) ( ( os * 0.125 + r_newrefdef.time ) * TURBSCALE ) & 255 ];
|
||||
t += tscroll;
|
||||
tex[index_tex++] = t * ( 1.0 / 64 );
|
||||
}
|
||||
|
||||
|
|
|
@ -357,14 +357,14 @@ static const char* vertexCommon3D = MULTILINE_STRING(
|
|||
mat4 transProjView;
|
||||
mat4 transModel;
|
||||
|
||||
float scroll; // for SURF_FLOWING
|
||||
float sscroll; // for SURF_FLOWING
|
||||
float tscroll; // for SURF_FLOWING
|
||||
float time;
|
||||
float alpha;
|
||||
float overbrightbits;
|
||||
float particleFadeFactor;
|
||||
float lightScaleForTurb; // surfaces with SURF_DRAWTURB (water, lava) don't have lightmaps, use this instead
|
||||
float _pad_1; // AMDs legacy windows driver needs this, otherwise uni3D has wrong size
|
||||
float _pad_2;
|
||||
float _pad_1; // AMDs legacy windows driver needs this, otherwise uni3D has wrong size, round up to 16 bytes?
|
||||
};
|
||||
);
|
||||
|
||||
|
@ -389,14 +389,14 @@ static const char* fragmentCommon3D = MULTILINE_STRING(
|
|||
mat4 transProjView;
|
||||
mat4 transModel;
|
||||
|
||||
float scroll; // for SURF_FLOWING
|
||||
float sscroll; // for SURF_FLOWING
|
||||
float tscroll; // for SURF_FLOWING
|
||||
float time;
|
||||
float alpha;
|
||||
float overbrightbits;
|
||||
float particleFadeFactor;
|
||||
float lightScaleForTurb; // surfaces with SURF_DRAWTURB (water, lava) don't have lightmaps, use this instead
|
||||
float _pad_1; // AMDs legacy windows driver needs this, otherwise uni3D has wrong size
|
||||
float _pad_2;
|
||||
float _pad_1; // AMDs legacy windows driver needs this, otherwise uni3D has wrong size, round up to 16 bytes?
|
||||
};
|
||||
);
|
||||
|
||||
|
@ -417,7 +417,7 @@ static const char* vertexSrc3Dflow = MULTILINE_STRING(
|
|||
|
||||
void main()
|
||||
{
|
||||
passTexCoord = texCoord + vec2(scroll, 0.0);
|
||||
passTexCoord = texCoord + vec2(sscroll, tscroll);
|
||||
gl_Position = transProjView * transModel * vec4(position, 1.0);
|
||||
}
|
||||
);
|
||||
|
@ -456,7 +456,7 @@ static const char* vertexSrc3DlmFlow = MULTILINE_STRING(
|
|||
|
||||
void main()
|
||||
{
|
||||
passTexCoord = texCoord + vec2(scroll, 0.0);
|
||||
passTexCoord = texCoord + vec2(sscroll, tscroll);
|
||||
passLMcoord = lmTexCoord;
|
||||
vec4 worldCoord = transModel * vec4(position, 1.0);
|
||||
passWorldCoord = worldCoord.xyz;
|
||||
|
@ -495,8 +495,9 @@ static const char* fragmentSrc3Dwater = MULTILINE_STRING(
|
|||
{
|
||||
vec2 tc = passTexCoord;
|
||||
tc.s += sin( passTexCoord.t*0.125 + time ) * 4.0;
|
||||
tc.s += scroll;
|
||||
tc.s += sscroll;
|
||||
tc.t += sin( passTexCoord.s*0.125 + time ) * 4.0;
|
||||
tc.s += tscroll;
|
||||
tc *= 1.0/64.0; // do this last
|
||||
|
||||
vec4 texel = texture(tex, tc);
|
||||
|
@ -1161,7 +1162,8 @@ static void initUBOs(void)
|
|||
// the matrices will be set to something more useful later, before being used
|
||||
gl3state.uni3DData.transProjViewMat4 = HMM_Mat4();
|
||||
gl3state.uni3DData.transModelMat4 = gl3_identityMat4;
|
||||
gl3state.uni3DData.scroll = 0.0f;
|
||||
gl3state.uni3DData.sscroll = 0.0f;
|
||||
gl3state.uni3DData.tscroll = 0.0f;
|
||||
gl3state.uni3DData.time = 0.0f;
|
||||
gl3state.uni3DData.alpha = 1.0f;
|
||||
// gl3_overbrightbits 0 means "no scaling" which is equivalent to multiplying with 1
|
||||
|
|
|
@ -178,23 +178,20 @@ void
|
|||
GL3_DrawGLFlowingPoly(msurface_t *fa)
|
||||
{
|
||||
mpoly_t *p;
|
||||
float scroll;
|
||||
float sscroll, tscroll;
|
||||
|
||||
p = fa->polys;
|
||||
|
||||
scroll = -64.0f * ((gl3_newrefdef.time / 40.0f) - (int)(gl3_newrefdef.time / 40.0f));
|
||||
R_FlowingScroll(&gl3_newrefdef, fa->texinfo->flags, &sscroll, &tscroll);
|
||||
|
||||
if (scroll == 0.0f)
|
||||
if((gl3state.uni3DData.sscroll != sscroll) || (gl3state.uni3DData.tscroll != tscroll))
|
||||
{
|
||||
scroll = -64.0f;
|
||||
}
|
||||
|
||||
if(gl3state.uni3DData.scroll != scroll)
|
||||
{
|
||||
gl3state.uni3DData.scroll = scroll;
|
||||
gl3state.uni3DData.sscroll = sscroll;
|
||||
gl3state.uni3DData.tscroll = tscroll;
|
||||
GL3_UpdateUBO3D();
|
||||
}
|
||||
|
||||
|
||||
GL3_BindVAO(gl3state.vao3D);
|
||||
GL3_BindVBO(gl3state.vbo3D);
|
||||
|
||||
|
@ -324,7 +321,7 @@ RenderBrushPoly(entity_t *currententity, msurface_t *fa)
|
|||
lmScales[map].A = 1.0f;
|
||||
}
|
||||
|
||||
if (fa->texinfo->flags & SURF_FLOWING)
|
||||
if (fa->texinfo->flags & SURF_SCROLL)
|
||||
{
|
||||
GL3_UseProgram(gl3state.si3DlmFlow.shaderProgram);
|
||||
UpdateLMscales(lmScales, &gl3state.si3DlmFlow);
|
||||
|
@ -380,7 +377,7 @@ GL3_DrawAlphaSurfaces(void)
|
|||
{
|
||||
GL3_EmitWaterPolys(s);
|
||||
}
|
||||
else if (s->texinfo->flags & SURF_FLOWING)
|
||||
else if (s->texinfo->flags & SURF_SCROLL)
|
||||
{
|
||||
GL3_UseProgram(gl3state.si3DtransFlow.shaderProgram);
|
||||
GL3_DrawGLFlowingPoly(s);
|
||||
|
@ -463,7 +460,7 @@ RenderLightmappedPoly(entity_t *currententity, msurface_t *surf)
|
|||
GL3_Bind(image->texnum);
|
||||
GL3_BindLightmap(surf->lightmaptexturenum);
|
||||
|
||||
if (surf->texinfo->flags & SURF_FLOWING)
|
||||
if (surf->texinfo->flags & SURF_SCROLL)
|
||||
{
|
||||
GL3_UseProgram(gl3state.si3DlmFlow.shaderProgram);
|
||||
UpdateLMscales(lmScales, &gl3state.si3DlmFlow);
|
||||
|
|
|
@ -34,21 +34,15 @@ void
|
|||
GL3_EmitWaterPolys(msurface_t *fa)
|
||||
{
|
||||
mpoly_t *bp;
|
||||
float scroll = 0.0f;
|
||||
float sscroll, tscroll = 0.0f;
|
||||
|
||||
if (fa->texinfo->flags & SURF_FLOWING)
|
||||
{
|
||||
scroll = -64.0f * ((gl3_newrefdef.time * 0.5) - (int)(gl3_newrefdef.time * 0.5));
|
||||
if (scroll == 0.0f) // this is done in GL3_DrawGLFlowingPoly() TODO: keep?
|
||||
{
|
||||
scroll = -64.0f;
|
||||
}
|
||||
}
|
||||
R_FlowingScroll(&gl3_newrefdef, fa->texinfo->flags, &sscroll, &tscroll);
|
||||
|
||||
qboolean updateUni3D = false;
|
||||
if(gl3state.uni3DData.scroll != scroll)
|
||||
if((gl3state.uni3DData.sscroll != sscroll) || (gl3state.uni3DData.tscroll != tscroll))
|
||||
{
|
||||
gl3state.uni3DData.scroll = scroll;
|
||||
gl3state.uni3DData.sscroll = sscroll;
|
||||
gl3state.uni3DData.tscroll = tscroll;
|
||||
updateUni3D = true;
|
||||
}
|
||||
// these surfaces (mostly water and lava, I think?) don't have a lightmap.
|
||||
|
|
|
@ -158,14 +158,15 @@ typedef struct
|
|||
hmm_mat4 transProjViewMat4; // gl3state.projMat3D * gl3state.viewMat3D - so we don't have to do this in the shader
|
||||
hmm_mat4 transModelMat4;
|
||||
|
||||
GLfloat scroll; // for SURF_FLOWING
|
||||
GLfloat sscroll; // for SURF_FLOWING
|
||||
GLfloat tscroll; // for SURF_FLOWING
|
||||
GLfloat time; // for warping surfaces like water & possibly other things
|
||||
GLfloat alpha; // for translucent surfaces (water, glass, ..)
|
||||
GLfloat overbrightbits; // gl3_overbrightbits, applied to lightmaps (and elsewhere to models)
|
||||
GLfloat particleFadeFactor; // gl3_particle_fade_factor, higher => less fading out towards edges
|
||||
|
||||
GLfloat lightScaleForTurb; // surfaces with SURF_DRAWTURB (water, lava) don't have lightmaps, use this instead
|
||||
GLfloat _padding[2]; // again, some padding to ensure this has right size
|
||||
GLfloat _padding; // again, some padding to ensure this has right size, round up to 16 bytes?
|
||||
} gl3Uni3D_t;
|
||||
|
||||
extern const hmm_mat4 gl3_identityMat4;
|
||||
|
|
|
@ -261,7 +261,6 @@ static const char* fragmentSrc2DpostprocessWater = MULTILINE_STRING(
|
|||
uniform sampler2D tex;
|
||||
|
||||
uniform float time;
|
||||
|
||||
uniform vec4 v_blend;
|
||||
|
||||
out vec4 outColor;
|
||||
|
@ -346,14 +345,14 @@ static const char* vertexCommon3D = MULTILINE_STRING(
|
|||
mat4 transProjView;
|
||||
mat4 transModel;
|
||||
|
||||
float scroll; // for SURF_FLOWING
|
||||
float sscroll; // for SURF_FLOWING
|
||||
float tscroll; // for SURF_FLOWING
|
||||
float time;
|
||||
float alpha;
|
||||
float overbrightbits;
|
||||
float particleFadeFactor;
|
||||
float lightScaleForTurb; // surfaces with SURF_DRAWTURB (water, lava) don't have lightmaps, use this instead
|
||||
float _pad_1; // AMDs legacy windows driver needs this, otherwise uni3D has wrong size
|
||||
float _pad_2;
|
||||
float _pad_1; // AMDs legacy windows driver needs this, otherwise uni3D has wrong size, round up to 16 bytes?
|
||||
};
|
||||
);
|
||||
|
||||
|
@ -378,14 +377,14 @@ static const char* fragmentCommon3D = MULTILINE_STRING(
|
|||
mat4 transProjView;
|
||||
mat4 transModel;
|
||||
|
||||
float scroll; // for SURF_FLOWING
|
||||
float sscroll; // for SURF_FLOWING
|
||||
float tscroll; // for SURF_FLOWING
|
||||
float time;
|
||||
float alpha;
|
||||
float overbrightbits;
|
||||
float particleFadeFactor;
|
||||
float lightScaleForTurb; // surfaces with SURF_DRAWTURB (water, lava) don't have lightmaps, use this instead
|
||||
float _pad_1; // AMDs legacy windows driver needs this, otherwise uni3D has wrong size
|
||||
float _pad_2;
|
||||
float _pad_1; // AMDs legacy windows driver needs this, otherwise uni3D has wrong size, round up to 16 bytes?
|
||||
};
|
||||
);
|
||||
|
||||
|
@ -406,7 +405,7 @@ static const char* vertexSrc3Dflow = MULTILINE_STRING(
|
|||
|
||||
void main()
|
||||
{
|
||||
passTexCoord = texCoord + vec2(scroll, 0.0);
|
||||
passTexCoord = texCoord + vec2(sscroll, tscroll);
|
||||
gl_Position = transProjView * transModel * vec4(position, 1.0);
|
||||
}
|
||||
);
|
||||
|
@ -445,7 +444,7 @@ static const char* vertexSrc3DlmFlow = MULTILINE_STRING(
|
|||
|
||||
void main()
|
||||
{
|
||||
passTexCoord = texCoord + vec2(scroll, 0.0);
|
||||
passTexCoord = texCoord + vec2(sscroll, tscroll);
|
||||
passLMcoord = lmTexCoord;
|
||||
vec4 worldCoord = transModel * vec4(position, 1.0);
|
||||
passWorldCoord = worldCoord.xyz;
|
||||
|
@ -484,8 +483,9 @@ static const char* fragmentSrc3Dwater = MULTILINE_STRING(
|
|||
{
|
||||
vec2 tc = passTexCoord;
|
||||
tc.s += sin( passTexCoord.t*0.125 + time ) * 4.0;
|
||||
tc.s += scroll;
|
||||
tc.s += sscroll;
|
||||
tc.t += sin( passTexCoord.s*0.125 + time ) * 4.0;
|
||||
tc.s += tscroll;
|
||||
tc *= 1.0/64.0; // do this last
|
||||
|
||||
vec4 texel = texture(tex, tc);
|
||||
|
@ -1150,7 +1150,8 @@ static void initUBOs(void)
|
|||
// the matrices will be set to something more useful later, before being used
|
||||
gl4state.uni3DData.transProjViewMat4 = HMM_Mat4();
|
||||
gl4state.uni3DData.transModelMat4 = gl4_identityMat4;
|
||||
gl4state.uni3DData.scroll = 0.0f;
|
||||
gl4state.uni3DData.sscroll = 0.0f;
|
||||
gl4state.uni3DData.tscroll = 0.0f;
|
||||
gl4state.uni3DData.time = 0.0f;
|
||||
gl4state.uni3DData.alpha = 1.0f;
|
||||
// gl4_overbrightbits 0 means "no scaling" which is equivalent to multiplying with 1
|
||||
|
|
|
@ -177,20 +177,16 @@ void
|
|||
GL4_DrawGLFlowingPoly(msurface_t *fa)
|
||||
{
|
||||
mpoly_t *p;
|
||||
float scroll;
|
||||
float sscroll, tscroll;
|
||||
|
||||
p = fa->polys;
|
||||
|
||||
scroll = -64.0f * ((gl4_newrefdef.time / 40.0f) - (int)(gl4_newrefdef.time / 40.0f));
|
||||
R_FlowingScroll(&gl4_newrefdef, fa->texinfo->flags, &sscroll, &tscroll);
|
||||
|
||||
if (scroll == 0.0f)
|
||||
if((gl4state.uni3DData.sscroll != sscroll) || (gl4state.uni3DData.tscroll != tscroll))
|
||||
{
|
||||
scroll = -64.0f;
|
||||
}
|
||||
|
||||
if(gl4state.uni3DData.scroll != scroll)
|
||||
{
|
||||
gl4state.uni3DData.scroll = scroll;
|
||||
gl4state.uni3DData.sscroll = sscroll;
|
||||
gl4state.uni3DData.tscroll = tscroll;
|
||||
GL4_UpdateUBO3D();
|
||||
}
|
||||
|
||||
|
@ -323,7 +319,7 @@ RenderBrushPoly(entity_t *currententity, msurface_t *fa)
|
|||
lmScales[map].A = 1.0f;
|
||||
}
|
||||
|
||||
if (fa->texinfo->flags & SURF_FLOWING)
|
||||
if (fa->texinfo->flags & SURF_SCROLL)
|
||||
{
|
||||
GL4_UseProgram(gl4state.si3DlmFlow.shaderProgram);
|
||||
UpdateLMscales(lmScales, &gl4state.si3DlmFlow);
|
||||
|
@ -379,7 +375,7 @@ GL4_DrawAlphaSurfaces(void)
|
|||
{
|
||||
GL4_EmitWaterPolys(s);
|
||||
}
|
||||
else if (s->texinfo->flags & SURF_FLOWING)
|
||||
else if (s->texinfo->flags & SURF_SCROLL)
|
||||
{
|
||||
GL4_UseProgram(gl4state.si3DtransFlow.shaderProgram);
|
||||
GL4_DrawGLFlowingPoly(s);
|
||||
|
@ -462,7 +458,7 @@ RenderLightmappedPoly(entity_t *currententity, msurface_t *surf)
|
|||
GL4_Bind(image->texnum);
|
||||
GL4_BindLightmap(surf->lightmaptexturenum);
|
||||
|
||||
if (surf->texinfo->flags & SURF_FLOWING)
|
||||
if (surf->texinfo->flags & SURF_SCROLL)
|
||||
{
|
||||
GL4_UseProgram(gl4state.si3DlmFlow.shaderProgram);
|
||||
UpdateLMscales(lmScales, &gl4state.si3DlmFlow);
|
||||
|
|
|
@ -34,23 +34,19 @@ void
|
|||
GL4_EmitWaterPolys(msurface_t *fa)
|
||||
{
|
||||
mpoly_t *bp;
|
||||
float scroll = 0.0f;
|
||||
|
||||
if (fa->texinfo->flags & SURF_FLOWING)
|
||||
{
|
||||
scroll = -64.0f * ((gl4_newrefdef.time * 0.5) - (int)(gl4_newrefdef.time * 0.5));
|
||||
if (scroll == 0.0f) // this is done in GL4_DrawGLFlowingPoly() TODO: keep?
|
||||
{
|
||||
scroll = -64.0f;
|
||||
}
|
||||
}
|
||||
float sscroll, tscroll = 0.0f;
|
||||
|
||||
R_FlowingScroll(&gl4_newrefdef, fa->texinfo->flags, &sscroll, &tscroll);
|
||||
|
||||
qboolean updateUni3D = false;
|
||||
if(gl4state.uni3DData.scroll != scroll)
|
||||
if((gl4state.uni3DData.sscroll != sscroll) || (gl4state.uni3DData.tscroll != tscroll))
|
||||
{
|
||||
gl4state.uni3DData.scroll = scroll;
|
||||
gl4state.uni3DData.sscroll = sscroll;
|
||||
gl4state.uni3DData.tscroll = tscroll;
|
||||
updateUni3D = true;
|
||||
}
|
||||
|
||||
// these surfaces (mostly water and lava, I think?) don't have a lightmap.
|
||||
// rendering water at full brightness looks bad (esp. for water in dark environments)
|
||||
// so default use a factor of 0.5 (ontop of intensity)
|
||||
|
|
|
@ -148,14 +148,15 @@ typedef struct
|
|||
hmm_mat4 transProjViewMat4; // gl4state.projMat3D * gl4state.viewMat3D - so we don't have to do this in the shader
|
||||
hmm_mat4 transModelMat4;
|
||||
|
||||
GLfloat scroll; // for SURF_FLOWING
|
||||
GLfloat sscroll; // for SURF_FLOWING
|
||||
GLfloat tscroll; // for SURF_FLOWING
|
||||
GLfloat time; // for warping surfaces like water & possibly other things
|
||||
GLfloat alpha; // for translucent surfaces (water, glass, ..)
|
||||
GLfloat overbrightbits; // gl4_overbrightbits, applied to lightmaps (and elsewhere to models)
|
||||
GLfloat particleFadeFactor; // gl4_particle_fade_factor, higher => less fading out towards edges
|
||||
|
||||
GLfloat lightScaleForTurb; // surfaces with SURF_DRAWTURB (water, lava) don't have lightmaps, use this instead
|
||||
GLfloat _padding[2]; // again, some padding to ensure this has right size
|
||||
GLfloat _padding; // again, some padding to ensure this has right size, round up to 16 bytes?
|
||||
} gl4Uni3D_t;
|
||||
|
||||
extern const hmm_mat4 gl4_identityMat4;
|
||||
|
|
|
@ -417,6 +417,8 @@ extern void R_AddSkySurface(msurface_t *fa,
|
|||
extern void R_ClearSkyBox(float skymins[2][6], float skymaxs[2][6]);
|
||||
extern void R_MakeSkyVec(float s, float t, int axis, mvtx_t* vert,
|
||||
qboolean farsee, float sky_min, float sky_max);
|
||||
extern void R_FlowingScroll(const refdef_t *r_newrefdef, int flags,
|
||||
float *sscroll, float *tscroll);
|
||||
|
||||
/* GL only code */
|
||||
extern const char* glshader_version(int major_version, int minor_version);
|
||||
|
|
|
@ -815,12 +815,13 @@ D_CalcGradients (msurface_t *pface, float d_ziorigin, float d_zistepu, float d_z
|
|||
+ pface->texinfo->vecs[1][3]*t;
|
||||
|
||||
// changing flow speed for non-warping textures.
|
||||
if (pface->texinfo->flags & SURF_FLOWING)
|
||||
if (pface->texinfo->flags & SURF_SCROLL)
|
||||
{
|
||||
if(pface->texinfo->flags & SURF_WARP)
|
||||
sadjust += SHIFT16XYZ_MULT * (-128 * ( (r_newrefdef.time * 0.25) - (int)(r_newrefdef.time * 0.25) ));
|
||||
else
|
||||
sadjust += SHIFT16XYZ_MULT * (-128 * ( (r_newrefdef.time * 0.77) - (int)(r_newrefdef.time * 0.77) ));
|
||||
float sscroll, tscroll;
|
||||
|
||||
R_FlowingScroll(&r_newrefdef, pface->texinfo->flags, &sscroll, &tscroll);
|
||||
sadjust += SHIFT16XYZ_MULT * 2 * sscroll;
|
||||
tadjust += SHIFT16XYZ_MULT * 2 * tscroll;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -288,10 +288,10 @@ Mod_LoadQFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
|||
|
||||
//==============
|
||||
// this marks flowing surfaces as turbulent.
|
||||
if (out->texinfo->flags & SURF_FLOWING)
|
||||
if (out->texinfo->flags & SURF_SCROLL)
|
||||
{
|
||||
out->flags |= SURF_DRAWTURB;
|
||||
for (i=0 ; i<2 ; i++)
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
out->extents[i] = 16384;
|
||||
out->texturemins[i] = -8192;
|
||||
|
|
|
@ -1083,7 +1083,7 @@ R_BuildPolygonFromSurface(const entity_t *currententity, const model_t *currentm
|
|||
VectorSubtract( vec3_origin, r_polydesc.vpn, r_polydesc.vpn );
|
||||
}
|
||||
|
||||
if ( fa->texinfo->flags & (SURF_WARP|SURF_FLOWING) )
|
||||
if ( fa->texinfo->flags & (SURF_WARP | SURF_SCROLL) )
|
||||
{
|
||||
r_polydesc.pixels = fa->texinfo->image->pixels[0];
|
||||
r_polydesc.pixel_width = fa->texinfo->image->width;
|
||||
|
@ -1109,9 +1109,14 @@ R_BuildPolygonFromSurface(const entity_t *currententity, const model_t *currentm
|
|||
r_polydesc.t_offset = fa->texinfo->vecs[1][3] - tmins[1];
|
||||
|
||||
// scrolling texture addition
|
||||
if (fa->texinfo->flags & SURF_FLOWING)
|
||||
if (fa->texinfo->flags & SURF_SCROLL)
|
||||
{
|
||||
r_polydesc.s_offset += -128 * ( (r_newrefdef.time*0.25) - (int)(r_newrefdef.time*0.25) );
|
||||
float sscroll, tscroll;
|
||||
|
||||
R_FlowingScroll(&r_newrefdef, fa->texinfo->flags, &sscroll, &tscroll);
|
||||
|
||||
r_polydesc.s_offset += 2 * sscroll;
|
||||
r_polydesc.t_offset += 2 * tscroll;
|
||||
}
|
||||
|
||||
r_polydesc.nump = lnumverts;
|
||||
|
@ -1238,9 +1243,9 @@ R_DrawAlphaSurfaces(const entity_t *currententity)
|
|||
|
||||
// pass down all the texinfo flags, not just SURF_WARP.
|
||||
if (s->texinfo->flags & SURF_TRANS66)
|
||||
R_ClipAndDrawPoly( 0.60f, (s->texinfo->flags & (SURF_WARP | SURF_FLOWING)), true );
|
||||
R_ClipAndDrawPoly( 0.60f, (s->texinfo->flags & (SURF_WARP | SURF_SCROLL)), true );
|
||||
else
|
||||
R_ClipAndDrawPoly( 0.30f, (s->texinfo->flags & (SURF_WARP | SURF_FLOWING)), true );
|
||||
R_ClipAndDrawPoly( 0.30f, (s->texinfo->flags & (SURF_WARP | SURF_SCROLL)), true );
|
||||
|
||||
s = s->nextalphasurface;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 1112.2.0
|
||||
// 1113.1.1
|
||||
#pragma once
|
||||
const uint32_t basic_color_quad_frag_spv[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x0000000d,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 1112.2.0
|
||||
// 1113.1.1
|
||||
#pragma once
|
||||
const uint32_t basic_color_quad_vert_spv[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x00000032,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 1112.2.0
|
||||
// 1113.1.1
|
||||
#pragma once
|
||||
const uint32_t basic_frag_spv[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x00000038,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 1112.2.0
|
||||
// 1113.1.1
|
||||
#pragma once
|
||||
const uint32_t basic_vert_spv[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x0000003e,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 1112.2.0
|
||||
// 1113.1.1
|
||||
#pragma once
|
||||
const uint32_t beam_vert_spv[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x00000027,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 1112.2.0
|
||||
// 1113.1.1
|
||||
#pragma once
|
||||
const uint32_t d_light_vert_spv[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x00000027,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 1112.2.0
|
||||
// 1113.1.1
|
||||
#pragma once
|
||||
const uint32_t model_frag_spv[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x00000028,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 1112.2.0
|
||||
// 1113.1.1
|
||||
#pragma once
|
||||
const uint32_t model_vert_spv[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x00000037,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 1112.2.0
|
||||
// 1113.1.1
|
||||
#pragma once
|
||||
const uint32_t nullmodel_vert_spv[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x0000002e,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 1112.2.0
|
||||
// 1113.1.1
|
||||
#pragma once
|
||||
const uint32_t particle_vert_spv[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x0000002d,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 1112.2.0
|
||||
// 1113.1.1
|
||||
#pragma once
|
||||
const uint32_t point_particle_frag_spv[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x00000020,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 1112.2.0
|
||||
// 1113.1.1
|
||||
#pragma once
|
||||
const uint32_t point_particle_vert_spv[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x00000055,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 1112.2.0
|
||||
// 1113.1.1
|
||||
#pragma once
|
||||
const uint32_t polygon_lmap_frag_spv[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x00000029,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 1112.2.0
|
||||
// 1113.1.1
|
||||
#pragma once
|
||||
const uint32_t polygon_lmap_vert_spv[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x00000039,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 1112.2.0
|
||||
// 1113.1.1
|
||||
#pragma once
|
||||
const uint32_t polygon_vert_spv[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x00000034,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
// 1112.2.0
|
||||
// 1113.1.1
|
||||
#pragma once
|
||||
const uint32_t polygon_warp_vert_spv[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x0000005c,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
0x07230203,0x00010000,0x0008000b,0x00000063,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
|
||||
0x000e000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x0000001d,0x00000029,
|
||||
0x0000002b,0x00000051,0x00000056,0x00000058,0x00000059,0x0000005b,0x00030003,0x00000002,
|
||||
0x0000002b,0x00000058,0x0000005d,0x0000005f,0x00000060,0x00000062,0x00030003,0x00000002,
|
||||
0x000001c2,0x00090004,0x415f4c47,0x735f4252,0x72617065,0x5f657461,0x64616873,0x6f5f7265,
|
||||
0x63656a62,0x00007374,0x00040005,0x00000004,0x6e69616d,0x00000000,0x00060005,0x00000008,
|
||||
0x505f6c67,0x65567265,0x78657472,0x00000000,0x00060006,0x00000008,0x00000000,0x505f6c67,
|
||||
|
@ -13,73 +13,79 @@ const uint32_t polygon_warp_vert_spv[] = {
|
|||
0x00000000,0x00030005,0x00000010,0x00006370,0x00070005,0x00000014,0x66696e55,0x426d726f,
|
||||
0x65666675,0x6a624f72,0x00746365,0x00050006,0x00000014,0x00000000,0x65646f6d,0x0000006c,
|
||||
0x00050006,0x00000014,0x00000001,0x6f6c6f63,0x00000072,0x00050006,0x00000014,0x00000002,
|
||||
0x656d6974,0x00000000,0x00050006,0x00000014,0x00000003,0x6f726373,0x00006c6c,0x00030005,
|
||||
0x00000016,0x006f6275,0x00050005,0x0000001d,0x65566e69,0x78657472,0x00000000,0x00050005,
|
||||
0x00000029,0x43786574,0x64726f6f,0x00000000,0x00050005,0x0000002b,0x65546e69,0x6f6f4378,
|
||||
0x00006472,0x00040005,0x00000051,0x6f6c6f63,0x00000072,0x00050005,0x00000056,0x65725461,
|
||||
0x6c6f6873,0x00000064,0x00060005,0x00000058,0x65546e69,0x6f6f4378,0x6d4c6472,0x00007061,
|
||||
0x00050005,0x00000059,0x6f4e6e69,0x6c616d72,0x00000000,0x00040005,0x0000005b,0x6c466e69,
|
||||
0x00736761,0x00050048,0x00000008,0x00000000,0x0000000b,0x00000000,0x00030047,0x00000008,
|
||||
0x00000002,0x00040048,0x0000000e,0x00000000,0x00000005,0x00050048,0x0000000e,0x00000000,
|
||||
0x00000023,0x00000000,0x00050048,0x0000000e,0x00000000,0x00000007,0x00000010,0x00030047,
|
||||
0x0000000e,0x00000002,0x00040048,0x00000014,0x00000000,0x00000005,0x00050048,0x00000014,
|
||||
0x00000000,0x00000023,0x00000000,0x00050048,0x00000014,0x00000000,0x00000007,0x00000010,
|
||||
0x00050048,0x00000014,0x00000001,0x00000023,0x00000040,0x00050048,0x00000014,0x00000002,
|
||||
0x00000023,0x00000050,0x00050048,0x00000014,0x00000003,0x00000023,0x00000054,0x00030047,
|
||||
0x00000014,0x00000002,0x00040047,0x00000016,0x00000022,0x00000001,0x00040047,0x00000016,
|
||||
0x00000021,0x00000000,0x00040047,0x0000001d,0x0000001e,0x00000000,0x00040047,0x00000029,
|
||||
0x0000001e,0x00000000,0x00040047,0x0000002b,0x0000001e,0x00000001,0x00040047,0x00000051,
|
||||
0x0000001e,0x00000001,0x00040047,0x00000056,0x0000001e,0x00000002,0x00040047,0x00000058,
|
||||
0x0000001e,0x00000002,0x00040047,0x00000059,0x0000001e,0x00000003,0x00040047,0x0000005b,
|
||||
0x0000001e,0x00000004,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,
|
||||
0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000004,0x0003001e,0x00000008,
|
||||
0x00000007,0x00040020,0x00000009,0x00000003,0x00000008,0x0004003b,0x00000009,0x0000000a,
|
||||
0x00000003,0x00040015,0x0000000b,0x00000020,0x00000001,0x0004002b,0x0000000b,0x0000000c,
|
||||
0x00000000,0x00040018,0x0000000d,0x00000007,0x00000004,0x0003001e,0x0000000e,0x0000000d,
|
||||
0x00040020,0x0000000f,0x00000009,0x0000000e,0x0004003b,0x0000000f,0x00000010,0x00000009,
|
||||
0x00040020,0x00000011,0x00000009,0x0000000d,0x0006001e,0x00000014,0x0000000d,0x00000007,
|
||||
0x00000006,0x00000006,0x00040020,0x00000015,0x00000002,0x00000014,0x0004003b,0x00000015,
|
||||
0x00000016,0x00000002,0x00040020,0x00000017,0x00000002,0x0000000d,0x00040017,0x0000001b,
|
||||
0x00000006,0x00000003,0x00040020,0x0000001c,0x00000001,0x0000001b,0x0004003b,0x0000001c,
|
||||
0x0000001d,0x00000001,0x0004002b,0x00000006,0x0000001f,0x3f800000,0x00040020,0x00000025,
|
||||
0x00000003,0x00000007,0x00040017,0x00000027,0x00000006,0x00000002,0x00040020,0x00000028,
|
||||
0x00000003,0x00000027,0x0004003b,0x00000028,0x00000029,0x00000003,0x00040020,0x0000002a,
|
||||
0x00000001,0x00000027,0x0004003b,0x0000002a,0x0000002b,0x00000001,0x0004002b,0x00000006,
|
||||
0x0000002d,0x40000000,0x0004002b,0x0000000b,0x0000002e,0x00000002,0x00040020,0x0000002f,
|
||||
0x00000002,0x00000006,0x00040015,0x00000033,0x00000020,0x00000000,0x0004002b,0x00000033,
|
||||
0x00000034,0x00000001,0x00040020,0x00000035,0x00000001,0x00000006,0x0004002b,0x00000006,
|
||||
0x00000038,0x4051eb85,0x0004002b,0x00000033,0x0000003f,0x00000000,0x0004002b,0x00000006,
|
||||
0x00000046,0x3d4ccccd,0x0004002b,0x0000000b,0x00000049,0x00000003,0x00040020,0x0000004c,
|
||||
0x00000003,0x00000006,0x0004003b,0x00000025,0x00000051,0x00000003,0x0004002b,0x0000000b,
|
||||
0x00000052,0x00000001,0x00040020,0x00000053,0x00000002,0x00000007,0x0004003b,0x0000004c,
|
||||
0x00000056,0x00000003,0x0004002b,0x00000006,0x00000057,0x00000000,0x0004003b,0x0000002a,
|
||||
0x00000058,0x00000001,0x0004003b,0x0000001c,0x00000059,0x00000001,0x00040020,0x0000005a,
|
||||
0x00000001,0x0000000b,0x0004003b,0x0000005a,0x0000005b,0x00000001,0x00050036,0x00000002,
|
||||
0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x00050041,0x00000011,0x00000012,
|
||||
0x00000010,0x0000000c,0x0004003d,0x0000000d,0x00000013,0x00000012,0x00050041,0x00000017,
|
||||
0x00000018,0x00000016,0x0000000c,0x0004003d,0x0000000d,0x00000019,0x00000018,0x00050092,
|
||||
0x0000000d,0x0000001a,0x00000013,0x00000019,0x0004003d,0x0000001b,0x0000001e,0x0000001d,
|
||||
0x00050051,0x00000006,0x00000020,0x0000001e,0x00000000,0x00050051,0x00000006,0x00000021,
|
||||
0x0000001e,0x00000001,0x00050051,0x00000006,0x00000022,0x0000001e,0x00000002,0x00070050,
|
||||
0x00000007,0x00000023,0x00000020,0x00000021,0x00000022,0x0000001f,0x00050091,0x00000007,
|
||||
0x00000024,0x0000001a,0x00000023,0x00050041,0x00000025,0x00000026,0x0000000a,0x0000000c,
|
||||
0x0003003e,0x00000026,0x00000024,0x0004003d,0x00000027,0x0000002c,0x0000002b,0x00050041,
|
||||
0x0000002f,0x00000030,0x00000016,0x0000002e,0x0004003d,0x00000006,0x00000031,0x00000030,
|
||||
0x00050085,0x00000006,0x00000032,0x0000002d,0x00000031,0x00050041,0x00000035,0x00000036,
|
||||
0x0000002b,0x00000034,0x0004003d,0x00000006,0x00000037,0x00000036,0x00050085,0x00000006,
|
||||
0x00000039,0x00000037,0x00000038,0x00050081,0x00000006,0x0000003a,0x00000032,0x00000039,
|
||||
0x0006000c,0x00000006,0x0000003b,0x00000001,0x0000000d,0x0000003a,0x00050041,0x0000002f,
|
||||
0x0000003c,0x00000016,0x0000002e,0x0004003d,0x00000006,0x0000003d,0x0000003c,0x00050085,
|
||||
0x00000006,0x0000003e,0x0000002d,0x0000003d,0x00050041,0x00000035,0x00000040,0x0000002b,
|
||||
0x0000003f,0x0004003d,0x00000006,0x00000041,0x00000040,0x00050085,0x00000006,0x00000042,
|
||||
0x00000041,0x00000038,0x00050081,0x00000006,0x00000043,0x0000003e,0x00000042,0x0006000c,
|
||||
0x00000006,0x00000044,0x00000001,0x0000000d,0x00000043,0x00050050,0x00000027,0x00000045,
|
||||
0x0000003b,0x00000044,0x0005008e,0x00000027,0x00000047,0x00000045,0x00000046,0x00050081,
|
||||
0x00000027,0x00000048,0x0000002c,0x00000047,0x0003003e,0x00000029,0x00000048,0x00050041,
|
||||
0x0000002f,0x0000004a,0x00000016,0x00000049,0x0004003d,0x00000006,0x0000004b,0x0000004a,
|
||||
0x00050041,0x0000004c,0x0000004d,0x00000029,0x0000003f,0x0004003d,0x00000006,0x0000004e,
|
||||
0x0000004d,0x00050081,0x00000006,0x0000004f,0x0000004e,0x0000004b,0x00050041,0x0000004c,
|
||||
0x00000050,0x00000029,0x0000003f,0x0003003e,0x00000050,0x0000004f,0x00050041,0x00000053,
|
||||
0x00000054,0x00000016,0x00000052,0x0004003d,0x00000007,0x00000055,0x00000054,0x0003003e,
|
||||
0x00000051,0x00000055,0x0003003e,0x00000056,0x00000057,0x000100fd,0x00010038
|
||||
0x656d6974,0x00000000,0x00050006,0x00000014,0x00000003,0x72637373,0x006c6c6f,0x00050006,
|
||||
0x00000014,0x00000004,0x72637374,0x006c6c6f,0x00030005,0x00000016,0x006f6275,0x00050005,
|
||||
0x0000001d,0x65566e69,0x78657472,0x00000000,0x00050005,0x00000029,0x43786574,0x64726f6f,
|
||||
0x00000000,0x00050005,0x0000002b,0x65546e69,0x6f6f4378,0x00006472,0x00040005,0x00000058,
|
||||
0x6f6c6f63,0x00000072,0x00050005,0x0000005d,0x65725461,0x6c6f6873,0x00000064,0x00060005,
|
||||
0x0000005f,0x65546e69,0x6f6f4378,0x6d4c6472,0x00007061,0x00050005,0x00000060,0x6f4e6e69,
|
||||
0x6c616d72,0x00000000,0x00040005,0x00000062,0x6c466e69,0x00736761,0x00050048,0x00000008,
|
||||
0x00000000,0x0000000b,0x00000000,0x00030047,0x00000008,0x00000002,0x00040048,0x0000000e,
|
||||
0x00000000,0x00000005,0x00050048,0x0000000e,0x00000000,0x00000023,0x00000000,0x00050048,
|
||||
0x0000000e,0x00000000,0x00000007,0x00000010,0x00030047,0x0000000e,0x00000002,0x00040048,
|
||||
0x00000014,0x00000000,0x00000005,0x00050048,0x00000014,0x00000000,0x00000023,0x00000000,
|
||||
0x00050048,0x00000014,0x00000000,0x00000007,0x00000010,0x00050048,0x00000014,0x00000001,
|
||||
0x00000023,0x00000040,0x00050048,0x00000014,0x00000002,0x00000023,0x00000050,0x00050048,
|
||||
0x00000014,0x00000003,0x00000023,0x00000054,0x00050048,0x00000014,0x00000004,0x00000023,
|
||||
0x00000058,0x00030047,0x00000014,0x00000002,0x00040047,0x00000016,0x00000022,0x00000001,
|
||||
0x00040047,0x00000016,0x00000021,0x00000000,0x00040047,0x0000001d,0x0000001e,0x00000000,
|
||||
0x00040047,0x00000029,0x0000001e,0x00000000,0x00040047,0x0000002b,0x0000001e,0x00000001,
|
||||
0x00040047,0x00000058,0x0000001e,0x00000001,0x00040047,0x0000005d,0x0000001e,0x00000002,
|
||||
0x00040047,0x0000005f,0x0000001e,0x00000002,0x00040047,0x00000060,0x0000001e,0x00000003,
|
||||
0x00040047,0x00000062,0x0000001e,0x00000004,0x00020013,0x00000002,0x00030021,0x00000003,
|
||||
0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000004,
|
||||
0x0003001e,0x00000008,0x00000007,0x00040020,0x00000009,0x00000003,0x00000008,0x0004003b,
|
||||
0x00000009,0x0000000a,0x00000003,0x00040015,0x0000000b,0x00000020,0x00000001,0x0004002b,
|
||||
0x0000000b,0x0000000c,0x00000000,0x00040018,0x0000000d,0x00000007,0x00000004,0x0003001e,
|
||||
0x0000000e,0x0000000d,0x00040020,0x0000000f,0x00000009,0x0000000e,0x0004003b,0x0000000f,
|
||||
0x00000010,0x00000009,0x00040020,0x00000011,0x00000009,0x0000000d,0x0007001e,0x00000014,
|
||||
0x0000000d,0x00000007,0x00000006,0x00000006,0x00000006,0x00040020,0x00000015,0x00000002,
|
||||
0x00000014,0x0004003b,0x00000015,0x00000016,0x00000002,0x00040020,0x00000017,0x00000002,
|
||||
0x0000000d,0x00040017,0x0000001b,0x00000006,0x00000003,0x00040020,0x0000001c,0x00000001,
|
||||
0x0000001b,0x0004003b,0x0000001c,0x0000001d,0x00000001,0x0004002b,0x00000006,0x0000001f,
|
||||
0x3f800000,0x00040020,0x00000025,0x00000003,0x00000007,0x00040017,0x00000027,0x00000006,
|
||||
0x00000002,0x00040020,0x00000028,0x00000003,0x00000027,0x0004003b,0x00000028,0x00000029,
|
||||
0x00000003,0x00040020,0x0000002a,0x00000001,0x00000027,0x0004003b,0x0000002a,0x0000002b,
|
||||
0x00000001,0x0004002b,0x00000006,0x0000002d,0x40000000,0x0004002b,0x0000000b,0x0000002e,
|
||||
0x00000002,0x00040020,0x0000002f,0x00000002,0x00000006,0x00040015,0x00000033,0x00000020,
|
||||
0x00000000,0x0004002b,0x00000033,0x00000034,0x00000001,0x00040020,0x00000035,0x00000001,
|
||||
0x00000006,0x0004002b,0x00000006,0x00000038,0x4051eb85,0x0004002b,0x00000033,0x0000003f,
|
||||
0x00000000,0x0004002b,0x00000006,0x00000046,0x3d4ccccd,0x0004002b,0x0000000b,0x00000049,
|
||||
0x00000003,0x00040020,0x0000004c,0x00000003,0x00000006,0x0004002b,0x0000000b,0x00000051,
|
||||
0x00000004,0x0004003b,0x00000025,0x00000058,0x00000003,0x0004002b,0x0000000b,0x00000059,
|
||||
0x00000001,0x00040020,0x0000005a,0x00000002,0x00000007,0x0004003b,0x0000004c,0x0000005d,
|
||||
0x00000003,0x0004002b,0x00000006,0x0000005e,0x00000000,0x0004003b,0x0000002a,0x0000005f,
|
||||
0x00000001,0x0004003b,0x0000001c,0x00000060,0x00000001,0x00040020,0x00000061,0x00000001,
|
||||
0x0000000b,0x0004003b,0x00000061,0x00000062,0x00000001,0x00050036,0x00000002,0x00000004,
|
||||
0x00000000,0x00000003,0x000200f8,0x00000005,0x00050041,0x00000011,0x00000012,0x00000010,
|
||||
0x0000000c,0x0004003d,0x0000000d,0x00000013,0x00000012,0x00050041,0x00000017,0x00000018,
|
||||
0x00000016,0x0000000c,0x0004003d,0x0000000d,0x00000019,0x00000018,0x00050092,0x0000000d,
|
||||
0x0000001a,0x00000013,0x00000019,0x0004003d,0x0000001b,0x0000001e,0x0000001d,0x00050051,
|
||||
0x00000006,0x00000020,0x0000001e,0x00000000,0x00050051,0x00000006,0x00000021,0x0000001e,
|
||||
0x00000001,0x00050051,0x00000006,0x00000022,0x0000001e,0x00000002,0x00070050,0x00000007,
|
||||
0x00000023,0x00000020,0x00000021,0x00000022,0x0000001f,0x00050091,0x00000007,0x00000024,
|
||||
0x0000001a,0x00000023,0x00050041,0x00000025,0x00000026,0x0000000a,0x0000000c,0x0003003e,
|
||||
0x00000026,0x00000024,0x0004003d,0x00000027,0x0000002c,0x0000002b,0x00050041,0x0000002f,
|
||||
0x00000030,0x00000016,0x0000002e,0x0004003d,0x00000006,0x00000031,0x00000030,0x00050085,
|
||||
0x00000006,0x00000032,0x0000002d,0x00000031,0x00050041,0x00000035,0x00000036,0x0000002b,
|
||||
0x00000034,0x0004003d,0x00000006,0x00000037,0x00000036,0x00050085,0x00000006,0x00000039,
|
||||
0x00000037,0x00000038,0x00050081,0x00000006,0x0000003a,0x00000032,0x00000039,0x0006000c,
|
||||
0x00000006,0x0000003b,0x00000001,0x0000000d,0x0000003a,0x00050041,0x0000002f,0x0000003c,
|
||||
0x00000016,0x0000002e,0x0004003d,0x00000006,0x0000003d,0x0000003c,0x00050085,0x00000006,
|
||||
0x0000003e,0x0000002d,0x0000003d,0x00050041,0x00000035,0x00000040,0x0000002b,0x0000003f,
|
||||
0x0004003d,0x00000006,0x00000041,0x00000040,0x00050085,0x00000006,0x00000042,0x00000041,
|
||||
0x00000038,0x00050081,0x00000006,0x00000043,0x0000003e,0x00000042,0x0006000c,0x00000006,
|
||||
0x00000044,0x00000001,0x0000000d,0x00000043,0x00050050,0x00000027,0x00000045,0x0000003b,
|
||||
0x00000044,0x0005008e,0x00000027,0x00000047,0x00000045,0x00000046,0x00050081,0x00000027,
|
||||
0x00000048,0x0000002c,0x00000047,0x0003003e,0x00000029,0x00000048,0x00050041,0x0000002f,
|
||||
0x0000004a,0x00000016,0x00000049,0x0004003d,0x00000006,0x0000004b,0x0000004a,0x00050041,
|
||||
0x0000004c,0x0000004d,0x00000029,0x0000003f,0x0004003d,0x00000006,0x0000004e,0x0000004d,
|
||||
0x00050081,0x00000006,0x0000004f,0x0000004e,0x0000004b,0x00050041,0x0000004c,0x00000050,
|
||||
0x00000029,0x0000003f,0x0003003e,0x00000050,0x0000004f,0x00050041,0x0000002f,0x00000052,
|
||||
0x00000016,0x00000051,0x0004003d,0x00000006,0x00000053,0x00000052,0x00050041,0x0000004c,
|
||||
0x00000054,0x00000029,0x00000034,0x0004003d,0x00000006,0x00000055,0x00000054,0x00050081,
|
||||
0x00000006,0x00000056,0x00000055,0x00000053,0x00050041,0x0000004c,0x00000057,0x00000029,
|
||||
0x00000034,0x0003003e,0x00000057,0x00000056,0x00050041,0x0000005a,0x0000005b,0x00000016,
|
||||
0x00000059,0x0004003d,0x00000007,0x0000005c,0x0000005b,0x0003003e,0x00000058,0x0000005c,
|
||||
0x0003003e,0x0000005d,0x0000005e,0x000100fd,0x00010038
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 1112.2.0
|
||||
// 1113.1.1
|
||||
#pragma once
|
||||
const uint32_t postprocess_frag_spv[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x00000046,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 1112.2.0
|
||||
// 1113.1.1
|
||||
#pragma once
|
||||
const uint32_t postprocess_vert_spv[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x00000029,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 1112.2.0
|
||||
// 1113.1.1
|
||||
#pragma once
|
||||
const uint32_t shadows_vert_spv[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x0000002b,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 1112.2.0
|
||||
// 1113.1.1
|
||||
#pragma once
|
||||
const uint32_t skybox_vert_spv[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x00000036,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 1112.2.0
|
||||
// 1113.1.1
|
||||
#pragma once
|
||||
const uint32_t sprite_vert_spv[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x0000002f,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 1112.2.0
|
||||
// 1113.1.1
|
||||
#pragma once
|
||||
const uint32_t world_warp_frag_spv[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x000000c1,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 1112.2.0
|
||||
// 1113.1.1
|
||||
#pragma once
|
||||
const uint32_t world_warp_vert_spv[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x00000024,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
|
|
|
@ -76,17 +76,13 @@ DrawVkFlowingPoly -- version of DrawVkPoly that handles scrolling texture
|
|||
static void
|
||||
DrawVkFlowingPoly(msurface_t *fa, image_t *texture, const float *color)
|
||||
{
|
||||
float scroll;
|
||||
float sscroll, tscroll;
|
||||
mpoly_t *p;
|
||||
int i;
|
||||
|
||||
p = fa->polys;
|
||||
|
||||
scroll = -64 * ((r_newrefdef.time / 40.0) - (int)(r_newrefdef.time / 40.0));
|
||||
if (scroll == 0.0)
|
||||
{
|
||||
scroll = -64.0;
|
||||
}
|
||||
R_FlowingScroll(&r_newrefdef, fa->texinfo->flags, &sscroll, &tscroll);
|
||||
|
||||
if (Mesh_VertsRealloc(p->numverts))
|
||||
{
|
||||
|
@ -96,7 +92,8 @@ DrawVkFlowingPoly(msurface_t *fa, image_t *texture, const float *color)
|
|||
memcpy(verts_buffer, p->verts, sizeof(mvtx_t) * p->numverts);
|
||||
for (i = 0; i < p->numverts; i++)
|
||||
{
|
||||
verts_buffer[i].texCoord[0] += scroll;
|
||||
verts_buffer[i].texCoord[0] += sscroll;
|
||||
verts_buffer[i].texCoord[1] += tscroll;
|
||||
}
|
||||
|
||||
QVk_BindPipeline(&vk_drawPolyPipeline);
|
||||
|
@ -209,7 +206,7 @@ R_RenderBrushPoly(msurface_t *fa, const float *modelMatrix, float alpha,
|
|||
|
||||
//======
|
||||
//PGM
|
||||
if (fa->texinfo->flags & SURF_FLOWING)
|
||||
if (fa->texinfo->flags & SURF_SCROLL)
|
||||
DrawVkFlowingPoly(fa, image, color);
|
||||
else
|
||||
DrawVkPoly(fa->polys, image, color);
|
||||
|
@ -312,7 +309,7 @@ R_DrawAlphaSurfaces(void)
|
|||
{
|
||||
EmitWaterPolys(s, s->texinfo->image, NULL, color, false);
|
||||
}
|
||||
else if (s->texinfo->flags & SURF_FLOWING) // PGM 9/16/98
|
||||
else if (s->texinfo->flags & SURF_SCROLL) // PGM 9/16/98
|
||||
{
|
||||
DrawVkFlowingPoly(s, s->texinfo->image, color); // PGM
|
||||
}
|
||||
|
@ -482,13 +479,11 @@ Vk_RenderLightmappedPoly(msurface_t *surf, const float *modelMatrix, float alpha
|
|||
|
||||
//==========
|
||||
//PGM
|
||||
if (surf->texinfo->flags & SURF_FLOWING)
|
||||
if (surf->texinfo->flags & SURF_SCROLL)
|
||||
{
|
||||
float scroll;
|
||||
float sscroll, tscroll;
|
||||
|
||||
scroll = -64 * ((r_newrefdef.time / 40.0) - (int)(r_newrefdef.time / 40.0));
|
||||
if (scroll == 0.0)
|
||||
scroll = -64.0;
|
||||
R_FlowingScroll(&r_newrefdef, surf->texinfo->flags, &sscroll, &tscroll);
|
||||
|
||||
VkBuffer vbo;
|
||||
VkDeviceSize vboOffset;
|
||||
|
@ -505,7 +500,8 @@ Vk_RenderLightmappedPoly(msurface_t *surf, const float *modelMatrix, float alpha
|
|||
|
||||
for (i = 0; i < nv; i++)
|
||||
{
|
||||
verts_buffer[i].texCoord[0] += scroll;
|
||||
verts_buffer[i].texCoord[0] += sscroll;
|
||||
verts_buffer[i].texCoord[1] += tscroll;
|
||||
}
|
||||
|
||||
uint8_t *vertData = QVk_GetVertexBuffer(sizeof(mvtx_t) * nv, &vbo, &vboOffset);
|
||||
|
@ -546,13 +542,11 @@ Vk_RenderLightmappedPoly(msurface_t *surf, const float *modelMatrix, float alpha
|
|||
|
||||
//==========
|
||||
//PGM
|
||||
if (surf->texinfo->flags & SURF_FLOWING)
|
||||
if (surf->texinfo->flags & SURF_SCROLL)
|
||||
{
|
||||
float scroll;
|
||||
float sscroll, tscroll;
|
||||
|
||||
scroll = -64 * ((r_newrefdef.time / 40.0) - (int)(r_newrefdef.time / 40.0));
|
||||
if (scroll == 0.0)
|
||||
scroll = -64.0;
|
||||
R_FlowingScroll(&r_newrefdef, surf->texinfo->flags, &sscroll, &tscroll);
|
||||
|
||||
for (p = surf->polys; p; p = p->chain)
|
||||
{
|
||||
|
@ -560,7 +554,8 @@ Vk_RenderLightmappedPoly(msurface_t *surf, const float *modelMatrix, float alpha
|
|||
|
||||
for (i = 0; i < nv; i++)
|
||||
{
|
||||
verts_buffer[i].texCoord[0] += scroll;
|
||||
verts_buffer[i].texCoord[0] += sscroll;
|
||||
verts_buffer[i].texCoord[1] += tscroll;
|
||||
}
|
||||
|
||||
VkBuffer vbo;
|
||||
|
|
|
@ -56,7 +56,8 @@ EmitWaterPolys(msurface_t *fa, image_t *texture, const float *modelMatrix,
|
|||
float model[16];
|
||||
float color[4];
|
||||
float time;
|
||||
float scroll;
|
||||
float sscroll;
|
||||
float tscroll;
|
||||
} polyUbo;
|
||||
|
||||
polyUbo.color[0] = color[0];
|
||||
|
@ -65,14 +66,9 @@ EmitWaterPolys(msurface_t *fa, image_t *texture, const float *modelMatrix,
|
|||
polyUbo.color[3] = color[3];
|
||||
polyUbo.time = r_newrefdef.time;
|
||||
|
||||
if (fa->texinfo->flags & SURF_FLOWING)
|
||||
{
|
||||
polyUbo.scroll = (-64 * ((r_newrefdef.time * 0.5) - (int)(r_newrefdef.time * 0.5))) / 64.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
polyUbo.scroll = 0;
|
||||
}
|
||||
R_FlowingScroll(&r_newrefdef, fa->texinfo->flags, &polyUbo.sscroll, &polyUbo.tscroll);
|
||||
polyUbo.sscroll /= 64.f;
|
||||
polyUbo.tscroll /= 64.f;
|
||||
|
||||
if (modelMatrix)
|
||||
{
|
||||
|
|
|
@ -508,6 +508,8 @@ typedef struct cvar_s
|
|||
#define SURF_N64_SCROLL_FLIP 0x80000000 /* ReRelease Flip direction of texture scroll. */
|
||||
/* Transparnet but not explicitly warp */
|
||||
#define SURF_TRANSPARENT (SURF_TRANS33 | SURF_TRANS66 | SURF_ALPHATEST)
|
||||
/* Different flowing settings */
|
||||
#define SURF_SCROLL (SURF_FLOWING | SURF_N64_SCROLL_X | SURF_N64_SCROLL_Y)
|
||||
|
||||
/* content masks */
|
||||
#define MASK_ALL (-1)
|
||||
|
|
|
@ -17,7 +17,8 @@ layout(set = 1, binding = 0) uniform UniformBufferObject
|
|||
mat4 model;
|
||||
vec4 color;
|
||||
float time;
|
||||
float scroll;
|
||||
float sscroll;
|
||||
float tscroll;
|
||||
} ubo;
|
||||
|
||||
layout(location = 0) out vec2 texCoord;
|
||||
|
@ -31,7 +32,8 @@ out gl_PerVertex {
|
|||
void main() {
|
||||
gl_Position = pc.vpMatrix * ubo.model * vec4(inVertex, 1.0);
|
||||
texCoord = inTexCoord + vec2(sin(2.0 * ubo.time + inTexCoord.y * 3.28), sin(2.0 * ubo.time + inTexCoord.x * 3.28)) * 0.05;
|
||||
texCoord.x += ubo.scroll;
|
||||
texCoord.x += ubo.sscroll;
|
||||
texCoord.y += ubo.tscroll;
|
||||
color = ubo.color;
|
||||
aTreshold = 0.0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue