From 157273b493630cbb608c4e11eee26dead79f812a Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Fri, 10 May 2024 19:51:56 -0500 Subject: [PATCH] ioquake3 resync to commit 60dfabbe from f9547e45 opengl1: Fix skybox in OpenGL 1.1 Update SECURITY.md --- engine/Makefile | 2 +- engine/code/renderergl1/tr_sky.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/engine/Makefile b/engine/Makefile index 15bb612c..ff1e56a7 100644 --- a/engine/Makefile +++ b/engine/Makefile @@ -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 = f9547e45 +IOQ3_REVISION = 60dfabbe ############################################################################# # diff --git a/engine/code/renderergl1/tr_sky.c b/engine/code/renderergl1/tr_sky.c index 1d12e924..2f5f7786 100644 --- a/engine/code/renderergl1/tr_sky.c +++ b/engine/code/renderergl1/tr_sky.c @@ -387,12 +387,17 @@ static void DrawSkySide( struct image_s *image, const int mins[2], const int max static void DrawSkyBox( shader_t *shader ) { int i; + float w_offset, w_scale; + float h_offset, h_scale; sky_min = 0; sky_max = 1; Com_Memset( s_skyTexCoords, 0, sizeof( s_skyTexCoords ) ); + w_offset = h_offset = 0; + w_scale = h_scale = 1; + for (i=0 ; i<6 ; i++) { int sky_mins_subd[2], sky_maxs_subd[2]; @@ -432,6 +437,15 @@ static void DrawSkyBox( shader_t *shader ) else if ( sky_maxs_subd[1] > HALF_SKY_SUBDIVISIONS ) sky_maxs_subd[1] = HALF_SKY_SUBDIVISIONS; + if ( !haveClampToEdge ) + { + w_offset = 0.5f / shader->sky.outerbox[sky_texorder[i]]->width; + h_offset = 0.5f / shader->sky.outerbox[sky_texorder[i]]->height; + + w_scale = 1.0f - w_offset * 2; + h_scale = 1.0f - h_offset * 2; + } + // // iterate through the subdivisions // @@ -444,6 +458,12 @@ static void DrawSkyBox( shader_t *shader ) i, s_skyTexCoords[t][s], s_skyPoints[t][s] ); + + s_skyTexCoords[t][s][0] *= w_scale; + s_skyTexCoords[t][s][0] += w_offset; + + s_skyTexCoords[t][s][1] *= h_scale; + s_skyTexCoords[t][s][1] += h_offset; } }