diff --git a/codemp/client/cl_main.cpp b/codemp/client/cl_main.cpp index cdeda3c429..e40a986753 100644 --- a/codemp/client/cl_main.cpp +++ b/codemp/client/cl_main.cpp @@ -3711,6 +3711,23 @@ void CL_ServerInfoPacket( netadr_t from, msg_t *msg ) { } } + if ( cl_filterGames && cl_filterGames->string && cl_filterGames->string[0] ) { + const char *gameFolder = Info_ValueForKey( infoString, "game" ); + + // If no game folder was specified the server is using base. Use the BASEGAME string so we can filter for it. + if ( !gameFolder[0] ) gameFolder = BASEGAME; + + // NOTE: As the command tokenization doesn't support nested quotes we can't filter fs_game with spaces using + // this approach, but fs_game with spaces cause other issues as well, like downloads not working and at + // the time of writing this no public servers actually use an fs_game with spaces... + Cmd_TokenizeString( cl_filterGames->string ); + for ( i = 0; i < Cmd_Argc(); i++ ) { + if ( !Q_stricmp(Cmd_Argv(i), gameFolder) && Q_stricmp(Cmd_Argv(i), FS_GetCurrentGameDir(false)) ) { + return; + } + } + } + // iterate servers waiting for ping response for (i=0; imod_index] - + int dataSize; // just for listing purposes bmodel_t *bmodel; // only if type == MOD_BRUSH md3Header_t *md3[MD3_MAX_LODS]; // only if type == MOD_MESH @@ -1272,6 +1272,9 @@ extern cvar_t *r_noServerGhoul2; /* Ghoul2 Insert End */ + +extern cvar_t *r_patchStitching; + //==================================================================== float R_NoiseGet4f( float x, float y, float z, float t ); @@ -1579,8 +1582,6 @@ CURVE TESSELATION ============================================================ */ -#define PATCH_STITCHING - srfGridMesh_t *R_SubdividePatchToGrid( int width, int height, drawVert_t points[MAX_PATCH_SIZE*MAX_PATCH_SIZE] ); diff --git a/codemp/rd-rend2/tr_init.cpp b/codemp/rd-rend2/tr_init.cpp index 3d1a4a4c99..0ed30bad46 100644 --- a/codemp/rd-rend2/tr_init.cpp +++ b/codemp/rd-rend2/tr_init.cpp @@ -276,6 +276,8 @@ cvar_t *r_debugWeather; cvar_t *r_aspectCorrectFonts; cvar_t *cl_ratioFix; +cvar_t *r_patchStitching; + extern void RB_SetGL2D (void); static void R_Splash() { @@ -630,8 +632,8 @@ we use statics to store a count and start writing the first screenshot/screensho (with FS_FileExists / FS_FOpenFileWrite calls) FIXME: the statics don't get a reinit between fs_game changes -============================================================================== -*/ +============================================================================== +*/ /* ================== @@ -688,10 +690,10 @@ static void ConvertRGBtoBGR( *dst++ = pixelRGB[2]; *dst++ = pixelRGB[1]; *dst++ = temp; - + pixelRGB += 3; } - + row += stride; } } @@ -724,11 +726,11 @@ static void R_SaveTGA( ri.Hunk_FreeTempMemory(buffer); } -/* -================== +/* +================== R_SaveScreenshotTGA -================== -*/ +================== +*/ static void R_SaveScreenshotTGA( const screenshotReadback_t *screenshotReadback, byte *pixels) { @@ -741,9 +743,9 @@ static void R_SaveScreenshotTGA( } /* -================== +================== R_SaveScreenshotPNG -================== +================== */ static void R_SaveScreenshotPNG( const screenshotReadback_t *screenshotReadback, byte *pixels) @@ -828,7 +830,7 @@ R_TakeScreenshotCmd */ const void *RB_TakeScreenshotCmd( const void *data ) { const screenshotCommand_t *cmd; - + cmd = (const screenshotCommand_t *)data; // finish any 2D drawing if needed @@ -838,13 +840,13 @@ const void *RB_TakeScreenshotCmd( const void *data ) { const int frameNumber = backEndData->realFrameNumber; gpuFrame_t *thisFrame = &backEndData->frames[frameNumber % MAX_FRAMES]; screenshotReadback_t *screenshot = &thisFrame->screenshotReadback; - + GLint packAlign; qglGetIntegerv(GL_PACK_ALIGNMENT, &packAlign); - + const int linelen = cmd->width * 3; const int strideInBytes = PAD(linelen, packAlign); - + qglGenBuffers(1, &screenshot->pbo); qglBindBuffer(GL_PIXEL_PACK_BUFFER, screenshot->pbo); qglBufferData( @@ -862,8 +864,8 @@ const void *RB_TakeScreenshotCmd( const void *data ) { screenshot->format = cmd->format; Q_strncpyz( screenshot->filename, cmd->fileName, sizeof(screenshot->filename)); - - return (const void *)(cmd + 1); + + return (const void *)(cmd + 1); } /* @@ -890,11 +892,11 @@ void R_TakeScreenshot( int x, int y, int width, int height, char *name, screensh cmd->format = format; } -/* -================== +/* +================== R_ScreenshotFilename -================== -*/ +================== +*/ void R_ScreenshotFilename( char *buf, int bufSize, const char *ext ) { time_t rawtime; char timeStr[32] = {0}; // should really only reach ~19 chars @@ -974,8 +976,8 @@ static void R_LevelShot( void ) { ri.Printf( PRINT_ALL, "Wrote %s\n", checkname ); } -/* -================== +/* +================== R_ScreenShotTGA_f screenshot @@ -984,8 +986,8 @@ screenshot [levelshot] screenshot [filename] Doesn't print the pacifier message if there is a second arg -================== -*/ +================== +*/ void R_ScreenShotTGA_f (void) { char checkname[MAX_OSPATH] = {0}; qboolean silent = qfalse; @@ -1007,7 +1009,7 @@ void R_ScreenShotTGA_f (void) { R_ScreenshotFilename( checkname, sizeof( checkname ), ".tga" ); if ( ri.FS_FileExists( checkname ) ) { - Com_Printf( "ScreenShot: Couldn't create a file\n"); + Com_Printf( "ScreenShot: Couldn't create a file\n"); return; } } @@ -1039,7 +1041,7 @@ void R_ScreenShotPNG_f (void) { R_ScreenshotFilename( checkname, sizeof( checkname ), ".png" ); if ( ri.FS_FileExists( checkname ) ) { - Com_Printf( "ScreenShot: Couldn't create a file\n"); + Com_Printf( "ScreenShot: Couldn't create a file\n"); return; } } @@ -1071,7 +1073,7 @@ void R_ScreenShotJPEG_f (void) { R_ScreenshotFilename( checkname, sizeof( checkname ), ".jpg" ); if ( ri.FS_FileExists( checkname ) ) { - Com_Printf( "ScreenShot: Couldn't create a file\n"); + Com_Printf( "ScreenShot: Couldn't create a file\n"); return; } } @@ -1102,7 +1104,7 @@ const void *RB_TakeVideoFrameCmd( const void *data ) RB_EndSurface(); cmd = (const videoFrameCommand_t *)data; - + qglGetIntegerv(GL_PACK_ALIGNMENT, &packAlign); linelen = cmd->width * 3; @@ -1115,7 +1117,7 @@ const void *RB_TakeVideoFrameCmd( const void *data ) avipadlen = avipadwidth - linelen; cBuf = (byte*)(PADP(cmd->captureBuffer, packAlign)); - + qglReadPixels(0, 0, cmd->width, cmd->height, GL_RGB, GL_UNSIGNED_BYTE, cBuf); @@ -1136,11 +1138,11 @@ const void *RB_TakeVideoFrameCmd( const void *data ) { byte *lineend, *memend; byte *srcptr, *destptr; - + srcptr = cBuf; destptr = cmd->encodeBuffer; memend = srcptr + memcount; - + // swap R and B and remove line paddings while(srcptr < memend) { @@ -1152,17 +1154,17 @@ const void *RB_TakeVideoFrameCmd( const void *data ) *destptr++ = srcptr[0]; srcptr += 3; } - + Com_Memset(destptr, '\0', avipadlen); destptr += avipadlen; - + srcptr += padlen; } - + ri.CL_WriteAVIVideoFrame(cmd->encodeBuffer, avipadwidth * cmd->height); } - return (const void *)(cmd + 1); + return (const void *)(cmd + 1); } //============================================================================ @@ -1246,7 +1248,7 @@ void R_PrintLongString(const char *string) { GfxInfo_f ================ */ -static void GfxInfo_f( void ) +static void GfxInfo_f( void ) { const char *enablestrings[] = { @@ -1322,7 +1324,7 @@ static void GfxInfo_f( void ) GfxMemInfo_f ================ */ -void GfxMemInfo_f( void ) +void GfxMemInfo_f( void ) { switch (glRefConfig.memInfo) { @@ -1452,7 +1454,7 @@ static const size_t numCommands = ARRAY_LEN( commands ); R_Register =============== */ -void R_Register( void ) +void R_Register( void ) { // // latched and archived variables @@ -1534,7 +1536,7 @@ void R_Register( void ) r_baseNormalX = ri.Cvar_Get( "r_baseNormalX", "1.0", CVAR_ARCHIVE | CVAR_LATCH, "" ); r_baseNormalY = ri.Cvar_Get( "r_baseNormalY", "1.0", CVAR_ARCHIVE | CVAR_LATCH, "" ); r_baseParallax = ri.Cvar_Get( "r_baseParallax", "0.05", CVAR_ARCHIVE | CVAR_LATCH, "" ); - r_baseSpecular = ri.Cvar_Get( "r_baseSpecular", "0.04", CVAR_ARCHIVE | CVAR_LATCH, "" ); + r_baseSpecular = ri.Cvar_Get( "r_baseSpecular", "0.04", CVAR_ARCHIVE | CVAR_LATCH, "" ); r_dlightMode = ri.Cvar_Get( "r_dlightMode", "1", CVAR_ARCHIVE | CVAR_LATCH, "" ); r_pshadowDist = ri.Cvar_Get( "r_pshadowDist", "128", CVAR_ARCHIVE, "" ); r_imageUpsample = ri.Cvar_Get( "r_imageUpsample", "0", CVAR_ARCHIVE | CVAR_LATCH, "" ); @@ -1681,6 +1683,8 @@ Ghoul2 Insert Start Ghoul2 Insert End */ + r_patchStitching = ri.Cvar_Get("r_patchStitching", "1", CVAR_ARCHIVE, "Enable stitching of neighbouring patch surfaces" ); + se_language = ri.Cvar_Get ( "se_language", "english", CVAR_ARCHIVE | CVAR_NORESTART, "" ); for ( size_t i = 0; i < numCommands; i++ ) @@ -1943,14 +1947,14 @@ R_Init void R_Init( void ) { byte *ptr; int i; - + ri.Printf( PRINT_ALL, "----- R_Init -----\n" ); // clear all our internal state Com_Memset( &tr, 0, sizeof( tr ) ); Com_Memset( &backEnd, 0, sizeof( backEnd ) ); Com_Memset( &tess, 0, sizeof( tess ) ); - + // // init function tables @@ -2242,7 +2246,7 @@ Q_EXPORT refexport_t* QDECL GetRefAPI ( int apiVersion, refimport_t *rimp ) { Com_Memset( &re, 0, sizeof( re ) ); if ( apiVersion != REF_API_VERSION ) { - ri.Printf(PRINT_ALL, "Mismatched REF_API_VERSION: expected %i, got %i\n", + ri.Printf(PRINT_ALL, "Mismatched REF_API_VERSION: expected %i, got %i\n", REF_API_VERSION, apiVersion ); return NULL; } diff --git a/codemp/rd-vanilla/tr_bsp.cpp b/codemp/rd-vanilla/tr_bsp.cpp index 2941444b8f..59bbed12c0 100644 --- a/codemp/rd-vanilla/tr_bsp.cpp +++ b/codemp/rd-vanilla/tr_bsp.cpp @@ -1392,15 +1392,15 @@ static void R_LoadSurfaces( lump_t *surfs, lump_t *verts, lump_t *indexLump, wor } } -#ifdef PATCH_STITCHING - R_StitchAllPatches(worldData); -#endif + if ( r_patchStitching->integer ) { + R_StitchAllPatches(worldData); + } R_FixSharedVertexLodError(worldData); -#ifdef PATCH_STITCHING - R_MovePatchSurfacesToHunk(worldData); -#endif + if ( r_patchStitching->integer ) { + R_MovePatchSurfacesToHunk(worldData); + } ri.Printf( PRINT_ALL, "...loaded %d faces, %i meshes, %i trisurfs, %i flares\n", numFaces, numMeshes, numTriSurfs, numFlares ); } diff --git a/codemp/rd-vanilla/tr_curve.cpp b/codemp/rd-vanilla/tr_curve.cpp index bc67911d0d..8cd4455bc5 100644 --- a/codemp/rd-vanilla/tr_curve.cpp +++ b/codemp/rd-vanilla/tr_curve.cpp @@ -306,7 +306,6 @@ srfGridMesh_t *R_CreateSurfaceGridMesh(int width, int height, // copy the results out to a grid size = (width * height - 1) * sizeof( drawVert_t ) + sizeof( *grid ); -#ifdef PATCH_STITCHING grid = (struct srfGridMesh_s *)/*Hunk_Alloc*/ Z_Malloc( size, TAG_GRIDMESH, qfalse ); memset(grid, 0, size); @@ -315,16 +314,7 @@ srfGridMesh_t *R_CreateSurfaceGridMesh(int width, int height, grid->heightLodError = (float *)/*Hunk_Alloc*/ Z_Malloc( height * 4, TAG_GRIDMESH, qfalse ); memcpy( grid->heightLodError, errorTable[1], height * 4 ); -#else - grid = Hunk_Alloc( size ); - memset(grid, 0, size); - - grid->widthLodError = Hunk_Alloc( width * 4 ); - memcpy( grid->widthLodError, errorTable[0], width * 4 ); - grid->heightLodError = Hunk_Alloc( height * 4 ); - memcpy( grid->heightLodError, errorTable[1], height * 4 ); -#endif grid->width = width; grid->height = height; diff --git a/codemp/rd-vanilla/tr_init.cpp b/codemp/rd-vanilla/tr_init.cpp index 89726aa83c..9759c3160a 100644 --- a/codemp/rd-vanilla/tr_init.cpp +++ b/codemp/rd-vanilla/tr_init.cpp @@ -220,6 +220,8 @@ cvar_t *se_language; cvar_t *r_aviMotionJpegQuality; cvar_t *r_screenshotJpegQuality; +cvar_t *r_patchStitching; + #if !defined(__APPLE__) PFNGLSTENCILOPSEPARATEPROC qglStencilOpSeparate; #endif @@ -1773,6 +1775,8 @@ Ghoul2 Insert End ri.Cvar_CheckRange( r_aviMotionJpegQuality, 10, 100, qtrue ); ri.Cvar_CheckRange( r_screenshotJpegQuality, 10, 100, qtrue ); + r_patchStitching = ri.Cvar_Get("r_patchStitching", "1", CVAR_ARCHIVE, "Enable stitching of neighbouring patch surfaces" ); + for ( size_t i = 0; i < numCommands; i++ ) ri.Cmd_AddCommand( commands[i].cmd, commands[i].func, "" ); } diff --git a/codemp/rd-vanilla/tr_local.h b/codemp/rd-vanilla/tr_local.h index fd900859f7..af22d96d5c 100644 --- a/codemp/rd-vanilla/tr_local.h +++ b/codemp/rd-vanilla/tr_local.h @@ -1291,6 +1291,9 @@ extern cvar_t *r_noServerGhoul2; /* Ghoul2 Insert End */ + +extern cvar_t *r_patchStitching; + //==================================================================== void R_SwapBuffers( int ); @@ -1615,8 +1618,6 @@ CURVE TESSELATION ============================================================ */ -#define PATCH_STITCHING - srfGridMesh_t *R_SubdividePatchToGrid( int width, int height, drawVert_t points[MAX_PATCH_SIZE*MAX_PATCH_SIZE] ); diff --git a/codemp/rd-vulkan/tr_bsp.cpp b/codemp/rd-vulkan/tr_bsp.cpp index cc4f1b1d7b..92bcc842ee 100644 --- a/codemp/rd-vulkan/tr_bsp.cpp +++ b/codemp/rd-vulkan/tr_bsp.cpp @@ -1633,15 +1633,15 @@ static void R_LoadSurfaces( const lump_t *surfs, const lump_t *verts, const lump } } -#ifdef PATCH_STITCHING - R_StitchAllPatches(worldData); -#endif + if ( r_patchStitching->integer ) { + R_StitchAllPatches(worldData); + } R_FixSharedVertexLodError(worldData); -#ifdef PATCH_STITCHING - R_MovePatchSurfacesToHunk(worldData); -#endif + if ( r_patchStitching->integer ) { + R_MovePatchSurfacesToHunk(worldData); + } vk_debug("...loaded %d faces, %i meshes, %i trisurfs, %i flares\n", numFaces, numMeshes, numTriSurfs, numFlares ); } diff --git a/codemp/rd-vulkan/tr_curve.cpp b/codemp/rd-vulkan/tr_curve.cpp index 8da1b0872d..1027212b59 100644 --- a/codemp/rd-vulkan/tr_curve.cpp +++ b/codemp/rd-vulkan/tr_curve.cpp @@ -305,7 +305,6 @@ static srfGridMesh_t *R_CreateSurfaceGridMesh( int width, int height, // copy the results out to a grid size = (width * height - 1) * sizeof( drawVert_t ) + sizeof( *grid ); -#ifdef PATCH_STITCHING grid = (struct srfGridMesh_s *)/*Hunk_Alloc*/ Z_Malloc( size, TAG_GRIDMESH, qfalse ); memset(grid, 0, size); @@ -314,16 +313,6 @@ static srfGridMesh_t *R_CreateSurfaceGridMesh( int width, int height, grid->heightLodError = (float *)/*Hunk_Alloc*/ Z_Malloc( height * 4, TAG_GRIDMESH, qfalse ); memcpy( grid->heightLodError, errorTable[1], height * 4 ); -#else - grid = Hunk_Alloc( size ); - memset(grid, 0, size); - - grid->widthLodError = Hunk_Alloc( width * 4 ); - memcpy( grid->widthLodError, errorTable[0], width * 4 ); - - grid->heightLodError = Hunk_Alloc( height * 4 ); - memcpy( grid->heightLodError, errorTable[1], height * 4 ); -#endif grid->width = width; grid->height = height; diff --git a/codemp/rd-vulkan/tr_init.cpp b/codemp/rd-vulkan/tr_init.cpp index 642fb9b0ea..b033625a00 100644 --- a/codemp/rd-vulkan/tr_init.cpp +++ b/codemp/rd-vulkan/tr_init.cpp @@ -178,6 +178,7 @@ cvar_t *r_marksOnTriangleMeshes; cvar_t *r_aspectCorrectFonts; cvar_t *cl_ratioFix; +cvar_t *r_patchStitching; // Vulkan cvar_t *r_defaultImage; @@ -771,8 +772,9 @@ R_Register */ void R_Register( void ) { + r_patchStitching = ri.Cvar_Get("r_patchStitching", "1", CVAR_ARCHIVE, "Enable stitching of neighbouring patch surfaces" ); //FIXME: lol badness - se_language = ri.Cvar_Get("se_language", "english", CVAR_ARCHIVE | CVAR_NORESTART, ""); + se_language = ri.Cvar_Get("se_language", "english", CVAR_ARCHIVE | CVAR_NORESTART, ""); // // latched and archived variables // diff --git a/codemp/rd-vulkan/tr_local.h b/codemp/rd-vulkan/tr_local.h index 663f0aebc3..eecc4c4e8b 100644 --- a/codemp/rd-vulkan/tr_local.h +++ b/codemp/rd-vulkan/tr_local.h @@ -661,6 +661,7 @@ extern hitMatReg_t hitMatReg[MAX_HITMAT_ENTRIES]; Ghoul2 Insert End */ +extern cvar_t *r_patchStitching; // trRefdef_t holds everything that comes in refdef_t, // as well as the locally generated scene information @@ -1907,7 +1908,6 @@ CURVE TESSELATION ============================================================ */ -#define PATCH_STITCHING srfGridMesh_t *R_SubdividePatchToGrid( int width, int height, drawVert_t points[MAX_PATCH_SIZE * MAX_PATCH_SIZE] ); srfGridMesh_t *R_GridInsertColumn( srfGridMesh_t *grid, int column, int row, vec3_t point, float loderror ); diff --git a/shared/rd-rend2/tr_bsp.cpp b/shared/rd-rend2/tr_bsp.cpp index 85d720c972..1f2442afa6 100644 --- a/shared/rd-rend2/tr_bsp.cpp +++ b/shared/rd-rend2/tr_bsp.cpp @@ -114,7 +114,7 @@ static void R_ColorShiftLightingBytes( byte in[4], byte out[4] ) { r = in[0] << shift; g = in[1] << shift; b = in[2] << shift; - + // normalize by color instead of saturating to white if ( ( r | g | b ) > 255 ) { int max; @@ -242,7 +242,7 @@ static void R_LoadLightmaps( world_t *worldData, lump_t *l, lump_t *surfs ) { // we are about to upload textures R_IssuePendingRenderCommands(); - + // check for deluxe mapping if (numLightmaps <= 1) { @@ -376,7 +376,7 @@ static void R_LoadLightmaps( world_t *worldData, lump_t *l, lump_t *surfs ) { R_LoadImage(filename, &externalLightmap, &lightmapWidth, &lightmapHeight); } } - + if (externalLightmap) { int newImageSize = lightmapWidth * lightmapHeight * 4 * 2; @@ -451,7 +451,7 @@ static void R_LoadLightmaps( world_t *worldData, lump_t *l, lump_t *surfs ) { else if (buf_p && hdr_capable) { vec4_t color; - + //hack: convert LDR lightmap to HDR one color[0] = MAX(buf_p[j*numColorComponents + 0], 0.499f); color[1] = MAX(buf_p[j*numColorComponents + 1], 0.499f); @@ -734,7 +734,7 @@ static int FatLightmap(int lightmapnum) if (tr.lightmapAtlasSize[0] > 0) return 0; - + return lightmapnum; } @@ -2174,8 +2174,8 @@ static void R_CreateWorldVBOs( world_t *worldData ) ri.Printf(PRINT_ALL, "...calculating world VBO %d ( %i verts %i tris )\n", k, numVerts, numIndexes / 3); // create arrays - verts = (packedVertex_t *)Hunk_AllocateTempMemory(numVerts * sizeof(packedVertex_t)); - indexes = (glIndex_t *)Hunk_AllocateTempMemory(numIndexes * sizeof(glIndex_t)); + verts = (packedVertex_t *)Hunk_AllocateTempMemory(numVerts * sizeof(packedVertex_t)); + indexes = (glIndex_t *)Hunk_AllocateTempMemory(numIndexes * sizeof(glIndex_t)); // set up indices and copy vertices numVerts = 0; @@ -2319,7 +2319,7 @@ static void R_LoadSurfaces( world_t *worldData, lump_t *surfs, lump_t *verts, lu if ( indexLump->filelen % sizeof(*indexes)) ri.Error (ERR_DROP, "LoadMap: funny lump size in %s",worldData->name); - out = (msurface_t *)Hunk_Alloc ( count * sizeof(*out), h_low ); + out = (msurface_t *)Hunk_Alloc ( count * sizeof(*out), h_low ); worldData->surfaces = out; worldData->numsurfaces = count; @@ -2427,17 +2427,17 @@ static void R_LoadSurfaces( world_t *worldData, lump_t *surfs, lump_t *verts, lu ri.FS_FreeFile(hdrVertColors); } -#ifdef PATCH_STITCHING - R_StitchAllPatches(worldData); -#endif + if ( r_patchStitching->integer ) { + R_StitchAllPatches(worldData); + } R_FixSharedVertexLodError(worldData); -#ifdef PATCH_STITCHING - R_MovePatchSurfacesToHunk(worldData); -#endif + if ( r_patchStitching->integer ) { + R_MovePatchSurfacesToHunk(worldData); + } - ri.Printf( PRINT_ALL, "...loaded %d faces, %i meshes, %i trisurfs, %i flares\n", + ri.Printf( PRINT_ALL, "...loaded %d faces, %i meshes, %i trisurfs, %i flares\n", numFaces, numMeshes, numTriSurfs, numFlares ); } @@ -2538,7 +2538,7 @@ static void R_LoadNodesAndLeafs (world_t *worldData, lump_t *nodeLump, lump_t *l numNodes = nodeLump->filelen / sizeof(dnode_t); numLeafs = leafLump->filelen / sizeof(dleaf_t); - out = (mnode_t *)Hunk_Alloc ( (numNodes + numLeafs) * sizeof(*out), h_low); + out = (mnode_t *)Hunk_Alloc ( (numNodes + numLeafs) * sizeof(*out), h_low); worldData->nodes = out; worldData->numnodes = numNodes + numLeafs; @@ -2552,7 +2552,7 @@ static void R_LoadNodesAndLeafs (world_t *worldData, lump_t *nodeLump, lump_t *l out->mins[j] = LittleLong (in->mins[j]); out->maxs[j] = LittleLong (in->maxs[j]); } - + p = LittleLong(in->planeNum); out->plane = worldData->planes + p; @@ -2567,7 +2567,7 @@ static void R_LoadNodesAndLeafs (world_t *worldData, lump_t *nodeLump, lump_t *l out->children[j] = worldData->nodes + numNodes + (-1 - p); } } - + // load leafs inLeaf = (dleaf_t *)(fileBase + leafLump->fileofs); for ( i=0 ; ifirstmarksurface = LittleLong(inLeaf->firstLeafSurface); out->nummarksurfaces = LittleLong(inLeaf->numLeafSurfaces); - } + } // chain decendants R_SetParent (worldData->nodes, NULL); @@ -2600,10 +2600,10 @@ static void R_LoadNodesAndLeafs (world_t *worldData, lump_t *nodeLump, lump_t *l R_LoadShaders ================= */ -static void R_LoadShaders( world_t *worldData, lump_t *l ) { +static void R_LoadShaders( world_t *worldData, lump_t *l ) { int i, count; dshader_t *in, *out; - + in = (dshader_t *)(fileBase + l->fileofs); if (l->filelen % sizeof(*in)) ri.Error (ERR_DROP, "LoadMap: funny lump size in %s",worldData->name); @@ -2628,16 +2628,16 @@ R_LoadMarksurfaces ================= */ static void R_LoadMarksurfaces (world_t *worldData, lump_t *l) -{ +{ int i, j, count; int *in; int *out; - + in = (int *)(fileBase + l->fileofs); if (l->filelen % sizeof(*in)) ri.Error (ERR_DROP, "LoadMap: funny lump size in %s",worldData->name); count = l->filelen / sizeof(*in); - out = (int *)Hunk_Alloc ( count*sizeof(*out), h_low); + out = (int *)Hunk_Alloc ( count*sizeof(*out), h_low); worldData->marksurfaces = out; worldData->nummarksurfaces = count; @@ -2661,12 +2661,12 @@ static void R_LoadPlanes( world_t *worldData, lump_t *l ) { dplane_t *in; int count; int bits; - + in = (dplane_t *)(fileBase + l->fileofs); if (l->filelen % sizeof(*in)) ri.Error (ERR_DROP, "LoadMap: funny lump size in %s",worldData->name); count = l->filelen / sizeof(*in); - out = (cplane_t *)Hunk_Alloc ( count*2*sizeof(*out), h_low); + out = (cplane_t *)Hunk_Alloc ( count*2*sizeof(*out), h_low); worldData->planes = out; worldData->numplanes = count; @@ -2797,8 +2797,8 @@ static void R_LoadFogs( world_t *worldData, lump_t *l, lump_t *brushesLump, lump out->parms = shader->fogParms; VectorSet4(out->color, - shader->fogParms.color[0] * tr.identityLight, - shader->fogParms.color[1] * tr.identityLight, + shader->fogParms.color[0] * tr.identityLight, + shader->fogParms.color[1] * tr.identityLight, shader->fogParms.color[2] * tr.identityLight, 1.0); @@ -2851,7 +2851,7 @@ void R_LoadLightGrid( world_t *worldData, lump_t *l ) { Com_Memcpy( worldData->lightGridData, (void *)(fileBase + l->fileofs), l->filelen ); // deal with overbright bits - for ( i = 0 ; i < numGridDataElements ; i++ ) + for ( i = 0 ; i < numGridDataElements ; i++ ) { for(int j = 0; j < MAXLIGHTMAPS; j++) { @@ -2957,7 +2957,7 @@ void R_LoadEntities( world_t *worldData, lump_t *l ) { } // only parse the world spawn - while ( 1 ) { + while ( 1 ) { // parse key token = COM_ParseExt( &p, qtrue ); @@ -3072,7 +3072,7 @@ static qboolean R_ParseSpawnVars( char *spawnVarChars, int maxSpawnVarChars, int } // go through all the key / value pairs - while ( 1 ) { + while ( 1 ) { int keyLength, tokenLength; // parse key @@ -3085,7 +3085,7 @@ static qboolean R_ParseSpawnVars( char *spawnVarChars, int maxSpawnVarChars, int break; } - // parse value + // parse value if ( !R_GetEntityToken( com_token, sizeof( com_token ) ) ) { ri.Printf( PRINT_ALL, "R_ParseSpawnVars: EOF without closing brace\n" ); return qfalse; @@ -3309,7 +3309,7 @@ static void R_RenderAllCubemaps() { //cubemapFormat = GL_RGBA16F; } - + for (int k = 0; k <= r_cubeMappingBounces->integer; k++) { bool bounce = k != 0; @@ -3470,7 +3470,7 @@ static void R_MergeLeafSurfaces(world_t *worldData) if (worldData->surfacesViewCount[surfNum2] != -1) continue; - + surf2 = worldData->surfaces + surfNum2; if ((*surf2->data != SF_GRID) && @@ -3520,7 +3520,7 @@ static void R_MergeLeafSurfaces(world_t *worldData) if (!merges) worldData->surfacesViewCount[i] = -1; - } + } // count merged/unmerged surfaces numMergedSurfaces = 0; @@ -3551,7 +3551,7 @@ static void R_MergeLeafSurfaces(world_t *worldData) (int *)Hunk_Alloc( sizeof(*worldData->mergedSurfacesPshadowBits) * numMergedSurfaces, h_low); worldData->numMergedSurfaces = numMergedSurfaces; - + // view surfaces are like mark surfaces, except negative ones represent merged surfaces // -1 represents 0, -2 represents 1, and so on worldData->viewSurfaces = @@ -3715,7 +3715,7 @@ static void R_MergeLeafSurfaces(world_t *worldData) endTime = ri.Milliseconds(); - ri.Printf(PRINT_ALL, "Processed %d surfaces into %d merged, %d unmerged in %5.2f seconds\n", + ri.Printf(PRINT_ALL, "Processed %d surfaces into %d merged, %d unmerged in %5.2f seconds\n", numWorldSurfaces, numMergedSurfaces, numUnmergedSurfaces, (endTime - startTime) / 1000.0f); // reset viewcounts @@ -4155,8 +4155,8 @@ static void R_GenerateSurfaceSprites( const world_t *world, int worldIndex ) { VBO_t *vbo = R_CreateVBO((byte *)sprites_data.data(), sizeof(sprite_t) * sprites_data.size(), VBO_USAGE_STATIC); - - for (srfSprites_t *sp : currentBatch) + + for (srfSprites_t *sp : currentBatch) { sp->vbo = vbo; sp->ibo = ibo; @@ -4257,7 +4257,7 @@ world_t *R_LoadBSP(const char *name, int *bspIndex) { ri.Error( ERR_DROP, - "R_LoadBSP: %s has wrong version number (%i should be %i)", + "R_LoadBSP: %s has wrong version number (%i should be %i)", name, bspVersion, BSP_VERSION); @@ -4305,7 +4305,7 @@ world_t *R_LoadBSP(const char *name, int *bspIndex) R_LoadWeatherImages(); R_GenerateSurfaceSprites(worldData, worldIndex + 1); - + // load cubemaps if (r_cubeMapping->integer && bspIndex == nullptr) { @@ -4336,7 +4336,7 @@ world_t *R_LoadBSP(const char *name, int *bspIndex) if (tr.numCubemaps) break; } - + } if (tr.numCubemaps) diff --git a/shared/rd-rend2/tr_curve.cpp b/shared/rd-rend2/tr_curve.cpp index 7a47b25ede..ad923dc50d 100644 --- a/shared/rd-rend2/tr_curve.cpp +++ b/shared/rd-rend2/tr_curve.cpp @@ -347,7 +347,7 @@ static void InvertErrorTable( float errorTable[2][MAX_GRID_SIZE], int width, int PutPointsOnCurve ================== */ -static void PutPointsOnCurve( srfVert_t ctrl[MAX_GRID_SIZE][MAX_GRID_SIZE], +static void PutPointsOnCurve( srfVert_t ctrl[MAX_GRID_SIZE][MAX_GRID_SIZE], int width, int height ) { int i, j; srfVert_t prev, next; @@ -386,7 +386,6 @@ srfBspSurface_t *R_CreateSurfaceGridMesh(int width, int height, // copy the results out to a grid size = (width * height - 1) * sizeof( srfVert_t ) + sizeof( *grid ); -#ifdef PATCH_STITCHING grid = /*ri.Hunk_Alloc*/ (srfBspSurface_t *)R_Malloc( size, TAG_GRIDMESH ); Com_Memset(grid, 0, size); @@ -402,23 +401,6 @@ srfBspSurface_t *R_CreateSurfaceGridMesh(int width, int height, grid->numVerts = (width * height); grid->verts = (srfVert_t *)R_Malloc(grid->numVerts * sizeof(srfVert_t), TAG_GRIDMESH); -#else - grid = ri.Hunk_Alloc( size ); - Com_Memset(grid, 0, size); - - grid->widthLodError = ri.Hunk_Alloc( width * 4 ); - Com_Memcpy( grid->widthLodError, errorTable[0], width * 4 ); - - grid->heightLodError = ri.Hunk_Alloc( height * 4 ); - Com_Memcpy( grid->heightLodError, errorTable[1], height * 4 ); - - grid->numIndexes = numIndexes; - grid->indexes = (glIndex_t *)ri.Hunk_Alloc(grid->numIndexes * sizeof(glIndex_t), h_low); - Com_Memcpy(grid->indexes, indexes, numIndexes * sizeof(glIndex_t)); - - grid->numVerts = (width * height); - grid->verts = ri.Hunk_Alloc(grid->numVerts * sizeof(srfVert_t), h_low); -#endif grid->width = width; grid->height = height; @@ -476,7 +458,7 @@ srfBspSurface_t *R_SubdividePatchToGrid( int width, int height, int numIndexes; static glIndex_t indexes[(MAX_GRID_SIZE-1)*(MAX_GRID_SIZE-1)*2*3]; int consecutiveComplete; - + Com_Memset (&prev, 0, sizeof (prev)); Com_Memset (&next, 0, sizeof (next)); Com_Memset (&mid, 0, sizeof (mid)); diff --git a/shared/rd-rend2/tr_local.h b/shared/rd-rend2/tr_local.h index c29ddf61e2..e85b3b4474 100644 --- a/shared/rd-rend2/tr_local.h +++ b/shared/rd-rend2/tr_local.h @@ -302,6 +302,8 @@ extern cvar_t *broadsword_dircap; Ghoul2 Insert End */ +extern cvar_t *r_patchStitching; + /* End Cvars */ @@ -513,8 +515,8 @@ typedef enum { GF_SIN, GF_SQUARE, GF_TRIANGLE, - GF_SAWTOOTH, - GF_INVERSE_SAWTOOTH, + GF_SAWTOOTH, + GF_INVERSE_SAWTOOTH, GF_NOISE, GF_RAND @@ -871,7 +873,7 @@ typedef enum ST_GLSL } stageType_t; -typedef enum +typedef enum { SPEC_NONE, // no specular found SPEC_SPECGLOSS, // Specular Gloss @@ -907,7 +909,7 @@ typedef struct { qboolean cloth; AlphaTestType alphaTestType; - + textureBundle_t bundle[NUM_TEXTURE_BUNDLES]; waveForm_t rgbWave; @@ -993,7 +995,7 @@ typedef struct shader_s { qboolean isPortal; cullType_t cullType; // CT_FRONT_SIDED, CT_BACK_SIDED, or CT_TWO_SIDED - qboolean polygonOffset; // set for decals and other items that must be offset + qboolean polygonOffset; // set for decals and other items that must be offset qboolean noMipMaps; // for console fonts, 2D elements, etc. qboolean noPicMip; // for images that must always be full resolution qboolean noTC; // for images that don't want to be texture compressed (eg skies) @@ -1009,8 +1011,8 @@ typedef struct shader_s { int numSurfaceSpriteStages; GLuint spriteUbo; int ShaderInstanceUboOffset; - - shaderStage_t *stages[MAX_SHADER_STAGES]; + + shaderStage_t *stages[MAX_SHADER_STAGES]; void (*optimalStageIteratorFunc)( void ); qboolean isHDRLit; @@ -1198,7 +1200,7 @@ enum #else GENERICDEF_ALL = 0x007F, #endif // REND2_SP - + GENERICDEF_COUNT = GENERICDEF_ALL + 1, }; @@ -1260,7 +1262,7 @@ enum #else LIGHTDEF_ALL = 0x01FF, #endif // REND2_SP - + LIGHTDEF_COUNT = LIGHTDEF_ALL + 1 }; @@ -1791,7 +1793,7 @@ typedef struct srfBspSurface_s // static render data VBO_t *vbo; IBO_t *ibo; - + // SF_GRID specific variables after here // lod information, which may be different @@ -1884,7 +1886,7 @@ SHADOWS typedef struct pshadow_s { float sort; - + int numEntities; int entityNums[8]; vec3_t entityOrigins[8]; @@ -1953,7 +1955,7 @@ typedef struct mnode_s { // node specific cplane_t *plane; - struct mnode_s *children[2]; + struct mnode_s *children[2]; // leaf specific int cluster; @@ -1970,7 +1972,7 @@ typedef struct { int numSurfaces; } bmodel_t; -typedef struct +typedef struct { byte ambientLight[MAXLIGHTMAPS][3]; byte directLight[MAXLIGHTMAPS][3]; @@ -2195,7 +2197,7 @@ typedef struct model_s { void R_ModelInit (void); model_t *R_GetModelByHandle( qhandle_t hModel ); -int R_LerpTag( orientation_t *tag, qhandle_t handle, int startFrame, int endFrame, +int R_LerpTag( orientation_t *tag, qhandle_t handle, int startFrame, int endFrame, float frac, const char *tagName ); void R_ModelBounds( qhandle_t handle, vec3_t mins, vec3_t maxs ); @@ -2349,7 +2351,7 @@ typedef struct { int c_surfaces, c_shaders, c_vertexes, c_indexes, c_totalIndexes; int c_surfBatches; float c_overDraw; - + int c_vboVertexBuffers; int c_vboIndexBuffers; int c_vboVertexes; @@ -2403,7 +2405,7 @@ typedef struct { } backEndState_t; /* -** trGlobals_t +** trGlobals_t ** ** Most renderer globals are defined here. ** backend functions should never modify any of these fields, @@ -2573,7 +2575,7 @@ typedef struct trGlobals_s { viewParms_t viewParms; viewParms_t cachedViewParms[3 + MAX_DLIGHTS * 6 + 3 + MAX_DRAWN_PSHADOWS]; int numCachedViewParms; - + viewParms_t skyPortalParms; byte skyPortalAreaMask[MAX_MAP_AREA_BYTES]; int skyPortalEntities; @@ -2889,7 +2891,7 @@ void R_AddPolygonSurfaces( const trRefdef_t *refdef ); void R_DecomposeSort( uint32_t sort, int *entityNum, shader_t **shader, int *cubemap, int *postRender ); uint32_t R_CreateSortKey(int entityNum, int sortedShaderIndex, int cubemapIndex, int postRender); -void R_AddDrawSurf( surfaceType_t *surface, int entityNum, shader_t *shader, +void R_AddDrawSurf( surfaceType_t *surface, int entityNum, shader_t *shader, int fogIndex, int dlightMap, int postRender, int cubemap ); bool R_IsPostRenderEntity ( const trRefEntity_t *refEntity ); @@ -3057,7 +3059,7 @@ typedef struct stageVars #define MAX_MULTIDRAW_PRIMITIVES 16384 const int NUM_TESS_TEXCOORDS = 1 + MAXLIGHTMAPS; -struct shaderCommands_s +struct shaderCommands_s { glIndex_t indexes[SHADER_MAX_INDEXES] QALIGN(16); vec4_t xyz[SHADER_MAX_VERTEXES] QALIGN(16); @@ -3208,8 +3210,6 @@ CURVE TESSELATION ============================================================ */ -#define PATCH_STITCHING - srfBspSurface_t *R_SubdividePatchToGrid( int width, int height, srfVert_t points[MAX_PATCH_SIZE*MAX_PATCH_SIZE] ); srfBspSurface_t *R_GridInsertColumn( srfBspSurface_t *grid, int column, int row, vec3_t point, float loderror );