mirror of
https://github.com/Q3Rally-Team/q3rally.git
synced 2024-11-21 19:41:36 +00:00
ioquake3 resync to commit f9547e45 from 93abc60a
OpenGL2: Fix sun rays being affected by the viewport size OpenGL2: Fix merged lightmap hacks to have real lightmap index OpenGL2: Fix using merged lightmaps with tcGen environment OpenGL2: Fix hack for tcMod transform on merged lightmaps OpenGL2: Fix flares behind mirror being visible Fix running on Windows XP Fix GitHub Actions CI deprecation warnings OpenGL2: Don't mix drawing to default framebuffer and FBO
This commit is contained in:
parent
d8dcb28d04
commit
6f62f2806a
11 changed files with 131 additions and 75 deletions
12
.github/workflows/build.yml
vendored
12
.github/workflows/build.yml
vendored
|
@ -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
|
||||
|
@ -15,7 +15,7 @@ jobs:
|
|||
run: make release -C engine
|
||||
env:
|
||||
ARCHIVE: 1
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Linux
|
||||
path: engine/build/*.zip
|
||||
|
@ -23,14 +23,14 @@ jobs:
|
|||
name: Windows
|
||||
runs-on: windows-2019
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: Compile
|
||||
run: |
|
||||
choco install zip
|
||||
make release -C engine
|
||||
env:
|
||||
ARCHIVE: 1
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Windows
|
||||
path: engine/build/*.zip
|
||||
|
@ -38,12 +38,12 @@ jobs:
|
|||
name: macOS
|
||||
runs-on: macos-11
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: Compile
|
||||
run: make release -C engine
|
||||
env:
|
||||
ARCHIVE: 1
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: macOS
|
||||
path: engine/build/*.zip
|
||||
|
|
|
@ -48,7 +48,7 @@ ifndef BUILD_AUTOUPDATER # DON'T build unless you mean to!
|
|||
endif
|
||||
|
||||
# ioquake3 git commit that this is based on
|
||||
IOQ3_REVISION = 93abc60a
|
||||
IOQ3_REVISION = f9547e45
|
||||
|
||||
#############################################################################
|
||||
#
|
||||
|
|
|
@ -342,7 +342,7 @@ void RB_BeginDrawingView (void) {
|
|||
{
|
||||
FBO_t *fbo = backEnd.viewParms.targetFbo;
|
||||
|
||||
if (fbo == NULL && (!r_postProcess->integer || !(backEnd.refdef.rdflags & RDF_NOWORLDMODEL)))
|
||||
if (fbo == NULL)
|
||||
fbo = tr.renderFbo;
|
||||
|
||||
if (tr.renderCubeFbo && fbo == tr.renderCubeFbo)
|
||||
|
@ -455,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
|
||||
|
@ -484,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;
|
||||
|
||||
//
|
||||
|
@ -708,7 +708,7 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *
|
|||
|
||||
if (glRefConfig.framebufferObject)
|
||||
{
|
||||
FBO_Bind(r_postProcess->integer ? NULL : tr.renderFbo);
|
||||
FBO_Bind(tr.renderFbo);
|
||||
}
|
||||
|
||||
RB_SetGL2D();
|
||||
|
@ -793,7 +793,7 @@ const void *RB_StretchPic ( const void *data ) {
|
|||
cmd = (const stretchPicCommand_t *)data;
|
||||
|
||||
if (glRefConfig.framebufferObject)
|
||||
FBO_Bind(r_postProcess->integer ? NULL : tr.renderFbo);
|
||||
FBO_Bind(tr.renderFbo);
|
||||
|
||||
RB_SetGL2D();
|
||||
|
||||
|
@ -1202,16 +1202,13 @@ const void *RB_DrawBuffer( const void *data ) {
|
|||
|
||||
// clear screen for debugging
|
||||
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);
|
||||
}
|
||||
|
@ -1380,8 +1377,6 @@ const void *RB_SwapBuffers( const void *data ) {
|
|||
}
|
||||
|
||||
if (glRefConfig.framebufferObject)
|
||||
{
|
||||
if (!r_postProcess->integer)
|
||||
{
|
||||
if (tr.msaaResolveFbo && r_hdr->integer)
|
||||
{
|
||||
|
@ -1394,7 +1389,6 @@ const void *RB_SwapBuffers( const void *data ) {
|
|||
FBO_FastBlit(tr.renderFbo, NULL, NULL, NULL, GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !glState.finishCalled ) {
|
||||
qglFinish();
|
||||
|
@ -1454,7 +1448,7 @@ RB_PostProcess
|
|||
const void *RB_PostProcess(const void *data)
|
||||
{
|
||||
const postProcessCommand_t *cmd = data;
|
||||
FBO_t *srcFbo;
|
||||
FBO_t *srcFbo, *dstFbo;
|
||||
ivec4_t srcBox, dstBox;
|
||||
qboolean autoExposure;
|
||||
|
||||
|
@ -1475,6 +1469,8 @@ const void *RB_PostProcess(const void *data)
|
|||
}
|
||||
|
||||
srcFbo = tr.renderFbo;
|
||||
dstFbo = tr.renderFbo;
|
||||
|
||||
if (tr.msaaResolveFbo)
|
||||
{
|
||||
// Resolve the MSAA before anything else
|
||||
|
@ -1508,13 +1504,13 @@ const void *RB_PostProcess(const void *data)
|
|||
if (r_hdr->integer && (r_toneMap->integer || r_forceToneMap->integer))
|
||||
{
|
||||
autoExposure = r_autoExposure->integer || r_forceAutoExposure->integer;
|
||||
RB_ToneMap(srcFbo, srcBox, NULL, dstBox, autoExposure);
|
||||
|
||||
// Use an intermediate FBO because it can't blit to the same FBO directly
|
||||
// and can't read from an MSAA dstFbo later.
|
||||
RB_ToneMap(srcFbo, srcBox, tr.screenScratchFbo, srcBox, autoExposure);
|
||||
FBO_FastBlit(tr.screenScratchFbo, srcBox, srcFbo, srcBox, GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
}
|
||||
else if (r_cameraExposure->value == 0.0f)
|
||||
{
|
||||
FBO_FastBlit(srcFbo, srcBox, NULL, dstBox, GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
}
|
||||
else
|
||||
else if (r_cameraExposure->value != 0.0f)
|
||||
{
|
||||
vec4_t color;
|
||||
|
||||
|
@ -1523,17 +1519,20 @@ const void *RB_PostProcess(const void *data)
|
|||
color[2] = pow(2, r_cameraExposure->value); //exp2(r_cameraExposure->value);
|
||||
color[3] = 1.0f;
|
||||
|
||||
FBO_Blit(srcFbo, srcBox, NULL, NULL, dstBox, NULL, color, 0);
|
||||
FBO_BlitFromTexture(tr.whiteImage, NULL, NULL, srcFbo, srcBox, NULL, color, GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ZERO);
|
||||
}
|
||||
}
|
||||
|
||||
if (r_drawSunRays->integer)
|
||||
RB_SunRays(NULL, srcBox, NULL, dstBox);
|
||||
RB_SunRays(srcFbo, srcBox, srcFbo, srcBox);
|
||||
|
||||
if (1)
|
||||
RB_BokehBlur(NULL, srcBox, NULL, dstBox, backEnd.refdef.blurFactor);
|
||||
RB_BokehBlur(srcFbo, srcBox, srcFbo, srcBox, backEnd.refdef.blurFactor);
|
||||
else
|
||||
RB_GaussianBlur(backEnd.refdef.blurFactor);
|
||||
RB_GaussianBlur(srcFbo, srcFbo, backEnd.refdef.blurFactor);
|
||||
|
||||
if (srcFbo != dstFbo)
|
||||
FBO_FastBlit(srcFbo, srcBox, dstFbo, dstBox, GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
|
||||
#if 0
|
||||
if (0)
|
||||
|
@ -1549,7 +1548,7 @@ const void *RB_PostProcess(const void *data)
|
|||
if (scale < 0.01f)
|
||||
scale = 5.0f;
|
||||
|
||||
FBO_FastBlit(NULL, NULL, tr.quarterFbo[0], NULL, GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
FBO_FastBlit(dstFbo, NULL, tr.quarterFbo[0], NULL, GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
|
||||
iQtrBox[0] = backEnd.viewParms.viewportX * tr.quarterImage[0]->width / (float)glConfig.vidWidth;
|
||||
iQtrBox[1] = backEnd.viewParms.viewportY * tr.quarterImage[0]->height / (float)glConfig.vidHeight;
|
||||
|
@ -1595,7 +1594,7 @@ const void *RB_PostProcess(const void *data)
|
|||
|
||||
SetViewportAndScissor();
|
||||
|
||||
FBO_FastBlit(tr.quarterFbo[1], NULL, NULL, NULL, GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
FBO_FastBlit(tr.quarterFbo[1], NULL, dstFbo, NULL, GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
FBO_Bind(NULL);
|
||||
}
|
||||
#endif
|
||||
|
@ -1604,42 +1603,42 @@ const void *RB_PostProcess(const void *data)
|
|||
{
|
||||
ivec4_t dstBox;
|
||||
VectorSet4(dstBox, 0, glConfig.vidHeight - 128, 128, 128);
|
||||
FBO_BlitFromTexture(tr.sunShadowDepthImage[0], NULL, NULL, NULL, dstBox, NULL, NULL, 0);
|
||||
FBO_BlitFromTexture(tr.sunShadowDepthImage[0], NULL, NULL, dstFbo, dstBox, NULL, NULL, 0);
|
||||
VectorSet4(dstBox, 128, glConfig.vidHeight - 128, 128, 128);
|
||||
FBO_BlitFromTexture(tr.sunShadowDepthImage[1], NULL, NULL, NULL, dstBox, NULL, NULL, 0);
|
||||
FBO_BlitFromTexture(tr.sunShadowDepthImage[1], NULL, NULL, dstFbo, dstBox, NULL, NULL, 0);
|
||||
VectorSet4(dstBox, 256, glConfig.vidHeight - 128, 128, 128);
|
||||
FBO_BlitFromTexture(tr.sunShadowDepthImage[2], NULL, NULL, NULL, dstBox, NULL, NULL, 0);
|
||||
FBO_BlitFromTexture(tr.sunShadowDepthImage[2], NULL, NULL, dstFbo, dstBox, NULL, NULL, 0);
|
||||
VectorSet4(dstBox, 384, glConfig.vidHeight - 128, 128, 128);
|
||||
FBO_BlitFromTexture(tr.sunShadowDepthImage[3], NULL, NULL, NULL, dstBox, NULL, NULL, 0);
|
||||
FBO_BlitFromTexture(tr.sunShadowDepthImage[3], NULL, NULL, dstFbo, dstBox, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
if (0 && r_shadows->integer == 4)
|
||||
{
|
||||
ivec4_t dstBox;
|
||||
VectorSet4(dstBox, 512 + 0, glConfig.vidHeight - 128, 128, 128);
|
||||
FBO_BlitFromTexture(tr.pshadowMaps[0], NULL, NULL, NULL, dstBox, NULL, NULL, 0);
|
||||
FBO_BlitFromTexture(tr.pshadowMaps[0], NULL, NULL, dstFbo, dstBox, NULL, NULL, 0);
|
||||
VectorSet4(dstBox, 512 + 128, glConfig.vidHeight - 128, 128, 128);
|
||||
FBO_BlitFromTexture(tr.pshadowMaps[1], NULL, NULL, NULL, dstBox, NULL, NULL, 0);
|
||||
FBO_BlitFromTexture(tr.pshadowMaps[1], NULL, NULL, dstFbo, dstBox, NULL, NULL, 0);
|
||||
VectorSet4(dstBox, 512 + 256, glConfig.vidHeight - 128, 128, 128);
|
||||
FBO_BlitFromTexture(tr.pshadowMaps[2], NULL, NULL, NULL, dstBox, NULL, NULL, 0);
|
||||
FBO_BlitFromTexture(tr.pshadowMaps[2], NULL, NULL, dstFbo, dstBox, NULL, NULL, 0);
|
||||
VectorSet4(dstBox, 512 + 384, glConfig.vidHeight - 128, 128, 128);
|
||||
FBO_BlitFromTexture(tr.pshadowMaps[3], NULL, NULL, NULL, dstBox, NULL, NULL, 0);
|
||||
FBO_BlitFromTexture(tr.pshadowMaps[3], NULL, NULL, dstFbo, dstBox, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
if (0)
|
||||
{
|
||||
ivec4_t dstBox;
|
||||
VectorSet4(dstBox, 256, glConfig.vidHeight - 256, 256, 256);
|
||||
FBO_BlitFromTexture(tr.renderDepthImage, NULL, NULL, NULL, dstBox, NULL, NULL, 0);
|
||||
FBO_BlitFromTexture(tr.renderDepthImage, NULL, NULL, dstFbo, dstBox, NULL, NULL, 0);
|
||||
VectorSet4(dstBox, 512, glConfig.vidHeight - 256, 256, 256);
|
||||
FBO_BlitFromTexture(tr.screenShadowImage, NULL, NULL, NULL, dstBox, NULL, NULL, 0);
|
||||
FBO_BlitFromTexture(tr.screenShadowImage, NULL, NULL, dstFbo, dstBox, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
if (0)
|
||||
{
|
||||
ivec4_t dstBox;
|
||||
VectorSet4(dstBox, 256, glConfig.vidHeight - 256, 256, 256);
|
||||
FBO_BlitFromTexture(tr.sunRaysImage, NULL, NULL, NULL, dstBox, NULL, NULL, 0);
|
||||
FBO_BlitFromTexture(tr.sunRaysImage, NULL, NULL, dstFbo, dstBox, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -1651,8 +1650,8 @@ const void *RB_PostProcess(const void *data)
|
|||
if (cubemapIndex)
|
||||
{
|
||||
VectorSet4(dstBox, 0, glConfig.vidHeight - 256, 256, 256);
|
||||
//FBO_BlitFromTexture(tr.renderCubeImage, NULL, NULL, NULL, dstBox, &tr.testcubeShader, NULL, 0);
|
||||
FBO_BlitFromTexture(tr.cubemaps[cubemapIndex - 1].image, NULL, NULL, NULL, dstBox, &tr.testcubeShader, NULL, 0);
|
||||
//FBO_BlitFromTexture(tr.renderCubeImage, NULL, NULL, dstFbo, dstBox, &tr.testcubeShader, NULL, 0);
|
||||
FBO_BlitFromTexture(tr.cubemaps[cubemapIndex - 1].image, NULL, NULL, dstFbo, dstBox, &tr.testcubeShader, NULL, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -617,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 ) {
|
||||
|
@ -706,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;
|
||||
}
|
||||
|
@ -813,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;
|
||||
}
|
||||
|
|
|
@ -648,10 +648,30 @@ void FBO_FastBlit(FBO_t *src, ivec4_t srcBox, FBO_t *dst, ivec4_t dstBox, int bu
|
|||
int width = dst ? dst->width : glConfig.vidWidth;
|
||||
int height = dst ? dst->height : glConfig.vidHeight;
|
||||
|
||||
qglScissor(0, 0, width, height);
|
||||
|
||||
VectorSet4(dstBoxFinal, 0, 0, width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
ivec4_t scissorBox;
|
||||
|
||||
Vector4Copy(dstBox, scissorBox);
|
||||
|
||||
if (scissorBox[2] < 0)
|
||||
{
|
||||
scissorBox[0] += scissorBox[2];
|
||||
scissorBox[2] = fabsf(scissorBox[2]);
|
||||
}
|
||||
|
||||
if (scissorBox[3] < 0)
|
||||
{
|
||||
scissorBox[1] += scissorBox[3];
|
||||
scissorBox[3] = fabsf(scissorBox[3]);
|
||||
}
|
||||
|
||||
qglScissor(scissorBox[0], scissorBox[1], scissorBox[2], scissorBox[3]);
|
||||
|
||||
VectorSet4(dstBoxFinal, dstBox[0], dstBox[1], dstBox[0] + dstBox[2], dstBox[1] + dstBox[3]);
|
||||
}
|
||||
|
||||
|
|
|
@ -2766,7 +2766,7 @@ void R_CreateBuiltinImages( void ) {
|
|||
|
||||
tr.renderImage = R_CreateImage("_render", NULL, width, height, IMGTYPE_COLORALPHA, IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE, hdrFormat);
|
||||
|
||||
if (r_shadowBlur->integer)
|
||||
if (r_shadowBlur->integer || r_hdr->integer)
|
||||
tr.screenScratchImage = R_CreateImage("screenScratch", NULL, width, height, IMGTYPE_COLORALPHA, IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE, rgbFormat);
|
||||
|
||||
if (r_shadowBlur->integer || r_ssao->integer)
|
||||
|
|
|
@ -1995,6 +1995,7 @@ const void *RB_TakeVideoFrameCmd( const void *data );
|
|||
// tr_shader.c
|
||||
//
|
||||
shader_t *R_FindShader( const char *name, int lightmapIndex, qboolean mipRawImage );
|
||||
shader_t *R_FindShaderEx( const char *name, int lightmapIndex, qboolean mipRawImage, int realLightmapIndex );
|
||||
shader_t *R_GetShaderByHandle( qhandle_t hShader );
|
||||
shader_t *R_GetShaderByState( int index, long *cycleTime );
|
||||
shader_t *R_FindShaderByName( const char *name );
|
||||
|
|
|
@ -447,7 +447,7 @@ static void RB_VBlur(FBO_t *srcFbo, FBO_t *dstFbo, float strength)
|
|||
RB_BlurAxis(srcFbo, dstFbo, strength, qfalse);
|
||||
}
|
||||
|
||||
void RB_GaussianBlur(float blur)
|
||||
void RB_GaussianBlur(FBO_t *srcFbo, FBO_t *dstFbo, float blur)
|
||||
{
|
||||
//float mul = 1.f;
|
||||
float factor = Com_Clamp(0.f, 1.f, blur);
|
||||
|
@ -462,7 +462,7 @@ void RB_GaussianBlur(float blur)
|
|||
VectorSet4(color, 1, 1, 1, 1);
|
||||
|
||||
// first, downsample the framebuffer
|
||||
FBO_FastBlit(NULL, NULL, tr.quarterFbo[0], NULL, GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
FBO_FastBlit(srcFbo, NULL, tr.quarterFbo[0], NULL, GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
FBO_FastBlit(tr.quarterFbo[0], NULL, tr.textureScratchFbo[0], NULL, GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
|
||||
// set the alpha channel
|
||||
|
@ -478,6 +478,6 @@ void RB_GaussianBlur(float blur)
|
|||
VectorSet4(srcBox, 0, 0, tr.textureScratchFbo[0]->width, tr.textureScratchFbo[0]->height);
|
||||
VectorSet4(dstBox, 0, 0, glConfig.vidWidth, glConfig.vidHeight);
|
||||
color[3] = factor;
|
||||
FBO_Blit(tr.textureScratchFbo[0], srcBox, NULL, NULL, dstBox, NULL, color, GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA);
|
||||
FBO_Blit(tr.textureScratchFbo[0], srcBox, NULL, dstFbo, dstBox, NULL, color, GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
void RB_ToneMap(FBO_t *hdrFbo, ivec4_t hdrBox, FBO_t *ldrFbo, ivec4_t ldrBox, int autoExposure);
|
||||
void RB_BokehBlur(FBO_t *src, ivec4_t srcBox, FBO_t *dst, ivec4_t dstBox, float blur);
|
||||
void RB_SunRays(FBO_t *srcFbo, ivec4_t srcBox, FBO_t *dstFbo, ivec4_t dstBox);
|
||||
void RB_GaussianBlur(float blur);
|
||||
void RB_GaussianBlur(FBO_t *srcFbo, FBO_t *dstFbo, float blur);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,6 +30,7 @@ static char *s_shaderText;
|
|||
static shaderStage_t stages[MAX_SHADER_STAGES];
|
||||
static shader_t shader;
|
||||
static texModInfo_t texMods[MAX_SHADER_STAGES][TR_MAX_TEXMODS];
|
||||
static int shader_realLightmapIndex;
|
||||
|
||||
#define FILE_HASH_SIZE 1024
|
||||
static shader_t* hashTable[FILE_HASH_SIZE];
|
||||
|
@ -2929,7 +2930,7 @@ static void FixFatLightmapTexCoords(void)
|
|||
return;
|
||||
}
|
||||
|
||||
lightmapnum = shader.lightmapIndex;
|
||||
lightmapnum = shader_realLightmapIndex;
|
||||
|
||||
if (tr.worldDeluxeMapping)
|
||||
lightmapnum >>= 1;
|
||||
|
@ -2943,8 +2944,9 @@ static void FixFatLightmapTexCoords(void)
|
|||
break;
|
||||
}
|
||||
|
||||
// fix tcMod transform for internal lightmaps, it may be used by q3map2 lightstyles
|
||||
if ( pStage->bundle[0].isLightmap ) {
|
||||
// fix tcMod transform for internal lightmaps, it may be used by q3map2 lightstyles
|
||||
if ( pStage->bundle[0].tcGen == TCGEN_LIGHTMAP ) {
|
||||
for ( i = 0; i < pStage->bundle[0].numTexMods; i++ ) {
|
||||
tmi = &pStage->bundle[0].texMods[i];
|
||||
|
||||
|
@ -2954,10 +2956,32 @@ static void FixFatLightmapTexCoords(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fix tcGen environment for internal lightmaps to be limited to the sub-image of the atlas
|
||||
// this is done last so other tcMods are applied first in the 0.0 to 1.0 space
|
||||
if ( pStage->bundle[0].tcGen == TCGEN_ENVIRONMENT_MAPPED ) {
|
||||
if ( pStage->bundle[0].numTexMods == TR_MAX_TEXMODS ) {
|
||||
ri.Printf( PRINT_DEVELOPER, "WARNING: too many tcmods to fix lightmap texcoords for r_mergeLightmaps in shader '%s'", shader.name );
|
||||
} else {
|
||||
tmi = &pStage->bundle[0].texMods[pStage->bundle[0].numTexMods];
|
||||
pStage->bundle[0].numTexMods++;
|
||||
|
||||
tmi->matrix[0][0] = 1.0f / tr.fatLightmapCols;
|
||||
tmi->matrix[0][1] = 0;
|
||||
tmi->matrix[1][0] = 0;
|
||||
tmi->matrix[1][1] = 1.0f / tr.fatLightmapRows;
|
||||
|
||||
tmi->translate[0] = ( lightmapnum % tr.fatLightmapCols ) / (float)tr.fatLightmapCols;
|
||||
tmi->translate[1] = ( lightmapnum / tr.fatLightmapCols ) / (float)tr.fatLightmapRows;
|
||||
|
||||
tmi->type = TMOD_TRANSFORM;
|
||||
}
|
||||
}
|
||||
}
|
||||
// add a tcMod transform for external lightmaps to convert back to the original texcoords
|
||||
else if ( pStage->bundle[0].tcGen == TCGEN_LIGHTMAP ) {
|
||||
if ( pStage->bundle[0].numTexMods == TR_MAX_TEXMODS ) {
|
||||
ri.Printf( PRINT_DEVELOPER, "WARNING: too many tcmods to fix external lightmap texcoords for r_mergeLightmaps in shader '%s'", shader.name );
|
||||
ri.Printf( PRINT_DEVELOPER, "WARNING: too many tcmods to fix lightmap texcoords for r_mergeLightmaps in shader '%s'", shader.name );
|
||||
} else {
|
||||
size = pStage->bundle[0].numTexMods * sizeof( texModInfo_t );
|
||||
|
||||
|
@ -2973,8 +2997,8 @@ static void FixFatLightmapTexCoords(void)
|
|||
tmi->matrix[1][0] = 0;
|
||||
tmi->matrix[1][1] = tr.fatLightmapRows;
|
||||
|
||||
tmi->translate[0] = -(lightmapnum % tr.fatLightmapCols);
|
||||
tmi->translate[1] = -(lightmapnum / tr.fatLightmapCols);
|
||||
tmi->translate[0] = -( lightmapnum % tr.fatLightmapCols );
|
||||
tmi->translate[1] = -( lightmapnum / tr.fatLightmapCols );
|
||||
|
||||
tmi->type = TMOD_TRANSFORM;
|
||||
}
|
||||
|
@ -2987,7 +3011,7 @@ static void FixFatLightmapTexCoords(void)
|
|||
InitShader
|
||||
===============
|
||||
*/
|
||||
static void InitShader( const char *name, int lightmapIndex ) {
|
||||
static void InitShaderEx( const char *name, int lightmapIndex, int realLightmapIndex ) {
|
||||
int i;
|
||||
|
||||
// clear the global shader
|
||||
|
@ -2996,6 +3020,7 @@ static void InitShader( const char *name, int lightmapIndex ) {
|
|||
|
||||
Q_strncpyz( shader.name, name, sizeof( shader.name ) );
|
||||
shader.lightmapIndex = lightmapIndex;
|
||||
shader_realLightmapIndex = realLightmapIndex;
|
||||
|
||||
for ( i = 0 ; i < MAX_SHADER_STAGES ; i++ ) {
|
||||
stages[i].bundle[0].texMods = texMods[i];
|
||||
|
@ -3016,6 +3041,10 @@ static void InitShader( const char *name, int lightmapIndex ) {
|
|||
}
|
||||
}
|
||||
|
||||
static void InitShader( const char *name, int lightmapIndex ) {
|
||||
InitShaderEx( name, lightmapIndex, lightmapIndex );
|
||||
}
|
||||
|
||||
/*
|
||||
=========================
|
||||
FinishShader
|
||||
|
@ -3337,6 +3366,10 @@ most world construction surfaces.
|
|||
===============
|
||||
*/
|
||||
shader_t *R_FindShader( const char *name, int lightmapIndex, qboolean mipRawImage ) {
|
||||
return R_FindShaderEx( name, lightmapIndex, mipRawImage, lightmapIndex );
|
||||
}
|
||||
|
||||
shader_t *R_FindShaderEx( const char *name, int lightmapIndex, qboolean mipRawImage, int realLightmapIndex ) {
|
||||
char strippedName[MAX_QPATH];
|
||||
int hash;
|
||||
char *shaderText;
|
||||
|
@ -3376,7 +3409,7 @@ shader_t *R_FindShader( const char *name, int lightmapIndex, qboolean mipRawImag
|
|||
}
|
||||
}
|
||||
|
||||
InitShader( strippedName, lightmapIndex );
|
||||
InitShaderEx( strippedName, lightmapIndex, realLightmapIndex );
|
||||
|
||||
//
|
||||
// attempt to define shader from an explicit parameter file
|
||||
|
|
|
@ -20,6 +20,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
===========================================================================
|
||||
*/
|
||||
|
||||
// Use EnumProcesses() with Windows XP compatibility
|
||||
#define PSAPI_VERSION 1
|
||||
|
||||
#include "../qcommon/q_shared.h"
|
||||
#include "../qcommon/qcommon.h"
|
||||
#include "sys_local.h"
|
||||
|
|
Loading…
Reference in a new issue