diff --git a/polymer/eduke32/build/include/polymer.h b/polymer/eduke32/build/include/polymer.h index b696a0c3f..6b68eac50 100644 --- a/polymer/eduke32/build/include/polymer.h +++ b/polymer/eduke32/build/include/polymer.h @@ -40,6 +40,7 @@ extern int32_t pr_shadowfiltering; extern int32_t pr_maxlightpasses; extern int32_t pr_maxlightpriority; extern int32_t pr_fov; +extern float pr_customaspect; extern int32_t pr_billboardingmode; extern int32_t pr_verbosity; extern int32_t pr_wireframe; diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index 8d7302a5b..3b2c970fe 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -17,6 +17,7 @@ int32_t pr_shadowfiltering = 1; int32_t pr_maxlightpasses = 10; int32_t pr_maxlightpriority = PR_MAXLIGHTPRIORITY; int32_t pr_fov = 426; // appears to be the classic setting. +float pr_customaspect = 0.0f; int32_t pr_billboardingmode = 1; int32_t pr_verbosity = 1; // 0: silent, 1: errors and one-times, 2: multiple-times, 3: flood int32_t pr_wireframe = 0; @@ -664,6 +665,8 @@ void polymer_uninit(void) void polymer_glinit(void) { + float aspect; + bglClearColor(0.0f, 0.0f, 0.0f, 1.0f); bglClearStencil(0); bglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); @@ -685,12 +688,15 @@ void polymer_glinit(void) else bglPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + if (pr_customaspect != 0.0f) + aspect = pr_customaspect; + else + aspect = (float)(windowx2-windowx1+1) / + (float)(windowy2-windowy1+1); + bglMatrixMode(GL_PROJECTION); bglLoadIdentity(); - bgluPerspective((float)(pr_fov) / (2048.0f / 360.0f), - (float)(windowx2-windowx1+1) / - (float)(windowy2-windowy1+1), - 0.01f, 100.0f); + bgluPerspective((float)(pr_fov) / (2048.0f / 360.0f), aspect, 0.01f, 100.0f); bglMatrixMode(GL_MODELVIEW); bglLoadIdentity(); diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 8f44dba9d..261bf2abd 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -5965,6 +5965,7 @@ void polymost_initosdfuncs(void) { "r_pr_maxlightpasses", "r_pr_maxlightpasses: the maximal amount of lights a single object can by affected by", (void*)&r_pr_maxlightpasses, CVAR_INT|CVAR_FUNCPTR, 0, 0, PR_MAXLIGHTS }, { "r_pr_maxlightpriority", "r_pr_maxlightpriority: lowering that value removes less meaningful lights from the scene", (void*)&pr_maxlightpriority, CVAR_INT, 0, 0, PR_MAXLIGHTPRIORITY }, { "r_pr_fov", "r_pr_fov: sets the field of vision in build angle", (void*)&pr_fov, CVAR_INT, 0, 0, 1023}, + { "r_pr_customaspect", "r_pr_customaspect: if non-zero, forces the 3D view aspect ratio", (void*)&pr_customaspect, CVAR_FLOAT, 0, 0, 3 }, { "r_pr_billboardingmode", "r_pr_billboardingmode: face sprite display method. 0: classic mode; 1: polymost mode", (void*)&pr_billboardingmode, CVAR_INT, 0, 0, 1 }, { "r_pr_verbosity", "r_pr_verbosity: verbosity level of the polymer renderer", (void*)&pr_verbosity, CVAR_INT, 0, 0, 3 }, { "r_pr_wireframe", "r_pr_wireframe: toggles wireframe mode", (void*)&pr_wireframe, CVAR_INT | CVAR_NOSAVE, 0, 0, 1 },