diff --git a/src/common/rendering/gl/gl_shader.cpp b/src/common/rendering/gl/gl_shader.cpp index 844f979d7..3fd70d388 100644 --- a/src/common/rendering/gl/gl_shader.cpp +++ b/src/common/rendering/gl/gl_shader.cpp @@ -37,7 +37,7 @@ #include "gl_shader.h" #include "hw_shaderpatcher.h" #include "hwrenderer/data/shaderuniforms.h" -#include "hwrenderer/scene/hw_viewpointuniforms.h" +#include "hw_viewpointuniforms.h" #include "hw_lightbuffer.h" #include "gl_interface.h" diff --git a/src/common/rendering/hwrenderer/data/hw_viewpointbuffer.cpp b/src/common/rendering/hwrenderer/data/hw_viewpointbuffer.cpp index 01e3e626e..d11284228 100644 --- a/src/common/rendering/hwrenderer/data/hw_viewpointbuffer.cpp +++ b/src/common/rendering/hwrenderer/data/hw_viewpointbuffer.cpp @@ -26,9 +26,10 @@ **/ #include "hwrenderer/data/shaderuniforms.h" -#include "hwrenderer/scene/hw_viewpointuniforms.h" +#include "hw_viewpointuniforms.h" #include "hw_renderstate.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 @@ -77,7 +78,15 @@ void HWViewpointBuffer::Set2D(FRenderState &di, int width, int height) if (width != m2DWidth || height != m2DHeight) { 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.CalcDependencies(); mBuffer->Map(); diff --git a/src/rendering/hwrenderer/scene/hw_viewpointuniforms.h b/src/common/rendering/hwrenderer/data/hw_viewpointuniforms.h similarity index 87% rename from src/rendering/hwrenderer/scene/hw_viewpointuniforms.h rename to src/common/rendering/hwrenderer/data/hw_viewpointuniforms.h index 5a1a1749d..3d28f5c4a 100644 --- a/src/rendering/hwrenderer/scene/hw_viewpointuniforms.h +++ b/src/common/rendering/hwrenderer/data/hw_viewpointuniforms.h @@ -1,7 +1,6 @@ #pragma once #include "matrix.h" -#include "r_utility.h" struct HWDrawInfo; @@ -24,9 +23,6 @@ struct HWViewpointUniforms { mNormalViewMatrix.computeNormalMatrix(mViewMatrix); } - - void SetDefaults(HWDrawInfo *drawInfo); - }; diff --git a/src/rendering/hwrenderer/scene/hw_drawinfo.cpp b/src/rendering/hwrenderer/scene/hw_drawinfo.cpp index 1335ffa8e..18204307f 100644 --- a/src/rendering/hwrenderer/scene/hw_drawinfo.cpp +++ b/src/rendering/hwrenderer/scene/hw_drawinfo.cpp @@ -139,7 +139,17 @@ void HWDrawInfo::StartScene(FRenderViewpoint &parentvp, HWViewpointUniforms *uni VPUniforms.mClipLine.X = -1000001.f; 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(gl_bandedswlight) | (static_cast(gl_fogmode) << 8) | ((int)lightmode << 16); + VPUniforms.mClipLine.X = -10000000.0f; + VPUniforms.mShadowmapFilter = gl_shadowmap_filter; + } mClipper->SetViewpoint(Viewpoint); 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(*gl_lightmode) : static_cast(drawInfo->lightmode); - mPalLightLevels = static_cast(gl_bandedswlight) | (static_cast(gl_fogmode) << 8) | (lightMode << 16); - mClipLine.X = -10000000.0f; - mShadowmapFilter = gl_shadowmap_filter; - -} - -//----------------------------------------------------------------------------- -// -// -// -//----------------------------------------------------------------------------- - HWDecal *HWDrawInfo::AddDecal(bool onmirror) { auto decal = (HWDecal*)RenderDataAllocator.Alloc(sizeof(HWDecal)); diff --git a/src/rendering/polyrenderer/backend/poly_renderstate.cpp b/src/rendering/polyrenderer/backend/poly_renderstate.cpp index cd13c3c48..5f4cf463d 100644 --- a/src/rendering/polyrenderer/backend/poly_renderstate.cpp +++ b/src/rendering/polyrenderer/backend/poly_renderstate.cpp @@ -27,7 +27,7 @@ #include "doomstat.h" #include "r_data/colormaps.h" #include "hwrenderer/scene/hw_skydome.h" -#include "hwrenderer/scene/hw_viewpointuniforms.h" +#include "hw_viewpointuniforms.h" #include "hw_lightbuffer.h" #include "hw_cvars.h" #include "hwrenderer/utility/hw_clock.h" diff --git a/src/rendering/polyrenderer/drawers/poly_vertex_shader.h b/src/rendering/polyrenderer/drawers/poly_vertex_shader.h index 22539e972..8ae178127 100644 --- a/src/rendering/polyrenderer/drawers/poly_vertex_shader.h +++ b/src/rendering/polyrenderer/drawers/poly_vertex_shader.h @@ -1,7 +1,7 @@ #pragma once -#include "hwrenderer/scene/hw_viewpointuniforms.h" +#include "hw_viewpointuniforms.h" #include "hw_renderstate.h" #ifndef NO_SSE diff --git a/src/rendering/vulkan/renderer/vk_renderpass.cpp b/src/rendering/vulkan/renderer/vk_renderpass.cpp index 24a3968aa..53b1cd732 100644 --- a/src/rendering/vulkan/renderer/vk_renderpass.cpp +++ b/src/rendering/vulkan/renderer/vk_renderpass.cpp @@ -29,7 +29,7 @@ #include "vulkan/system/vk_framebuffer.h" #include "vulkan/system/vk_buffers.h" #include "flatvertices.h" -#include "hwrenderer/scene/hw_viewpointuniforms.h" +#include "hw_viewpointuniforms.h" #include "v_2ddrawer.h" VkRenderPassManager::VkRenderPassManager() diff --git a/src/rendering/vulkan/renderer/vk_renderstate.cpp b/src/rendering/vulkan/renderer/vk_renderstate.cpp index 52a458d18..8a0223552 100644 --- a/src/rendering/vulkan/renderer/vk_renderstate.cpp +++ b/src/rendering/vulkan/renderer/vk_renderstate.cpp @@ -30,7 +30,7 @@ #include "doomstat.h" #include "r_data/colormaps.h" #include "hwrenderer/scene/hw_skydome.h" -#include "hwrenderer/scene/hw_viewpointuniforms.h" +#include "hw_viewpointuniforms.h" #include "hw_lightbuffer.h" #include "hw_cvars.h" #include "hwrenderer/utility/hw_clock.h"