Adjust meshbuilder to vkdoom changes and make sure the drawinfo functions always allocate vertices from the output renderstate object
This commit is contained in:
parent
71a78f2baf
commit
87c3be94d5
23 changed files with 329 additions and 347 deletions
|
|
@ -10,16 +10,14 @@ void Mesh::Draw(FRenderState& renderstate)
|
|||
|
||||
if (!mVertexBuffer && mVertices.Size() != 0)
|
||||
{
|
||||
mVertexBuffer.reset(screen->CreateVertexBuffer());
|
||||
mVertexBuffer->SetData(mVertices.Size() * sizeof(FFlatVertex), mVertices.Data(), BufferUsageType::Static);
|
||||
|
||||
static const FVertexBufferAttribute format[] =
|
||||
{
|
||||
{ 0, VATTR_VERTEX, VFmt_Float3, (int)myoffsetof(FFlatVertex, x) },
|
||||
{ 0, VATTR_TEXCOORD, VFmt_Float2, (int)myoffsetof(FFlatVertex, u) },
|
||||
{ 0, VATTR_LIGHTMAP, VFmt_Float3, (int)myoffsetof(FFlatVertex, lu) },
|
||||
};
|
||||
mVertexBuffer->SetFormat(1, 3, sizeof(FFlatVertex), format);
|
||||
mVertexBuffer.reset(screen->CreateVertexBuffer(1, 3, sizeof(FFlatVertex), format));
|
||||
mVertexBuffer->SetData(mVertices.Size() * sizeof(FFlatVertex), mVertices.Data(), BufferUsageType::Static);
|
||||
}
|
||||
|
||||
if (mVertexBuffer)
|
||||
|
|
@ -36,18 +34,12 @@ void Mesh::Draw(FRenderState& renderstate)
|
|||
origState.applyData.RenderStyle = renderstate.mRenderStyle;
|
||||
origState.applyData.SpecialEffect = renderstate.mSpecialEffect;
|
||||
origState.applyData.TextureEnabled = renderstate.mTextureEnabled;
|
||||
origState.applyData.AlphaThreshold = renderstate.mAlphaThreshold;
|
||||
origState.applyData.AlphaThreshold = renderstate.mStreamData.uAlphaThreshold;
|
||||
origState.applyData.FogEnabled = renderstate.mFogEnabled;
|
||||
origState.applyData.BrightmapEnabled = renderstate.mBrightmapEnabled;
|
||||
origState.applyData.TextureClamp = renderstate.mTextureClamp;
|
||||
origState.applyData.TextureMode = renderstate.mTextureMode;
|
||||
origState.applyData.TextureModeFlags = renderstate.mTextureModeFlags;
|
||||
origState.applyData.uLightDist = renderstate.mLightParms[0];
|
||||
origState.applyData.uLightFactor = renderstate.mLightParms[1];
|
||||
origState.applyData.uFogDensity = renderstate.mLightParms[2];
|
||||
origState.applyData.uClipSplit[0] = renderstate.mClipSplit[0];
|
||||
origState.applyData.uClipSplit[1] = renderstate.mClipSplit[1];
|
||||
origState.uLightLevel = renderstate.mLightParms[3];
|
||||
origState.streamData = renderstate.mStreamData;
|
||||
origState.material = renderstate.mMaterial;
|
||||
|
||||
|
|
@ -107,18 +99,11 @@ void Mesh::Apply(FRenderState& renderstate, const MeshApplyState& state)
|
|||
renderstate.mRenderStyle = state.applyData.RenderStyle;
|
||||
renderstate.mSpecialEffect = state.applyData.SpecialEffect;
|
||||
renderstate.mTextureEnabled = state.applyData.TextureEnabled;
|
||||
renderstate.mAlphaThreshold = state.applyData.AlphaThreshold;
|
||||
renderstate.mFogEnabled = state.applyData.FogEnabled;
|
||||
renderstate.mBrightmapEnabled = state.applyData.BrightmapEnabled;
|
||||
renderstate.mTextureClamp = state.applyData.TextureClamp;
|
||||
renderstate.mTextureMode = state.applyData.TextureMode;
|
||||
renderstate.mTextureModeFlags = state.applyData.TextureModeFlags;
|
||||
renderstate.mLightParms[0] = state.applyData.uLightDist;
|
||||
renderstate.mLightParms[1] = state.applyData.uLightFactor;
|
||||
renderstate.mLightParms[2] = state.applyData.uFogDensity;
|
||||
renderstate.mClipSplit[0] = state.applyData.uClipSplit[0];
|
||||
renderstate.mClipSplit[1] = state.applyData.uClipSplit[1];
|
||||
renderstate.mLightParms[3] = state.uLightLevel;
|
||||
renderstate.mStreamData = state.streamData;
|
||||
renderstate.mMaterial = state.material;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ private:
|
|||
TArray<MeshDrawCommand> mDraws;
|
||||
TArray<MeshDrawCommand> mIndexedDraws;
|
||||
TArray<FFlatVertex> mVertices;
|
||||
std::unique_ptr<IVertexBuffer> mVertexBuffer;
|
||||
std::unique_ptr<IBuffer> mVertexBuffer;
|
||||
|
||||
friend class MeshBuilder;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
#include "hw_meshbuilder.h"
|
||||
#include "hw_mesh.h"
|
||||
#include "v_video.h"
|
||||
|
||||
MeshBuilder::MeshBuilder()
|
||||
{
|
||||
|
|
@ -16,6 +17,9 @@ MeshBuilder::MeshBuilder()
|
|||
ClearDepthBias();
|
||||
EnableTexture(1);
|
||||
EnableBrightmap(true);
|
||||
|
||||
// Add the vbo_shadowdata as some geometry might use it
|
||||
mVertices = screen->mVertexData->vbo_shadowdata;
|
||||
}
|
||||
|
||||
void MeshBuilder::Draw(int dt, int index, int count, bool apply)
|
||||
|
|
@ -56,18 +60,13 @@ void MeshBuilder::Apply()
|
|||
state.applyData.RenderStyle = mRenderStyle;
|
||||
state.applyData.SpecialEffect = mSpecialEffect;
|
||||
state.applyData.TextureEnabled = mTextureEnabled;
|
||||
state.applyData.AlphaThreshold = mAlphaThreshold;
|
||||
state.applyData.AlphaThreshold = mStreamData.uAlphaThreshold;
|
||||
state.applyData.DepthFunc = mDepthFunc;
|
||||
state.applyData.FogEnabled = mFogEnabled;
|
||||
state.applyData.BrightmapEnabled = mBrightmapEnabled;
|
||||
state.applyData.TextureClamp = mTextureClamp;
|
||||
state.applyData.TextureMode = mTextureMode;
|
||||
state.applyData.TextureModeFlags = mTextureModeFlags;
|
||||
state.applyData.uLightDist = mLightParms[0];
|
||||
state.applyData.uLightFactor = mLightParms[1];
|
||||
state.applyData.uFogDensity = mLightParms[2];
|
||||
state.applyData.uClipSplit = { mClipSplit[0], mClipSplit[1] };
|
||||
state.uLightLevel = mLightParms[3];
|
||||
state.streamData = mStreamData;
|
||||
state.material = mMaterial;
|
||||
|
||||
|
|
@ -100,8 +99,10 @@ std::unique_ptr<Mesh> MeshBuilder::Create()
|
|||
applyIndex++;
|
||||
}
|
||||
|
||||
mesh->mVertices = std::move(mVertices);
|
||||
mVertices.Clear();
|
||||
// To do: the various mesh layers have to share the vertex buffer since some vertex allocations happen at the Process stage
|
||||
//mesh->mVertices = std::move(mVertices);
|
||||
//mVertices.Clear();
|
||||
mesh->mVertices = mVertices;
|
||||
|
||||
return mesh;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,14 +22,8 @@ public:
|
|||
int TextureClamp;
|
||||
int TextureMode;
|
||||
int TextureModeFlags;
|
||||
float uFogDensity;
|
||||
float uLightFactor;
|
||||
float uLightDist;
|
||||
FVector2 uClipSplit;
|
||||
};
|
||||
|
||||
float uLightLevel;
|
||||
|
||||
ApplyData applyData;
|
||||
StreamData streamData;
|
||||
FMaterialState material;
|
||||
|
|
@ -95,6 +89,7 @@ public:
|
|||
void SetCulling(int mode) override { }
|
||||
void EnableStencil(bool on) override { }
|
||||
void EnableDepthTest(bool on) override { }
|
||||
void SetViewpointOffset(uint32_t offset) override { }
|
||||
|
||||
std::unique_ptr<Mesh> Create();
|
||||
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ sector_t* RenderViewpoint(FRenderViewpoint& mainvp, AActor* camera, IntRect* bou
|
|||
vp.Pos += eye.GetViewShift(vp.HWAngles.Yaw.Degrees());
|
||||
di->SetupView(RenderState, vp.Pos.X, vp.Pos.Y, vp.Pos.Z, false, false);
|
||||
|
||||
di->ProcessScene(toscreen);
|
||||
di->ProcessScene(toscreen, *screen->RenderState());
|
||||
|
||||
if (mainview)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -106,6 +106,8 @@ void HWDrawInfo::WorkerThread()
|
|||
{
|
||||
sector_t *front, *back;
|
||||
|
||||
FRenderState& state = *screen->RenderState();
|
||||
|
||||
WTTotal.Clock();
|
||||
isWorkerThread = true; // for adding asserts in GL API code. The worker thread may never call any GL API.
|
||||
while (true)
|
||||
|
|
@ -169,7 +171,7 @@ void HWDrawInfo::WorkerThread()
|
|||
}
|
||||
else back = nullptr;
|
||||
|
||||
wall.Process(this, job->seg, front, back);
|
||||
wall.Process(this, state, job->seg, front, back);
|
||||
rendered_lines++;
|
||||
SetupWall.Unclock();
|
||||
break;
|
||||
|
|
@ -181,7 +183,7 @@ void HWDrawInfo::WorkerThread()
|
|||
SetupFlat.Clock();
|
||||
flat.section = job->sub->section;
|
||||
front = hw_FakeFlat(job->sub->render_sector, in_area, false);
|
||||
flat.ProcessSector(this, front);
|
||||
flat.ProcessSector(this, state, front);
|
||||
SetupFlat.Unclock();
|
||||
break;
|
||||
}
|
||||
|
|
@ -189,14 +191,14 @@ void HWDrawInfo::WorkerThread()
|
|||
case RenderJob::SpriteJob:
|
||||
SetupSprite.Clock();
|
||||
front = hw_FakeFlat(job->sub->sector, in_area, false);
|
||||
RenderThings(job->sub, front);
|
||||
RenderThings(job->sub, front, state);
|
||||
SetupSprite.Unclock();
|
||||
break;
|
||||
|
||||
case RenderJob::ParticleJob:
|
||||
SetupSprite.Clock();
|
||||
front = hw_FakeFlat(job->sub->sector, in_area, false);
|
||||
RenderParticles(job->sub, front);
|
||||
RenderParticles(job->sub, front, state);
|
||||
SetupSprite.Unclock();
|
||||
break;
|
||||
|
||||
|
|
@ -247,7 +249,7 @@ void HWDrawInfo::UnclipSubsector(subsector_t *sub)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWDrawInfo::AddLine (seg_t *seg, bool portalclip)
|
||||
void HWDrawInfo::AddLine (seg_t *seg, bool portalclip, FRenderState& state)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (seg->linedef && seg->linedef->Index() == 38)
|
||||
|
|
@ -350,7 +352,7 @@ void HWDrawInfo::AddLine (seg_t *seg, bool portalclip)
|
|||
HWWall wall;
|
||||
SetupWall.Clock();
|
||||
wall.sub = seg->Subsector;
|
||||
wall.Process(this, seg, currentsector, backsector);
|
||||
wall.Process(this, state, seg, currentsector, backsector);
|
||||
rendered_lines++;
|
||||
SetupWall.Unclock();
|
||||
}
|
||||
|
|
@ -367,7 +369,7 @@ void HWDrawInfo::AddLine (seg_t *seg, bool portalclip)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWDrawInfo::PolySubsector(subsector_t * sub)
|
||||
void HWDrawInfo::PolySubsector(subsector_t * sub, FRenderState& state)
|
||||
{
|
||||
int count = sub->numlines;
|
||||
seg_t * line = sub->firstline;
|
||||
|
|
@ -376,7 +378,7 @@ void HWDrawInfo::PolySubsector(subsector_t * sub)
|
|||
{
|
||||
if (line->linedef)
|
||||
{
|
||||
AddLine (line, mClipPortal != nullptr);
|
||||
AddLine (line, mClipPortal != nullptr, state);
|
||||
}
|
||||
line++;
|
||||
}
|
||||
|
|
@ -391,7 +393,7 @@ void HWDrawInfo::PolySubsector(subsector_t * sub)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWDrawInfo::RenderPolyBSPNode (void *node)
|
||||
void HWDrawInfo::RenderPolyBSPNode (void *node, FRenderState& state)
|
||||
{
|
||||
while (!((size_t)node & 1)) // Keep going until found a subsector
|
||||
{
|
||||
|
|
@ -401,7 +403,7 @@ void HWDrawInfo::RenderPolyBSPNode (void *node)
|
|||
int side = R_PointOnSide(viewx, viewy, bsp);
|
||||
|
||||
// Recursively divide front space (toward the viewer).
|
||||
RenderPolyBSPNode (bsp->children[side]);
|
||||
RenderPolyBSPNode (bsp->children[side], state);
|
||||
|
||||
// Possibly divide back space (away from the viewer).
|
||||
side ^= 1;
|
||||
|
|
@ -414,7 +416,7 @@ void HWDrawInfo::RenderPolyBSPNode (void *node)
|
|||
|
||||
node = bsp->children[side];
|
||||
}
|
||||
PolySubsector ((subsector_t *)((uint8_t *)node - 1));
|
||||
PolySubsector ((subsector_t *)((uint8_t *)node - 1), state);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
@ -424,7 +426,7 @@ void HWDrawInfo::RenderPolyBSPNode (void *node)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWDrawInfo::AddPolyobjs(subsector_t *sub)
|
||||
void HWDrawInfo::AddPolyobjs(subsector_t *sub, FRenderState& state)
|
||||
{
|
||||
if (sub->BSP == nullptr || sub->BSP->bDirty)
|
||||
{
|
||||
|
|
@ -432,11 +434,11 @@ void HWDrawInfo::AddPolyobjs(subsector_t *sub)
|
|||
}
|
||||
if (sub->BSP->Nodes.Size() == 0)
|
||||
{
|
||||
PolySubsector(&sub->BSP->Subsectors[0]);
|
||||
PolySubsector(&sub->BSP->Subsectors[0], state);
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderPolyBSPNode(&sub->BSP->Nodes.Last());
|
||||
RenderPolyBSPNode(&sub->BSP->Nodes.Last(), state);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -447,7 +449,7 @@ void HWDrawInfo::AddPolyobjs(subsector_t *sub)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWDrawInfo::AddLines(subsector_t * sub, sector_t * sector)
|
||||
void HWDrawInfo::AddLines(subsector_t * sub, sector_t * sector, FRenderState& state)
|
||||
{
|
||||
currentsector = sector;
|
||||
currentsubsector = sub;
|
||||
|
|
@ -455,7 +457,7 @@ void HWDrawInfo::AddLines(subsector_t * sub, sector_t * sector)
|
|||
ClipWall.Clock();
|
||||
if (sub->polys != nullptr)
|
||||
{
|
||||
AddPolyobjs(sub);
|
||||
AddPolyobjs(sub, state);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -466,11 +468,11 @@ void HWDrawInfo::AddLines(subsector_t * sub, sector_t * sector)
|
|||
{
|
||||
if (seg->linedef == nullptr)
|
||||
{
|
||||
if (!(sub->flags & SSECMF_DRAWN)) AddLine (seg, mClipPortal != nullptr);
|
||||
if (!(sub->flags & SSECMF_DRAWN)) AddLine (seg, mClipPortal != nullptr, state);
|
||||
}
|
||||
else if (!(seg->sidedef->Flags & WALLF_POLYOBJ))
|
||||
{
|
||||
AddLine (seg, mClipPortal != nullptr);
|
||||
AddLine (seg, mClipPortal != nullptr, state);
|
||||
}
|
||||
seg++;
|
||||
}
|
||||
|
|
@ -491,7 +493,7 @@ inline bool PointOnLine(const DVector2 &pos, const linebase_t *line)
|
|||
return fabs(v) <= EQUAL_EPSILON;
|
||||
}
|
||||
|
||||
void HWDrawInfo::AddSpecialPortalLines(subsector_t * sub, sector_t * sector, linebase_t *line)
|
||||
void HWDrawInfo::AddSpecialPortalLines(subsector_t * sub, sector_t * sector, linebase_t *line, FRenderState& state)
|
||||
{
|
||||
currentsector = sector;
|
||||
currentsubsector = sub;
|
||||
|
|
@ -505,7 +507,7 @@ void HWDrawInfo::AddSpecialPortalLines(subsector_t * sub, sector_t * sector, lin
|
|||
if (seg->linedef != nullptr && seg->PartnerSeg != nullptr)
|
||||
{
|
||||
if (PointOnLine(seg->v1->fPos(), line) && PointOnLine(seg->v2->fPos(), line))
|
||||
AddLine(seg, false);
|
||||
AddLine(seg, false, state);
|
||||
}
|
||||
seg++;
|
||||
}
|
||||
|
|
@ -519,7 +521,7 @@ void HWDrawInfo::AddSpecialPortalLines(subsector_t * sub, sector_t * sector, lin
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWDrawInfo::RenderThings(subsector_t * sub, sector_t * sector)
|
||||
void HWDrawInfo::RenderThings(subsector_t * sub, sector_t * sector, FRenderState& state)
|
||||
{
|
||||
sector_t * sec=sub->sector;
|
||||
// Handle all things in sector.
|
||||
|
|
@ -552,11 +554,11 @@ void HWDrawInfo::RenderThings(subsector_t * sub, sector_t * sector)
|
|||
double check = r_actorspriteshadowdist;
|
||||
if (dist <= check * check)
|
||||
{
|
||||
sprite.Process(this, thing, sector, in_area, false, true);
|
||||
sprite.Process(this, state, thing, sector, in_area, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
sprite.Process(this, thing, sector, in_area, false);
|
||||
sprite.Process(this, state, thing, sector, in_area, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -583,15 +585,15 @@ void HWDrawInfo::RenderThings(subsector_t * sub, sector_t * sector)
|
|||
double check = r_actorspriteshadowdist;
|
||||
if (dist <= check * check)
|
||||
{
|
||||
sprite.Process(this, thing, sector, in_area, true, true);
|
||||
sprite.Process(this, state, thing, sector, in_area, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
sprite.Process(this, thing, sector, in_area, true);
|
||||
sprite.Process(this, state, thing, sector, in_area, true);
|
||||
}
|
||||
}
|
||||
|
||||
void HWDrawInfo::RenderParticles(subsector_t *sub, sector_t *front)
|
||||
void HWDrawInfo::RenderParticles(subsector_t *sub, sector_t *front, FRenderState& state)
|
||||
{
|
||||
SetupSprite.Clock();
|
||||
for (int i = Level->ParticlesInSubsec[sub->Index()]; i != NO_PARTICLE; i = Level->Particles[i].snext)
|
||||
|
|
@ -603,7 +605,7 @@ void HWDrawInfo::RenderParticles(subsector_t *sub, sector_t *front)
|
|||
}
|
||||
|
||||
HWSprite sprite;
|
||||
sprite.ProcessParticle(this, &Level->Particles[i], front);
|
||||
sprite.ProcessParticle(this, state, &Level->Particles[i], front);
|
||||
}
|
||||
SetupSprite.Unclock();
|
||||
}
|
||||
|
|
@ -618,7 +620,7 @@ void HWDrawInfo::RenderParticles(subsector_t *sub, sector_t *front)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWDrawInfo::DoSubsector(subsector_t * sub)
|
||||
void HWDrawInfo::DoSubsector(subsector_t * sub, FRenderState& state)
|
||||
{
|
||||
sector_t * sector;
|
||||
sector_t * fakesector;
|
||||
|
|
@ -655,7 +657,7 @@ void HWDrawInfo::DoSubsector(subsector_t * sub)
|
|||
{
|
||||
auto line = mClipPortal->ClipLine();
|
||||
// The subsector is out of range, but we still have to check lines that lie directly on the boundary and may expose their upper or lower parts.
|
||||
if (line) AddSpecialPortalLines(sub, fakesector, line);
|
||||
if (line) AddSpecialPortalLines(sub, fakesector, line, state);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -675,12 +677,12 @@ void HWDrawInfo::DoSubsector(subsector_t * sub)
|
|||
else
|
||||
{
|
||||
SetupSprite.Clock();
|
||||
RenderParticles(sub, fakesector);
|
||||
RenderParticles(sub, fakesector, state);
|
||||
SetupSprite.Unclock();
|
||||
}
|
||||
}
|
||||
|
||||
AddLines(sub, fakesector);
|
||||
AddLines(sub, fakesector, state);
|
||||
|
||||
// BSP is traversed by subsector.
|
||||
// A sector might have been split into several
|
||||
|
|
@ -701,7 +703,7 @@ void HWDrawInfo::DoSubsector(subsector_t * sub)
|
|||
else
|
||||
{
|
||||
SetupSprite.Clock();
|
||||
RenderThings(sub, fakesector);
|
||||
RenderThings(sub, fakesector, state);
|
||||
SetupSprite.Unclock();
|
||||
}
|
||||
}
|
||||
|
|
@ -740,7 +742,7 @@ void HWDrawInfo::DoSubsector(subsector_t * sub)
|
|||
HWFlat flat;
|
||||
flat.section = sub->section;
|
||||
SetupFlat.Clock();
|
||||
flat.ProcessSector(this, fakesector);
|
||||
flat.ProcessSector(this, state, fakesector);
|
||||
SetupFlat.Unclock();
|
||||
}
|
||||
}
|
||||
|
|
@ -799,11 +801,11 @@ void HWDrawInfo::DoSubsector(subsector_t * sub)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWDrawInfo::RenderBSPNode (void *node)
|
||||
void HWDrawInfo::RenderBSPNode (void *node, FRenderState& state)
|
||||
{
|
||||
if (Level->nodes.Size() == 0)
|
||||
{
|
||||
DoSubsector (&Level->subsectors[0]);
|
||||
DoSubsector (&Level->subsectors[0], state);
|
||||
return;
|
||||
}
|
||||
while (!((size_t)node & 1)) // Keep going until found a subsector
|
||||
|
|
@ -814,7 +816,7 @@ void HWDrawInfo::RenderBSPNode (void *node)
|
|||
int side = R_PointOnSide(viewx, viewy, bsp);
|
||||
|
||||
// Recursively divide front space (toward the viewer).
|
||||
RenderBSPNode (bsp->children[side]);
|
||||
RenderBSPNode (bsp->children[side], state);
|
||||
|
||||
// Possibly divide back space (away from the viewer).
|
||||
side ^= 1;
|
||||
|
|
@ -828,10 +830,10 @@ void HWDrawInfo::RenderBSPNode (void *node)
|
|||
|
||||
node = bsp->children[side];
|
||||
}
|
||||
DoSubsector ((subsector_t *)((uint8_t *)node - 1));
|
||||
DoSubsector ((subsector_t *)((uint8_t *)node - 1), state);
|
||||
}
|
||||
|
||||
void HWDrawInfo::RenderBSP(void *node, bool drawpsprites)
|
||||
void HWDrawInfo::RenderBSP(void *node, bool drawpsprites, FRenderState& state)
|
||||
{
|
||||
Bsp.Clock();
|
||||
|
||||
|
|
@ -848,7 +850,7 @@ void HWDrawInfo::RenderBSP(void *node, bool drawpsprites)
|
|||
auto future = renderPool.push([&](int id) {
|
||||
WorkerThread();
|
||||
});
|
||||
RenderBSPNode(node);
|
||||
RenderBSPNode(node, state);
|
||||
|
||||
jobQueue.AddJob(RenderJob::TerminateJob, nullptr, nullptr);
|
||||
Bsp.Unclock();
|
||||
|
|
@ -858,12 +860,12 @@ void HWDrawInfo::RenderBSP(void *node, bool drawpsprites)
|
|||
}
|
||||
else
|
||||
{
|
||||
RenderBSPNode(node);
|
||||
RenderBSPNode(node, state);
|
||||
Bsp.Unclock();
|
||||
}
|
||||
// Process all the sprites on the current portal's back side which touch the portal.
|
||||
if (mCurrentPortal != nullptr) mCurrentPortal->RenderAttached(this);
|
||||
if (mCurrentPortal != nullptr) mCurrentPortal->RenderAttached(this, state);
|
||||
|
||||
if (drawpsprites)
|
||||
PreparePlayerSprites(Viewpoint.sector, in_area);
|
||||
PreparePlayerSprites(Viewpoint.sector, in_area, state);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ static float mix(float a, float b, float t)
|
|||
return a * (1.0f - t) + b * t;
|
||||
}
|
||||
|
||||
void HWWall::ProcessDecal(HWDrawInfo *di, DBaseDecal *decal, const FVector3 &normal)
|
||||
void HWWall::ProcessDecal(HWDrawInfo *di, FRenderState& state, DBaseDecal *decal, const FVector3 &normal)
|
||||
{
|
||||
line_t * line = seg->linedef;
|
||||
side_t * side = seg->sidedef;
|
||||
|
|
@ -445,7 +445,7 @@ void HWWall::ProcessDecal(HWDrawInfo *di, DBaseDecal *decal, const FVector3 &nor
|
|||
gldecal->lightlist = lightlist;
|
||||
memcpy(gldecal->dv, dv, sizeof(dv));
|
||||
|
||||
auto verts = screen->mVertexData->AllocVertices(4);
|
||||
auto verts = state.AllocVertices(4);
|
||||
gldecal->vertindex = verts.second;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
|
|
@ -460,7 +460,7 @@ void HWWall::ProcessDecal(HWDrawInfo *di, DBaseDecal *decal, const FVector3 &nor
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWWall::ProcessDecals(HWDrawInfo *di)
|
||||
void HWWall::ProcessDecals(HWDrawInfo *di, FRenderState& state)
|
||||
{
|
||||
if (seg->sidedef != nullptr)
|
||||
{
|
||||
|
|
@ -470,7 +470,7 @@ void HWWall::ProcessDecals(HWDrawInfo *di)
|
|||
auto normal = glseg.Normal(); // calculate the normal only once per wall because it requires a square root.
|
||||
while (decal)
|
||||
{
|
||||
ProcessDecal(di, decal, normal);
|
||||
ProcessDecal(di, state, decal, normal);
|
||||
decal = decal->WallNext;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ CVAR(Float, gl_mask_sprite_threshold, 0.5f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
|||
|
||||
CVAR(Bool, gl_coronas, true, CVAR_ARCHIVE);
|
||||
|
||||
CVAR(Bool, gl_meshcache, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CVAR(Bool, gl_meshcache, false, 0/*CVAR_ARCHIVE | CVAR_GLOBALCONFIG*/)
|
||||
|
||||
sector_t * hw_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool back);
|
||||
|
||||
|
|
@ -437,7 +437,7 @@ HWDecal *HWDrawInfo::AddDecal(bool onmirror)
|
|||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void HWDrawInfo::CreateScene(bool drawpsprites)
|
||||
void HWDrawInfo::CreateScene(bool drawpsprites, FRenderState& state)
|
||||
{
|
||||
const auto &vp = Viewpoint;
|
||||
angle_t a1 = FrustumAngle();
|
||||
|
|
@ -454,16 +454,16 @@ void HWDrawInfo::CreateScene(bool drawpsprites)
|
|||
screen->mBones->Map();
|
||||
|
||||
if (!gl_meshcache)
|
||||
RenderBSP(Level->HeadNode(), drawpsprites);
|
||||
RenderBSP(Level->HeadNode(), drawpsprites, state);
|
||||
|
||||
// And now the crappy hacks that have to be done to avoid rendering anomalies.
|
||||
// These cannot be multithreaded when the time comes because all these depend
|
||||
// on the global 'validcount' variable.
|
||||
|
||||
HandleMissingTextures(in_area); // Missing upper/lower textures
|
||||
HandleHackedSubsectors(); // open sector hacks for deep water
|
||||
PrepareUnhandledMissingTextures();
|
||||
DispatchRenderHacks();
|
||||
HandleMissingTextures(in_area, state); // Missing upper/lower textures
|
||||
HandleHackedSubsectors(state); // open sector hacks for deep water
|
||||
PrepareUnhandledMissingTextures(state);
|
||||
DispatchRenderHacks(state);
|
||||
screen->mLights->Unmap();
|
||||
screen->mBones->Unmap();
|
||||
screen->mVertexData->Unmap();
|
||||
|
|
@ -655,7 +655,7 @@ void HWDrawInfo::DrawCorona(FRenderState& state, ACorona* corona, double dist)
|
|||
float u0 = 0.0f, v0 = 0.0f;
|
||||
float u1 = 1.0f, v1 = 1.0f;
|
||||
|
||||
auto vert = screen->mVertexData->AllocVertices(4);
|
||||
auto vert = state.AllocVertices(4);
|
||||
auto vp = vert.first;
|
||||
unsigned int vertexindex = vert.second;
|
||||
|
||||
|
|
@ -816,7 +816,7 @@ void HWDrawInfo::Set3DViewport(FRenderState &state)
|
|||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void HWDrawInfo::DrawScene(int drawmode)
|
||||
void HWDrawInfo::DrawScene(int drawmode, FRenderState& state)
|
||||
{
|
||||
static int recursion = 0;
|
||||
static int ssao_portals_available = 0;
|
||||
|
|
@ -841,32 +841,31 @@ void HWDrawInfo::DrawScene(int drawmode)
|
|||
if (vp.camera != nullptr)
|
||||
{
|
||||
ActorRenderFlags savedflags = vp.camera->renderflags;
|
||||
CreateScene(drawmode == DM_MAINVIEW);
|
||||
CreateScene(drawmode == DM_MAINVIEW, state);
|
||||
vp.camera->renderflags = savedflags;
|
||||
}
|
||||
else
|
||||
{
|
||||
CreateScene(false);
|
||||
CreateScene(false, state);
|
||||
}
|
||||
auto& RenderState = *screen->RenderState();
|
||||
|
||||
RenderState.SetDepthMask(true);
|
||||
if (!gl_no_skyclear) portalState.RenderFirstSkyPortal(recursion, this, RenderState);
|
||||
state.SetDepthMask(true);
|
||||
if (!gl_no_skyclear) portalState.RenderFirstSkyPortal(recursion, this, state);
|
||||
|
||||
RenderScene(RenderState);
|
||||
RenderScene(state);
|
||||
|
||||
if (applySSAO && RenderState.GetPassType() == GBUFFER_PASS)
|
||||
if (applySSAO && state.GetPassType() == GBUFFER_PASS)
|
||||
{
|
||||
screen->AmbientOccludeScene(VPUniforms.mProjectionMatrix.get()[5]);
|
||||
screen->mViewpoints->Bind(RenderState, vpIndex);
|
||||
screen->mViewpoints->Bind(state, vpIndex);
|
||||
}
|
||||
|
||||
// Handle all portals after rendering the opaque objects but before
|
||||
// doing all translucent stuff
|
||||
recursion++;
|
||||
portalState.EndFrame(this, RenderState);
|
||||
portalState.EndFrame(this, state);
|
||||
recursion--;
|
||||
RenderTranslucent(RenderState);
|
||||
RenderTranslucent(state);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -876,13 +875,13 @@ void HWDrawInfo::DrawScene(int drawmode)
|
|||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void HWDrawInfo::ProcessScene(bool toscreen)
|
||||
void HWDrawInfo::ProcessScene(bool toscreen, FRenderState& state)
|
||||
{
|
||||
portalState.BeginScene();
|
||||
|
||||
int mapsection = Level->PointInRenderSubsector(Viewpoint.Pos)->mapsection;
|
||||
CurrentMapSections.Set(mapsection);
|
||||
DrawScene(toscreen ? DM_MAINVIEW : DM_OFFSCREEN);
|
||||
DrawScene(toscreen ? DM_MAINVIEW : DM_OFFSCREEN, state);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -197,18 +197,18 @@ private:
|
|||
|
||||
void UnclipSubsector(subsector_t *sub);
|
||||
|
||||
void AddLine(seg_t *seg, bool portalclip);
|
||||
void PolySubsector(subsector_t * sub);
|
||||
void RenderPolyBSPNode(void *node);
|
||||
void AddPolyobjs(subsector_t *sub);
|
||||
void AddLines(subsector_t * sub, sector_t * sector);
|
||||
void AddSpecialPortalLines(subsector_t * sub, sector_t * sector, linebase_t *line);
|
||||
void AddLine(seg_t *seg, bool portalclip, FRenderState& state);
|
||||
void PolySubsector(subsector_t * sub, FRenderState& state);
|
||||
void RenderPolyBSPNode(void *node, FRenderState& state);
|
||||
void AddPolyobjs(subsector_t *sub, FRenderState& state);
|
||||
void AddLines(subsector_t * sub, sector_t * sector, FRenderState& state);
|
||||
void AddSpecialPortalLines(subsector_t * sub, sector_t * sector, linebase_t *line, FRenderState& state);
|
||||
public:
|
||||
void RenderThings(subsector_t * sub, sector_t * sector);
|
||||
void RenderParticles(subsector_t *sub, sector_t *front);
|
||||
void DoSubsector(subsector_t * sub);
|
||||
void RenderThings(subsector_t * sub, sector_t * sector, FRenderState& state);
|
||||
void RenderParticles(subsector_t *sub, sector_t *front, FRenderState& state);
|
||||
void DoSubsector(subsector_t * sub, FRenderState& state);
|
||||
int SetupLightsForOtherPlane(subsector_t * sub, FDynLightData &lightdata, const secplane_t *plane);
|
||||
int CreateOtherPlaneVertices(subsector_t *sub, const secplane_t *plane);
|
||||
int CreateOtherPlaneVertices(subsector_t *sub, const secplane_t *plane, FRenderState& state);
|
||||
void DrawPSprite(HUDSprite *huds, FRenderState &state);
|
||||
void SetColor(FRenderState &state, int sectorlightlevel, int rellight, bool fullbright, const FColormap &cm, float alpha, bool weapon = false);
|
||||
void SetFog(FRenderState &state, int lightlevel, int rellight, bool fullbright, const FColormap *cmap, bool isadditive);
|
||||
|
|
@ -219,7 +219,7 @@ private:
|
|||
bool CheckFog(sector_t *frontsector, sector_t *backsector);
|
||||
WeaponLighting GetWeaponLighting(sector_t *viewsector, const DVector3 &pos, int cm, area_t in_area, const DVector3 &playerpos);
|
||||
|
||||
void PreparePlayerSprites2D(sector_t * viewsector, area_t in_area);
|
||||
void PreparePlayerSprites2D(sector_t * viewsector, area_t in_area, FRenderState& state);
|
||||
void PreparePlayerSprites3D(sector_t * viewsector, area_t in_area);
|
||||
public:
|
||||
|
||||
|
|
@ -242,8 +242,8 @@ public:
|
|||
}
|
||||
|
||||
HWPortal * FindPortal(const void * src);
|
||||
void RenderBSPNode(void *node);
|
||||
void RenderBSP(void *node, bool drawpsprites);
|
||||
void RenderBSPNode(void *node, FRenderState& state);
|
||||
void RenderBSP(void *node, bool drawpsprites, FRenderState& state);
|
||||
|
||||
static HWDrawInfo *StartDrawInfo(FLevelLocals *lev, HWDrawInfo *parent, FRenderViewpoint &parentvp, HWViewpointUniforms *uniforms);
|
||||
void StartScene(FRenderViewpoint &parentvp, HWViewpointUniforms *uniforms);
|
||||
|
|
@ -252,15 +252,15 @@ public:
|
|||
void SetViewArea();
|
||||
int SetFullbrightFlags(player_t *player);
|
||||
|
||||
void DrawScene(int drawmode);
|
||||
void CreateScene(bool drawpsprites);
|
||||
void DrawScene(int drawmode, FRenderState& state);
|
||||
void CreateScene(bool drawpsprites, FRenderState& state);
|
||||
void RenderScene(FRenderState &state);
|
||||
void RenderTranslucent(FRenderState &state);
|
||||
void RenderPortal(HWPortal *p, FRenderState &state, bool usestencil);
|
||||
void EndDrawScene(sector_t * viewsector, FRenderState &state);
|
||||
void DrawEndScene2D(sector_t * viewsector, FRenderState &state);
|
||||
void Set3DViewport(FRenderState &state);
|
||||
void ProcessScene(bool toscreen);
|
||||
void ProcessScene(bool toscreen, FRenderState& state);
|
||||
|
||||
bool DoOneSectorUpper(subsector_t * subsec, float planez, area_t in_area);
|
||||
bool DoOneSectorLower(subsector_t * subsec, float planez, area_t in_area);
|
||||
|
|
@ -274,32 +274,32 @@ public:
|
|||
void CollectSectorStacksCeiling(subsector_t * sub, sector_t * anchor, area_t in_area);
|
||||
void CollectSectorStacksFloor(subsector_t * sub, sector_t * anchor, area_t in_area);
|
||||
|
||||
void DispatchRenderHacks();
|
||||
void DispatchRenderHacks(FRenderState& state);
|
||||
void AddUpperMissingTexture(side_t * side, subsector_t *sub, float backheight);
|
||||
void AddLowerMissingTexture(side_t * side, subsector_t *sub, float backheight);
|
||||
void HandleMissingTextures(area_t in_area);
|
||||
void PrepareUnhandledMissingTextures();
|
||||
void PrepareUpperGap(seg_t * seg);
|
||||
void PrepareLowerGap(seg_t * seg);
|
||||
void HandleMissingTextures(area_t in_area, FRenderState& state);
|
||||
void PrepareUnhandledMissingTextures(FRenderState& state);
|
||||
void PrepareUpperGap(seg_t * seg, FRenderState& state);
|
||||
void PrepareLowerGap(seg_t * seg, FRenderState& state);
|
||||
void CreateFloodPoly(wallseg * ws, FFlatVertex *vertices, float planez, sector_t * sec, bool ceiling);
|
||||
void CreateFloodStencilPoly(wallseg * ws, FFlatVertex *vertices);
|
||||
|
||||
void AddHackedSubsector(subsector_t * sub);
|
||||
void HandleHackedSubsectors();
|
||||
void HandleHackedSubsectors(FRenderState& state);
|
||||
void AddFloorStack(sector_t * sec);
|
||||
void AddCeilingStack(sector_t * sec);
|
||||
void ProcessSectorStacks(area_t in_area);
|
||||
|
||||
void ProcessActorsInPortal(FLinePortalSpan *glport, area_t in_area);
|
||||
void ProcessActorsInPortal(FLinePortalSpan *glport, area_t in_area, FRenderState& state);
|
||||
|
||||
void AddOtherFloorPlane(int sector, gl_subsectorrendernode * node);
|
||||
void AddOtherCeilingPlane(int sector, gl_subsectorrendernode * node);
|
||||
void AddOtherFloorPlane(int sector, gl_subsectorrendernode * node, FRenderState& state);
|
||||
void AddOtherCeilingPlane(int sector, gl_subsectorrendernode * node, FRenderState& state);
|
||||
|
||||
void GetDynSpriteLight(AActor *self, float x, float y, float z, FLightNode *node, int portalgroup, float *out);
|
||||
void GetDynSpriteLight(AActor *thing, particle_t *particle, float *out);
|
||||
|
||||
void PreparePlayerSprites(sector_t * viewsector, area_t in_area);
|
||||
void PrepareTargeterSprites(double ticfrac);
|
||||
void PreparePlayerSprites(sector_t * viewsector, area_t in_area, FRenderState& state);
|
||||
void PrepareTargeterSprites(double ticfrac, FRenderState& state);
|
||||
|
||||
void UpdateCurrentMapSection();
|
||||
void SetViewMatrix(const FRotator &angles, float vx, float vy, float vz, bool mirror, bool planemirror);
|
||||
|
|
@ -311,11 +311,11 @@ public:
|
|||
void DrawCoronas(FRenderState& state);
|
||||
void DrawCorona(FRenderState& state, ACorona* corona, double dist);
|
||||
|
||||
void ProcessLowerMinisegs(TArray<seg_t *> &lowersegs);
|
||||
void ProcessLowerMinisegs(TArray<seg_t *> &lowersegs, FRenderState& state);
|
||||
void AddSubsectorToPortal(FSectorPortalGroup *portal, subsector_t *sub);
|
||||
|
||||
void AddWall(HWWall *w);
|
||||
void AddMirrorSurface(HWWall *w);
|
||||
void AddMirrorSurface(HWWall *w, FRenderState& state);
|
||||
void AddFlat(HWFlat *flat, bool fog);
|
||||
void AddSprite(HWSprite *sprite, bool translucent);
|
||||
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ void HWDrawList::SortPlaneIntoPlane(SortNode * head,SortNode * sort)
|
|||
//
|
||||
//
|
||||
//==========================================================================
|
||||
void HWDrawList::SortWallIntoPlane(HWDrawInfo* di, SortNode * head, SortNode * sort)
|
||||
void HWDrawList::SortWallIntoPlane(HWDrawInfo* di, FRenderState& state, SortNode * head, SortNode * sort)
|
||||
{
|
||||
HWFlat * fh = flats[drawitems[head->itemindex].index];
|
||||
HWWall * ws = walls[drawitems[sort->itemindex].index];
|
||||
|
|
@ -304,8 +304,8 @@ void HWDrawList::SortWallIntoPlane(HWDrawInfo* di, SortNode * head, SortNode * s
|
|||
w->tcs[HWWall::UPLFT].v = ws->tcs[HWWall::LOLFT].v = w->tcs[HWWall::UPRGT].v = ws->tcs[HWWall::LORGT].v = newtexv;
|
||||
w->lightuv[HWWall::UPLFT].v = ws->lightuv[HWWall::LOLFT].v = w->lightuv[HWWall::UPRGT].v = ws->lightuv[HWWall::LORGT].v = newlmv;
|
||||
}
|
||||
w->MakeVertices(di, *screen->RenderState(), false);
|
||||
ws->MakeVertices(di, *screen->RenderState(), false);
|
||||
w->MakeVertices(di, state, false);
|
||||
ws->MakeVertices(di, state, false);
|
||||
}
|
||||
|
||||
SortNode * sort2 = SortNodes.GetNew();
|
||||
|
|
@ -399,7 +399,7 @@ inline double CalcIntersectionVertex(HWWall *w1, HWWall * w2)
|
|||
return ((ay - cy)*(dx - cx) - (ax - cx)*(dy - cy)) / ((bx - ax)*(dy - cy) - (by - ay)*(dx - cx));
|
||||
}
|
||||
|
||||
void HWDrawList::SortWallIntoWall(HWDrawInfo *di, SortNode * head,SortNode * sort)
|
||||
void HWDrawList::SortWallIntoWall(HWDrawInfo *di, FRenderState& state, SortNode * head,SortNode * sort)
|
||||
{
|
||||
HWWall * wh= walls[drawitems[head->itemindex].index];
|
||||
HWWall * ws= walls[drawitems[sort->itemindex].index];
|
||||
|
|
@ -451,8 +451,8 @@ void HWDrawList::SortWallIntoWall(HWDrawInfo *di, SortNode * head,SortNode * sor
|
|||
w->zbottom[0]=ws->zbottom[1]=izb;
|
||||
w->tcs[HWWall::LOLFT].u = w->tcs[HWWall::UPLFT].u = ws->tcs[HWWall::LORGT].u = ws->tcs[HWWall::UPRGT].u = iu;
|
||||
w->lightuv[HWWall::LOLFT].u = w->lightuv[HWWall::UPLFT].u = ws->lightuv[HWWall::LORGT].u = ws->lightuv[HWWall::UPRGT].u = iu;
|
||||
ws->MakeVertices(di, *screen->RenderState(), false);
|
||||
w->MakeVertices(di, *screen->RenderState(), false);
|
||||
ws->MakeVertices(di, state, false);
|
||||
w->MakeVertices(di, state, false);
|
||||
|
||||
SortNode * sort2=SortNodes.GetNew();
|
||||
memset(sort2,0,sizeof(SortNode));
|
||||
|
|
@ -490,7 +490,7 @@ inline double CalcIntersectionVertex(HWSprite *s, HWWall * w2)
|
|||
return ((ay - cy)*(dx - cx) - (ax - cx)*(dy - cy)) / ((bx - ax)*(dy - cy) - (by - ay)*(dx - cx));
|
||||
}
|
||||
|
||||
void HWDrawList::SortSpriteIntoWall(HWDrawInfo *di, SortNode * head,SortNode * sort)
|
||||
void HWDrawList::SortSpriteIntoWall(HWDrawInfo *di, FRenderState& state, SortNode * head,SortNode * sort)
|
||||
{
|
||||
HWWall *wh= walls[drawitems[head->itemindex].index];
|
||||
HWSprite * ss= sprites[drawitems[sort->itemindex].index];
|
||||
|
|
@ -573,8 +573,8 @@ void HWDrawList::SortSpriteIntoWall(HWDrawInfo *di, SortNode * head,SortNode * s
|
|||
}
|
||||
else
|
||||
{
|
||||
s->CreateVertices(di);
|
||||
ss->CreateVertices(di);
|
||||
s->CreateVertices(di, state);
|
||||
ss->CreateVertices(di, state);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -633,7 +633,7 @@ SortNode * HWDrawList::SortSpriteList(SortNode * head)
|
|||
//
|
||||
//
|
||||
//==========================================================================
|
||||
SortNode * HWDrawList::DoSort(HWDrawInfo *di, SortNode * head)
|
||||
SortNode * HWDrawList::DoSort(HWDrawInfo *di, FRenderState& state, SortNode * head)
|
||||
{
|
||||
SortNode * node, * sn, * next;
|
||||
|
||||
|
|
@ -654,7 +654,7 @@ SortNode * HWDrawList::DoSort(HWDrawInfo *di, SortNode * head)
|
|||
break;
|
||||
|
||||
case DrawType_WALL:
|
||||
SortWallIntoPlane(di,head,node);
|
||||
SortWallIntoPlane(di,state,head,node);
|
||||
break;
|
||||
|
||||
case DrawType_SPRITE:
|
||||
|
|
@ -679,11 +679,11 @@ SortNode * HWDrawList::DoSort(HWDrawInfo *di, SortNode * head)
|
|||
switch(drawitems[node->itemindex].rendertype)
|
||||
{
|
||||
case DrawType_WALL:
|
||||
SortWallIntoWall(di, head,node);
|
||||
SortWallIntoWall(di, state, head, node);
|
||||
break;
|
||||
|
||||
case DrawType_SPRITE:
|
||||
SortSpriteIntoWall(di, head, node);
|
||||
SortSpriteIntoWall(di, state, head, node);
|
||||
break;
|
||||
|
||||
case DrawType_FLAT: break;
|
||||
|
|
@ -696,8 +696,8 @@ SortNode * HWDrawList::DoSort(HWDrawInfo *di, SortNode * head)
|
|||
return SortSpriteList(head);
|
||||
}
|
||||
}
|
||||
if (head->left) head->left=DoSort(di, head->left);
|
||||
if (head->right) head->right=DoSort(di, head->right);
|
||||
if (head->left) head->left=DoSort(di, state, head->left);
|
||||
if (head->right) head->right=DoSort(di, state, head->right);
|
||||
return sn;
|
||||
}
|
||||
|
||||
|
|
@ -706,12 +706,12 @@ SortNode * HWDrawList::DoSort(HWDrawInfo *di, SortNode * head)
|
|||
//
|
||||
//
|
||||
//==========================================================================
|
||||
void HWDrawList::Sort(HWDrawInfo *di)
|
||||
void HWDrawList::Sort(HWDrawInfo *di, FRenderState& state)
|
||||
{
|
||||
reverseSort = !!(di->Level->i_compatflags & COMPATF_SPRITESORT);
|
||||
SortZ = di->Viewpoint.Pos.Z;
|
||||
MakeSortList();
|
||||
sorted = DoSort(di, SortNodes[SortNodeStart]);
|
||||
sorted = DoSort(di, state, SortNodes[SortNodeStart]);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
@ -940,7 +940,7 @@ void HWDrawList::DrawSorted(HWDrawInfo *di, FRenderState &state)
|
|||
if (!sorted)
|
||||
{
|
||||
screen->mVertexData->Map();
|
||||
Sort(di);
|
||||
Sort(di, state);
|
||||
screen->mVertexData->Unmap();
|
||||
}
|
||||
state.ClearClipSplit();
|
||||
|
|
|
|||
|
|
@ -100,14 +100,14 @@ public:
|
|||
SortNode * FindSortPlane(SortNode * head);
|
||||
SortNode * FindSortWall(SortNode * head);
|
||||
void SortPlaneIntoPlane(SortNode * head,SortNode * sort);
|
||||
void SortWallIntoPlane(HWDrawInfo* di, SortNode * head,SortNode * sort);
|
||||
void SortWallIntoPlane(HWDrawInfo* di, FRenderState& state, SortNode * head,SortNode * sort);
|
||||
void SortSpriteIntoPlane(SortNode * head,SortNode * sort);
|
||||
void SortWallIntoWall(HWDrawInfo *di, SortNode * head,SortNode * sort);
|
||||
void SortSpriteIntoWall(HWDrawInfo *di, SortNode * head,SortNode * sort);
|
||||
void SortWallIntoWall(HWDrawInfo *di, FRenderState& state, SortNode * head,SortNode * sort);
|
||||
void SortSpriteIntoWall(HWDrawInfo *di, FRenderState& state, SortNode * head,SortNode * sort);
|
||||
int CompareSprites(SortNode * a,SortNode * b);
|
||||
SortNode * SortSpriteList(SortNode * head);
|
||||
SortNode * DoSort(HWDrawInfo *di, SortNode * head);
|
||||
void Sort(HWDrawInfo *di);
|
||||
SortNode * DoSort(HWDrawInfo *di, FRenderState& state, SortNode * head);
|
||||
void Sort(HWDrawInfo *di, FRenderState& state);
|
||||
|
||||
void DoDraw(HWDrawInfo *di, FRenderState &state, bool translucent, int i);
|
||||
void Draw(HWDrawInfo *di, FRenderState &state, bool translucent);
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ void HWDrawInfo::AddWall(HWWall *wall)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWDrawInfo::AddMirrorSurface(HWWall *w)
|
||||
void HWDrawInfo::AddMirrorSurface(HWWall *w, FRenderState& state)
|
||||
{
|
||||
w->type = RENDERWALL_MIRRORSURFACE;
|
||||
auto newwall = drawlists[GLDL_TRANSLUCENTBORDER].NewWall();
|
||||
|
|
@ -81,14 +81,14 @@ void HWDrawInfo::AddMirrorSurface(HWWall *w)
|
|||
auto tcs = newwall->tcs;
|
||||
tcs[HWWall::LOLFT].u = tcs[HWWall::LORGT].u = tcs[HWWall::UPLFT].u = tcs[HWWall::UPRGT].u = v.X;
|
||||
tcs[HWWall::LOLFT].v = tcs[HWWall::LORGT].v = tcs[HWWall::UPLFT].v = tcs[HWWall::UPRGT].v = v.Z;
|
||||
newwall->MakeVertices(this, *screen->RenderState(), false);
|
||||
newwall->MakeVertices(this, state, false);
|
||||
|
||||
bool hasDecals = newwall->seg->sidedef && newwall->seg->sidedef->AttachedDecals;
|
||||
if (hasDecals && Level->HasDynamicLights && !isFullbrightScene())
|
||||
{
|
||||
newwall->SetupLights(this, lightdata);
|
||||
}
|
||||
newwall->ProcessDecals(this);
|
||||
newwall->ProcessDecals(this, state);
|
||||
newwall->dynlightindex = -1; // the environment map should not be affected by lights - only the decals.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -204,36 +204,36 @@ public:
|
|||
sector_t *frontsector, *backsector;
|
||||
//private:
|
||||
|
||||
void PutWall(HWDrawInfo *di, bool translucent);
|
||||
void PutPortal(HWDrawInfo *di, int ptype, int plane);
|
||||
void PutWall(HWDrawInfo *di, FRenderState& state, bool translucent);
|
||||
void PutPortal(HWDrawInfo *di, FRenderState& state, int ptype, int plane);
|
||||
void CheckTexturePosition(FTexCoordInfo *tci);
|
||||
|
||||
void Put3DWall(HWDrawInfo *di, lightlist_t * lightlist, bool translucent);
|
||||
bool SplitWallComplex(HWDrawInfo *di, sector_t * frontsector, bool translucent, float& maplightbottomleft, float& maplightbottomright);
|
||||
void SplitWall(HWDrawInfo *di, sector_t * frontsector, bool translucent);
|
||||
void Put3DWall(HWDrawInfo *di, FRenderState& state, lightlist_t * lightlist, bool translucent);
|
||||
bool SplitWallComplex(HWDrawInfo *di, FRenderState& state, sector_t * frontsector, bool translucent, float& maplightbottomleft, float& maplightbottomright);
|
||||
void SplitWall(HWDrawInfo *di, FRenderState& state, sector_t * frontsector, bool translucent);
|
||||
|
||||
void SetupLights(HWDrawInfo *di, FDynLightData &lightdata);
|
||||
|
||||
void MakeVertices(HWDrawInfo *di, FRenderState& state, bool nosplit);
|
||||
|
||||
void SkyPlane(HWDrawInfo *di, sector_t *sector, int plane, bool allowmirror);
|
||||
void SkyLine(HWDrawInfo *di, sector_t *sec, line_t *line);
|
||||
void SkyNormal(HWDrawInfo *di, sector_t * fs,vertex_t * v1,vertex_t * v2);
|
||||
void SkyTop(HWDrawInfo *di, seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex_t * v2);
|
||||
void SkyBottom(HWDrawInfo *di, seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex_t * v2);
|
||||
void SkyPlane(HWDrawInfo *di, FRenderState& state, sector_t *sector, int plane, bool allowmirror);
|
||||
void SkyLine(HWDrawInfo *di, FRenderState& state, sector_t *sec, line_t *line);
|
||||
void SkyNormal(HWDrawInfo *di, FRenderState& state, sector_t * fs,vertex_t * v1,vertex_t * v2);
|
||||
void SkyTop(HWDrawInfo *di, FRenderState& state, seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex_t * v2);
|
||||
void SkyBottom(HWDrawInfo *di, FRenderState& state, seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex_t * v2);
|
||||
|
||||
bool DoHorizon(HWDrawInfo *di, seg_t * seg,sector_t * fs, vertex_t * v1,vertex_t * v2);
|
||||
bool DoHorizon(HWDrawInfo *di, FRenderState& state, seg_t * seg,sector_t * fs, vertex_t * v1,vertex_t * v2);
|
||||
|
||||
bool SetWallCoordinates(seg_t * seg, FTexCoordInfo *tci, float ceilingrefheight,
|
||||
float topleft, float topright, float bottomleft, float bottomright, float t_ofs);
|
||||
|
||||
void DoTexture(HWDrawInfo *di, int type,seg_t * seg,int peg,
|
||||
void DoTexture(HWDrawInfo *di, FRenderState& state, int type,seg_t * seg,int peg,
|
||||
float ceilingrefheight, float floorrefheight,
|
||||
float CeilingHeightstart,float CeilingHeightend,
|
||||
float FloorHeightstart,float FloorHeightend,
|
||||
float v_offset);
|
||||
|
||||
void DoMidTexture(HWDrawInfo *di, seg_t * seg, bool drawfogboundary,
|
||||
void DoMidTexture(HWDrawInfo *di, FRenderState& state, seg_t * seg, bool drawfogboundary,
|
||||
sector_t * front, sector_t * back,
|
||||
sector_t * realfront, sector_t * realback,
|
||||
float fch1, float fch2, float ffh1, float ffh2,
|
||||
|
|
@ -241,21 +241,21 @@ public:
|
|||
|
||||
void GetPlanePos(F3DFloor::planeref * planeref, float & left, float & right);
|
||||
|
||||
void BuildFFBlock(HWDrawInfo *di, seg_t * seg, F3DFloor * rover, int roverIndex,
|
||||
void BuildFFBlock(HWDrawInfo *di, FRenderState& state, seg_t * seg, F3DFloor * rover, int roverIndex,
|
||||
float ff_topleft, float ff_topright,
|
||||
float ff_bottomleft, float ff_bottomright);
|
||||
void InverseFloors(HWDrawInfo *di, seg_t * seg, sector_t * frontsector,
|
||||
void InverseFloors(HWDrawInfo *di, FRenderState& state, seg_t * seg, sector_t * frontsector,
|
||||
float topleft, float topright,
|
||||
float bottomleft, float bottomright);
|
||||
void ClipFFloors(HWDrawInfo *di, seg_t * seg, F3DFloor * ffloor, int ffloorIndex, sector_t * frontsector,
|
||||
void ClipFFloors(HWDrawInfo *di, FRenderState& state, seg_t * seg, F3DFloor * ffloor, int ffloorIndex, sector_t * frontsector,
|
||||
float topleft, float topright,
|
||||
float bottomleft, float bottomright);
|
||||
void DoFFloorBlocks(HWDrawInfo *di, seg_t * seg, sector_t * frontsector, sector_t * backsector,
|
||||
void DoFFloorBlocks(HWDrawInfo *di, FRenderState& state, seg_t * seg, sector_t * frontsector, sector_t * backsector,
|
||||
float fch1, float fch2, float ffh1, float ffh2,
|
||||
float bch1, float bch2, float bfh1, float bfh2);
|
||||
|
||||
void ProcessDecal(HWDrawInfo *di, DBaseDecal *decal, const FVector3 &normal);
|
||||
void ProcessDecals(HWDrawInfo *di);
|
||||
void ProcessDecal(HWDrawInfo *di, FRenderState& state, DBaseDecal *decal, const FVector3 &normal);
|
||||
void ProcessDecals(HWDrawInfo *di, FRenderState& state);
|
||||
|
||||
int CreateVertices(FFlatVertex *&ptr, bool nosplit);
|
||||
void SplitLeftEdge (FFlatVertex *&ptr);
|
||||
|
|
@ -276,8 +276,8 @@ public:
|
|||
void DrawDecalsForMirror(HWDrawInfo *di, FRenderState &state, TArray<HWDecal *> &decals);
|
||||
|
||||
public:
|
||||
void Process(HWDrawInfo *di, seg_t *seg, sector_t *frontsector, sector_t *backsector);
|
||||
void ProcessLowerMiniseg(HWDrawInfo *di, seg_t *seg, sector_t *frontsector, sector_t *backsector);
|
||||
void Process(HWDrawInfo *di, FRenderState& state, seg_t *seg, sector_t *frontsector, sector_t *backsector);
|
||||
void ProcessLowerMiniseg(HWDrawInfo *di, FRenderState& state, seg_t *seg, sector_t *frontsector, sector_t *backsector);
|
||||
|
||||
float PointOnSide(float x,float y)
|
||||
{
|
||||
|
|
@ -324,9 +324,9 @@ public:
|
|||
void SetupLights(HWDrawInfo *di, FLightNode *head, FDynLightData &lightdata, int portalgroup);
|
||||
|
||||
void PutFlat(HWDrawInfo *di, bool fog = false);
|
||||
void Process(HWDrawInfo *di, sector_t * model, int whichplane, bool notexture);
|
||||
void Process(HWDrawInfo *di, FRenderState& state, sector_t * model, int whichplane, bool notexture);
|
||||
void SetFrom3DFloor(F3DFloor *rover, bool top, bool underside);
|
||||
void ProcessSector(HWDrawInfo *di, sector_t * frontsector, int which = 7 /*SSRF_RENDERALL*/); // cannot use constant due to circular dependencies.
|
||||
void ProcessSector(HWDrawInfo *di, FRenderState& state, sector_t * frontsector, int which = 7 /*SSRF_RENDERALL*/); // cannot use constant due to circular dependencies.
|
||||
|
||||
void DrawSubsectors(HWDrawInfo *di, FRenderState &state);
|
||||
void DrawFlat(HWDrawInfo *di, FRenderState &state, bool translucent);
|
||||
|
|
@ -380,16 +380,16 @@ public:
|
|||
DRotator Angles;
|
||||
|
||||
|
||||
void SplitSprite(HWDrawInfo *di, sector_t * frontsector, bool translucent);
|
||||
void SplitSprite(HWDrawInfo *di, FRenderState& state, sector_t * frontsector, bool translucent);
|
||||
void PerformSpriteClipAdjustment(AActor *thing, const DVector2 &thingpos, float spriteheight);
|
||||
bool CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp);
|
||||
|
||||
public:
|
||||
|
||||
void CreateVertices(HWDrawInfo *di);
|
||||
void PutSprite(HWDrawInfo *di, bool translucent);
|
||||
void Process(HWDrawInfo *di, AActor* thing,sector_t * sector, area_t in_area, int thruportal = false, bool isSpriteShadow = false);
|
||||
void ProcessParticle (HWDrawInfo *di, particle_t *particle, sector_t *sector);//, int shade, int fakeside)
|
||||
void CreateVertices(HWDrawInfo *di, FRenderState& state);
|
||||
void PutSprite(HWDrawInfo *di, FRenderState& state, bool translucent);
|
||||
void Process(HWDrawInfo *di, FRenderState& state, AActor* thing,sector_t * sector, area_t in_area, int thruportal = false, bool isSpriteShadow = false);
|
||||
void ProcessParticle (HWDrawInfo *di, FRenderState& state, particle_t *particle, sector_t *sector);//, int shade, int fakeside)
|
||||
|
||||
void DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -405,7 +405,7 @@ inline void HWFlat::PutFlat(HWDrawInfo *di, bool fog)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWFlat::Process(HWDrawInfo *di, sector_t * model, int whichplane, bool fog)
|
||||
void HWFlat::Process(HWDrawInfo *di, FRenderState& state, sector_t * model, int whichplane, bool fog)
|
||||
{
|
||||
plane.GetFromSector(model, whichplane);
|
||||
if (whichplane != int(ceiling))
|
||||
|
|
@ -433,7 +433,7 @@ void HWFlat::Process(HWDrawInfo *di, sector_t * model, int whichplane, bool fog)
|
|||
z = plane.plane.ZatPoint(0.f, 0.f);
|
||||
if (sector->special == GLSector_Skybox)
|
||||
{
|
||||
auto vert = screen->mVertexData->AllocVertices(4);
|
||||
auto vert = state.AllocVertices(4);
|
||||
CreateSkyboxVertices(vert.first);
|
||||
iboindex = vert.second;
|
||||
}
|
||||
|
|
@ -486,7 +486,7 @@ void HWFlat::SetFrom3DFloor(F3DFloor *rover, bool top, bool underside)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWFlat::ProcessSector(HWDrawInfo *di, sector_t * frontsector, int which)
|
||||
void HWFlat::ProcessSector(HWDrawInfo *di, FRenderState& state, sector_t * frontsector, int which)
|
||||
{
|
||||
lightlist_t * light;
|
||||
FSectorPortal *port;
|
||||
|
|
@ -562,7 +562,7 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sector_t * frontsector, int which)
|
|||
CopyFrom3DLight(Colormap, light);
|
||||
}
|
||||
renderstyle = STYLE_Translucent;
|
||||
Process(di, frontsector, sector_t::floor, false);
|
||||
Process(di, state, frontsector, sector_t::floor, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -618,7 +618,7 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sector_t * frontsector, int which)
|
|||
CopyFrom3DLight(Colormap, light);
|
||||
}
|
||||
renderstyle = STYLE_Translucent;
|
||||
Process(di, frontsector, sector_t::ceiling, false);
|
||||
Process(di, state, frontsector, sector_t::ceiling, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -662,7 +662,7 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sector_t * frontsector, int which)
|
|||
{
|
||||
SetFrom3DFloor(rover, true, !!(rover->flags&FF_FOG));
|
||||
Colormap.FadeColor = frontsector->Colormap.FadeColor;
|
||||
Process(di, rover->top.model, rover->top.isceiling, !!(rover->flags&FF_FOG));
|
||||
Process(di, state, rover->top.model, rover->top.isceiling, !!(rover->flags&FF_FOG));
|
||||
}
|
||||
lastceilingheight = ff_top;
|
||||
}
|
||||
|
|
@ -676,7 +676,7 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sector_t * frontsector, int which)
|
|||
{
|
||||
SetFrom3DFloor(rover, false, !(rover->flags&FF_FOG));
|
||||
Colormap.FadeColor = frontsector->Colormap.FadeColor;
|
||||
Process(di, rover->bottom.model, rover->bottom.isceiling, !!(rover->flags&FF_FOG));
|
||||
Process(di, state, rover->bottom.model, rover->bottom.isceiling, !!(rover->flags&FF_FOG));
|
||||
}
|
||||
lastceilingheight = ff_bottom;
|
||||
if (rover->alpha < 255) lastceilingheight += EQUAL_EPSILON;
|
||||
|
|
@ -709,7 +709,7 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sector_t * frontsector, int which)
|
|||
Colormap = rover->GetColormap();
|
||||
}
|
||||
|
||||
Process(di, rover->bottom.model, rover->bottom.isceiling, !!(rover->flags&FF_FOG));
|
||||
Process(di, state, rover->bottom.model, rover->bottom.isceiling, !!(rover->flags&FF_FOG));
|
||||
}
|
||||
lastfloorheight = ff_bottom;
|
||||
}
|
||||
|
|
@ -723,7 +723,7 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sector_t * frontsector, int which)
|
|||
{
|
||||
SetFrom3DFloor(rover, true, !!(rover->flags&FF_FOG));
|
||||
Colormap.FadeColor = frontsector->Colormap.FadeColor;
|
||||
Process(di, rover->top.model, rover->top.isceiling, !!(rover->flags&FF_FOG));
|
||||
Process(di, state, rover->top.model, rover->top.isceiling, !!(rover->flags&FF_FOG));
|
||||
}
|
||||
lastfloorheight = ff_top;
|
||||
if (rover->alpha < 255) lastfloorheight -= EQUAL_EPSILON;
|
||||
|
|
|
|||
|
|
@ -77,6 +77,8 @@ void HWMeshCache::Update(FRenderViewpoint& vp)
|
|||
HWDrawInfo* di = HWDrawInfo::StartDrawInfo(vp.ViewLevel, nullptr, vp, nullptr);
|
||||
di->MeshBuilding = true;
|
||||
|
||||
MeshBuilder state;
|
||||
|
||||
// Add to the draw lists
|
||||
|
||||
unsigned int count = level->sectors.Size();
|
||||
|
|
@ -96,7 +98,7 @@ void HWMeshCache::Update(FRenderViewpoint& vp)
|
|||
HWFlat flat;
|
||||
flat.section = subsector->section;
|
||||
sector_t* front = hw_FakeFlat(subsector->render_sector, area_default, false);
|
||||
flat.ProcessSector(di, front);
|
||||
flat.ProcessSector(di, state, front);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -106,14 +108,12 @@ void HWMeshCache::Update(FRenderViewpoint& vp)
|
|||
|
||||
HWWall wall;
|
||||
wall.sub = sector->subsectors[0];
|
||||
wall.Process(di, side->segs[0], sector, (line->sidedef[0]->sector == sector) ? line->backsector : line->frontsector);
|
||||
wall.Process(di, state, side->segs[0], sector, (line->sidedef[0]->sector == sector) ? line->backsector : line->frontsector);
|
||||
}
|
||||
}
|
||||
|
||||
// Convert draw lists to meshes
|
||||
|
||||
MeshBuilder state;
|
||||
|
||||
state.SetDepthMask(true);
|
||||
state.EnableFog(true);
|
||||
state.SetRenderStyle(STYLE_Source);
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ void HWPortal::DrawPortalStencil(FRenderState &state, int pass)
|
|||
screen->mVertexData->Map();
|
||||
if (planesused & (1 << sector_t::floor))
|
||||
{
|
||||
auto verts = screen->mVertexData->AllocVertices(4);
|
||||
auto verts = state.AllocVertices(4);
|
||||
auto ptr = verts.first;
|
||||
ptr[0].Set((float)boundingBox.left, -32767.f, (float)boundingBox.top, 0, 0);
|
||||
ptr[1].Set((float)boundingBox.right, -32767.f, (float)boundingBox.top, 0, 0);
|
||||
|
|
@ -204,7 +204,7 @@ void HWPortal::DrawPortalStencil(FRenderState &state, int pass)
|
|||
}
|
||||
if (planesused & (1 << sector_t::ceiling))
|
||||
{
|
||||
auto verts = screen->mVertexData->AllocVertices(4);
|
||||
auto verts = state.AllocVertices(4);
|
||||
auto ptr = verts.first;
|
||||
ptr[0].Set((float)boundingBox.left, 32767.f, (float)boundingBox.top, 0, 0);
|
||||
ptr[1].Set((float)boundingBox.right, 32767.f, (float)boundingBox.top, 0, 0);
|
||||
|
|
@ -641,9 +641,9 @@ bool HWLineToLinePortal::Setup(HWDrawInfo *di, FRenderState &rstate, Clipper *cl
|
|||
return true;
|
||||
}
|
||||
|
||||
void HWLineToLinePortal::RenderAttached(HWDrawInfo *di)
|
||||
void HWLineToLinePortal::RenderAttached(HWDrawInfo *di, FRenderState& state)
|
||||
{
|
||||
di->ProcessActorsInPortal(glport, di->in_area);
|
||||
di->ProcessActorsInPortal(glport, di->in_area, state);
|
||||
}
|
||||
|
||||
const char *HWLineToLinePortal::GetName() { return "LineToLine"; }
|
||||
|
|
@ -884,7 +884,7 @@ const char *HWPlaneMirrorPortal::GetName() { return origin->fC() < 0? "Planemirr
|
|||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
HWHorizonPortal::HWHorizonPortal(FPortalSceneState *s, HWHorizonInfo * pt, FRenderViewpoint &vp, bool local)
|
||||
HWHorizonPortal::HWHorizonPortal(FPortalSceneState *s, FRenderState& renderstate, HWHorizonInfo * pt, FRenderViewpoint &vp, bool local)
|
||||
: HWPortal(s, local)
|
||||
{
|
||||
origin = pt;
|
||||
|
|
@ -899,7 +899,7 @@ HWHorizonPortal::HWHorizonPortal(FPortalSceneState *s, HWHorizonInfo * pt, FRend
|
|||
|
||||
// Draw to some far away boundary
|
||||
// This is not drawn as larger strips because it causes visual glitches.
|
||||
auto verts = screen->mVertexData->AllocVertices(1024 + 10);
|
||||
auto verts = renderstate.AllocVertices(1024 + 10);
|
||||
auto ptr = verts.first;
|
||||
for (int xx = -32768; xx < 32768; xx += 4096)
|
||||
{
|
||||
|
|
@ -1044,7 +1044,7 @@ void HWEEHorizonPortal::DrawContents(HWDrawInfo *di, FRenderState &state)
|
|||
{
|
||||
horz.plane.Texheight = vp.Pos.Z + fabs(horz.plane.Texheight);
|
||||
}
|
||||
HWHorizonPortal ceil(mState, &horz, di->Viewpoint, true);
|
||||
HWHorizonPortal ceil(mState, state, &horz, di->Viewpoint, true);
|
||||
ceil.DrawContents(di, state);
|
||||
}
|
||||
if (sector->GetTexture(sector_t::floor) != skyflatnum)
|
||||
|
|
@ -1058,7 +1058,7 @@ void HWEEHorizonPortal::DrawContents(HWDrawInfo *di, FRenderState &state)
|
|||
{
|
||||
horz.plane.Texheight = vp.Pos.Z - fabs(horz.plane.Texheight);
|
||||
}
|
||||
HWHorizonPortal floor(mState, &horz, di->Viewpoint, true);
|
||||
HWHorizonPortal floor(mState, state, &horz, di->Viewpoint, true);
|
||||
floor.DrawContents(di, state);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ public:
|
|||
virtual bool NeedCap() { return true; }
|
||||
virtual bool NeedDepthBuffer() { return true; }
|
||||
virtual void DrawContents(HWDrawInfo *di, FRenderState &state) = 0;
|
||||
virtual void RenderAttached(HWDrawInfo *di) {}
|
||||
virtual void RenderAttached(HWDrawInfo *di, FRenderState& state) {}
|
||||
void SetupStencil(HWDrawInfo *di, FRenderState &state, bool usestencil);
|
||||
void RemoveStencil(HWDrawInfo *di, FRenderState &state, bool usestencil);
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ public:
|
|||
{
|
||||
if (Setup(di, state, di->mClipper))
|
||||
{
|
||||
di->DrawScene(DM_PORTAL);
|
||||
di->DrawScene(DM_PORTAL, state);
|
||||
Shutdown(di, state);
|
||||
}
|
||||
else state.ClearScreen();
|
||||
|
|
@ -225,7 +225,7 @@ protected:
|
|||
virtual void * GetSource() const override { return glport; }
|
||||
virtual const char *GetName() override;
|
||||
virtual linebase_t *ClipLine() override { return this; }
|
||||
virtual void RenderAttached(HWDrawInfo *di) override;
|
||||
virtual void RenderAttached(HWDrawInfo *di, FRenderState& state) override;
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -323,7 +323,7 @@ protected:
|
|||
|
||||
public:
|
||||
|
||||
HWHorizonPortal(FPortalSceneState *state, HWHorizonInfo * pt, FRenderViewpoint &vp, bool local = false);
|
||||
HWHorizonPortal(FPortalSceneState *state, FRenderState& renderstate, HWHorizonInfo * pt, FRenderViewpoint &vp, bool local = false);
|
||||
};
|
||||
|
||||
struct HWEEHorizonPortal : public HWPortal
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWDrawInfo::DispatchRenderHacks()
|
||||
void HWDrawInfo::DispatchRenderHacks(FRenderState& state)
|
||||
{
|
||||
TMap<int, gl_subsectorrendernode*>::Pair *pair;
|
||||
TMap<int, gl_floodrendernode*>::Pair *fpair;
|
||||
|
|
@ -58,28 +58,28 @@ void HWDrawInfo::DispatchRenderHacks()
|
|||
while (ofi.NextPair(pair))
|
||||
{
|
||||
auto sec = hw_FakeFlat(&Level->sectors[pair->Key], in_area, false);
|
||||
glflat.ProcessSector(this, sec, SSRF_RENDERFLOOR | SSRF_PLANEHACK);
|
||||
glflat.ProcessSector(this, state, sec, SSRF_RENDERFLOOR | SSRF_PLANEHACK);
|
||||
}
|
||||
|
||||
TMap<int, gl_subsectorrendernode*>::Iterator oci(otherCeilingPlanes);
|
||||
while (oci.NextPair(pair))
|
||||
{
|
||||
auto sec = hw_FakeFlat(&Level->sectors[pair->Key], in_area, false);
|
||||
glflat.ProcessSector(this, sec, SSRF_RENDERCEILING | SSRF_PLANEHACK);
|
||||
glflat.ProcessSector(this, state, sec, SSRF_RENDERCEILING | SSRF_PLANEHACK);
|
||||
}
|
||||
|
||||
TMap<int, gl_floodrendernode*>::Iterator ffi(floodFloorSegs);
|
||||
while (ffi.NextPair(fpair))
|
||||
{
|
||||
auto sec = hw_FakeFlat(&Level->sectors[fpair->Key], in_area, false);
|
||||
glflat.ProcessSector(this, sec, SSRF_RENDERFLOOR | SSRF_FLOODHACK);
|
||||
glflat.ProcessSector(this, state, sec, SSRF_RENDERFLOOR | SSRF_FLOODHACK);
|
||||
}
|
||||
|
||||
TMap<int, gl_floodrendernode*>::Iterator fci(floodCeilingSegs);
|
||||
while (fci.NextPair(fpair))
|
||||
{
|
||||
auto sec = hw_FakeFlat(&Level->sectors[fpair->Key], in_area, false);
|
||||
glflat.ProcessSector(this, sec, SSRF_RENDERCEILING | SSRF_FLOODHACK);
|
||||
glflat.ProcessSector(this, state, sec, SSRF_RENDERCEILING | SSRF_FLOODHACK);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -144,9 +144,9 @@ 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, FRenderState& state)
|
||||
{
|
||||
auto alloc = screen->mVertexData->AllocVertices(sub->numlines);
|
||||
auto alloc = state.AllocVertices(sub->numlines);
|
||||
auto ptr = alloc.first;
|
||||
for (unsigned int k = 0; k < sub->numlines; k++)
|
||||
{
|
||||
|
|
@ -167,23 +167,23 @@ int HWDrawInfo::CreateOtherPlaneVertices(subsector_t *sub, const secplane_t *pla
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWDrawInfo::AddOtherFloorPlane(int sector, gl_subsectorrendernode * node)
|
||||
void HWDrawInfo::AddOtherFloorPlane(int sector, gl_subsectorrendernode* node, FRenderState& state)
|
||||
{
|
||||
auto pNode = otherFloorPlanes.CheckKey(sector);
|
||||
|
||||
node->next = pNode? *pNode : nullptr;
|
||||
node->lightindex = SetupLightsForOtherPlane(node->sub, lightdata, &Level->sectors[sector].floorplane);
|
||||
node->vertexindex = CreateOtherPlaneVertices(node->sub, &Level->sectors[sector].floorplane);
|
||||
node->vertexindex = CreateOtherPlaneVertices(node->sub, &Level->sectors[sector].floorplane, state);
|
||||
otherFloorPlanes[sector] = node;
|
||||
}
|
||||
|
||||
void HWDrawInfo::AddOtherCeilingPlane(int sector, gl_subsectorrendernode * node)
|
||||
void HWDrawInfo::AddOtherCeilingPlane(int sector, gl_subsectorrendernode* node, FRenderState& state)
|
||||
{
|
||||
auto pNode = otherCeilingPlanes.CheckKey(sector);
|
||||
|
||||
node->next = pNode? *pNode : nullptr;
|
||||
node->lightindex = SetupLightsForOtherPlane(node->sub, lightdata, &Level->sectors[sector].ceilingplane);
|
||||
node->vertexindex = CreateOtherPlaneVertices(node->sub, &Level->sectors[sector].ceilingplane);
|
||||
node->vertexindex = CreateOtherPlaneVertices(node->sub, &Level->sectors[sector].ceilingplane, state);
|
||||
otherCeilingPlanes[sector] = node;
|
||||
}
|
||||
|
||||
|
|
@ -536,7 +536,7 @@ bool HWDrawInfo::DoFakeCeilingBridge(subsector_t * subsec, float Planez, area_t
|
|||
// Draws the fake planes
|
||||
//
|
||||
//==========================================================================
|
||||
void HWDrawInfo::HandleMissingTextures(area_t in_area)
|
||||
void HWDrawInfo::HandleMissingTextures(area_t in_area, FRenderState& state)
|
||||
{
|
||||
for (unsigned int i = 0; i < MissingUpperTextures.Size(); i++)
|
||||
{
|
||||
|
|
@ -557,7 +557,7 @@ void HWDrawInfo::HandleMissingTextures(area_t in_area)
|
|||
gl_subsectorrendernode * node = NewSubsectorRenderNode();
|
||||
node->sub = HandledSubsectors[j];
|
||||
|
||||
AddOtherCeilingPlane(sec->sectornum, node);
|
||||
AddOtherCeilingPlane(sec->sectornum, node, state);
|
||||
}
|
||||
|
||||
if (HandledSubsectors.Size() != 1)
|
||||
|
|
@ -597,7 +597,7 @@ void HWDrawInfo::HandleMissingTextures(area_t in_area)
|
|||
{
|
||||
gl_subsectorrendernode * node = NewSubsectorRenderNode();
|
||||
node->sub = HandledSubsectors[j];
|
||||
AddOtherCeilingPlane(fakesector->sectornum, node);
|
||||
AddOtherCeilingPlane(fakesector->sectornum, node, state);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
|
|
@ -623,7 +623,7 @@ void HWDrawInfo::HandleMissingTextures(area_t in_area)
|
|||
{
|
||||
gl_subsectorrendernode * node = NewSubsectorRenderNode();
|
||||
node->sub = HandledSubsectors[j];
|
||||
AddOtherFloorPlane(sec->sectornum, node);
|
||||
AddOtherFloorPlane(sec->sectornum, node, state);
|
||||
}
|
||||
|
||||
if (HandledSubsectors.Size() != 1)
|
||||
|
|
@ -663,7 +663,7 @@ void HWDrawInfo::HandleMissingTextures(area_t in_area)
|
|||
{
|
||||
gl_subsectorrendernode * node = NewSubsectorRenderNode();
|
||||
node->sub = HandledSubsectors[j];
|
||||
AddOtherFloorPlane(fakesector->sectornum, node);
|
||||
AddOtherFloorPlane(fakesector->sectornum, node, state);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
|
|
@ -724,7 +724,7 @@ void HWDrawInfo::CreateFloodPoly(wallseg * ws, FFlatVertex *vertices, float plan
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWDrawInfo::PrepareUpperGap(seg_t * seg)
|
||||
void HWDrawInfo::PrepareUpperGap(seg_t * seg, FRenderState& state)
|
||||
{
|
||||
wallseg ws;
|
||||
sector_t * fakefsector = hw_FakeFlat(seg->frontsector, in_area, false);
|
||||
|
|
@ -759,7 +759,7 @@ void HWDrawInfo::PrepareUpperGap(seg_t * seg)
|
|||
ws.z1 = frontz;
|
||||
ws.z2 = backz;
|
||||
|
||||
auto vertices = screen->mVertexData->AllocVertices(8);
|
||||
auto vertices = state.AllocVertices(8);
|
||||
|
||||
CreateFloodStencilPoly(&ws, vertices.first);
|
||||
CreateFloodPoly(&ws, vertices.first+4, ws.z2, fakebsector, true);
|
||||
|
|
@ -780,7 +780,7 @@ void HWDrawInfo::PrepareUpperGap(seg_t * seg)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWDrawInfo::PrepareLowerGap(seg_t * seg)
|
||||
void HWDrawInfo::PrepareLowerGap(seg_t * seg, FRenderState& state)
|
||||
{
|
||||
wallseg ws;
|
||||
sector_t * fakefsector = hw_FakeFlat(seg->frontsector, in_area, false);
|
||||
|
|
@ -816,7 +816,7 @@ void HWDrawInfo::PrepareLowerGap(seg_t * seg)
|
|||
ws.z2 = frontz;
|
||||
ws.z1 = backz;
|
||||
|
||||
auto vertices = screen->mVertexData->AllocVertices(8);
|
||||
auto vertices = state.AllocVertices(8);
|
||||
|
||||
CreateFloodStencilPoly(&ws, vertices.first);
|
||||
CreateFloodPoly(&ws, vertices.first+4, ws.z1, fakebsector, false);
|
||||
|
|
@ -837,7 +837,7 @@ void HWDrawInfo::PrepareLowerGap(seg_t * seg)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWDrawInfo::PrepareUnhandledMissingTextures()
|
||||
void HWDrawInfo::PrepareUnhandledMissingTextures(FRenderState& state)
|
||||
{
|
||||
if (!Level->notexturefill)
|
||||
{
|
||||
|
|
@ -860,7 +860,7 @@ void HWDrawInfo::PrepareUnhandledMissingTextures()
|
|||
if (seg->backsector->GetTexture(sector_t::ceiling) == skyflatnum) continue;
|
||||
if (seg->backsector->ValidatePortal(sector_t::ceiling) != NULL) continue;
|
||||
|
||||
PrepareUpperGap(seg);
|
||||
PrepareUpperGap(seg, state);
|
||||
}
|
||||
|
||||
validcount++;
|
||||
|
|
@ -878,7 +878,7 @@ void HWDrawInfo::PrepareUnhandledMissingTextures()
|
|||
if (seg->backsector->GetTexture(sector_t::floor) == skyflatnum) continue;
|
||||
if (seg->backsector->ValidatePortal(sector_t::floor) != NULL) continue;
|
||||
|
||||
PrepareLowerGap(seg);
|
||||
PrepareLowerGap(seg, state);
|
||||
}
|
||||
}
|
||||
MissingUpperTextures.Clear();
|
||||
|
|
@ -1111,19 +1111,19 @@ bool HWDrawInfo::CollectSubsectorsCeiling(subsector_t * sub, sector_t * anchor)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWDrawInfo::ProcessLowerMinisegs(TArray<seg_t *> &lowersegs)
|
||||
void HWDrawInfo::ProcessLowerMinisegs(TArray<seg_t *> &lowersegs, FRenderState& state)
|
||||
{
|
||||
for(unsigned int j=0;j<lowersegs.Size();j++)
|
||||
{
|
||||
seg_t * seg=lowersegs[j];
|
||||
HWWall wall;
|
||||
wall.ProcessLowerMiniseg(this, seg, seg->Subsector->render_sector, seg->PartnerSeg->Subsector->render_sector);
|
||||
wall.ProcessLowerMiniseg(this, state, seg, seg->Subsector->render_sector, seg->PartnerSeg->Subsector->render_sector);
|
||||
rendered_lines++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void HWDrawInfo::HandleHackedSubsectors()
|
||||
void HWDrawInfo::HandleHackedSubsectors(FRenderState& state)
|
||||
{
|
||||
viewsubsector = Level->PointInRenderSubsector(Viewpoint.Pos);
|
||||
|
||||
|
|
@ -1144,9 +1144,9 @@ void HWDrawInfo::HandleHackedSubsectors()
|
|||
{
|
||||
gl_subsectorrendernode * node = NewSubsectorRenderNode();
|
||||
node->sub = HandledSubsectors[j];
|
||||
AddOtherFloorPlane(sub->render_sector->sectornum, node);
|
||||
AddOtherFloorPlane(sub->render_sector->sectornum, node, state);
|
||||
}
|
||||
if (inview) ProcessLowerMinisegs(lowersegs);
|
||||
if (inview) ProcessLowerMinisegs(lowersegs, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1166,7 +1166,7 @@ void HWDrawInfo::HandleHackedSubsectors()
|
|||
{
|
||||
gl_subsectorrendernode * node = NewSubsectorRenderNode();
|
||||
node->sub = HandledSubsectors[j];
|
||||
AddOtherCeilingPlane(sub->render_sector->sectornum, node);
|
||||
AddOtherCeilingPlane(sub->render_sector->sectornum, node, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ void HWSkyInfo::init(HWDrawInfo *di, int sky1, PalEntry FadeColor)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWWall::SkyPlane(HWDrawInfo *di, sector_t *sector, int plane, bool allowreflect)
|
||||
void HWWall::SkyPlane(HWDrawInfo *di, FRenderState& state, sector_t *sector, int plane, bool allowreflect)
|
||||
{
|
||||
int ptype = -1;
|
||||
|
||||
|
|
@ -125,7 +125,7 @@ void HWWall::SkyPlane(HWDrawInfo *di, sector_t *sector, int plane, bool allowref
|
|||
skyinfo.init(di, sector->sky, Colormap.FadeColor);
|
||||
ptype = PORTALTYPE_SKY;
|
||||
sky = &skyinfo;
|
||||
PutPortal(di, ptype, plane);
|
||||
PutPortal(di, state, ptype, plane);
|
||||
}
|
||||
else if (sportal != nullptr)
|
||||
{
|
||||
|
|
@ -165,7 +165,7 @@ void HWWall::SkyPlane(HWDrawInfo *di, sector_t *sector, int plane, bool allowref
|
|||
}
|
||||
if (ptype != -1)
|
||||
{
|
||||
PutPortal(di, ptype, plane);
|
||||
PutPortal(di, state, ptype, plane);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -176,7 +176,7 @@ void HWWall::SkyPlane(HWDrawInfo *di, sector_t *sector, int plane, bool allowref
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWWall::SkyLine(HWDrawInfo *di, sector_t *fs, line_t *line)
|
||||
void HWWall::SkyLine(HWDrawInfo *di, FRenderState& state, sector_t *fs, line_t *line)
|
||||
{
|
||||
FSectorPortal *secport = line->GetTransferredPortal();
|
||||
HWSkyInfo skyinfo;
|
||||
|
|
@ -200,7 +200,7 @@ void HWWall::SkyLine(HWDrawInfo *di, sector_t *fs, line_t *line)
|
|||
ztop[1] = zceil[1];
|
||||
zbottom[0] = zfloor[0];
|
||||
zbottom[1] = zfloor[1];
|
||||
PutPortal(di, ptype, -1);
|
||||
PutPortal(di, state, ptype, -1);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -210,17 +210,17 @@ void HWWall::SkyLine(HWDrawInfo *di, sector_t *fs, line_t *line)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWWall::SkyNormal(HWDrawInfo *di, sector_t * fs,vertex_t * v1,vertex_t * v2)
|
||||
void HWWall::SkyNormal(HWDrawInfo *di, FRenderState& state, sector_t * fs,vertex_t * v1,vertex_t * v2)
|
||||
{
|
||||
ztop[0]=ztop[1]=32768.0f;
|
||||
zbottom[0]=zceil[0];
|
||||
zbottom[1]=zceil[1];
|
||||
SkyPlane(di, fs, sector_t::ceiling, true);
|
||||
SkyPlane(di, state, fs, sector_t::ceiling, true);
|
||||
|
||||
ztop[0]=zfloor[0];
|
||||
ztop[1]=zfloor[1];
|
||||
zbottom[0]=zbottom[1]=-32768.0f;
|
||||
SkyPlane(di, fs, sector_t::floor, true);
|
||||
SkyPlane(di, state, fs, sector_t::floor, true);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
@ -229,7 +229,7 @@ void HWWall::SkyNormal(HWDrawInfo *di, sector_t * fs,vertex_t * v1,vertex_t * v2
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWWall::SkyTop(HWDrawInfo *di, seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex_t * v2)
|
||||
void HWWall::SkyTop(HWDrawInfo *di, FRenderState& state, seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex_t * v2)
|
||||
{
|
||||
if (fs->GetTexture(sector_t::ceiling)==skyflatnum)
|
||||
{
|
||||
|
|
@ -259,7 +259,7 @@ void HWWall::SkyTop(HWDrawInfo *di, seg_t * seg,sector_t * fs,sector_t * bs,vert
|
|||
ztop[0]=ztop[1]=32768.0f;
|
||||
zbottom[0]=zbottom[1]=
|
||||
bs->ceilingplane.ZatPoint(v2) + seg->sidedef->GetTextureYOffset(side_t::mid);
|
||||
SkyPlane(di, fs, sector_t::ceiling, false);
|
||||
SkyPlane(di, state, fs, sector_t::ceiling, false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -313,7 +313,7 @@ void HWWall::SkyTop(HWDrawInfo *di, seg_t * seg,sector_t * fs,sector_t * bs,vert
|
|||
|
||||
}
|
||||
|
||||
SkyPlane(di, fs, sector_t::ceiling, true);
|
||||
SkyPlane(di, state, fs, sector_t::ceiling, true);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -323,7 +323,7 @@ void HWWall::SkyTop(HWDrawInfo *di, seg_t * seg,sector_t * fs,sector_t * bs,vert
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWWall::SkyBottom(HWDrawInfo *di, seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex_t * v2)
|
||||
void HWWall::SkyBottom(HWDrawInfo *di, FRenderState& state, seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex_t * v2)
|
||||
{
|
||||
if (fs->GetTexture(sector_t::floor)==skyflatnum)
|
||||
{
|
||||
|
|
@ -391,6 +391,6 @@ void HWWall::SkyBottom(HWDrawInfo *di, seg_t * seg,sector_t * fs,sector_t * bs,v
|
|||
ztop[1] = fs->floorplane.ZatPoint(v2);
|
||||
}
|
||||
|
||||
SkyPlane(di, fs, sector_t::floor, true);
|
||||
SkyPlane(di, state, fs, sector_t::floor, true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
|
|||
|
||||
if (screen->BuffersArePersistent())
|
||||
{
|
||||
CreateVertices(di);
|
||||
CreateVertices(di, state);
|
||||
}
|
||||
if (polyoffset)
|
||||
{
|
||||
|
|
@ -372,12 +372,12 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
|
|||
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
auto vert = screen->mVertexData->AllocVertices(2);
|
||||
auto vert = state.AllocVertices(2);
|
||||
auto vp = vert.first;
|
||||
unsigned int vertexindex = vert.second;
|
||||
vp[0].Set(actor->X() + actor->radius * scales[i][0], actor->Z() + actor->Height * scales[i][1], actor->Y() + actor->radius * scales[i][2], 0.0f, 0.0f);
|
||||
vp[1].Set(actor->X() + actor->radius * scales[i][3], actor->Z() + actor->Height * scales[i][4], actor->Y() + actor->radius * scales[i][5], 0.0f, 0.0f);
|
||||
screen->RenderState()->Draw(DT_Lines, vertexindex, 2);
|
||||
state.Draw(DT_Lines, vertexindex, 2);
|
||||
}
|
||||
|
||||
state.EnableTexture(true);
|
||||
|
|
@ -546,7 +546,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
inline void HWSprite::PutSprite(HWDrawInfo *di, bool translucent)
|
||||
inline void HWSprite::PutSprite(HWDrawInfo *di, FRenderState& state, bool translucent)
|
||||
{
|
||||
// That's a lot of checks...
|
||||
if (modelframe && !modelframe->isVoxel && !(modelframe->flags & MDL_NOPERPIXELLIGHTING) && RenderStyle.BlendOp != STYLEOP_Shadow && gl_light_sprites && di->Level->HasDynamicLights && !di->isFullbrightScene() && !fullbright)
|
||||
|
|
@ -560,7 +560,7 @@ inline void HWSprite::PutSprite(HWDrawInfo *di, bool translucent)
|
|||
vertexindex = -1;
|
||||
if (!screen->BuffersArePersistent())
|
||||
{
|
||||
CreateVertices(di);
|
||||
CreateVertices(di, state);
|
||||
}
|
||||
di->AddSprite(this, translucent);
|
||||
}
|
||||
|
|
@ -571,13 +571,13 @@ inline void HWSprite::PutSprite(HWDrawInfo *di, bool translucent)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWSprite::CreateVertices(HWDrawInfo *di)
|
||||
void HWSprite::CreateVertices(HWDrawInfo *di, FRenderState& state)
|
||||
{
|
||||
if (modelframe == nullptr)
|
||||
{
|
||||
FVector3 v[4];
|
||||
polyoffset = CalculateVertices(di, v, &di->Viewpoint.Pos);
|
||||
auto vert = screen->mVertexData->AllocVertices(4);
|
||||
auto vert = state.AllocVertices(4);
|
||||
auto vp = vert.first;
|
||||
vertexindex = vert.second;
|
||||
|
||||
|
|
@ -596,7 +596,7 @@ void HWSprite::CreateVertices(HWDrawInfo *di)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWSprite::SplitSprite(HWDrawInfo *di, sector_t * frontsector, bool translucent)
|
||||
void HWSprite::SplitSprite(HWDrawInfo *di, FRenderState& state, sector_t * frontsector, bool translucent)
|
||||
{
|
||||
HWSprite copySprite;
|
||||
double lightbottom;
|
||||
|
|
@ -633,7 +633,7 @@ void HWSprite::SplitSprite(HWDrawInfo *di, sector_t * frontsector, bool transluc
|
|||
z1=copySprite.z2=lightbottom;
|
||||
vt=copySprite.vb=copySprite.vt+
|
||||
(lightbottom-copySprite.z1)*(copySprite.vb-copySprite.vt)/(z2-copySprite.z1);
|
||||
copySprite.PutSprite(di, translucent);
|
||||
copySprite.PutSprite(di, state, translucent);
|
||||
put=true;
|
||||
}
|
||||
}
|
||||
|
|
@ -745,7 +745,7 @@ void HWSprite::PerformSpriteClipAdjustment(AActor *thing, const DVector2 &thingp
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t in_area, int thruportal, bool isSpriteShadow)
|
||||
void HWSprite::Process(HWDrawInfo *di, FRenderState& state, AActor* thing, sector_t * sector, area_t in_area, int thruportal, bool isSpriteShadow)
|
||||
{
|
||||
sector_t rs;
|
||||
sector_t * rendersector;
|
||||
|
|
@ -1272,7 +1272,7 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
|
|||
lightlist = nullptr;
|
||||
if (!drawWithXYBillboard && !modelframe)
|
||||
{
|
||||
SplitSprite(di, thing->Sector, hw_styleflags != STYLEHW_Solid);
|
||||
SplitSprite(di, state, thing->Sector, hw_styleflags != STYLEHW_Solid);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -1285,7 +1285,7 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
|
|||
lightlist = nullptr;
|
||||
}
|
||||
|
||||
PutSprite(di, hw_styleflags != STYLEHW_Solid);
|
||||
PutSprite(di, state, hw_styleflags != STYLEHW_Solid);
|
||||
rendered_sprites++;
|
||||
}
|
||||
|
||||
|
|
@ -1296,7 +1296,7 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWSprite::ProcessParticle (HWDrawInfo *di, particle_t *particle, sector_t *sector)//, int shade, int fakeside)
|
||||
void HWSprite::ProcessParticle (HWDrawInfo *di, FRenderState& state, particle_t *particle, sector_t *sector)//, int shade, int fakeside)
|
||||
{
|
||||
if (particle->alpha==0) return;
|
||||
|
||||
|
|
@ -1439,7 +1439,7 @@ void HWSprite::ProcessParticle (HWDrawInfo *di, particle_t *particle, sector_t *
|
|||
else
|
||||
lightlist = nullptr;
|
||||
|
||||
PutSprite(di, hw_styleflags != STYLEHW_Solid);
|
||||
PutSprite(di, state, hw_styleflags != STYLEHW_Solid);
|
||||
rendered_sprites++;
|
||||
}
|
||||
|
||||
|
|
@ -1449,7 +1449,7 @@ void HWSprite::ProcessParticle (HWDrawInfo *di, particle_t *particle, sector_t *
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWDrawInfo::ProcessActorsInPortal(FLinePortalSpan *glport, area_t in_area)
|
||||
void HWDrawInfo::ProcessActorsInPortal(FLinePortalSpan *glport, area_t in_area, FRenderState& state)
|
||||
{
|
||||
TMap<AActor*, bool> processcheck;
|
||||
if (glport->validcount == validcount) return; // only process once per frame
|
||||
|
|
@ -1519,11 +1519,11 @@ void HWDrawInfo::ProcessActorsInPortal(FLinePortalSpan *glport, area_t in_area)
|
|||
// [Nash] draw sprite shadow
|
||||
if (R_ShouldDrawSpriteShadow(th))
|
||||
{
|
||||
spr.Process(this, th, hw_FakeFlat(th->Sector, in_area, false, &fakesector), in_area, 2, true);
|
||||
spr.Process(this, state, th, hw_FakeFlat(th->Sector, in_area, false, &fakesector), in_area, 2, true);
|
||||
}
|
||||
|
||||
// This is called from the worker thread and must not alter the fake sector cache.
|
||||
spr.Process(this, th, hw_FakeFlat(th->Sector, in_area, false, &fakesector), in_area, 2);
|
||||
spr.Process(this, state, th, hw_FakeFlat(th->Sector, in_area, false, &fakesector), in_area, 2);
|
||||
th->Angles.Yaw = savedangle;
|
||||
th->SetXYZ(savedpos);
|
||||
th->Prev -= newpos - savedpos;
|
||||
|
|
|
|||
|
|
@ -493,7 +493,7 @@ const char HWWall::passflag[] = {
|
|||
//
|
||||
//
|
||||
//==========================================================================
|
||||
void HWWall::PutWall(HWDrawInfo *di, bool translucent)
|
||||
void HWWall::PutWall(HWDrawInfo *di, FRenderState& state, bool translucent)
|
||||
{
|
||||
if (texture && texture->GetTranslucency() && passflag[type] == 2)
|
||||
{
|
||||
|
|
@ -523,7 +523,7 @@ void HWWall::PutWall(HWDrawInfo *di, bool translucent)
|
|||
{
|
||||
SetupLights(di, lightdata);
|
||||
}
|
||||
MakeVertices(di, *screen->RenderState(), translucent);
|
||||
MakeVertices(di, state, translucent);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -544,7 +544,7 @@ void HWWall::PutWall(HWDrawInfo *di, bool translucent)
|
|||
SetupLights(di, lightdata);
|
||||
}
|
||||
}
|
||||
ProcessDecals(di);
|
||||
ProcessDecals(di, state);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -563,14 +563,14 @@ void HWWall::PutWall(HWDrawInfo *di, bool translucent)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWWall::PutPortal(HWDrawInfo *di, int ptype, int plane)
|
||||
void HWWall::PutPortal(HWDrawInfo *di, FRenderState& state, int ptype, int plane)
|
||||
{
|
||||
if (di->MeshBuilding)
|
||||
return;
|
||||
|
||||
HWPortal * portal = nullptr;
|
||||
|
||||
MakeVertices(di, *screen->RenderState(), false);
|
||||
MakeVertices(di, state, false);
|
||||
switch (ptype)
|
||||
{
|
||||
// portals don't go into the draw list.
|
||||
|
|
@ -580,7 +580,7 @@ void HWWall::PutPortal(HWDrawInfo *di, int ptype, int plane)
|
|||
portal = di->FindPortal(horizon);
|
||||
if (!portal)
|
||||
{
|
||||
portal = new HWHorizonPortal(&portalState, horizon, di->Viewpoint);
|
||||
portal = new HWHorizonPortal(&portalState, state, horizon, di->Viewpoint);
|
||||
di->Portals.Push(portal);
|
||||
}
|
||||
portal->AddLine(this);
|
||||
|
|
@ -636,7 +636,7 @@ void HWWall::PutPortal(HWDrawInfo *di, int ptype, int plane)
|
|||
if (gl_mirror_envmap)
|
||||
{
|
||||
// draw a reflective layer over the mirror
|
||||
di->AddMirrorSurface(this);
|
||||
di->AddMirrorSurface(this, state);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -649,7 +649,7 @@ void HWWall::PutPortal(HWDrawInfo *di, int ptype, int plane)
|
|||
line_t *otherside = lineportal->lines[0]->mDestination;
|
||||
if (otherside != nullptr && otherside->portalindex < di->Level->linePortals.Size())
|
||||
{
|
||||
di->ProcessActorsInPortal(otherside->getPortal()->mGroup, di->in_area);
|
||||
di->ProcessActorsInPortal(otherside->getPortal()->mGroup, di->in_area, state);
|
||||
}
|
||||
portal = new HWLineToLinePortal(&portalState, lineportal);
|
||||
di->Portals.Push(portal);
|
||||
|
|
@ -682,7 +682,7 @@ void HWWall::PutPortal(HWDrawInfo *di, int ptype, int plane)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWWall::Put3DWall(HWDrawInfo *di, lightlist_t * lightlist, bool translucent)
|
||||
void HWWall::Put3DWall(HWDrawInfo *di, FRenderState& state, lightlist_t * lightlist, bool translucent)
|
||||
{
|
||||
// only modify the light di->Level-> if it doesn't originate from the seg's frontsector. This is to account for light transferring effects
|
||||
if (lightlist->p_lightlevel != &seg->sidedef->sector->lightlevel)
|
||||
|
|
@ -692,7 +692,7 @@ void HWWall::Put3DWall(HWDrawInfo *di, lightlist_t * lightlist, bool translucent
|
|||
// relative light won't get changed here. It is constant across the entire wall.
|
||||
|
||||
CopyFrom3DLight(Colormap, lightlist);
|
||||
PutWall(di, translucent);
|
||||
PutWall(di, state, translucent);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
@ -702,7 +702,7 @@ void HWWall::Put3DWall(HWDrawInfo *di, lightlist_t * lightlist, bool translucent
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
bool HWWall::SplitWallComplex(HWDrawInfo *di, sector_t * frontsector, bool translucent, float& maplightbottomleft, float& maplightbottomright)
|
||||
bool HWWall::SplitWallComplex(HWDrawInfo *di, FRenderState& state, sector_t * frontsector, bool translucent, float& maplightbottomleft, float& maplightbottomright)
|
||||
{
|
||||
// check for an intersection with the upper plane
|
||||
if ((maplightbottomleft<ztop[0] && maplightbottomright>ztop[1]) ||
|
||||
|
|
@ -742,8 +742,8 @@ bool HWWall::SplitWallComplex(HWDrawInfo *di, sector_t * frontsector, bool trans
|
|||
copyWall1.lightuv[LORGT].u = copyWall2.lightuv[LOLFT].u = lightuv[LOLFT].u + coeff * (lightuv[LORGT].u - lightuv[LOLFT].u);
|
||||
copyWall1.lightuv[LORGT].v = copyWall2.lightuv[LOLFT].v = lightuv[LOLFT].v + coeff * (lightuv[LORGT].v - lightuv[LOLFT].v);
|
||||
|
||||
copyWall1.SplitWall(di, frontsector, translucent);
|
||||
copyWall2.SplitWall(di, frontsector, translucent);
|
||||
copyWall1.SplitWall(di, state, frontsector, translucent);
|
||||
copyWall2.SplitWall(di, state, frontsector, translucent);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -787,8 +787,8 @@ bool HWWall::SplitWallComplex(HWDrawInfo *di, sector_t * frontsector, bool trans
|
|||
copyWall1.lightuv[LORGT].u = copyWall2.lightuv[LOLFT].u = lightuv[LOLFT].u + coeff * (lightuv[LORGT].u - lightuv[LOLFT].u);
|
||||
copyWall1.lightuv[LORGT].v = copyWall2.lightuv[LOLFT].v = lightuv[LOLFT].v + coeff * (lightuv[LORGT].v - lightuv[LOLFT].v);
|
||||
|
||||
copyWall1.SplitWall(di, frontsector, translucent);
|
||||
copyWall2.SplitWall(di, frontsector, translucent);
|
||||
copyWall1.SplitWall(di, state, frontsector, translucent);
|
||||
copyWall2.SplitWall(di, state, frontsector, translucent);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -796,7 +796,7 @@ bool HWWall::SplitWallComplex(HWDrawInfo *di, sector_t * frontsector, bool trans
|
|||
return false;
|
||||
}
|
||||
|
||||
void HWWall::SplitWall(HWDrawInfo *di, sector_t * frontsector, bool translucent)
|
||||
void HWWall::SplitWall(HWDrawInfo *di, FRenderState& state, sector_t * frontsector, bool translucent)
|
||||
{
|
||||
float maplightbottomleft;
|
||||
float maplightbottomright;
|
||||
|
|
@ -850,12 +850,12 @@ void HWWall::SplitWall(HWDrawInfo *di, sector_t * frontsector, bool translucent)
|
|||
{
|
||||
// Use hardware clipping if this cannot be done cleanly.
|
||||
this->lightlist = &lightlist;
|
||||
PutWall(di, translucent);
|
||||
PutWall(di, state, translucent);
|
||||
|
||||
goto out;
|
||||
}
|
||||
// crappy fallback if no clip planes available
|
||||
else if (SplitWallComplex(di, frontsector, translucent, maplightbottomleft, maplightbottomright))
|
||||
else if (SplitWallComplex(di, state, frontsector, translucent, maplightbottomleft, maplightbottomright))
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -864,7 +864,7 @@ void HWWall::SplitWall(HWDrawInfo *di, sector_t * frontsector, bool translucent)
|
|||
// 3D floor is completely within this light
|
||||
if (maplightbottomleft<=zbottom[0] && maplightbottomright<=zbottom[1])
|
||||
{
|
||||
Put3DWall(di, &lightlist[i], translucent);
|
||||
Put3DWall(di, state, &lightlist[i], translucent);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
@ -885,7 +885,7 @@ void HWWall::SplitWall(HWDrawInfo *di, sector_t * frontsector, bool translucent)
|
|||
(maplightbottomleft-copyWall1.ztop[0])*(copyWall1.lightuv[LOLFT].v-copyWall1.lightuv[UPLFT].v)/(zbottom[0]-copyWall1.ztop[0]);
|
||||
lightuv[UPRGT].v=copyWall1.lightuv[LORGT].v=copyWall1.lightuv[UPRGT].v+
|
||||
(maplightbottomright-copyWall1.ztop[1])*(copyWall1.lightuv[LORGT].v-copyWall1.lightuv[UPRGT].v)/(zbottom[1]-copyWall1.ztop[1]);
|
||||
copyWall1.Put3DWall(di, &lightlist[i], translucent);
|
||||
copyWall1.Put3DWall(di, state, &lightlist[i], translucent);
|
||||
}
|
||||
if (ztop[0]==zbottom[0] && ztop[1]==zbottom[1])
|
||||
{
|
||||
|
|
@ -895,7 +895,7 @@ void HWWall::SplitWall(HWDrawInfo *di, sector_t * frontsector, bool translucent)
|
|||
}
|
||||
}
|
||||
|
||||
Put3DWall(di, &lightlist[lightlist.Size()-1], translucent);
|
||||
Put3DWall(di, state, &lightlist[lightlist.Size()-1], translucent);
|
||||
|
||||
out:
|
||||
lightlevel=origlight;
|
||||
|
|
@ -911,7 +911,7 @@ out:
|
|||
//
|
||||
//
|
||||
//==========================================================================
|
||||
bool HWWall::DoHorizon(HWDrawInfo *di, seg_t * seg,sector_t * fs, vertex_t * v1,vertex_t * v2)
|
||||
bool HWWall::DoHorizon(HWDrawInfo *di, FRenderState& state, seg_t * seg,sector_t * fs, vertex_t * v1,vertex_t * v2)
|
||||
{
|
||||
HWHorizonInfo hi;
|
||||
lightlist_t * light;
|
||||
|
|
@ -928,7 +928,7 @@ bool HWWall::DoHorizon(HWDrawInfo *di, seg_t * seg,sector_t * fs, vertex_t * v1,
|
|||
|
||||
if (fs->GetTexture(sector_t::ceiling) == skyflatnum)
|
||||
{
|
||||
SkyPlane(di, fs, sector_t::ceiling, false);
|
||||
SkyPlane(di, state, fs, sector_t::ceiling, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -947,7 +947,7 @@ bool HWWall::DoHorizon(HWDrawInfo *di, seg_t * seg,sector_t * fs, vertex_t * v1,
|
|||
|
||||
if (di->isFullbrightScene()) hi.colormap.Clear();
|
||||
horizon = &hi;
|
||||
PutPortal(di, PORTALTYPE_HORIZON, -1);
|
||||
PutPortal(di, state, PORTALTYPE_HORIZON, -1);
|
||||
}
|
||||
ztop[1] = ztop[0] = zbottom[0];
|
||||
}
|
||||
|
|
@ -957,7 +957,7 @@ bool HWWall::DoHorizon(HWDrawInfo *di, seg_t * seg,sector_t * fs, vertex_t * v1,
|
|||
zbottom[1] = zbottom[0] = fs->GetPlaneTexZ(sector_t::floor);
|
||||
if (fs->GetTexture(sector_t::floor) == skyflatnum)
|
||||
{
|
||||
SkyPlane(di, fs, sector_t::floor, false);
|
||||
SkyPlane(di, state, fs, sector_t::floor, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -976,7 +976,7 @@ bool HWWall::DoHorizon(HWDrawInfo *di, seg_t * seg,sector_t * fs, vertex_t * v1,
|
|||
|
||||
if (di->isFullbrightScene()) hi.colormap.Clear();
|
||||
horizon = &hi;
|
||||
PutPortal(di, PORTALTYPE_HORIZON, -1);
|
||||
PutPortal(di, state, PORTALTYPE_HORIZON, -1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
@ -1228,7 +1228,7 @@ static void GetTexCoordInfo(FGameTexture *tex, FTexCoordInfo *tci, side_t *side,
|
|||
// Handle one sided walls, upper and lower texture
|
||||
//
|
||||
//==========================================================================
|
||||
void HWWall::DoTexture(HWDrawInfo *di, int _type,seg_t * seg, int peg,
|
||||
void HWWall::DoTexture(HWDrawInfo *di, FRenderState& state, int _type,seg_t * seg, int peg,
|
||||
float ceilingrefheight,float floorrefheight,
|
||||
float topleft,float topright,
|
||||
float bottomleft,float bottomright,
|
||||
|
|
@ -1278,7 +1278,7 @@ void HWWall::DoTexture(HWDrawInfo *di, int _type,seg_t * seg, int peg,
|
|||
|
||||
if (seg->linedef->special == Line_Mirror && _type == RENDERWALL_M1S && gl_mirrors)
|
||||
{
|
||||
PutPortal(di, PORTALTYPE_MIRROR, -1);
|
||||
PutPortal(di, state, PORTALTYPE_MIRROR, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1287,8 +1287,8 @@ void HWWall::DoTexture(HWDrawInfo *di, int _type,seg_t * seg, int peg,
|
|||
|
||||
// Add this wall to the render list
|
||||
sector_t * sec = sub ? sub->sector : seg->frontsector;
|
||||
if (sec->e->XFloor.lightlist.Size()==0 || di->isFullbrightScene()) PutWall(di, false);
|
||||
else SplitWall(di, sec, false);
|
||||
if (sec->e->XFloor.lightlist.Size()==0 || di->isFullbrightScene()) PutWall(di, state, false);
|
||||
else SplitWall(di, state, sec, false);
|
||||
}
|
||||
|
||||
glseg = glsave;
|
||||
|
|
@ -1302,7 +1302,7 @@ void HWWall::DoTexture(HWDrawInfo *di, int _type,seg_t * seg, int peg,
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWWall::DoMidTexture(HWDrawInfo *di, seg_t * seg, bool drawfogboundary,
|
||||
void HWWall::DoMidTexture(HWDrawInfo *di, FRenderState& state, seg_t * seg, bool drawfogboundary,
|
||||
sector_t * front, sector_t * back,
|
||||
sector_t * realfront, sector_t * realback,
|
||||
float fch1, float fch2, float ffh1, float ffh2,
|
||||
|
|
@ -1516,7 +1516,7 @@ void HWWall::DoMidTexture(HWDrawInfo *di, seg_t * seg, bool drawfogboundary,
|
|||
type=RENDERWALL_FOGBOUNDARY;
|
||||
auto savetex = texture;
|
||||
texture = NULL;
|
||||
PutWall(di, true);
|
||||
PutWall(di, state, true);
|
||||
if (!savetex)
|
||||
{
|
||||
flags &= ~(HWF_NOSPLITUPPER|HWF_NOSPLITLOWER);
|
||||
|
|
@ -1606,8 +1606,8 @@ void HWWall::DoMidTexture(HWDrawInfo *di, seg_t * seg, bool drawfogboundary,
|
|||
// Draw the stuff
|
||||
//
|
||||
//
|
||||
if (front->e->XFloor.lightlist.Size()==0 || di->isFullbrightScene()) split.PutWall(di, translucent);
|
||||
else split.SplitWall(di, front, translucent);
|
||||
if (front->e->XFloor.lightlist.Size()==0 || di->isFullbrightScene()) split.PutWall(di, state, translucent);
|
||||
else split.SplitWall(di, state, front, translucent);
|
||||
|
||||
t=1;
|
||||
}
|
||||
|
|
@ -1620,8 +1620,8 @@ void HWWall::DoMidTexture(HWDrawInfo *di, seg_t * seg, bool drawfogboundary,
|
|||
// Draw the stuff without splitting
|
||||
//
|
||||
//
|
||||
if (front->e->XFloor.lightlist.Size()==0 || di->isFullbrightScene()) PutWall(di, translucent);
|
||||
else SplitWall(di, front, translucent);
|
||||
if (front->e->XFloor.lightlist.Size()==0 || di->isFullbrightScene()) PutWall(di, state, translucent);
|
||||
else SplitWall(di, state, front, translucent);
|
||||
}
|
||||
alpha=1.0f;
|
||||
}
|
||||
|
|
@ -1637,7 +1637,7 @@ void HWWall::DoMidTexture(HWDrawInfo *di, seg_t * seg, bool drawfogboundary,
|
|||
//
|
||||
//
|
||||
//==========================================================================
|
||||
void HWWall::BuildFFBlock(HWDrawInfo *di, seg_t * seg, F3DFloor * rover, int roverIndex,
|
||||
void HWWall::BuildFFBlock(HWDrawInfo *di, FRenderState& state, seg_t * seg, F3DFloor * rover, int roverIndex,
|
||||
float ff_topleft, float ff_topright,
|
||||
float ff_bottomleft, float ff_bottomright)
|
||||
{
|
||||
|
|
@ -1763,8 +1763,8 @@ void HWWall::BuildFFBlock(HWDrawInfo *di, seg_t * seg, F3DFloor * rover, int rov
|
|||
|
||||
sector_t * sec = sub ? sub->sector : seg->frontsector;
|
||||
|
||||
if (sec->e->XFloor.lightlist.Size() == 0 || di->isFullbrightScene()) PutWall(di, translucent);
|
||||
else SplitWall(di, sec, translucent);
|
||||
if (sec->e->XFloor.lightlist.Size() == 0 || di->isFullbrightScene()) PutWall(di, state, translucent);
|
||||
else SplitWall(di, state, sec, translucent);
|
||||
|
||||
alpha = 1.0f;
|
||||
lightlevel = savelight;
|
||||
|
|
@ -1791,7 +1791,7 @@ __forceinline void HWWall::GetPlanePos(F3DFloor::planeref *planeref, float &left
|
|||
//
|
||||
//
|
||||
//==========================================================================
|
||||
void HWWall::InverseFloors(HWDrawInfo *di, seg_t * seg, sector_t * frontsector,
|
||||
void HWWall::InverseFloors(HWDrawInfo *di, FRenderState& state, seg_t * seg, sector_t * frontsector,
|
||||
float topleft, float topright,
|
||||
float bottomleft, float bottomright)
|
||||
{
|
||||
|
|
@ -1829,7 +1829,7 @@ void HWWall::InverseFloors(HWDrawInfo *di, seg_t * seg, sector_t * frontsector,
|
|||
}
|
||||
if (ff_topleft < ff_bottomleft || ff_topright < ff_bottomright) continue;
|
||||
|
||||
BuildFFBlock(di, seg, rover, i, ff_topleft, ff_topright, ff_bottomleft, ff_bottomright);
|
||||
BuildFFBlock(di, state, seg, rover, i, ff_topleft, ff_topright, ff_bottomleft, ff_bottomright);
|
||||
topleft = ff_bottomleft;
|
||||
topright = ff_bottomright;
|
||||
|
||||
|
|
@ -1842,7 +1842,7 @@ void HWWall::InverseFloors(HWDrawInfo *di, seg_t * seg, sector_t * frontsector,
|
|||
//
|
||||
//
|
||||
//==========================================================================
|
||||
void HWWall::ClipFFloors(HWDrawInfo *di, seg_t * seg, F3DFloor * ffloor, int ffloorIndex, sector_t * frontsector,
|
||||
void HWWall::ClipFFloors(HWDrawInfo *di, FRenderState& state, seg_t * seg, F3DFloor * ffloor, int ffloorIndex, sector_t * frontsector,
|
||||
float topleft, float topright,
|
||||
float bottomleft, float bottomright)
|
||||
{
|
||||
|
|
@ -1893,7 +1893,7 @@ void HWWall::ClipFFloors(HWDrawInfo *di, seg_t * seg, F3DFloor * ffloor, int ffl
|
|||
}
|
||||
else if (ff_topleft <= topleft && ff_topright <= topright)
|
||||
{
|
||||
BuildFFBlock(di, seg, ffloor, ffloorIndex, topleft, topright, ff_topleft, ff_topright);
|
||||
BuildFFBlock(di, state, seg, ffloor, ffloorIndex, topleft, topright, ff_topleft, ff_topright);
|
||||
if (ff_bottomleft <= bottomleft && ff_bottomright <= bottomright) return;
|
||||
topleft = ff_bottomleft;
|
||||
topright = ff_bottomright;
|
||||
|
|
@ -1908,7 +1908,7 @@ void HWWall::ClipFFloors(HWDrawInfo *di, seg_t * seg, F3DFloor * ffloor, int ffl
|
|||
|
||||
done:
|
||||
// if the program reaches here there is one block left to draw
|
||||
BuildFFBlock(di, seg, ffloor, ffloorIndex, topleft, topright, bottomleft, bottomright);
|
||||
BuildFFBlock(di, state, seg, ffloor, ffloorIndex, topleft, topright, bottomleft, bottomright);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
@ -1916,7 +1916,7 @@ done:
|
|||
//
|
||||
//
|
||||
//==========================================================================
|
||||
void HWWall::DoFFloorBlocks(HWDrawInfo *di, seg_t * seg, sector_t * frontsector, sector_t * backsector,
|
||||
void HWWall::DoFFloorBlocks(HWDrawInfo *di, FRenderState& state, seg_t * seg, sector_t * frontsector, sector_t * backsector,
|
||||
float fch1, float fch2, float ffh1, float ffh2,
|
||||
float bch1, float bch2, float bfh1, float bfh2)
|
||||
|
||||
|
|
@ -1978,13 +1978,13 @@ void HWWall::DoFFloorBlocks(HWDrawInfo *di, seg_t * seg, sector_t * frontsector,
|
|||
// do all inverse floors above the current one it there is a gap between the
|
||||
// last 3D floor and this one.
|
||||
if (topleft > ff_topleft && topright > ff_topright)
|
||||
InverseFloors(di, seg, frontsector, topleft, topright, ff_topleft, ff_topright);
|
||||
InverseFloors(di, state, seg, frontsector, topleft, topright, ff_topleft, ff_topright);
|
||||
|
||||
// if translucent or liquid clip away adjoining parts of the same type of FFloors on the other side
|
||||
if (rover->flags&(FF_SWIMMABLE | FF_TRANSLUCENT))
|
||||
ClipFFloors(di, seg, rover, i, frontsector, ff_topleft, ff_topright, ff_bottomleft, ff_bottomright);
|
||||
ClipFFloors(di, state, seg, rover, i, frontsector, ff_topleft, ff_topright, ff_bottomleft, ff_bottomright);
|
||||
else
|
||||
BuildFFBlock(di, seg, rover, i, ff_topleft, ff_topright, ff_bottomleft, ff_bottomright);
|
||||
BuildFFBlock(di, state, seg, rover, i, ff_topleft, ff_topright, ff_bottomleft, ff_bottomright);
|
||||
|
||||
topleft = ff_bottomleft;
|
||||
topright = ff_bottomright;
|
||||
|
|
@ -1996,7 +1996,7 @@ void HWWall::DoFFloorBlocks(HWDrawInfo *di, seg_t * seg, sector_t * frontsector,
|
|||
if (frontsector->e->XFloor.ffloors.Size() > 0)
|
||||
{
|
||||
if (topleft > bottomleft || topright > bottomright)
|
||||
InverseFloors(di, seg, frontsector, topleft, topright, bottomleft, bottomright);
|
||||
InverseFloors(di, state, seg, frontsector, topleft, topright, bottomleft, bottomright);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2021,7 +2021,7 @@ inline int CalcRelLight(int lightlevel, int orglightlevel, int rel)
|
|||
//
|
||||
//
|
||||
//==========================================================================
|
||||
void HWWall::Process(HWDrawInfo *di, seg_t *seg, sector_t * frontsector, sector_t * backsector)
|
||||
void HWWall::Process(HWDrawInfo *di, FRenderState& state, seg_t *seg, sector_t * frontsector, sector_t * backsector)
|
||||
{
|
||||
vertex_t * v1, *v2;
|
||||
float fch1;
|
||||
|
|
@ -2137,8 +2137,8 @@ void HWWall::Process(HWDrawInfo *di, seg_t *seg, sector_t * frontsector, sector_
|
|||
|
||||
if (seg->linedef->special == Line_Horizon)
|
||||
{
|
||||
SkyNormal(di, frontsector, v1, v2);
|
||||
DoHorizon(di, seg, frontsector, v1, v2);
|
||||
SkyNormal(di, state, frontsector, v1, v2);
|
||||
DoHorizon(di, state, seg, frontsector, v1, v2);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2149,7 +2149,7 @@ void HWWall::Process(HWDrawInfo *di, seg_t *seg, sector_t * frontsector, sector_
|
|||
if (!backsector || (!(seg->linedef->flags&(ML_TWOSIDED | ML_3DMIDTEX)) && !isportal)) // one sided
|
||||
{
|
||||
// sector's sky
|
||||
SkyNormal(di, frontsector, v1, v2);
|
||||
SkyNormal(di, state, frontsector, v1, v2);
|
||||
|
||||
if (isportal)
|
||||
{
|
||||
|
|
@ -2158,11 +2158,11 @@ void HWWall::Process(HWDrawInfo *di, seg_t *seg, sector_t * frontsector, sector_
|
|||
ztop[1] = zceil[1];
|
||||
zbottom[0] = zfloor[0];
|
||||
zbottom[1] = zfloor[1];
|
||||
PutPortal(di, PORTALTYPE_LINETOLINE, -1);
|
||||
PutPortal(di, state, PORTALTYPE_LINETOLINE, -1);
|
||||
}
|
||||
else if (seg->linedef->GetTransferredPortal())
|
||||
{
|
||||
SkyLine(di, frontsector, seg->linedef);
|
||||
SkyLine(di, state, frontsector, seg->linedef);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2172,7 +2172,7 @@ void HWWall::Process(HWDrawInfo *di, seg_t *seg, sector_t * frontsector, sector_
|
|||
texture = TexMan.GetGameTexture(seg->sidedef->GetTexture(side_t::mid), true);
|
||||
if (texture && texture->isValid())
|
||||
{
|
||||
DoTexture(di, RENDERWALL_M1S, seg, (seg->linedef->flags & ML_DONTPEGBOTTOM) > 0,
|
||||
DoTexture(di, state, RENDERWALL_M1S, seg, (seg->linedef->flags & ML_DONTPEGBOTTOM) > 0,
|
||||
crefz, frefz, // must come from the original!
|
||||
fch1, fch2, ffh1, ffh2, 0);
|
||||
}
|
||||
|
|
@ -2189,7 +2189,7 @@ void HWWall::Process(HWDrawInfo *di, seg_t *seg, sector_t * frontsector, sector_
|
|||
|
||||
if (isportal && seg->backsector == nullptr)
|
||||
{
|
||||
SkyNormal(di, frontsector, v1, v2); // For sky rendering purposes this needs to be treated as a one-sided wall.
|
||||
SkyNormal(di, state, frontsector, v1, v2); // For sky rendering purposes this needs to be treated as a one-sided wall.
|
||||
|
||||
// If this is a one-sided portal and we got floor or ceiling alignment, the upper/lower texture position needs to be adjusted for that.
|
||||
// (We assume that this portal won't involve slopes!)
|
||||
|
|
@ -2217,8 +2217,8 @@ void HWWall::Process(HWDrawInfo *di, seg_t *seg, sector_t * frontsector, sector_
|
|||
}
|
||||
else
|
||||
{
|
||||
SkyTop(di, seg, frontsector, backsector, v1, v2);
|
||||
SkyBottom(di, seg, frontsector, backsector, v1, v2);
|
||||
SkyTop(di, state, seg, frontsector, backsector, v1, v2);
|
||||
SkyBottom(di, state, seg, frontsector, backsector, v1, v2);
|
||||
}
|
||||
|
||||
// upper texture
|
||||
|
|
@ -2242,7 +2242,7 @@ void HWWall::Process(HWDrawInfo *di, seg_t *seg, sector_t * frontsector, sector_
|
|||
texture = TexMan.GetGameTexture(seg->sidedef->GetTexture(side_t::top), true);
|
||||
if (texture && texture->isValid())
|
||||
{
|
||||
DoTexture(di, RENDERWALL_TOP, seg, (seg->linedef->flags & (ML_DONTPEGTOP)) == 0,
|
||||
DoTexture(di, state, RENDERWALL_TOP, seg, (seg->linedef->flags & (ML_DONTPEGTOP)) == 0,
|
||||
crefz, realback->GetPlaneTexZ(sector_t::ceiling),
|
||||
fch1, fch2, bch1a, bch2a, 0);
|
||||
}
|
||||
|
|
@ -2255,7 +2255,7 @@ void HWWall::Process(HWDrawInfo *di, seg_t *seg, sector_t * frontsector, sector_
|
|||
texture = TexMan.GetGameTexture(frontsector->GetTexture(sector_t::ceiling), true);
|
||||
if (texture && texture->isValid())
|
||||
{
|
||||
DoTexture(di, RENDERWALL_TOP, seg, (seg->linedef->flags & (ML_DONTPEGTOP)) == 0,
|
||||
DoTexture(di, state, RENDERWALL_TOP, seg, (seg->linedef->flags & (ML_DONTPEGTOP)) == 0,
|
||||
crefz, realback->GetPlaneTexZ(sector_t::ceiling),
|
||||
fch1, fch2, bch1a, bch2a, 0);
|
||||
}
|
||||
|
|
@ -2299,11 +2299,11 @@ void HWWall::Process(HWDrawInfo *di, seg_t *seg, sector_t * frontsector, sector_
|
|||
ztop[1] = bch2;
|
||||
zbottom[0] = bfh1;
|
||||
zbottom[1] = bfh2;
|
||||
PutPortal(di, PORTALTYPE_LINETOLINE, -1);
|
||||
PutPortal(di, state, PORTALTYPE_LINETOLINE, -1);
|
||||
|
||||
if (texture && seg->backsector != nullptr)
|
||||
{
|
||||
DoMidTexture(di, seg, drawfogboundary, frontsector, backsector, realfront, realback,
|
||||
DoMidTexture(di, state, seg, drawfogboundary, frontsector, backsector, realfront, realback,
|
||||
fch1, fch2, ffh1, ffh2, bch1, bch2, bfh1, bfh2, zalign);
|
||||
}
|
||||
}
|
||||
|
|
@ -2312,7 +2312,7 @@ void HWWall::Process(HWDrawInfo *di, seg_t *seg, sector_t * frontsector, sector_
|
|||
|
||||
if (texture || drawfogboundary)
|
||||
{
|
||||
DoMidTexture(di, seg, drawfogboundary, frontsector, backsector, realfront, realback,
|
||||
DoMidTexture(di, state, seg, drawfogboundary, frontsector, backsector, realfront, realback,
|
||||
fch1, fch2, ffh1, ffh2, bch1, bch2, bfh1, bfh2, zalign);
|
||||
}
|
||||
|
||||
|
|
@ -2320,7 +2320,7 @@ void HWWall::Process(HWDrawInfo *di, seg_t *seg, sector_t * frontsector, sector_
|
|||
{
|
||||
lightlevel = hw_ClampLight(seg->sidedef->GetLightLevel(foggy, orglightlevel, side_t::top, false, &rel));
|
||||
rellight = CalcRelLight(lightlevel, orglightlevel, rel);
|
||||
DoFFloorBlocks(di, seg, frontsector, backsector, fch1, fch2, ffh1, ffh2, bch1, bch2, bfh1, bfh2);
|
||||
DoFFloorBlocks(di, state, seg, frontsector, backsector, fch1, fch2, ffh1, ffh2, bch1, bch2, bfh1, bfh2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2339,7 +2339,7 @@ void HWWall::Process(HWDrawInfo *di, seg_t *seg, sector_t * frontsector, sector_
|
|||
texture = TexMan.GetGameTexture(seg->sidedef->GetTexture(side_t::bottom), true);
|
||||
if (texture && texture->isValid())
|
||||
{
|
||||
DoTexture(di, RENDERWALL_BOTTOM, seg, (seg->linedef->flags & ML_DONTPEGBOTTOM) > 0,
|
||||
DoTexture(di, state, RENDERWALL_BOTTOM, seg, (seg->linedef->flags & ML_DONTPEGBOTTOM) > 0,
|
||||
realback->GetPlaneTexZ(sector_t::floor), frefz,
|
||||
bfh1, bfh2, ffh1, ffh2,
|
||||
frontsector->GetTexture(sector_t::ceiling) == skyflatnum && backsector->GetTexture(sector_t::ceiling) == skyflatnum ?
|
||||
|
|
@ -2358,7 +2358,7 @@ void HWWall::Process(HWDrawInfo *di, seg_t *seg, sector_t * frontsector, sector_
|
|||
texture = TexMan.GetGameTexture(frontsector->GetTexture(sector_t::floor), true);
|
||||
if (texture && texture->isValid())
|
||||
{
|
||||
DoTexture(di, RENDERWALL_BOTTOM, seg, (seg->linedef->flags & ML_DONTPEGBOTTOM) > 0,
|
||||
DoTexture(di, state, RENDERWALL_BOTTOM, seg, (seg->linedef->flags & ML_DONTPEGBOTTOM) > 0,
|
||||
realback->GetPlaneTexZ(sector_t::floor), frefz,
|
||||
bfh1, bfh2, ffh1, ffh2, frefz - crefz);
|
||||
}
|
||||
|
|
@ -2381,7 +2381,7 @@ void HWWall::Process(HWDrawInfo *di, seg_t *seg, sector_t * frontsector, sector_
|
|||
//
|
||||
//
|
||||
//==========================================================================
|
||||
void HWWall::ProcessLowerMiniseg(HWDrawInfo *di, seg_t *seg, sector_t * frontsector, sector_t * backsector)
|
||||
void HWWall::ProcessLowerMiniseg(HWDrawInfo *di, FRenderState& state, seg_t *seg, sector_t * frontsector, sector_t * backsector)
|
||||
{
|
||||
if (frontsector->GetTexture(sector_t::floor) == skyflatnum) return;
|
||||
lightlist = NULL;
|
||||
|
|
@ -2433,7 +2433,7 @@ void HWWall::ProcessLowerMiniseg(HWDrawInfo *di, seg_t *seg, sector_t * frontsec
|
|||
type = RENDERWALL_BOTTOM;
|
||||
tci.GetFromTexture(texture, 1, 1, false);
|
||||
SetWallCoordinates(seg, &tci, bfh, bfh, bfh, ffh, ffh, 0);
|
||||
PutWall(di, false);
|
||||
PutWall(di, state, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -488,7 +488,7 @@ bool HUDSprite::GetWeaponRenderStyle(DPSprite *psp, AActor *playermo, sector_t *
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
bool HUDSprite::GetWeaponRect(HWDrawInfo *di, DPSprite *psp, float sx, float sy, player_t *player, double ticfrac)
|
||||
bool HUDSprite::GetWeaponRect(HWDrawInfo *di, FRenderState& state, DPSprite *psp, float sx, float sy, player_t *player, double ticfrac)
|
||||
{
|
||||
float tx;
|
||||
float scale;
|
||||
|
|
@ -652,7 +652,7 @@ bool HUDSprite::GetWeaponRect(HWDrawInfo *di, DPSprite *psp, float sx, float sy,
|
|||
Vert.v[3].X < vw))
|
||||
return false;
|
||||
*/
|
||||
auto verts = screen->mVertexData->AllocVertices(4);
|
||||
auto verts = state.AllocVertices(4);
|
||||
mx = verts.second;
|
||||
|
||||
verts.first[0].Set(Vert.v[0].X, Vert.v[0].Y, 0, u1, v1);
|
||||
|
|
@ -669,7 +669,7 @@ bool HUDSprite::GetWeaponRect(HWDrawInfo *di, DPSprite *psp, float sx, float sy,
|
|||
// R_DrawPlayerSprites
|
||||
//
|
||||
//==========================================================================
|
||||
void HWDrawInfo::PreparePlayerSprites2D(sector_t * viewsector, area_t in_area)
|
||||
void HWDrawInfo::PreparePlayerSprites2D(sector_t * viewsector, area_t in_area, FRenderState& state)
|
||||
{
|
||||
AActor * playermo = players[consoleplayer].camera;
|
||||
player_t * player = playermo->player;
|
||||
|
|
@ -712,7 +712,7 @@ void HWDrawInfo::PreparePlayerSprites2D(sector_t * viewsector, area_t in_area)
|
|||
GetDynSpriteLight(playermo, nullptr, hudsprite.dynrgb);
|
||||
}
|
||||
|
||||
if (!hudsprite.GetWeaponRect(this, psp, spos.X, spos.Y, player, vp.TicFrac)) continue;
|
||||
if (!hudsprite.GetWeaponRect(this, state, psp, spos.X, spos.Y, player, vp.TicFrac)) continue;
|
||||
hudsprites.Push(hudsprite);
|
||||
}
|
||||
lightmode = oldlightmode;
|
||||
|
|
@ -772,7 +772,7 @@ void HWDrawInfo::PreparePlayerSprites3D(sector_t * viewsector, area_t in_area)
|
|||
lightmode = oldlightmode;
|
||||
}
|
||||
|
||||
void HWDrawInfo::PreparePlayerSprites(sector_t * viewsector, area_t in_area)
|
||||
void HWDrawInfo::PreparePlayerSprites(sector_t * viewsector, area_t in_area, FRenderState& state)
|
||||
{
|
||||
|
||||
AActor * playermo = players[consoleplayer].camera;
|
||||
|
|
@ -798,10 +798,10 @@ void HWDrawInfo::PreparePlayerSprites(sector_t * viewsector, area_t in_area)
|
|||
}
|
||||
else
|
||||
{
|
||||
PreparePlayerSprites2D(viewsector,in_area);
|
||||
PreparePlayerSprites2D(viewsector,in_area,state);
|
||||
}
|
||||
|
||||
PrepareTargeterSprites(vp.TicFrac);
|
||||
PrepareTargeterSprites(vp.TicFrac,state);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -811,7 +811,7 @@ void HWDrawInfo::PreparePlayerSprites(sector_t * viewsector, area_t in_area)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWDrawInfo::PrepareTargeterSprites(double ticfrac)
|
||||
void HWDrawInfo::PrepareTargeterSprites(double ticfrac, FRenderState& state)
|
||||
{
|
||||
AActor * playermo = players[consoleplayer].camera;
|
||||
player_t * player = playermo->player;
|
||||
|
|
@ -844,7 +844,7 @@ void HWDrawInfo::PrepareTargeterSprites(double ticfrac)
|
|||
{
|
||||
hudsprite.weapon = psp;
|
||||
|
||||
if (hudsprite.GetWeaponRect(this, psp, psp->x, psp->y, player, ticfrac))
|
||||
if (hudsprite.GetWeaponRect(this, state, psp, psp->x, psp->y, player, ticfrac))
|
||||
{
|
||||
hudsprites.Push(hudsprite);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,6 @@ struct HUDSprite
|
|||
|
||||
void SetBright(bool isbelow);
|
||||
bool GetWeaponRenderStyle(DPSprite *psp, AActor *playermo, sector_t *viewsector, WeaponLighting &light);
|
||||
bool GetWeaponRect(HWDrawInfo *di, DPSprite *psp, float sx, float sy, player_t *player, double ticfrac);
|
||||
bool GetWeaponRect(HWDrawInfo *di, FRenderState& state, DPSprite *psp, float sx, float sy, player_t *player, double ticfrac);
|
||||
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue