summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/renderergl2/tr_backend.c6
-rw-r--r--src/renderergl2/tr_bsp.c2
-rw-r--r--src/renderergl2/tr_image.c2
-rw-r--r--src/renderergl2/tr_init.c2
-rw-r--r--src/renderergl2/tr_local.h3
5 files changed, 8 insertions, 7 deletions
diff --git a/src/renderergl2/tr_backend.c b/src/renderergl2/tr_backend.c
index 4a29c966..557f553b 100644
--- a/src/renderergl2/tr_backend.c
+++ b/src/renderergl2/tr_backend.c
@@ -1765,7 +1765,7 @@ const void *RB_ExportCubemaps(const void *data)
if (cmd)
{
FBO_t *oldFbo = glState.currentFBO;
- int sideSize = CUBE_MAP_SIZE * CUBE_MAP_SIZE * 4;
+ int sideSize = r_cubemapSize->integer * r_cubemapSize->integer * 4;
byte *cubemapPixels = ri.Malloc(sideSize * 6);
int i, j;
@@ -1780,12 +1780,12 @@ const void *RB_ExportCubemaps(const void *data)
for (j = 0; j < 6; j++)
{
qglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_CUBE_MAP_POSITIVE_X + j, cubemap->image->texnum, 0);
- qglReadPixels(0, 0, CUBE_MAP_SIZE, CUBE_MAP_SIZE, GL_RGBA, GL_UNSIGNED_BYTE, p);
+ qglReadPixels(0, 0, r_cubemapSize->integer, r_cubemapSize->integer, GL_RGBA, GL_UNSIGNED_BYTE, p);
p += sideSize;
}
Com_sprintf(filename, MAX_QPATH, "cubemaps/%s/%03d.dds", tr.world->baseName, i);
- R_SaveDDS(filename, cubemapPixels, CUBE_MAP_SIZE, CUBE_MAP_SIZE, 6);
+ R_SaveDDS(filename, cubemapPixels, r_cubemapSize->integer, r_cubemapSize->integer, 6);
ri.Printf(PRINT_ALL, "Saved cubemap %d as %s\n", i, filename);
}
diff --git a/src/renderergl2/tr_bsp.c b/src/renderergl2/tr_bsp.c
index 960e9282..e0a97d4d 100644
--- a/src/renderergl2/tr_bsp.c
+++ b/src/renderergl2/tr_bsp.c
@@ -3075,7 +3075,7 @@ void R_RenderAllCubemaps(void)
for (i = 0; i < tr.numCubemaps; i++)
{
- tr.cubemaps[i].image = R_CreateImage(va("*cubeMap%d", i), NULL, CUBE_MAP_SIZE, CUBE_MAP_SIZE, IMGTYPE_COLORALPHA, IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE | IMGFLAG_MIPMAP | IMGFLAG_CUBEMAP, GL_RGBA8);
+ tr.cubemaps[i].image = R_CreateImage(va("*cubeMap%d", i), NULL, r_cubemapSize->integer, r_cubemapSize->integer, IMGTYPE_COLORALPHA, IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE | IMGFLAG_MIPMAP | IMGFLAG_CUBEMAP, GL_RGBA8);
}
for (i = 0; i < tr.numCubemaps; i++)
diff --git a/src/renderergl2/tr_image.c b/src/renderergl2/tr_image.c
index 74eddfe0..d01f42c4 100644
--- a/src/renderergl2/tr_image.c
+++ b/src/renderergl2/tr_image.c
@@ -2842,7 +2842,7 @@ void R_CreateBuiltinImages( void ) {
if (r_cubeMapping->integer)
{
- tr.renderCubeImage = R_CreateImage("*renderCube", NULL, CUBE_MAP_SIZE, CUBE_MAP_SIZE, IMGTYPE_COLORALPHA, IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE | IMGFLAG_MIPMAP | IMGFLAG_CUBEMAP, rgbFormat);
+ tr.renderCubeImage = R_CreateImage("*renderCube", NULL, r_cubemapSize->integer, r_cubemapSize->integer, IMGTYPE_COLORALPHA, IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE | IMGFLAG_MIPMAP | IMGFLAG_CUBEMAP, rgbFormat);
}
}
}
diff --git a/src/renderergl2/tr_init.c b/src/renderergl2/tr_init.c
index 8a84c1f8..bf05e210 100644
--- a/src/renderergl2/tr_init.c
+++ b/src/renderergl2/tr_init.c
@@ -141,6 +141,7 @@ cvar_t *r_specularMapping;
cvar_t *r_deluxeMapping;
cvar_t *r_parallaxMapping;
cvar_t *r_cubeMapping;
+cvar_t *r_cubemapSize;
cvar_t *r_specularIsMetallic;
cvar_t *r_glossIsRoughness;
cvar_t *r_baseNormalX;
@@ -1171,6 +1172,7 @@ void R_Register( void )
r_deluxeMapping = ri.Cvar_Get( "r_deluxeMapping", "1", CVAR_ARCHIVE | CVAR_LATCH );
r_parallaxMapping = ri.Cvar_Get( "r_parallaxMapping", "0", CVAR_ARCHIVE | CVAR_LATCH );
r_cubeMapping = ri.Cvar_Get( "r_cubeMapping", "0", CVAR_ARCHIVE | CVAR_LATCH );
+ r_cubemapSize = ri.Cvar_Get( "r_cubemapSize", "128", CVAR_ARCHIVE | CVAR_LATCH );
r_specularIsMetallic = ri.Cvar_Get( "r_specularIsMetallic", "0", CVAR_ARCHIVE | CVAR_LATCH );
r_glossIsRoughness = ri.Cvar_Get("r_glossIsRoughness", "0", CVAR_ARCHIVE | CVAR_LATCH);
r_baseNormalX = ri.Cvar_Get( "r_baseNormalX", "1.0", CVAR_ARCHIVE | CVAR_LATCH );
diff --git a/src/renderergl2/tr_local.h b/src/renderergl2/tr_local.h
index a652a396..72f11989 100644
--- a/src/renderergl2/tr_local.h
+++ b/src/renderergl2/tr_local.h
@@ -55,8 +55,6 @@ typedef unsigned int glIndex_t;
#define MAX_CALC_PSHADOWS 64
#define MAX_DRAWN_PSHADOWS 16 // do not increase past 32, because bit flags are used on surfaces
#define PSHADOW_MAP_SIZE 512
-#define CUBE_MAP_MIPS 7
-#define CUBE_MAP_SIZE (1 << CUBE_MAP_MIPS)
#define USE_VERT_TANGENT_SPACE
#define USE_OVERBRIGHT
@@ -1794,6 +1792,7 @@ extern cvar_t *r_specularMapping;
extern cvar_t *r_deluxeMapping;
extern cvar_t *r_parallaxMapping;
extern cvar_t *r_cubeMapping;
+extern cvar_t *r_cubemapSize;
extern cvar_t *r_specularIsMetallic;
extern cvar_t *r_glossIsRoughness;
extern cvar_t *r_baseNormalX;