Skip to content
Permalink
Browse files

- fixed: light mode from mapinfo had no effect

  • Loading branch information...
alexey-lysiuk committed Jun 12, 2019
1 parent b6ada16 commit 7e901055ea30b5e2d9fa33c2bc8142be89503f38
@@ -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();
@@ -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;

@@ -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);

};

2 comments on commit 7e90105

@drfrag666

This comment has been minimized.

Copy link
Contributor

replied Jun 12, 2019

Why static_cast<int>(*gl_lightmode) and not static_cast<int>(gl_lightmode)?

@alexey-lysiuk

This comment has been minimized.

Copy link
Collaborator Author

replied Jun 12, 2019

Does it really matter? Both operators do the same thing.

Please sign in to comment.
You can’t perform that action at this time.