- fixed: light mode from mapinfo had no effect

https://forum.zdoom.org/viewtopic.php?t=64997
This commit is contained in:
alexey.lysiuk 2019-06-12 09:49:40 +03:00
parent b6ada166fc
commit 7e901055ea
3 changed files with 8 additions and 5 deletions

View file

@ -78,7 +78,7 @@ void HWViewpointBuffer::Set2D(FRenderState &di, int width, int height)
if (width != m2DWidth || height != m2DHeight)
{
HWViewpointUniforms matrices;
matrices.SetDefaults();
matrices.SetDefaults(nullptr);
matrices.mProjectionMatrix.ortho(0, (float)width, (float)height, 0, -1.0f, 1.0f);
matrices.CalcDependencies();
mBuffer->Map();

View file

@ -135,7 +135,7 @@ void HWDrawInfo::StartScene(FRenderViewpoint &parentvp, HWViewpointUniforms *uni
VPUniforms.mClipLine.X = -1000001.f;
VPUniforms.mClipHeight = 0;
}
else VPUniforms.SetDefaults();
else VPUniforms.SetDefaults(this);
mClipper->SetViewpoint(Viewpoint);
ClearBuffers();
@ -387,14 +387,15 @@ HWPortal * HWDrawInfo::FindPortal(const void * src)
//
//-----------------------------------------------------------------------------
void HWViewpointUniforms::SetDefaults()
void HWViewpointUniforms::SetDefaults(HWDrawInfo *drawInfo)
{
mProjectionMatrix.loadIdentity();
mViewMatrix.loadIdentity();
mNormalViewMatrix.loadIdentity();
mViewHeight = viewheight;
mGlobVis = (float)R_GetGlobVis(r_viewwindow, r_visibility) / 32.f;
mPalLightLevels = static_cast<int>(gl_bandedswlight) | (static_cast<int>(gl_fogmode) << 8) | (static_cast<int>(gl_lightmode) << 16);
const int lightMode = drawInfo == nullptr ? static_cast<int>(*gl_lightmode) : static_cast<int>(drawInfo->lightmode);
mPalLightLevels = static_cast<int>(gl_bandedswlight) | (static_cast<int>(gl_fogmode) << 8) | (lightMode << 16);
mClipLine.X = -10000000.0f;
mShadowmapFilter = gl_shadowmap_filter;

View file

@ -3,6 +3,8 @@
#include "r_data/matrix.h"
#include "r_utility.h"
struct HWDrawInfo;
struct HWViewpointUniforms
{
VSMatrix mProjectionMatrix;
@ -23,7 +25,7 @@ struct HWViewpointUniforms
mNormalViewMatrix.computeNormalMatrix(mViewMatrix);
}
void SetDefaults();
void SetDefaults(HWDrawInfo *drawInfo);
};