- moved more code out of 'gl'.

This commit is contained in:
Christoph Oelckers 2018-10-28 18:49:29 +01:00
parent e6efee61b1
commit df15f00a21
6 changed files with 30 additions and 33 deletions

View file

@ -1,7 +1,7 @@
#ifndef __GL_DRAWINFO_H
#define __GL_DRAWINFO_H
#include "hwrenderer/scene/hw_drawlist.h"
#include "hwrenderer/scene/hw_drawinfo.h"
#include "hwrenderer/scene/hw_weapon.h"
#include "hwrenderer/scene/hw_viewpointuniforms.h"
@ -11,29 +11,9 @@
#pragma warning(disable:4244)
#endif
enum DrawListType
{
GLDL_PLAINWALLS,
GLDL_PLAINFLATS,
GLDL_MASKEDWALLS,
GLDL_MASKEDFLATS,
GLDL_MASKEDWALLSOFS,
GLDL_MODELS,
GLDL_TRANSLUCENT,
GLDL_TRANSLUCENTBORDER,
GLDL_TYPES,
};
struct FDrawInfo : public HWDrawInfo
{
HWDrawList drawlists[GLDL_TYPES];
int vpIndex;
void ApplyVPUniforms() override;
void AddWall(GLWall *wall) override;
void AddMirrorSurface(GLWall *w) override;
void AddFlat(GLFlat *flat, bool fog) override;

View file

@ -75,13 +75,6 @@ EXTERN_CVAR (Float, r_visibility)
EXTERN_CVAR (Bool, r_drawvoxels)
void FDrawInfo::ApplyVPUniforms()
{
VPUniforms.CalcDependencies();
vpIndex = screen->mViewpoints->SetViewpoint(this, &VPUniforms);
}
//-----------------------------------------------------------------------------
//
// CreateScene

View file

@ -31,12 +31,12 @@
#include "d_player.h"
#include "g_levellocals.h"
#include "hw_fakeflat.h"
#include "hw_drawinfo.h"
#include "hw_portal.h"
#include "hw_renderstate.h"
#include "hw_drawlist.h"
#include "hw_drawinfo.h"
#include "hwrenderer/utility/hw_clock.h"
#include "hwrenderer/utility/hw_cvars.h"
#include "hwrenderer/data/hw_viewpointbuffer.h"
EXTERN_CVAR(Float, r_visibility)
CVAR(Bool, gl_bandedswlight, false, CVAR_ARCHIVE)
@ -252,7 +252,8 @@ void HWDrawInfo::SetupView(float vx, float vy, float vz, bool mirror, bool plane
vp.SetViewAngle(r_viewwindow);
SetViewMatrix(vp.HWAngles, vx, vy, vz, mirror, planemirror);
SetCameraPos(vp.Pos);
ApplyVPUniforms();
VPUniforms.CalcDependencies();
vpIndex = screen->mViewpoints->SetViewpoint(this, &VPUniforms);
}
//-----------------------------------------------------------------------------

View file

@ -7,6 +7,7 @@
#include "hw_viewpointuniforms.h"
#include "v_video.h"
#include "hw_weapon.h"
#include "hw_drawlist.h"
enum EDrawMode
{
@ -115,6 +116,21 @@ enum EPortalClip
PClip_Behind,
};
enum DrawListType
{
GLDL_PLAINWALLS,
GLDL_PLAINFLATS,
GLDL_MASKEDWALLS,
GLDL_MASKEDFLATS,
GLDL_MASKEDWALLSOFS,
GLDL_MODELS,
GLDL_TRANSLUCENT,
GLDL_TRANSLUCENTBORDER,
GLDL_TYPES,
};
struct HWDrawInfo
{
@ -159,6 +175,9 @@ struct HWDrawInfo
bool isNightvision() const { return !!(FullbrightFlags & Nightvision); }
bool isStealthVision() const { return !!(FullbrightFlags & StealthVision); }
HWDrawList drawlists[GLDL_TYPES];
int vpIndex;
HWDrawInfo * outer = nullptr;
int FullbrightFlags;
std::atomic<int> spriteindex;
@ -337,7 +356,6 @@ public:
virtual void AddFlat(GLFlat *flat, bool fog) = 0;
virtual void AddSprite(GLSprite *sprite, bool translucent) = 0;
virtual void ApplyVPUniforms() = 0;
virtual bool SetDepthClamp(bool on) = 0;
GLDecal *AddDecal(bool onmirror);

View file

@ -35,6 +35,7 @@
#include "hwrenderer/data/flatvertices.h"
#include "hwrenderer/utility/hw_clock.h"
#include "hw_renderstate.h"
#include "hw_drawinfo.h"
FMemArena RenderDataAllocator(1024*1024); // Use large blocks to reduce allocation time.

View file

@ -1,10 +1,14 @@
#pragma once
#include "hwrenderer/scene/hw_drawinfo.h"
#include "memarena.h"
extern FMemArena RenderDataAllocator;
void ResetRenderDataAllocator();
struct HWDrawInfo;
class GLWall;
class GLFlat;
class GLSprite;
class FRenderState;
//==========================================================================
//