mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
- moved RenderPortal, too.
This commit is contained in:
parent
24d6b23042
commit
70f9507f16
7 changed files with 34 additions and 68 deletions
|
@ -1,54 +0,0 @@
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Copyright(C) 2002-2016 Christoph Oelckers
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Lesser General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Lesser General Public License
|
|
||||||
// along with this program. If not, see http://www.gnu.org/licenses/
|
|
||||||
//
|
|
||||||
//--------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "gl_load/gl_system.h"
|
|
||||||
#include "r_sky.h"
|
|
||||||
#include "r_utility.h"
|
|
||||||
#include "doomstat.h"
|
|
||||||
#include "g_levellocals.h"
|
|
||||||
#include "tarray.h"
|
|
||||||
#include "hwrenderer/scene/hw_drawstructs.h"
|
|
||||||
#include "hwrenderer/data/flatvertices.h"
|
|
||||||
|
|
||||||
#include "gl/scene/gl_drawinfo.h"
|
|
||||||
#include "hwrenderer/scene/hw_clipper.h"
|
|
||||||
#include "gl/renderer/gl_renderstate.h"
|
|
||||||
#include "gl/renderer/gl_renderer.h"
|
|
||||||
#include "hwrenderer/data/hw_viewpointbuffer.h"
|
|
||||||
#include "hwrenderer/dynlights/hw_lightbuffer.h"
|
|
||||||
#include "hwrenderer/models/hw_models.h"
|
|
||||||
|
|
||||||
void FDrawInfo::RenderPortal(HWPortal *p, bool usestencil)
|
|
||||||
{
|
|
||||||
auto gp = static_cast<HWPortal *>(p);
|
|
||||||
gp->SetupStencil(this, gl_RenderState, usestencil);
|
|
||||||
auto new_di = StartDrawInfo(Viewpoint, &VPUniforms);
|
|
||||||
new_di->mCurrentPortal = gp;
|
|
||||||
gl_RenderState.SetLightIndex(-1);
|
|
||||||
gp->DrawContents(new_di, gl_RenderState);
|
|
||||||
new_di->EndDrawInfo();
|
|
||||||
screen->mVertexData->Bind(gl_RenderState);
|
|
||||||
screen->mViewpoints->Bind(gl_RenderState, vpIndex);
|
|
||||||
gp->RemoveStencil(this, gl_RenderState, usestencil);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
|
|
||||||
struct FDrawInfo : public HWDrawInfo
|
struct FDrawInfo : public HWDrawInfo
|
||||||
{
|
{
|
||||||
void RenderPortal(HWPortal *p, bool stencil) override;
|
|
||||||
|
|
||||||
void CreateScene();
|
void CreateScene();
|
||||||
void DrawScene(int drawmode) override;
|
void DrawScene(int drawmode) override;
|
||||||
void ProcessScene(bool toscreen = false);
|
void ProcessScene(bool toscreen = false);
|
||||||
|
|
|
@ -172,7 +172,7 @@ void FDrawInfo::DrawScene(int drawmode)
|
||||||
}
|
}
|
||||||
|
|
||||||
glDepthMask(true);
|
glDepthMask(true);
|
||||||
if (!gl_no_skyclear) screen->mPortalState->RenderFirstSkyPortal(recursion, this);
|
if (!gl_no_skyclear) screen->mPortalState->RenderFirstSkyPortal(recursion, this, gl_RenderState);
|
||||||
|
|
||||||
RenderScene(gl_RenderState);
|
RenderScene(gl_RenderState);
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ void FDrawInfo::DrawScene(int drawmode)
|
||||||
// Handle all portals after rendering the opaque objects but before
|
// Handle all portals after rendering the opaque objects but before
|
||||||
// doing all translucent stuff
|
// doing all translucent stuff
|
||||||
recursion++;
|
recursion++;
|
||||||
screen->mPortalState->EndFrame(this);
|
screen->mPortalState->EndFrame(this, gl_RenderState);
|
||||||
recursion--;
|
recursion--;
|
||||||
RenderTranslucent(gl_RenderState);
|
RenderTranslucent(gl_RenderState);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "hwrenderer/utility/hw_clock.h"
|
#include "hwrenderer/utility/hw_clock.h"
|
||||||
#include "hwrenderer/utility/hw_cvars.h"
|
#include "hwrenderer/utility/hw_cvars.h"
|
||||||
#include "hwrenderer/data/hw_viewpointbuffer.h"
|
#include "hwrenderer/data/hw_viewpointbuffer.h"
|
||||||
|
#include "hwrenderer/data/flatvertices.h"
|
||||||
#include "hwrenderer/dynlights/hw_lightbuffer.h"
|
#include "hwrenderer/dynlights/hw_lightbuffer.h"
|
||||||
#include "hw_clipper.h"
|
#include "hw_clipper.h"
|
||||||
|
|
||||||
|
@ -514,3 +515,24 @@ void HWDrawInfo::RenderTranslucent(FRenderState &state)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// RenderTranslucent
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void HWDrawInfo::RenderPortal(HWPortal *p, FRenderState &state, bool usestencil)
|
||||||
|
{
|
||||||
|
auto gp = static_cast<HWPortal *>(p);
|
||||||
|
gp->SetupStencil(this, state, usestencil);
|
||||||
|
auto new_di = StartDrawInfo(Viewpoint, &VPUniforms);
|
||||||
|
new_di->mCurrentPortal = gp;
|
||||||
|
state.SetLightIndex(-1);
|
||||||
|
gp->DrawContents(new_di, state);
|
||||||
|
new_di->EndDrawInfo();
|
||||||
|
screen->mVertexData->Bind(state);
|
||||||
|
screen->mViewpoints->Bind(state, vpIndex);
|
||||||
|
gp->RemoveStencil(this, state, usestencil);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -307,6 +307,7 @@ public:
|
||||||
|
|
||||||
void RenderScene(FRenderState &state);
|
void RenderScene(FRenderState &state);
|
||||||
void RenderTranslucent(FRenderState &state);
|
void RenderTranslucent(FRenderState &state);
|
||||||
|
void RenderPortal(HWPortal *p, FRenderState &state, bool usestencil);
|
||||||
|
|
||||||
bool DoOneSectorUpper(subsector_t * subsec, float planez, area_t in_area);
|
bool DoOneSectorUpper(subsector_t * subsec, float planez, area_t in_area);
|
||||||
bool DoOneSectorLower(subsector_t * subsec, float planez, area_t in_area);
|
bool DoOneSectorLower(subsector_t * subsec, float planez, area_t in_area);
|
||||||
|
@ -365,7 +366,6 @@ public:
|
||||||
|
|
||||||
GLDecal *AddDecal(bool onmirror);
|
GLDecal *AddDecal(bool onmirror);
|
||||||
|
|
||||||
virtual void RenderPortal(HWPortal *p, bool usestencil) = 0;
|
|
||||||
virtual void DrawScene(int drawmode) = 0;
|
virtual void DrawScene(int drawmode) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ static FString indent;
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void FPortalSceneState::EndFrame(HWDrawInfo *di)
|
void FPortalSceneState::EndFrame(HWDrawInfo *di, FRenderState &state)
|
||||||
{
|
{
|
||||||
HWPortal * p;
|
HWPortal * p;
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ void FPortalSceneState::EndFrame(HWDrawInfo *di)
|
||||||
}
|
}
|
||||||
if (p->lines.Size() > 0)
|
if (p->lines.Size() > 0)
|
||||||
{
|
{
|
||||||
RenderPortal(p, true, di);
|
RenderPortal(p, state, true, di);
|
||||||
}
|
}
|
||||||
delete p;
|
delete p;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ void FPortalSceneState::EndFrame(HWDrawInfo *di)
|
||||||
// the GPU and there's rarely more than one sky visible at a time.
|
// the GPU and there's rarely more than one sky visible at a time.
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool FPortalSceneState::RenderFirstSkyPortal(int recursion, HWDrawInfo *outer_di)
|
bool FPortalSceneState::RenderFirstSkyPortal(int recursion, HWDrawInfo *outer_di, FRenderState &state)
|
||||||
{
|
{
|
||||||
HWPortal * p;
|
HWPortal * p;
|
||||||
HWPortal * best = nullptr;
|
HWPortal * best = nullptr;
|
||||||
|
@ -147,7 +147,7 @@ bool FPortalSceneState::RenderFirstSkyPortal(int recursion, HWDrawInfo *outer_di
|
||||||
if (best)
|
if (best)
|
||||||
{
|
{
|
||||||
portals.Delete(bestindex);
|
portals.Delete(bestindex);
|
||||||
RenderPortal(best, false, outer_di);
|
RenderPortal(best, state, false, outer_di);
|
||||||
delete best;
|
delete best;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -155,9 +155,9 @@ bool FPortalSceneState::RenderFirstSkyPortal(int recursion, HWDrawInfo *outer_di
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FPortalSceneState::RenderPortal(HWPortal *p, bool usestencil, HWDrawInfo *outer_di)
|
void FPortalSceneState::RenderPortal(HWPortal *p, FRenderState &state, bool usestencil, HWDrawInfo *outer_di)
|
||||||
{
|
{
|
||||||
if (gl_portals) outer_di->RenderPortal(p, usestencil);
|
if (gl_portals) outer_di->RenderPortal(p, state, usestencil);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -111,9 +111,9 @@ struct FPortalSceneState
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartFrame();
|
void StartFrame();
|
||||||
bool RenderFirstSkyPortal(int recursion, HWDrawInfo *outer_di);
|
bool RenderFirstSkyPortal(int recursion, HWDrawInfo *outer_di, FRenderState &state);
|
||||||
void EndFrame(HWDrawInfo *outer_di);
|
void EndFrame(HWDrawInfo *outer_di, FRenderState &state);
|
||||||
void RenderPortal(HWPortal *p, bool usestencil, HWDrawInfo *outer_di);
|
void RenderPortal(HWPortal *p, FRenderState &state, bool usestencil, HWDrawInfo *outer_di);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline HWPortal::HWPortal(FPortalSceneState *s, bool local) : mState(s)
|
inline HWPortal::HWPortal(FPortalSceneState *s, bool local) : mState(s)
|
||||||
|
|
Loading…
Reference in a new issue