mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-12 15:15:46 +00:00
- changed a bit more stuff that doesn't need to be routed through the OpenGL interface anymore.
This commit is contained in:
parent
f7c7c8d1c5
commit
54de0bf59f
22 changed files with 70 additions and 104 deletions
|
@ -150,11 +150,6 @@ void FGLRenderer::ResetSWScene()
|
||||||
swdrawer = nullptr;
|
swdrawer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGLRenderer::SetupLevel()
|
|
||||||
{
|
|
||||||
screen->mVertexData->CreateVBO();
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
|
@ -81,7 +81,6 @@ public:
|
||||||
|
|
||||||
void ClearBorders();
|
void ClearBorders();
|
||||||
|
|
||||||
void SetupLevel();
|
|
||||||
void ResetSWScene();
|
void ResetSWScene();
|
||||||
|
|
||||||
void PresentStereo();
|
void PresentStereo();
|
||||||
|
|
|
@ -59,31 +59,6 @@ public:
|
||||||
static FDrawInfo * gl_drawinfo;
|
static FDrawInfo * gl_drawinfo;
|
||||||
FDrawInfoList di_list;
|
FDrawInfoList di_list;
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
void FDrawInfo::DrawSorted(int listindex)
|
|
||||||
{
|
|
||||||
HWDrawList *dl = &drawlists[listindex];
|
|
||||||
if (dl->drawitems.Size()==0) return;
|
|
||||||
|
|
||||||
if (!dl->sorted)
|
|
||||||
{
|
|
||||||
screen->mVertexData->Map();
|
|
||||||
dl->Sort(this);
|
|
||||||
screen->mVertexData->Unmap();
|
|
||||||
}
|
|
||||||
gl_RenderState.ClearClipSplit();
|
|
||||||
EnableClipDistance(1, true);
|
|
||||||
EnableClipDistance(2, true);
|
|
||||||
dl->DrawSorted(this, gl_RenderState, dl->sorted);
|
|
||||||
EnableClipDistance(1, false);
|
|
||||||
EnableClipDistance(2, false);
|
|
||||||
gl_RenderState.ClearClipSplit();
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// Try to reuse the lists as often as possible as they contain resources that
|
// Try to reuse the lists as often as possible as they contain resources that
|
||||||
|
@ -183,13 +158,6 @@ void FDrawInfo::AddSubsectorToPortal(FSectorPortalGroup *ptg, subsector_t *sub)
|
||||||
ptl->AddSubsector(sub);
|
ptl->AddSubsector(sub);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<FFlatVertex *, unsigned int> FDrawInfo::AllocVertices(unsigned int count)
|
|
||||||
{
|
|
||||||
unsigned int index = -1;
|
|
||||||
auto p = screen->mVertexData->Alloc(count, &index);
|
|
||||||
return std::make_pair(p, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
int FDrawInfo::UploadLights(FDynLightData &data)
|
int FDrawInfo::UploadLights(FDynLightData &data)
|
||||||
{
|
{
|
||||||
return GLRenderer->mLights->UploadLights(data);
|
return GLRenderer->mLights->UploadLights(data);
|
||||||
|
@ -232,20 +200,6 @@ void FDrawInfo::DrawIndexed(EDrawType dt, FRenderState &state, int index, int co
|
||||||
drawcalls.Unclock();
|
drawcalls.Unclock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FDrawInfo::DrawModel(GLSprite *spr, FRenderState &state)
|
|
||||||
{
|
|
||||||
FGLModelRenderer renderer(this, state, spr->dynlightindex);
|
|
||||||
renderer.RenderModel(spr->x, spr->y, spr->z, spr->modelframe, spr->actor, Viewpoint.TicFrac);
|
|
||||||
screen->mVertexData->Bind(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FDrawInfo::DrawHUDModel(HUDSprite *huds, FRenderState &state)
|
|
||||||
{
|
|
||||||
FGLModelRenderer renderer(this, state, huds->lightindex);
|
|
||||||
renderer.RenderHUDModel(huds->weapon, huds->mx, huds->my);
|
|
||||||
screen->mVertexData->Bind(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FDrawInfo::RenderPortal(HWPortal *p, bool usestencil)
|
void FDrawInfo::RenderPortal(HWPortal *p, bool usestencil)
|
||||||
{
|
{
|
||||||
auto gp = static_cast<HWPortal *>(p);
|
auto gp = static_cast<HWPortal *>(p);
|
||||||
|
|
|
@ -39,13 +39,10 @@ struct FDrawInfo : public HWDrawInfo
|
||||||
void AddFlat(GLFlat *flat, bool fog) override;
|
void AddFlat(GLFlat *flat, bool fog) override;
|
||||||
void AddSprite(GLSprite *sprite, bool translucent) override;
|
void AddSprite(GLSprite *sprite, bool translucent) override;
|
||||||
|
|
||||||
std::pair<FFlatVertex *, unsigned int> AllocVertices(unsigned int count) override;
|
|
||||||
int UploadLights(FDynLightData &data) override;
|
int UploadLights(FDynLightData &data) override;
|
||||||
|
|
||||||
void Draw(EDrawType dt, FRenderState &state, int index, int count, bool apply = true) 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 DrawIndexed(EDrawType dt, FRenderState &state, int index, int count, bool apply = true) override;
|
||||||
void DrawModel(GLSprite *spr, FRenderState &state) override;
|
|
||||||
void DrawHUDModel(HUDSprite *spr, FRenderState &state) override;
|
|
||||||
void RenderPortal(HWPortal *p, bool stencil) override;
|
void RenderPortal(HWPortal *p, bool stencil) override;
|
||||||
|
|
||||||
void SetDepthMask(bool on) override;
|
void SetDepthMask(bool on) override;
|
||||||
|
@ -58,8 +55,6 @@ struct FDrawInfo : public HWDrawInfo
|
||||||
|
|
||||||
void StartScene();
|
void StartScene();
|
||||||
|
|
||||||
void DrawSorted(int listindex);
|
|
||||||
|
|
||||||
void AddSubsectorToPortal(FSectorPortalGroup *portal, subsector_t *sub) override;
|
void AddSubsectorToPortal(FSectorPortalGroup *portal, subsector_t *sub) override;
|
||||||
|
|
||||||
void CreateScene();
|
void CreateScene();
|
||||||
|
|
|
@ -217,7 +217,8 @@ void FDrawInfo::RenderTranslucent()
|
||||||
gl_RenderState.EnableBrightmap(true);
|
gl_RenderState.EnableBrightmap(true);
|
||||||
drawlists[GLDL_TRANSLUCENTBORDER].Draw(this, gl_RenderState, true);
|
drawlists[GLDL_TRANSLUCENTBORDER].Draw(this, gl_RenderState, true);
|
||||||
glDepthMask(false);
|
glDepthMask(false);
|
||||||
DrawSorted(GLDL_TRANSLUCENT);
|
|
||||||
|
drawlists[GLDL_TRANSLUCENT].DrawSorted(this, gl_RenderState);
|
||||||
gl_RenderState.EnableBrightmap(false);
|
gl_RenderState.EnableBrightmap(false);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -391,15 +391,6 @@ void OpenGLFrameBuffer::SetViewportRects(IntRect *bounds)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OpenGLFrameBuffer::InitForLevel()
|
|
||||||
{
|
|
||||||
if (GLRenderer != NULL)
|
|
||||||
{
|
|
||||||
GLRenderer->SetupLevel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OpenGLFrameBuffer::UpdatePalette()
|
void OpenGLFrameBuffer::UpdatePalette()
|
||||||
{
|
{
|
||||||
if (GLRenderer)
|
if (GLRenderer)
|
||||||
|
|
|
@ -27,7 +27,6 @@ public:
|
||||||
|
|
||||||
void CleanForRestart() override;
|
void CleanForRestart() override;
|
||||||
void UpdatePalette() override;
|
void UpdatePalette() override;
|
||||||
void InitForLevel() override;
|
|
||||||
void SetClearColor(int color) override;
|
void SetClearColor(int color) override;
|
||||||
uint32_t GetCaps() override;
|
uint32_t GetCaps() override;
|
||||||
void RenderTextureView(FCanvasTexture *tex, AActor *Viewpoint, double FOV) override;
|
void RenderTextureView(FCanvasTexture *tex, AActor *Viewpoint, double FOV) override;
|
||||||
|
|
|
@ -379,6 +379,25 @@ void FFlatVertexBuffer::CheckUpdate(sector_t *sector)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
|
std::pair<FFlatVertex *, unsigned int> FFlatVertexBuffer::AllocVertices(unsigned int count)
|
||||||
|
{
|
||||||
|
FFlatVertex *p = GetBuffer();
|
||||||
|
auto index = mCurIndex.fetch_add(count);
|
||||||
|
auto offset = index;
|
||||||
|
if (index + count >= BUFFER_SIZE_TO_USE)
|
||||||
|
{
|
||||||
|
// If a single scene needs 2'000'000 vertices there must be something very wrong.
|
||||||
|
I_FatalError("Out of vertex memory. Tried to allocate more than %u vertices for a single frame", index + count);
|
||||||
|
}
|
||||||
|
return std::make_pair(p, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
void FFlatVertexBuffer::Copy(int start, int count)
|
void FFlatVertexBuffer::Copy(int start, int count)
|
||||||
{
|
{
|
||||||
Map();
|
Map();
|
||||||
|
|
|
@ -56,7 +56,6 @@ class FFlatVertexBuffer
|
||||||
|
|
||||||
unsigned int mIndex;
|
unsigned int mIndex;
|
||||||
std::atomic<unsigned int> mCurIndex;
|
std::atomic<unsigned int> mCurIndex;
|
||||||
std::mutex mBufferMutex;
|
|
||||||
unsigned int mNumReserved;
|
unsigned int mNumReserved;
|
||||||
|
|
||||||
|
|
||||||
|
@ -119,23 +118,7 @@ public:
|
||||||
return GetBuffer(mCurIndex);
|
return GetBuffer(mCurIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
std::pair<FFlatVertex *, unsigned int> AllocVertices(unsigned int count);
|
||||||
FFlatVertex *Alloc(int num, T *poffset)
|
|
||||||
{
|
|
||||||
again:
|
|
||||||
FFlatVertex *p = GetBuffer();
|
|
||||||
auto index = mCurIndex.fetch_add(num);
|
|
||||||
*poffset = static_cast<T>(index);
|
|
||||||
if (index + num >= BUFFER_SIZE_TO_USE)
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lock(mBufferMutex);
|
|
||||||
if (mCurIndex >= BUFFER_SIZE_TO_USE) // retest condition, in case another thread got here first
|
|
||||||
mCurIndex = mIndex;
|
|
||||||
|
|
||||||
if (index >= BUFFER_SIZE_TO_USE) goto again;
|
|
||||||
}
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Reset()
|
void Reset()
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,7 +77,7 @@ void GLViewpointBuffer::Set2D(HWDrawInfo *di, int width, int height)
|
||||||
{
|
{
|
||||||
HWViewpointUniforms matrices;
|
HWViewpointUniforms matrices;
|
||||||
matrices.SetDefaults();
|
matrices.SetDefaults();
|
||||||
matrices.mProjectionMatrix.ortho(0, width, 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();
|
||||||
memcpy(mBuffer->Memory(), &matrices, sizeof(matrices));
|
memcpy(mBuffer->Memory(), &matrices, sizeof(matrices));
|
||||||
|
|
|
@ -409,7 +409,7 @@ void GLWall::ProcessDecal(HWDrawInfo *di, DBaseDecal *decal, const FVector3 &nor
|
||||||
gldecal->lightlist = lightlist;
|
gldecal->lightlist = lightlist;
|
||||||
memcpy(gldecal->dv, dv, sizeof(dv));
|
memcpy(gldecal->dv, dv, sizeof(dv));
|
||||||
|
|
||||||
auto verts = di->AllocVertices(4);
|
auto verts = screen->mVertexData->AllocVertices(4);
|
||||||
gldecal->vertindex = verts.second;
|
gldecal->vertindex = verts.second;
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
|
|
|
@ -343,13 +343,9 @@ public:
|
||||||
|
|
||||||
GLDecal *AddDecal(bool onmirror);
|
GLDecal *AddDecal(bool onmirror);
|
||||||
|
|
||||||
virtual std::pair<FFlatVertex *, unsigned int> AllocVertices(unsigned int count) = 0;
|
|
||||||
|
|
||||||
virtual void ClearScreen() = 0;
|
virtual void ClearScreen() = 0;
|
||||||
virtual void Draw(EDrawType dt, FRenderState &state, int index, int count, bool apply = true) = 0;
|
virtual void Draw(EDrawType dt, FRenderState &state, int index, int count, bool apply = true) = 0;
|
||||||
virtual void DrawIndexed(EDrawType dt, FRenderState &state, int index, int count, bool apply = true) = 0;
|
virtual void DrawIndexed(EDrawType dt, FRenderState &state, int index, int count, bool apply = true) = 0;
|
||||||
virtual void DrawModel(GLSprite *spr, FRenderState &state) = 0;
|
|
||||||
virtual void DrawHUDModel(HUDSprite *spr, FRenderState &state) = 0;
|
|
||||||
virtual void RenderPortal(HWPortal *p, bool usestencil) = 0;
|
virtual void RenderPortal(HWPortal *p, bool usestencil) = 0;
|
||||||
virtual void DrawScene(int drawmode) = 0;
|
virtual void DrawScene(int drawmode) = 0;
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "g_levellocals.h"
|
#include "g_levellocals.h"
|
||||||
#include "hwrenderer/scene/hw_drawstructs.h"
|
#include "hwrenderer/scene/hw_drawstructs.h"
|
||||||
#include "hwrenderer/scene/hw_drawlist.h"
|
#include "hwrenderer/scene/hw_drawlist.h"
|
||||||
|
#include "hwrenderer/data/flatvertices.h"
|
||||||
#include "hwrenderer/utility/hw_clock.h"
|
#include "hwrenderer/utility/hw_clock.h"
|
||||||
#include "hw_renderstate.h"
|
#include "hw_renderstate.h"
|
||||||
|
|
||||||
|
@ -908,3 +909,27 @@ void HWDrawList::DrawSorted(HWDrawInfo *di, FRenderState &state, SortNode * head
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
void HWDrawList::DrawSorted(HWDrawInfo *di, FRenderState &state)
|
||||||
|
{
|
||||||
|
if (drawitems.Size() == 0) return;
|
||||||
|
|
||||||
|
if (!sorted)
|
||||||
|
{
|
||||||
|
screen->mVertexData->Map();
|
||||||
|
Sort(di);
|
||||||
|
screen->mVertexData->Unmap();
|
||||||
|
}
|
||||||
|
state.ClearClipSplit();
|
||||||
|
di->EnableClipDistance(1, true);
|
||||||
|
di->EnableClipDistance(2, true);
|
||||||
|
DrawSorted(di, state, sorted);
|
||||||
|
di->EnableClipDistance(1, false);
|
||||||
|
di->EnableClipDistance(2, false);
|
||||||
|
state.ClearClipSplit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,7 @@ public:
|
||||||
void DrawFlats(HWDrawInfo *di, FRenderState &state, bool translucent);
|
void DrawFlats(HWDrawInfo *di, FRenderState &state, bool translucent);
|
||||||
|
|
||||||
void DrawSorted(HWDrawInfo *di, FRenderState &state, SortNode * head);
|
void DrawSorted(HWDrawInfo *di, FRenderState &state, SortNode * head);
|
||||||
|
void DrawSorted(HWDrawInfo *di, FRenderState &state);
|
||||||
|
|
||||||
HWDrawList * next;
|
HWDrawList * next;
|
||||||
} ;
|
} ;
|
||||||
|
|
|
@ -395,7 +395,7 @@ void GLFlat::Process(HWDrawInfo *di, sector_t * model, int whichplane, bool fog)
|
||||||
z = plane.plane.ZatPoint(0.f, 0.f);
|
z = plane.plane.ZatPoint(0.f, 0.f);
|
||||||
if (sector->special == GLSector_Skybox)
|
if (sector->special == GLSector_Skybox)
|
||||||
{
|
{
|
||||||
auto vert = di->AllocVertices(4);
|
auto vert = screen->mVertexData->AllocVertices(4);
|
||||||
CreateSkyboxVertices(vert.first);
|
CreateSkyboxVertices(vert.first);
|
||||||
iboindex = vert.second;
|
iboindex = vert.second;
|
||||||
}
|
}
|
||||||
|
|
|
@ -811,7 +811,7 @@ HWHorizonPortal::HWHorizonPortal(FPortalSceneState *s, GLHorizonInfo * pt, FRend
|
||||||
|
|
||||||
// Draw to some far away boundary
|
// Draw to some far away boundary
|
||||||
// This is not drawn as larger strips because it causes visual glitches.
|
// This is not drawn as larger strips because it causes visual glitches.
|
||||||
auto verts = di->AllocVertices(1024 + 10);
|
auto verts = screen->mVertexData->AllocVertices(1024 + 10);
|
||||||
auto ptr = verts.first;
|
auto ptr = verts.first;
|
||||||
for (int xx = -32768; xx < 32768; xx += 4096)
|
for (int xx = -32768; xx < 32768; xx += 4096)
|
||||||
{
|
{
|
||||||
|
|
|
@ -84,7 +84,7 @@ int HWDrawInfo::SetupLightsForOtherPlane(subsector_t * sub, FDynLightData &light
|
||||||
|
|
||||||
int HWDrawInfo::CreateOtherPlaneVertices(subsector_t *sub, const secplane_t *plane)
|
int HWDrawInfo::CreateOtherPlaneVertices(subsector_t *sub, const secplane_t *plane)
|
||||||
{
|
{
|
||||||
auto alloc = AllocVertices(sub->numlines);
|
auto alloc = screen->mVertexData->AllocVertices(sub->numlines);
|
||||||
auto ptr = alloc.first;
|
auto ptr = alloc.first;
|
||||||
for (unsigned int k = 0; k < sub->numlines; k++)
|
for (unsigned int k = 0; k < sub->numlines; k++)
|
||||||
{
|
{
|
||||||
|
@ -722,7 +722,7 @@ void HWDrawInfo::PrepareUpperGap(seg_t * seg)
|
||||||
ws.z1 = frontz;
|
ws.z1 = frontz;
|
||||||
ws.z2 = backz;
|
ws.z2 = backz;
|
||||||
|
|
||||||
auto vertices = AllocVertices(8);
|
auto vertices = screen->mVertexData->AllocVertices(8);
|
||||||
|
|
||||||
CreateFloodStencilPoly(&ws, vertices.first);
|
CreateFloodStencilPoly(&ws, vertices.first);
|
||||||
CreateFloodPoly(&ws, vertices.first+4, ws.z2, fakebsector, true);
|
CreateFloodPoly(&ws, vertices.first+4, ws.z2, fakebsector, true);
|
||||||
|
@ -786,7 +786,7 @@ void HWDrawInfo::PrepareLowerGap(seg_t * seg)
|
||||||
ws.z2 = frontz;
|
ws.z2 = frontz;
|
||||||
ws.z1 = backz;
|
ws.z1 = backz;
|
||||||
|
|
||||||
auto vertices = AllocVertices(8);
|
auto vertices = screen->mVertexData->AllocVertices(8);
|
||||||
|
|
||||||
CreateFloodStencilPoly(&ws, vertices.first);
|
CreateFloodStencilPoly(&ws, vertices.first);
|
||||||
CreateFloodPoly(&ws, vertices.first+4, ws.z1, fakebsector, false);
|
CreateFloodPoly(&ws, vertices.first+4, ws.z1, fakebsector, false);
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include "r_data/models/models.h"
|
#include "r_data/models/models.h"
|
||||||
#include "vectors.h"
|
#include "vectors.h"
|
||||||
|
|
||||||
|
#include "hwrenderer/models/hw_models.h"
|
||||||
#include "hwrenderer/scene/hw_drawstructs.h"
|
#include "hwrenderer/scene/hw_drawstructs.h"
|
||||||
#include "hwrenderer/scene/hw_drawinfo.h"
|
#include "hwrenderer/scene/hw_drawinfo.h"
|
||||||
#include "hwrenderer/scene/hw_fakeflat.h"
|
#include "hwrenderer/scene/hw_fakeflat.h"
|
||||||
|
@ -267,7 +268,9 @@ void GLSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
di->DrawModel(this, state);
|
FGLModelRenderer renderer(di, state, dynlightindex);
|
||||||
|
renderer.RenderModel(x, y, z, modelframe, actor, di->Viewpoint.TicFrac);
|
||||||
|
screen->mVertexData->Bind(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,7 +485,7 @@ void GLSprite::CreateVertices(HWDrawInfo *di)
|
||||||
{
|
{
|
||||||
FVector3 v[4];
|
FVector3 v[4];
|
||||||
polyoffset = CalculateVertices(di, v, &di->Viewpoint.Pos);
|
polyoffset = CalculateVertices(di, v, &di->Viewpoint.Pos);
|
||||||
auto vert = di->AllocVertices(4);
|
auto vert = screen->mVertexData->AllocVertices(4);
|
||||||
auto vp = vert.first;
|
auto vp = vert.first;
|
||||||
vertexindex = vert.second;
|
vertexindex = vert.second;
|
||||||
|
|
||||||
|
|
|
@ -267,7 +267,7 @@ void GLWall::MakeVertices(HWDrawInfo *di, bool nosplit)
|
||||||
if (vertcount == 0)
|
if (vertcount == 0)
|
||||||
{
|
{
|
||||||
bool split = (gl_seamless && !nosplit && seg->sidedef != nullptr && !(seg->sidedef->Flags & WALLF_POLYOBJ) && !(flags & GLWF_NOSPLIT));
|
bool split = (gl_seamless && !nosplit && seg->sidedef != nullptr && !(seg->sidedef->Flags & WALLF_POLYOBJ) && !(flags & GLWF_NOSPLIT));
|
||||||
auto ret = di->AllocVertices(split ? CountVertices() : 4);
|
auto ret = screen->mVertexData->AllocVertices(split ? CountVertices() : 4);
|
||||||
vertindex = ret.second;
|
vertindex = ret.second;
|
||||||
vertcount = CreateVertices(ret.first, split);
|
vertcount = CreateVertices(ret.first, split);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
#include "r_data/models/models.h"
|
#include "r_data/models/models.h"
|
||||||
#include "hw_weapon.h"
|
#include "hw_weapon.h"
|
||||||
#include "hw_fakeflat.h"
|
#include "hw_fakeflat.h"
|
||||||
|
|
||||||
|
#include "hwrenderer/models/hw_models.h"
|
||||||
#include "hwrenderer/dynlights/hw_dynlightdata.h"
|
#include "hwrenderer/dynlights/hw_dynlightdata.h"
|
||||||
#include "hwrenderer/textures/hw_material.h"
|
#include "hwrenderer/textures/hw_material.h"
|
||||||
#include "hwrenderer/utility/hw_lighting.h"
|
#include "hwrenderer/utility/hw_lighting.h"
|
||||||
|
@ -75,7 +77,10 @@ void HWDrawInfo::DrawPSprite(HUDSprite *huds, FRenderState &state)
|
||||||
if (huds->mframe)
|
if (huds->mframe)
|
||||||
{
|
{
|
||||||
state.AlphaFunc(Alpha_GEqual, 0);
|
state.AlphaFunc(Alpha_GEqual, 0);
|
||||||
DrawHUDModel(huds, state);
|
|
||||||
|
FGLModelRenderer renderer(this, state, huds->lightindex);
|
||||||
|
renderer.RenderHUDModel(huds->weapon, huds->mx, huds->my);
|
||||||
|
screen->mVertexData->Bind(state);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -464,7 +469,7 @@ bool HUDSprite::GetWeaponRect(HWDrawInfo *di, DPSprite *psp, float sx, float sy,
|
||||||
v2 = tex->GetSpriteVB();
|
v2 = tex->GetSpriteVB();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto verts = di->AllocVertices(4);
|
auto verts = screen->mVertexData->AllocVertices(4);
|
||||||
mx = verts.second;
|
mx = verts.second;
|
||||||
|
|
||||||
verts.first[0].Set(x1, y1, 0, u1, v1);
|
verts.first[0].Set(x1, y1, 0, u1, v1);
|
||||||
|
|
|
@ -104,6 +104,7 @@
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "i_time.h"
|
#include "i_time.h"
|
||||||
#include "scripting/vm/vm.h"
|
#include "scripting/vm/vm.h"
|
||||||
|
#include "hwrenderer/data/flatvertices.h"
|
||||||
|
|
||||||
#include "fragglescript/t_fs.h"
|
#include "fragglescript/t_fs.h"
|
||||||
|
|
||||||
|
@ -4115,7 +4116,7 @@ void P_SetupLevel (const char *lumpname, int position)
|
||||||
|
|
||||||
// This must be done BEFORE the PolyObj Spawn!!!
|
// This must be done BEFORE the PolyObj Spawn!!!
|
||||||
InitRenderInfo(); // create hardware independent renderer resources for the level.
|
InitRenderInfo(); // create hardware independent renderer resources for the level.
|
||||||
screen->InitForLevel(); // create hardware dependent level resources (e.g. the vertex buffer)
|
screen->mVertexData->CreateVBO();
|
||||||
SWRenderer->SetColormap(); //The SW renderer needs to do some special setup for the level's default colormap.
|
SWRenderer->SetColormap(); //The SW renderer needs to do some special setup for the level's default colormap.
|
||||||
InitPortalGroups();
|
InitPortalGroups();
|
||||||
|
|
||||||
|
|
|
@ -485,7 +485,6 @@ public:
|
||||||
|
|
||||||
// Report a game restart
|
// Report a game restart
|
||||||
void InitPalette();
|
void InitPalette();
|
||||||
virtual void InitForLevel() {}
|
|
||||||
virtual void SetClearColor(int color) {}
|
virtual void SetClearColor(int color) {}
|
||||||
virtual uint32_t GetCaps();
|
virtual uint32_t GetCaps();
|
||||||
virtual void RenderTextureView(FCanvasTexture *tex, AActor *Viewpoint, double FOV);
|
virtual void RenderTextureView(FCanvasTexture *tex, AActor *Viewpoint, double FOV);
|
||||||
|
|
Loading…
Reference in a new issue