Skip to content

Commit

Permalink
Merge branch 'upstream'
Browse files Browse the repository at this point in the history
  • Loading branch information
zturtleman committed Feb 26, 2024
2 parents e228b16 + 2cd1a7e commit 8569b34
Show file tree
Hide file tree
Showing 28 changed files with 1,556 additions and 158 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
name: Linux
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo apt-get update
Expand All @@ -15,35 +15,35 @@ jobs:
run: make release
env:
ARCHIVE: 1
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: Linux
path: build/*.zip
windows:
name: Windows
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Compile
run: |
choco install zip
make release
env:
ARCHIVE: 1
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: Windows
path: build/*.zip
macos:
name: macOS
runs-on: macos-11
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Compile
run: make release
env:
ARCHIVE: 1
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: macOS
path: build/*.zip
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,6 @@ endif

ifneq ($(HAVE_VM_COMPILED),true)
BASE_CFLAGS += -DNO_VM_COMPILED
BUILD_GAME_QVM=0
endif

TARGETS =
Expand Down
2 changes: 1 addition & 1 deletion code/botlib/be_aas.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,5 +217,5 @@ typedef struct aas_predictroute_s
int endcontents; //contents at the end of movement prediction
int endtravelflags; //end travel flags
int numareas; //number of areas predicted ahead
int time; //time predicted ahead (in hundreth of a sec)
int time; //time predicted ahead (in hundredths of a sec)
} aas_predictroute_t;
2 changes: 1 addition & 1 deletion code/botlib/be_aas_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ void AAS_FileInfo(void)
aasworld.reachabilitysize * sizeof(aas_reachability_t) +
aasworld.numportals * sizeof(aas_portal_t) +
aasworld.numclusters * sizeof(aas_cluster_t);
botimport.Print(PRT_MESSAGE, "optimzed size %d KB\n", optimized >> 10);
botimport.Print(PRT_MESSAGE, "optimized size %d KB\n", optimized >> 10);
} //end of the function AAS_FileInfo
#endif //AASFILEDEBUG
//===========================================================================
Expand Down
54 changes: 40 additions & 14 deletions code/renderergl2/glsl/generic_vp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,16 @@ attribute vec4 attr_TexCoord0;
attribute vec4 attr_TexCoord1;
#endif

uniform vec4 u_DiffuseTexMatrix;
uniform vec4 u_DiffuseTexOffTurb;
#if defined(USE_TCMOD)
uniform vec4 u_DiffuseTexMatrix0;
uniform vec4 u_DiffuseTexMatrix1;
uniform vec4 u_DiffuseTexMatrix2;
uniform vec4 u_DiffuseTexMatrix3;
uniform vec4 u_DiffuseTexMatrix4;
uniform vec4 u_DiffuseTexMatrix5;
uniform vec4 u_DiffuseTexMatrix6;
uniform vec4 u_DiffuseTexMatrix7;
#endif

#if defined(USE_TCGEN) || defined(USE_RGBAGEN)
uniform vec3 u_LocalViewOrigin;
Expand Down Expand Up @@ -140,19 +148,28 @@ vec2 GenTexCoords(int TCGen, vec3 position, vec3 normal, vec3 TCGenVector0, vec3
#endif

#if defined(USE_TCMOD)
vec2 ModTexCoords(vec2 st, vec3 position, vec4 texMatrix, vec4 offTurb)
vec2 ModTexCoords(vec2 st, vec3 position, vec4 texMatrix[8])
{
float amplitude = offTurb.z;
float phase = offTurb.w * 2.0 * M_PI;
vec2 st2;
st2.x = st.x * texMatrix.x + (st.y * texMatrix.z + offTurb.x);
st2.y = st.x * texMatrix.y + (st.y * texMatrix.w + offTurb.y);

vec2 st2 = st;
vec2 offsetPos = vec2(position.x + position.z, position.y);

vec2 texOffset = sin(offsetPos * (2.0 * M_PI / 1024.0) + vec2(phase));

return st2 + texOffset * amplitude;

st2 = vec2(st2.x * texMatrix[0].x + st2.y * texMatrix[0].y + texMatrix[0].z,
st2.x * texMatrix[1].x + st2.y * texMatrix[1].y + texMatrix[1].z);
st2 += texMatrix[0].w * sin(offsetPos * (2.0 * M_PI / 1024.0) + vec2(texMatrix[1].w * 2.0 * M_PI));

st2 = vec2(st2.x * texMatrix[2].x + st2.y * texMatrix[2].y + texMatrix[2].z,
st2.x * texMatrix[3].x + st2.y * texMatrix[3].y + texMatrix[3].z);
st2 += texMatrix[2].w * sin(offsetPos * (2.0 * M_PI / 1024.0) + vec2(texMatrix[3].w * 2.0 * M_PI));

st2 = vec2(st2.x * texMatrix[4].x + st2.y * texMatrix[4].y + texMatrix[4].z,
st2.x * texMatrix[5].x + st2.y * texMatrix[5].y + texMatrix[5].z);
st2 += texMatrix[4].w * sin(offsetPos * (2.0 * M_PI / 1024.0) + vec2(texMatrix[5].w * 2.0 * M_PI));

st2 = vec2(st2.x * texMatrix[6].x + st2.y * texMatrix[6].y + texMatrix[6].z,
st2.x * texMatrix[7].x + st2.y * texMatrix[7].y + texMatrix[7].z);
st2 += texMatrix[6].w * sin(offsetPos * (2.0 * M_PI / 1024.0) + vec2(texMatrix[7].w * 2.0 * M_PI));

return st2;
}
#endif

Expand Down Expand Up @@ -236,7 +253,16 @@ void main()
#endif

#if defined(USE_TCMOD)
var_DiffuseTex = ModTexCoords(tex, position, u_DiffuseTexMatrix, u_DiffuseTexOffTurb);
vec4 diffuseTexMatrix[8];
diffuseTexMatrix[0] = u_DiffuseTexMatrix0;
diffuseTexMatrix[1] = u_DiffuseTexMatrix1;
diffuseTexMatrix[2] = u_DiffuseTexMatrix2;
diffuseTexMatrix[3] = u_DiffuseTexMatrix3;
diffuseTexMatrix[4] = u_DiffuseTexMatrix4;
diffuseTexMatrix[5] = u_DiffuseTexMatrix5;
diffuseTexMatrix[6] = u_DiffuseTexMatrix6;
diffuseTexMatrix[7] = u_DiffuseTexMatrix7;
var_DiffuseTex = ModTexCoords(tex, position, diffuseTexMatrix);
#else
var_DiffuseTex = tex;
#endif
Expand Down
48 changes: 36 additions & 12 deletions code/renderergl2/glsl/lightall_vp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,14 @@ uniform vec3 u_LocalViewOrigin;
#endif

#if defined(USE_TCMOD)
uniform vec4 u_DiffuseTexMatrix;
uniform vec4 u_DiffuseTexOffTurb;
uniform vec4 u_DiffuseTexMatrix0;
uniform vec4 u_DiffuseTexMatrix1;
uniform vec4 u_DiffuseTexMatrix2;
uniform vec4 u_DiffuseTexMatrix3;
uniform vec4 u_DiffuseTexMatrix4;
uniform vec4 u_DiffuseTexMatrix5;
uniform vec4 u_DiffuseTexMatrix6;
uniform vec4 u_DiffuseTexMatrix7;
#endif

uniform mat4 u_ModelViewProjectionMatrix;
Expand Down Expand Up @@ -114,19 +120,28 @@ vec2 GenTexCoords(int TCGen, vec3 position, vec3 normal, vec3 TCGenVector0, vec3
#endif

#if defined(USE_TCMOD)
vec2 ModTexCoords(vec2 st, vec3 position, vec4 texMatrix, vec4 offTurb)
vec2 ModTexCoords(vec2 st, vec3 position, vec4 texMatrix[8])
{
float amplitude = offTurb.z;
float phase = offTurb.w * 2.0 * M_PI;
vec2 st2;
st2.x = st.x * texMatrix.x + (st.y * texMatrix.z + offTurb.x);
st2.y = st.x * texMatrix.y + (st.y * texMatrix.w + offTurb.y);

vec2 st2 = st;
vec2 offsetPos = vec2(position.x + position.z, position.y);

vec2 texOffset = sin(offsetPos * (2.0 * M_PI / 1024.0) + vec2(phase));
st2 = vec2(st2.x * texMatrix[0].x + st2.y * texMatrix[0].y + texMatrix[0].z,
st2.x * texMatrix[1].x + st2.y * texMatrix[1].y + texMatrix[1].z);
st2 += texMatrix[0].w * sin(offsetPos * (2.0 * M_PI / 1024.0) + vec2(texMatrix[1].w * 2.0 * M_PI));

st2 = vec2(st2.x * texMatrix[2].x + st2.y * texMatrix[2].y + texMatrix[2].z,
st2.x * texMatrix[3].x + st2.y * texMatrix[3].y + texMatrix[3].z);
st2 += texMatrix[2].w * sin(offsetPos * (2.0 * M_PI / 1024.0) + vec2(texMatrix[3].w * 2.0 * M_PI));

st2 = vec2(st2.x * texMatrix[4].x + st2.y * texMatrix[4].y + texMatrix[4].z,
st2.x * texMatrix[5].x + st2.y * texMatrix[5].y + texMatrix[5].z);
st2 += texMatrix[4].w * sin(offsetPos * (2.0 * M_PI / 1024.0) + vec2(texMatrix[5].w * 2.0 * M_PI));

st2 = vec2(st2.x * texMatrix[6].x + st2.y * texMatrix[6].y + texMatrix[6].z,
st2.x * texMatrix[7].x + st2.y * texMatrix[7].y + texMatrix[7].z);
st2 += texMatrix[6].w * sin(offsetPos * (2.0 * M_PI / 1024.0) + vec2(texMatrix[7].w * 2.0 * M_PI));

return st2 + texOffset * amplitude;
return st2;
}
#endif

Expand Down Expand Up @@ -183,7 +198,16 @@ void main()
#endif

#if defined(USE_TCMOD)
var_TexCoords.xy = ModTexCoords(texCoords, position, u_DiffuseTexMatrix, u_DiffuseTexOffTurb);
vec4 diffuseTexMatrix[8];
diffuseTexMatrix[0] = u_DiffuseTexMatrix0;
diffuseTexMatrix[1] = u_DiffuseTexMatrix1;
diffuseTexMatrix[2] = u_DiffuseTexMatrix2;
diffuseTexMatrix[3] = u_DiffuseTexMatrix3;
diffuseTexMatrix[4] = u_DiffuseTexMatrix4;
diffuseTexMatrix[5] = u_DiffuseTexMatrix5;
diffuseTexMatrix[6] = u_DiffuseTexMatrix6;
diffuseTexMatrix[7] = u_DiffuseTexMatrix7;
var_TexCoords.xy = ModTexCoords(texCoords, position, diffuseTexMatrix);
#else
var_TexCoords.xy = texCoords;
#endif
Expand Down
42 changes: 21 additions & 21 deletions code/renderergl2/tr_backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,7 @@ void RB_BeginDrawingView (void) {
{
FBO_t *fbo = backEnd.viewParms.targetFbo;

// FIXME: HUGE HACK: render to the screen fbo if we've already postprocessed the frame and aren't drawing more world
// drawing more world check is in case of double renders, such as skyportals
if (fbo == NULL && !(backEnd.framePostProcessed && (backEnd.refdef.rdflags & RDF_NOWORLDMODEL)))
if (fbo == NULL && (!r_postProcess->integer || !(backEnd.refdef.rdflags & RDF_NOWORLDMODEL)))
fbo = tr.renderFbo;

if (tr.renderCubeFbo && fbo == tr.renderCubeFbo)
Expand Down Expand Up @@ -457,7 +455,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {

for (i = 0, drawSurf = drawSurfs ; i < numDrawSurfs ; i++, drawSurf++) {
if ( drawSurf->sort == oldSort && drawSurf->cubemapIndex == oldCubemapIndex) {
if (backEnd.depthFill && shader && shader->sort != SS_OPAQUE)
if (backEnd.depthFill && shader && (shader->sort != SS_OPAQUE && shader->sort != SS_PORTAL))
continue;

// fast path, same as previous sort
Expand Down Expand Up @@ -486,7 +484,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
oldCubemapIndex = cubemapIndex;
}

if (backEnd.depthFill && shader && shader->sort != SS_OPAQUE)
if (backEnd.depthFill && shader && (shader->sort != SS_OPAQUE && shader->sort != SS_PORTAL))
continue;

//
Expand Down Expand Up @@ -708,10 +706,9 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *
ri.Printf( PRINT_ALL, "qglTexSubImage2D %i, %i: %i msec\n", cols, rows, end - start );
}

// FIXME: HUGE hack
if (glRefConfig.framebufferObject)
{
FBO_Bind(backEnd.framePostProcessed ? NULL : tr.renderFbo);
FBO_Bind(r_postProcess->integer ? NULL : tr.renderFbo);
}

RB_SetGL2D();
Expand Down Expand Up @@ -795,9 +792,8 @@ const void *RB_StretchPic ( const void *data ) {

cmd = (const stretchPicCommand_t *)data;

// FIXME: HUGE hack
if (glRefConfig.framebufferObject)
FBO_Bind(backEnd.framePostProcessed ? NULL : tr.renderFbo);
FBO_Bind(r_postProcess->integer ? NULL : tr.renderFbo);

RB_SetGL2D();

Expand Down Expand Up @@ -1173,6 +1169,13 @@ const void *RB_DrawSurfs( const void *data ) {
qglGenerateTextureMipmapEXT(cubemap->image->texnum, GL_TEXTURE_CUBE_MAP);
}

// FIXME? backEnd.viewParms doesn't get properly initialized for 2D drawing.
// r_cubeMapping 1 generates cubemaps with R_RenderCubemapSide()
// and sets isMirror = qtrue. Clear it here to prevent it from leaking
// to 2D drawing and causing the loading screen to be culled.
backEnd.viewParms.isMirror = qfalse;
backEnd.viewParms.flags = 0;

return (const void *)(cmd + 1);
}

Expand Down Expand Up @@ -1201,6 +1204,13 @@ const void *RB_DrawBuffer( const void *data ) {
if ( r_clear->integer ) {
qglClearColor( 1, 0, 0.5, 1 );
qglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

if (glRefConfig.framebufferObject && tr.renderFbo) {
FBO_Bind(tr.renderFbo);

qglClearColor( 1, 0, 0.5, 1 );
qglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
}
}

return (const void *)(cmd + 1);
Expand Down Expand Up @@ -1313,14 +1323,7 @@ const void *RB_ClearDepth(const void *data)

if (glRefConfig.framebufferObject)
{
if (!tr.renderFbo || backEnd.framePostProcessed)
{
FBO_Bind(NULL);
}
else
{
FBO_Bind(tr.renderFbo);
}
FBO_Bind(tr.renderFbo);
}

qglClear(GL_DEPTH_BUFFER_BIT);
Expand Down Expand Up @@ -1378,7 +1381,7 @@ const void *RB_SwapBuffers( const void *data ) {

if (glRefConfig.framebufferObject)
{
if (!backEnd.framePostProcessed)
if (!r_postProcess->integer)
{
if (tr.msaaResolveFbo && r_hdr->integer)
{
Expand All @@ -1401,7 +1404,6 @@ const void *RB_SwapBuffers( const void *data ) {

GLimp_EndFrame();

backEnd.framePostProcessed = qfalse;
backEnd.projection2D = qfalse;

return (const void *)(cmd + 1);
Expand Down Expand Up @@ -1655,8 +1657,6 @@ const void *RB_PostProcess(const void *data)
}
#endif

backEnd.framePostProcessed = qtrue;

return (const void *)(cmd + 1);
}

Expand Down
7 changes: 4 additions & 3 deletions code/renderergl2/tr_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ static void R_LoadLightmaps( lump_t *l, lump_t *surfs ) {
}


// If FatPackU() or FatPackV() changes, update FixFatLightmapTexCoords()
static float FatPackU(float input, int lightmapnum)
{
if (lightmapnum < 0)
Expand Down Expand Up @@ -616,7 +617,7 @@ static shader_t *ShaderForShaderNum( int shaderNum, int lightmapNum ) {
lightmapNum = LIGHTMAP_WHITEIMAGE;
}

shader = R_FindShader( dsh->shader, lightmapNum, qtrue );
shader = R_FindShaderEx( dsh->shader, FatLightmap( lightmapNum ), qtrue, lightmapNum );

// if the shader had errors, just use default shader
if ( shader->defaultShader ) {
Expand Down Expand Up @@ -705,7 +706,7 @@ static void ParseFace( dsurface_t *ds, drawVert_t *verts, float *hdrVertColors,
surf->fogIndex = LittleLong( ds->fogNum ) + 1;

// get shader value
surf->shader = ShaderForShaderNum( ds->shaderNum, FatLightmap(realLightmapNum) );
surf->shader = ShaderForShaderNum( ds->shaderNum, realLightmapNum );
if ( r_singleShader->integer && !surf->shader->isSky ) {
surf->shader = tr.defaultShader;
}
Expand Down Expand Up @@ -812,7 +813,7 @@ static void ParseMesh ( dsurface_t *ds, drawVert_t *verts, float *hdrVertColors,
surf->fogIndex = LittleLong( ds->fogNum ) + 1;

// get shader value
surf->shader = ShaderForShaderNum( ds->shaderNum, FatLightmap(realLightmapNum) );
surf->shader = ShaderForShaderNum( ds->shaderNum, realLightmapNum );
if ( r_singleShader->integer && !surf->shader->isSky ) {
surf->shader = tr.defaultShader;
}
Expand Down
Loading

0 comments on commit 8569b34

Please sign in to comment.