mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
- moved the light buffer pointer to globally visible state.
This commit is contained in:
parent
b2776c9351
commit
926a918e0c
15 changed files with 27 additions and 27 deletions
|
@ -102,7 +102,6 @@ void FGLRenderer::Initialize(int width, int height)
|
|||
glBindVertexArray(mVAOID);
|
||||
FGLDebug::LabelObject(GL_VERTEX_ARRAY, mVAOID, "FGLRenderer.mVAOID");
|
||||
|
||||
mLights = new FLightBuffer();
|
||||
mFBID = 0;
|
||||
mOldFBID = 0;
|
||||
|
||||
|
@ -117,7 +116,6 @@ FGLRenderer::~FGLRenderer()
|
|||
FMaterial::FlushAll();
|
||||
if (mShaderManager != nullptr) delete mShaderManager;
|
||||
if (mSamplerManager != nullptr) delete mSamplerManager;
|
||||
if (mLights != nullptr) delete mLights;
|
||||
if (mFBID != 0) glDeleteFramebuffers(1, &mFBID);
|
||||
if (mVAOID != 0)
|
||||
{
|
||||
|
@ -209,7 +207,7 @@ sector_t *FGLRenderer::RenderView(player_t* player)
|
|||
|
||||
P_FindParticleSubsectors();
|
||||
|
||||
mLights->Clear();
|
||||
screen->mLights->Clear();
|
||||
screen->mViewpoints->Clear();
|
||||
|
||||
// NoInterpolateView should have no bearing on camera textures, but needs to be preserved for the main view below.
|
||||
|
@ -311,7 +309,7 @@ void FGLRenderer::WriteSavePic (player_t *player, FileWriter *file, int width, i
|
|||
P_FindParticleSubsectors(); // make sure that all recently spawned particles have a valid subsector.
|
||||
screen->mVertexData->Bind(gl_RenderState);
|
||||
screen->mVertexData->Reset();
|
||||
mLights->Clear();
|
||||
screen->mLights->Clear();
|
||||
screen->mViewpoints->Clear();
|
||||
|
||||
// This shouldn't overwrite the global viewpoint even for a short time.
|
||||
|
|
|
@ -69,7 +69,6 @@ public:
|
|||
|
||||
//FRotator mAngles;
|
||||
|
||||
FLightBuffer *mLights = nullptr;
|
||||
SWSceneDrawer *swdrawer = nullptr;
|
||||
|
||||
float mSceneClearColor[3];
|
||||
|
|
|
@ -200,7 +200,7 @@ bool FGLRenderState::ApplyShader()
|
|||
matrixToGL(identityMatrix, activeShader->normalmodelmatrix_index);
|
||||
}
|
||||
|
||||
auto index = GLRenderer->mLights->BindUBO(mLightIndex);
|
||||
auto index = screen->mLights->BindUBO(mLightIndex);
|
||||
activeShader->muLightIndex.Set(index);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -158,11 +158,6 @@ void FDrawInfo::AddSubsectorToPortal(FSectorPortalGroup *ptg, subsector_t *sub)
|
|||
ptl->AddSubsector(sub);
|
||||
}
|
||||
|
||||
int FDrawInfo::UploadLights(FDynLightData &data)
|
||||
{
|
||||
return GLRenderer->mLights->UploadLights(data);
|
||||
}
|
||||
|
||||
bool FDrawInfo::SetDepthClamp(bool on)
|
||||
{
|
||||
return gl_RenderState.SetDepthClamp(on);
|
||||
|
|
|
@ -39,8 +39,6 @@ struct FDrawInfo : public HWDrawInfo
|
|||
void AddFlat(GLFlat *flat, bool fog) override;
|
||||
void AddSprite(GLSprite *sprite, bool translucent) override;
|
||||
|
||||
int UploadLights(FDynLightData &data) override;
|
||||
|
||||
void Draw(EDrawType dt, FRenderState &state, int index, int count, bool apply = true) override;
|
||||
void DrawIndexed(EDrawType dt, FRenderState &state, int index, int count, bool apply = true) override;
|
||||
void RenderPortal(HWPortal *p, bool stencil) override;
|
||||
|
|
|
@ -105,7 +105,7 @@ void FDrawInfo::CreateScene()
|
|||
// clip the scene and fill the drawlists
|
||||
Bsp.Clock();
|
||||
screen->mVertexData->Map();
|
||||
GLRenderer->mLights->Map();
|
||||
screen->mLights->Map();
|
||||
|
||||
// Give the DrawInfo the viewpoint in fixed point because that's what the nodes are.
|
||||
viewx = FLOAT2FIXED(vp.Pos.X);
|
||||
|
@ -130,7 +130,7 @@ void FDrawInfo::CreateScene()
|
|||
HandleHackedSubsectors(); // open sector hacks for deep water
|
||||
ProcessSectorStacks(in_area); // merge visplanes of sector stacks
|
||||
PrepareUnhandledMissingTextures();
|
||||
GLRenderer->mLights->Unmap();
|
||||
screen->mLights->Unmap();
|
||||
screen->mVertexData->Unmap();
|
||||
|
||||
ProcessAll.Unclock();
|
||||
|
@ -153,7 +153,7 @@ void FDrawInfo::RenderScene(int recursion)
|
|||
glDepthMask(true);
|
||||
if (!gl_no_skyclear) screen->mPortalState->RenderFirstSkyPortal(recursion, this);
|
||||
|
||||
GLRenderer->mLights->BindBase(gl_RenderState); // not needed for OpenGL but necessary for Vulkan command buffers to do it here!
|
||||
screen->mLights->BindBase(gl_RenderState); // not needed for OpenGL but necessary for Vulkan command buffers to do it here!
|
||||
gl_RenderState.EnableFog(true);
|
||||
gl_RenderState.SetRenderStyle(STYLE_Source);
|
||||
|
||||
|
|
|
@ -166,10 +166,10 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
//
|
||||
FString vp_comb;
|
||||
|
||||
assert(GLRenderer->mLights != NULL);
|
||||
assert(screen->mLights != NULL);
|
||||
|
||||
bool lightbuffertype = GLRenderer->mLights->GetBufferType();
|
||||
unsigned int lightbuffersize = GLRenderer->mLights->GetBlockSize();
|
||||
bool lightbuffertype = screen->mLights->GetBufferType();
|
||||
unsigned int lightbuffersize = screen->mLights->GetBlockSize();
|
||||
if (!lightbuffertype)
|
||||
{
|
||||
vp_comb.Format("#version 330 core\n#define NUM_UBO_LIGHTS %d\n", lightbuffersize);
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "hwrenderer/models/hw_models.h"
|
||||
#include "hwrenderer/scene/hw_skydome.h"
|
||||
#include "hwrenderer/data/hw_viewpointbuffer.h"
|
||||
#include "hwrenderer/dynlights/hw_lightbuffer.h"
|
||||
#include "gl/shaders/gl_shaderprogram.h"
|
||||
#include "gl_debug.h"
|
||||
#include "r_videoscale.h"
|
||||
|
@ -87,6 +88,7 @@ OpenGLFrameBuffer::~OpenGLFrameBuffer()
|
|||
if (mVertexData != nullptr) delete mVertexData;
|
||||
if (mSkyData != nullptr) delete mSkyData;
|
||||
if (mViewpoints != nullptr) delete mViewpoints;
|
||||
if (mLights != nullptr) delete mLights;
|
||||
|
||||
if (GLRenderer)
|
||||
{
|
||||
|
@ -144,13 +146,15 @@ void OpenGLFrameBuffer::InitializeState()
|
|||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
GLRenderer = new FGLRenderer(this);
|
||||
GLRenderer->Initialize(GetWidth(), GetHeight());
|
||||
SetViewportRects(nullptr);
|
||||
|
||||
mVertexData = new FFlatVertexBuffer(GetWidth(), GetHeight());
|
||||
mSkyData = new FSkyVertexBuffer;
|
||||
mViewpoints = new GLViewpointBuffer;
|
||||
mLights = new FLightBuffer();
|
||||
|
||||
GLRenderer = new FGLRenderer(this);
|
||||
GLRenderer->Initialize(GetWidth(), GetHeight());
|
||||
|
||||
mDebug = std::make_shared<FGLDebug>();
|
||||
mDebug->Update();
|
||||
|
|
|
@ -337,7 +337,6 @@ public:
|
|||
virtual void AddFlat(GLFlat *flat, bool fog) = 0;
|
||||
virtual void AddSprite(GLSprite *sprite, bool translucent) = 0;
|
||||
|
||||
virtual int UploadLights(FDynLightData &data) = 0;
|
||||
virtual void ApplyVPUniforms() = 0;
|
||||
virtual bool SetDepthClamp(bool on) = 0;
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "hwrenderer/textures/hw_material.h"
|
||||
#include "hwrenderer/scene/hw_drawinfo.h"
|
||||
#include "hwrenderer/data/flatvertices.h"
|
||||
#include "hwrenderer/dynlights/hw_lightbuffer.h"
|
||||
#include "hw_drawstructs.h"
|
||||
#include "hw_renderstate.h"
|
||||
|
||||
|
@ -170,7 +171,7 @@ void GLFlat::SetupLights(HWDrawInfo *di, FLightNode * node, FDynLightData &light
|
|||
node = node->nextLight;
|
||||
}
|
||||
|
||||
dynlightindex = di->UploadLights(lightdata);
|
||||
dynlightindex = screen->mLights->UploadLights(lightdata);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "hwrenderer/utility/hw_clock.h"
|
||||
#include "hwrenderer/dynlights/hw_dynlightdata.h"
|
||||
#include "hwrenderer/data/flatvertices.h"
|
||||
#include "hwrenderer/dynlights/hw_lightbuffer.h"
|
||||
|
||||
sector_t * hw_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool back);
|
||||
|
||||
|
@ -71,7 +72,7 @@ int HWDrawInfo::SetupLightsForOtherPlane(subsector_t * sub, FDynLightData &light
|
|||
node = node->nextLight;
|
||||
}
|
||||
|
||||
return UploadLights(lightdata);
|
||||
return screen->mLights->UploadLights(lightdata);
|
||||
}
|
||||
else return -1;
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include "hwrenderer/utility/hw_lighting.h"
|
||||
#include "hwrenderer/textures/hw_material.h"
|
||||
#include "hwrenderer/dynlights/hw_dynlightdata.h"
|
||||
#include "hwrenderer/dynlights/hw_lightbuffer.h"
|
||||
#include "hw_renderstate.h"
|
||||
|
||||
extern TArray<spritedef_t> sprites;
|
||||
|
@ -460,7 +461,7 @@ inline void GLSprite::PutSprite(HWDrawInfo *di, bool translucent)
|
|||
if (modelframe && RenderStyle.BlendOp != STYLEOP_Shadow && gl_light_sprites && level.HasDynamicLights && !di->isFullbrightScene() && !fullbright)
|
||||
{
|
||||
hw_GetDynModelLight(actor, lightdata);
|
||||
dynlightindex = di->UploadLights(lightdata);
|
||||
dynlightindex = screen->mLights->UploadLights(lightdata);
|
||||
}
|
||||
else
|
||||
dynlightindex = -1;
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "hwrenderer/scene/hw_drawinfo.h"
|
||||
#include "hwrenderer/scene/hw_drawstructs.h"
|
||||
#include "hwrenderer/scene/hw_portal.h"
|
||||
#include "hwrenderer/dynlights/hw_lightbuffer.h"
|
||||
#include "hw_renderstate.h"
|
||||
#include "hw_skydome.h"
|
||||
|
||||
|
@ -359,7 +360,7 @@ void GLWall::SetupLights(HWDrawInfo *di, FDynLightData &lightdata)
|
|||
}
|
||||
node = node->nextLight;
|
||||
}
|
||||
dynlightindex = di->UploadLights(lightdata);
|
||||
dynlightindex = screen->mLights->UploadLights(lightdata);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "hwrenderer/scene/hw_drawinfo.h"
|
||||
#include "hwrenderer/scene/hw_drawstructs.h"
|
||||
#include "hwrenderer/data/flatvertices.h"
|
||||
#include "hwrenderer/dynlights/hw_lightbuffer.h"
|
||||
#include "hw_renderstate.h"
|
||||
|
||||
EXTERN_CVAR(Float, transsouls)
|
||||
|
@ -544,7 +545,7 @@ void HWDrawInfo::PreparePlayerSprites(sector_t * viewsector, area_t in_area)
|
|||
else
|
||||
{
|
||||
hw_GetDynModelLight(playermo, lightdata);
|
||||
hudsprite.lightindex = UploadLights(lightdata);
|
||||
hudsprite.lightindex = screen->mLights->UploadLights(lightdata);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ class IVertexBuffer;
|
|||
class IDataBuffer;
|
||||
class FFlatVertexBuffer;
|
||||
class GLViewpointBuffer;
|
||||
class FLightBuffer;
|
||||
|
||||
enum EHWCaps
|
||||
{
|
||||
|
@ -380,6 +381,7 @@ public:
|
|||
FSkyVertexBuffer *mSkyData = nullptr; // the sky vertex buffer
|
||||
FFlatVertexBuffer *mVertexData = nullptr; // Global vertex data
|
||||
GLViewpointBuffer *mViewpoints = nullptr; // Viewpoint render data.
|
||||
FLightBuffer *mLights = nullptr; // Dynamic lights
|
||||
|
||||
IntRect mScreenViewport;
|
||||
IntRect mSceneViewport;
|
||||
|
|
Loading…
Reference in a new issue