mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-13 07:58:04 +00:00
Fox's projection patch 2.0
git-svn-id: https://svn.eduke32.com/eduke32@6496 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
7033d83d26
commit
9d0e76b2e3
1 changed files with 7 additions and 5 deletions
|
@ -522,10 +522,10 @@ static float get_projhack_ratio(void)
|
||||||
{
|
{
|
||||||
if (glprojectionhacks)
|
if (glprojectionhacks)
|
||||||
{
|
{
|
||||||
static constexpr float const projhack_zoom = 1.3f;
|
// tangent of ((angle of 4 by 3) + (angle of 128 by 199)) / tangent of 90
|
||||||
static constexpr float const maxcoshoriz = 0.540971179375801f; // 128/sqrt(128^2+199^2) = cos of an horiz diff of 199
|
static constexpr float const projhack_constant = 1.166015625f;
|
||||||
static constexpr float const factor = (projhack_zoom - 1.f) * (1.f / maxcoshoriz);
|
float const projhack = 65536.f / fviewingrange;
|
||||||
return 1.f + (factor * (1.f - Bfabsf(gchang)));
|
return projhack_constant > projhack ? projhack_constant : projhack;
|
||||||
}
|
}
|
||||||
|
|
||||||
// No projection hacks (legacy or new-aspect)
|
// No projection hacks (legacy or new-aspect)
|
||||||
|
@ -565,8 +565,10 @@ static void resizeglcheck(void)
|
||||||
const int32_t ourxdimen = (windowxy2.x-windowxy1.x+1);
|
const int32_t ourxdimen = (windowxy2.x-windowxy1.x+1);
|
||||||
float ratio = get_projhack_ratio();
|
float ratio = get_projhack_ratio();
|
||||||
const int32_t fovcorrect = (int32_t)(ourxdimen*ratio - ourxdimen);
|
const int32_t fovcorrect = (int32_t)(ourxdimen*ratio - ourxdimen);
|
||||||
|
viewingrange = Blrintf(fviewingrange *= ratio);
|
||||||
|
float const halfydimen = fydimen * 0.5f;
|
||||||
ratio = 1.f/ratio;
|
ratio = 1.f/ratio;
|
||||||
|
globalhoriz = ((globalhoriz - halfydimen) * ratio) + halfydimen;
|
||||||
|
|
||||||
glox1 = (float)windowxy1.x; gloy1 = (float)windowxy1.y;
|
glox1 = (float)windowxy1.x; gloy1 = (float)windowxy1.y;
|
||||||
glox2 = (float)windowxy2.x; gloy2 = (float)windowxy2.y;
|
glox2 = (float)windowxy2.x; gloy2 = (float)windowxy2.y;
|
||||||
|
|
Loading…
Reference in a new issue