- need hw_viewpointuniforms.h as well in 'common', after decoupling it from game data.

This commit is contained in:
Christoph Oelckers 2020-04-26 23:02:16 +02:00
parent cb1e8a177f
commit b58e3172fc
8 changed files with 27 additions and 32 deletions

View file

@ -37,7 +37,7 @@
#include "gl_shader.h" #include "gl_shader.h"
#include "hw_shaderpatcher.h" #include "hw_shaderpatcher.h"
#include "hwrenderer/data/shaderuniforms.h" #include "hwrenderer/data/shaderuniforms.h"
#include "hwrenderer/scene/hw_viewpointuniforms.h" #include "hw_viewpointuniforms.h"
#include "hw_lightbuffer.h" #include "hw_lightbuffer.h"
#include "gl_interface.h" #include "gl_interface.h"

View file

@ -26,9 +26,10 @@
**/ **/
#include "hwrenderer/data/shaderuniforms.h" #include "hwrenderer/data/shaderuniforms.h"
#include "hwrenderer/scene/hw_viewpointuniforms.h" #include "hw_viewpointuniforms.h"
#include "hw_renderstate.h" #include "hw_renderstate.h"
#include "hw_viewpointbuffer.h" #include "hw_viewpointbuffer.h"
#include "hw_cvars.h"
static const int INITIAL_BUFFER_SIZE = 100; // 100 viewpoints per frame should nearly always be enough static const int INITIAL_BUFFER_SIZE = 100; // 100 viewpoints per frame should nearly always be enough
@ -77,7 +78,15 @@ void HWViewpointBuffer::Set2D(FRenderState &di, int width, int height)
if (width != m2DWidth || height != m2DHeight) if (width != m2DWidth || height != m2DHeight)
{ {
HWViewpointUniforms matrices; HWViewpointUniforms matrices;
matrices.SetDefaults(nullptr);
matrices.mViewMatrix.loadIdentity();
matrices.mNormalViewMatrix.loadIdentity();
matrices.mViewHeight = 0;
matrices.mGlobVis = 1.f;
matrices.mPalLightLevels = 0;
matrices.mClipLine.X = -10000000.0f;
matrices.mShadowmapFilter = gl_shadowmap_filter;
matrices.mProjectionMatrix.ortho(0, (float)width, (float)height, 0, -1.0f, 1.0f); matrices.mProjectionMatrix.ortho(0, (float)width, (float)height, 0, -1.0f, 1.0f);
matrices.CalcDependencies(); matrices.CalcDependencies();
mBuffer->Map(); mBuffer->Map();

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
#include "matrix.h" #include "matrix.h"
#include "r_utility.h"
struct HWDrawInfo; struct HWDrawInfo;
@ -24,9 +23,6 @@ struct HWViewpointUniforms
{ {
mNormalViewMatrix.computeNormalMatrix(mViewMatrix); mNormalViewMatrix.computeNormalMatrix(mViewMatrix);
} }
void SetDefaults(HWDrawInfo *drawInfo);
}; };

View file

@ -139,7 +139,17 @@ void HWDrawInfo::StartScene(FRenderViewpoint &parentvp, HWViewpointUniforms *uni
VPUniforms.mClipLine.X = -1000001.f; VPUniforms.mClipLine.X = -1000001.f;
VPUniforms.mClipHeight = 0; VPUniforms.mClipHeight = 0;
} }
else VPUniforms.SetDefaults(this); else
{
VPUniforms.mProjectionMatrix.loadIdentity();
VPUniforms.mViewMatrix.loadIdentity();
VPUniforms.mNormalViewMatrix.loadIdentity();
VPUniforms.mViewHeight = viewheight;
VPUniforms.mGlobVis = (float)R_GetGlobVis(r_viewwindow, r_visibility) / 32.f;
VPUniforms.mPalLightLevels = static_cast<int>(gl_bandedswlight) | (static_cast<int>(gl_fogmode) << 8) | ((int)lightmode << 16);
VPUniforms.mClipLine.X = -10000000.0f;
VPUniforms.mShadowmapFilter = gl_shadowmap_filter;
}
mClipper->SetViewpoint(Viewpoint); mClipper->SetViewpoint(Viewpoint);
ClearBuffers(); ClearBuffers();
@ -391,26 +401,6 @@ HWPortal * HWDrawInfo::FindPortal(const void * src)
// //
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void HWViewpointUniforms::SetDefaults(HWDrawInfo *drawInfo)
{
mProjectionMatrix.loadIdentity();
mViewMatrix.loadIdentity();
mNormalViewMatrix.loadIdentity();
mViewHeight = viewheight;
mGlobVis = (float)R_GetGlobVis(r_viewwindow, r_visibility) / 32.f;
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;
}
//-----------------------------------------------------------------------------
//
//
//
//-----------------------------------------------------------------------------
HWDecal *HWDrawInfo::AddDecal(bool onmirror) HWDecal *HWDrawInfo::AddDecal(bool onmirror)
{ {
auto decal = (HWDecal*)RenderDataAllocator.Alloc(sizeof(HWDecal)); auto decal = (HWDecal*)RenderDataAllocator.Alloc(sizeof(HWDecal));

View file

@ -27,7 +27,7 @@
#include "doomstat.h" #include "doomstat.h"
#include "r_data/colormaps.h" #include "r_data/colormaps.h"
#include "hwrenderer/scene/hw_skydome.h" #include "hwrenderer/scene/hw_skydome.h"
#include "hwrenderer/scene/hw_viewpointuniforms.h" #include "hw_viewpointuniforms.h"
#include "hw_lightbuffer.h" #include "hw_lightbuffer.h"
#include "hw_cvars.h" #include "hw_cvars.h"
#include "hwrenderer/utility/hw_clock.h" #include "hwrenderer/utility/hw_clock.h"

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "hwrenderer/scene/hw_viewpointuniforms.h" #include "hw_viewpointuniforms.h"
#include "hw_renderstate.h" #include "hw_renderstate.h"
#ifndef NO_SSE #ifndef NO_SSE

View file

@ -29,7 +29,7 @@
#include "vulkan/system/vk_framebuffer.h" #include "vulkan/system/vk_framebuffer.h"
#include "vulkan/system/vk_buffers.h" #include "vulkan/system/vk_buffers.h"
#include "flatvertices.h" #include "flatvertices.h"
#include "hwrenderer/scene/hw_viewpointuniforms.h" #include "hw_viewpointuniforms.h"
#include "v_2ddrawer.h" #include "v_2ddrawer.h"
VkRenderPassManager::VkRenderPassManager() VkRenderPassManager::VkRenderPassManager()

View file

@ -30,7 +30,7 @@
#include "doomstat.h" #include "doomstat.h"
#include "r_data/colormaps.h" #include "r_data/colormaps.h"
#include "hwrenderer/scene/hw_skydome.h" #include "hwrenderer/scene/hw_skydome.h"
#include "hwrenderer/scene/hw_viewpointuniforms.h" #include "hw_viewpointuniforms.h"
#include "hw_lightbuffer.h" #include "hw_lightbuffer.h"
#include "hw_cvars.h" #include "hw_cvars.h"
#include "hwrenderer/utility/hw_clock.h" #include "hwrenderer/utility/hw_clock.h"