- set proper visibility factor and viewport.

This commit is contained in:
Christoph Oelckers 2021-03-17 19:07:00 +01:00
parent b492cbcebb
commit 65097c4098
2 changed files with 4 additions and 2 deletions

View file

@ -270,7 +270,8 @@ static void polymost_updaterotmat(void)
}; };
multiplyMatrix4f(matrix, tiltmatrix); multiplyMatrix4f(matrix, tiltmatrix);
renderSetViewMatrix(matrix); renderSetViewMatrix(matrix);
renderSetVisibility(MulScale(g_visibility, MulScale(xdimenscale, viewingrangerecip, 16), 16) * fviewingrange * (1.f / (65536.f * 65536.f)) / r_ambientlight); float fxdimen = FixedToFloat(xdimenscale);
renderSetVisibility(g_visibility * fxdimen * (1.f / (65536.f)) / r_ambientlight);
} }
const vec2_16_t tileSize(size_t index) const vec2_16_t tileSize(size_t index)

View file

@ -661,11 +661,12 @@ void render_drawrooms(vec3_t& position, int sectnum, fixed_t q16angle, fixed_t q
rotation.Yaw = -90.f + q16ang(q16angle).asdeg(); rotation.Yaw = -90.f + q16ang(q16angle).asdeg();
rotation.Pitch = -HorizToPitch(q16horizon); rotation.Pitch = -HorizToPitch(q16horizon);
rotation.Roll = rollang; rotation.Roll = rollang;
GLInterface.SetViewport(windowxy1.x, windowxy1.y, windowxy2.x - windowxy1.x + 1, windowxy2.y - windowxy1.y + 1);
SetProjection(rotation, fov); SetProjection(rotation, fov);
SetViewMatrix(rotation, position.x / 16.f, -position.y / 16.f, -position.z / 256.f, mirror, planemirror); SetViewMatrix(rotation, position.x / 16.f, -position.y / 16.f, -position.z / 256.f, mirror, planemirror);
renderSetViewpoint(position.x / 16.f, -position.y / 16.f, -position.z / 256.f); renderSetViewpoint(position.x / 16.f, -position.y / 16.f, -position.z / 256.f);
renderSetVisibility((1.f / (65536.f * 65536.f)) * g_visibility / r_ambientlight);// MulScale(g_visibility, MulScale(xdimenscale * viewingrangerecip * fviewingrange / r_ambientlight); renderSetVisibility((2 / 65536.f) * g_visibility / r_ambientlight); // (2 / 65536.f) is a magic factor to produce the same brightness as Polymost.
renderBeginScene(); renderBeginScene();
Clipper clipper; Clipper clipper;