mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-02 06:33:20 +00:00
- use psprite renderstyle on HUD models
This commit is contained in:
parent
9c398cd343
commit
d62a26a177
4 changed files with 134 additions and 56 deletions
|
@ -36,15 +36,69 @@
|
||||||
void PolyRenderModel(PolyRenderThread *thread, const Mat4f &worldToClip, uint32_t stencilValue, float x, float y, float z, FSpriteModelFrame *smf, AActor *actor)
|
void PolyRenderModel(PolyRenderThread *thread, const Mat4f &worldToClip, uint32_t stencilValue, float x, float y, float z, FSpriteModelFrame *smf, AActor *actor)
|
||||||
{
|
{
|
||||||
PolyModelRenderer renderer(thread, worldToClip, stencilValue);
|
PolyModelRenderer renderer(thread, worldToClip, stencilValue);
|
||||||
|
|
||||||
|
renderer.sector = actor->Sector;
|
||||||
|
renderer.RenderStyle = actor->RenderStyle;
|
||||||
|
renderer.RenderAlpha = (float)actor->Alpha;
|
||||||
|
if (!renderer.RenderStyle.IsVisible(renderer.RenderAlpha))
|
||||||
|
return;
|
||||||
|
|
||||||
|
bool foggy = false;
|
||||||
|
int actualextralight = foggy ? 0 : PolyRenderer::Instance()->Viewpoint.extralight << 4;
|
||||||
|
bool fullbrightSprite = ((actor->renderflags & RF_FULLBRIGHT) || (actor->flags5 & MF5_BRIGHT));
|
||||||
|
int lightlevel = fullbrightSprite ? 255 : actor->Sector->lightlevel + actualextralight;
|
||||||
|
renderer.visibility = PolyRenderer::Instance()->Light.SpriteGlobVis(foggy);
|
||||||
|
|
||||||
|
renderer.fillcolor = actor->fillcolor;
|
||||||
|
renderer.Translation = actor->Translation;
|
||||||
|
|
||||||
renderer.AddLights(actor);
|
renderer.AddLights(actor);
|
||||||
renderer.RenderModel(x, y, z, smf, actor, r_viewpoint.TicFrac);
|
renderer.RenderModel(x, y, z, smf, actor, r_viewpoint.TicFrac);
|
||||||
PolyTriangleDrawer::SetModelVertexShader(thread->DrawQueue, -1, -1, 0.0f);
|
PolyTriangleDrawer::SetModelVertexShader(thread->DrawQueue, -1, -1, 0.0f);
|
||||||
PolyTriangleDrawer::SetTransform(thread->DrawQueue, thread->FrameMemory->NewObject<Mat4f>(worldToClip), nullptr);
|
PolyTriangleDrawer::SetTransform(thread->DrawQueue, thread->FrameMemory->NewObject<Mat4f>(worldToClip), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isBright(DPSprite *psp)
|
||||||
|
{
|
||||||
|
if (psp != nullptr && psp->GetState() != nullptr)
|
||||||
|
{
|
||||||
|
bool disablefullbright = false;
|
||||||
|
FTextureID lump = sprites[psp->GetSprite()].GetSpriteFrame(psp->GetFrame(), 0, 0., nullptr);
|
||||||
|
if (lump.isValid())
|
||||||
|
{
|
||||||
|
FTexture * tex = TexMan(lump);
|
||||||
|
if (tex) disablefullbright = tex->bDisableFullbright;
|
||||||
|
}
|
||||||
|
return psp->GetState()->GetFullbright() && !disablefullbright;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void PolyRenderHUDModel(PolyRenderThread *thread, const Mat4f &worldToClip, uint32_t stencilValue, DPSprite *psp, float ofsx, float ofsy)
|
void PolyRenderHUDModel(PolyRenderThread *thread, const Mat4f &worldToClip, uint32_t stencilValue, DPSprite *psp, float ofsx, float ofsy)
|
||||||
{
|
{
|
||||||
PolyModelRenderer renderer(thread, worldToClip, stencilValue);
|
PolyModelRenderer renderer(thread, worldToClip, stencilValue);
|
||||||
|
|
||||||
|
AActor *playermo = players[consoleplayer].camera;
|
||||||
|
auto rs = psp->GetRenderStyle(playermo->RenderStyle, playermo->Alpha);
|
||||||
|
renderer.sector = playermo->Sector;
|
||||||
|
renderer.RenderStyle = rs.first;
|
||||||
|
renderer.RenderAlpha = rs.second;
|
||||||
|
if (psp->Flags & PSPF_FORCEALPHA) renderer.RenderAlpha = 0.0f;
|
||||||
|
if (!renderer.RenderStyle.IsVisible(renderer.RenderAlpha))
|
||||||
|
return;
|
||||||
|
|
||||||
|
bool foggy = false;
|
||||||
|
int actualextralight = foggy ? 0 : PolyRenderer::Instance()->Viewpoint.extralight << 4;
|
||||||
|
bool fullbrightSprite = isBright(psp);
|
||||||
|
int lightlevel = fullbrightSprite ? 255 : playermo->Sector->lightlevel + actualextralight;
|
||||||
|
renderer.visibility = PolyRenderer::Instance()->Light.SpriteGlobVis(foggy);
|
||||||
|
|
||||||
|
PalEntry ThingColor = (playermo->RenderStyle.Flags & STYLEF_ColorIsFixed) ? playermo->fillcolor : 0xffffff;
|
||||||
|
ThingColor.a = 255;
|
||||||
|
|
||||||
|
renderer.fillcolor = fullbrightSprite ? ThingColor : ThingColor.Modulate(playermo->Sector->SpecialColors[sector_t::sprites]);
|
||||||
|
renderer.Translation = 0xffffffff;// playermo->Translation;
|
||||||
|
|
||||||
renderer.RenderHUDModel(psp, ofsx, ofsy);
|
renderer.RenderHUDModel(psp, ofsx, ofsy);
|
||||||
PolyTriangleDrawer::SetModelVertexShader(thread->DrawQueue, -1, -1, 0.0f);
|
PolyTriangleDrawer::SetModelVertexShader(thread->DrawQueue, -1, -1, 0.0f);
|
||||||
}
|
}
|
||||||
|
@ -121,7 +175,6 @@ void PolyModelRenderer::AddLights(AActor *actor)
|
||||||
|
|
||||||
void PolyModelRenderer::BeginDrawModel(AActor *actor, FSpriteModelFrame *smf, const VSMatrix &objectToWorldMatrix, bool mirrored)
|
void PolyModelRenderer::BeginDrawModel(AActor *actor, FSpriteModelFrame *smf, const VSMatrix &objectToWorldMatrix, bool mirrored)
|
||||||
{
|
{
|
||||||
ModelActor = actor;
|
|
||||||
const_cast<VSMatrix &>(objectToWorldMatrix).copy(ObjectToWorld.Matrix);
|
const_cast<VSMatrix &>(objectToWorldMatrix).copy(ObjectToWorld.Matrix);
|
||||||
SetTransform();
|
SetTransform();
|
||||||
|
|
||||||
|
@ -135,8 +188,6 @@ void PolyModelRenderer::EndDrawModel(AActor *actor, FSpriteModelFrame *smf)
|
||||||
if (actor->RenderStyle == LegacyRenderStyles[STYLE_Normal] || !!(smf->flags & MDL_DONTCULLBACKFACES))
|
if (actor->RenderStyle == LegacyRenderStyles[STYLE_Normal] || !!(smf->flags & MDL_DONTCULLBACKFACES))
|
||||||
PolyTriangleDrawer::SetTwoSided(Thread->DrawQueue, false);
|
PolyTriangleDrawer::SetTwoSided(Thread->DrawQueue, false);
|
||||||
PolyTriangleDrawer::SetCullCCW(Thread->DrawQueue, true);
|
PolyTriangleDrawer::SetCullCCW(Thread->DrawQueue, true);
|
||||||
|
|
||||||
ModelActor = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IModelVertexBuffer *PolyModelRenderer::CreateVertexBuffer(bool needindex, bool singleframe)
|
IModelVertexBuffer *PolyModelRenderer::CreateVertexBuffer(bool needindex, bool singleframe)
|
||||||
|
@ -162,7 +213,6 @@ VSMatrix PolyModelRenderer::GetViewToWorldMatrix()
|
||||||
|
|
||||||
void PolyModelRenderer::BeginDrawHUDModel(AActor *actor, const VSMatrix &objectToWorldMatrix, bool mirrored)
|
void PolyModelRenderer::BeginDrawHUDModel(AActor *actor, const VSMatrix &objectToWorldMatrix, bool mirrored)
|
||||||
{
|
{
|
||||||
ModelActor = actor;
|
|
||||||
const_cast<VSMatrix &>(objectToWorldMatrix).copy(ObjectToWorld.Matrix);
|
const_cast<VSMatrix &>(objectToWorldMatrix).copy(ObjectToWorld.Matrix);
|
||||||
SetTransform();
|
SetTransform();
|
||||||
PolyTriangleDrawer::SetWeaponScene(Thread->DrawQueue, true);
|
PolyTriangleDrawer::SetWeaponScene(Thread->DrawQueue, true);
|
||||||
|
@ -174,7 +224,6 @@ void PolyModelRenderer::BeginDrawHUDModel(AActor *actor, const VSMatrix &objectT
|
||||||
|
|
||||||
void PolyModelRenderer::EndDrawHUDModel(AActor *actor)
|
void PolyModelRenderer::EndDrawHUDModel(AActor *actor)
|
||||||
{
|
{
|
||||||
ModelActor = nullptr;
|
|
||||||
PolyTriangleDrawer::SetWeaponScene(Thread->DrawQueue, false);
|
PolyTriangleDrawer::SetWeaponScene(Thread->DrawQueue, false);
|
||||||
|
|
||||||
if (actor->RenderStyle == LegacyRenderStyles[STYLE_Normal])
|
if (actor->RenderStyle == LegacyRenderStyles[STYLE_Normal])
|
||||||
|
@ -206,21 +255,12 @@ void PolyModelRenderer::SetTransform()
|
||||||
|
|
||||||
void PolyModelRenderer::DrawArrays(int start, int count)
|
void PolyModelRenderer::DrawArrays(int start, int count)
|
||||||
{
|
{
|
||||||
const auto &viewpoint = PolyRenderer::Instance()->Viewpoint;
|
|
||||||
|
|
||||||
bool foggy = false;
|
|
||||||
int actualextralight = foggy ? 0 : viewpoint.extralight << 4;
|
|
||||||
sector_t *sector = ModelActor->Sector;
|
|
||||||
|
|
||||||
bool fullbrightSprite = ((ModelActor->renderflags & RF_FULLBRIGHT) || (ModelActor->flags5 & MF5_BRIGHT));
|
|
||||||
int lightlevel = fullbrightSprite ? 255 : ModelActor->Sector->lightlevel + actualextralight;
|
|
||||||
|
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
args.SetLight(GetColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites], true), lightlevel, PolyRenderer::Instance()->Light.SpriteGlobVis(foggy), fullbrightSprite);
|
args.SetLight(GetColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites], true), lightlevel, visibility, fullbrightSprite);
|
||||||
args.SetLights(Lights, NumLights);
|
args.SetLights(Lights, NumLights);
|
||||||
args.SetStencilTestValue(StencilValue);
|
args.SetStencilTestValue(StencilValue);
|
||||||
args.SetClipPlane(0, PolyClipPlane());
|
args.SetClipPlane(0, PolyClipPlane());
|
||||||
args.SetStyle(ModelActor->RenderStyle, ModelActor->Alpha, ModelActor->fillcolor, ModelActor->Translation, SkinTexture, fullbrightSprite);
|
args.SetStyle(RenderStyle, RenderAlpha, fillcolor, Translation, SkinTexture, fullbrightSprite);
|
||||||
args.SetDepthTest(true);
|
args.SetDepthTest(true);
|
||||||
args.SetWriteDepth(true);
|
args.SetWriteDepth(true);
|
||||||
args.SetWriteStencil(false);
|
args.SetWriteStencil(false);
|
||||||
|
@ -229,21 +269,12 @@ void PolyModelRenderer::DrawArrays(int start, int count)
|
||||||
|
|
||||||
void PolyModelRenderer::DrawElements(int numIndices, size_t offset)
|
void PolyModelRenderer::DrawElements(int numIndices, size_t offset)
|
||||||
{
|
{
|
||||||
const auto &viewpoint = PolyRenderer::Instance()->Viewpoint;
|
|
||||||
|
|
||||||
bool foggy = false;
|
|
||||||
int actualextralight = foggy ? 0 : viewpoint.extralight << 4;
|
|
||||||
sector_t *sector = ModelActor->Sector;
|
|
||||||
|
|
||||||
bool fullbrightSprite = ((ModelActor->renderflags & RF_FULLBRIGHT) || (ModelActor->flags5 & MF5_BRIGHT));
|
|
||||||
int lightlevel = fullbrightSprite ? 255 : ModelActor->Sector->lightlevel + actualextralight;
|
|
||||||
|
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
args.SetLight(GetColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites], true), lightlevel, PolyRenderer::Instance()->Light.SpriteGlobVis(foggy), fullbrightSprite);
|
args.SetLight(GetColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites], true), lightlevel, visibility, fullbrightSprite);
|
||||||
args.SetLights(Lights, NumLights);
|
args.SetLights(Lights, NumLights);
|
||||||
args.SetStencilTestValue(StencilValue);
|
args.SetStencilTestValue(StencilValue);
|
||||||
args.SetClipPlane(0, PolyClipPlane());
|
args.SetClipPlane(0, PolyClipPlane());
|
||||||
args.SetStyle(ModelActor->RenderStyle, ModelActor->Alpha, ModelActor->fillcolor, ModelActor->Translation, SkinTexture, fullbrightSprite);
|
args.SetStyle(RenderStyle, RenderAlpha, fillcolor, Translation, SkinTexture, fullbrightSprite);
|
||||||
args.SetDepthTest(true);
|
args.SetDepthTest(true);
|
||||||
args.SetWriteDepth(true);
|
args.SetWriteDepth(true);
|
||||||
args.SetWriteStencil(false);
|
args.SetWriteStencil(false);
|
||||||
|
|
|
@ -55,7 +55,15 @@ public:
|
||||||
const Mat4f &WorldToClip;
|
const Mat4f &WorldToClip;
|
||||||
uint32_t StencilValue = 0;
|
uint32_t StencilValue = 0;
|
||||||
|
|
||||||
AActor *ModelActor = nullptr;
|
FRenderStyle RenderStyle;
|
||||||
|
float RenderAlpha;
|
||||||
|
sector_t *sector;
|
||||||
|
bool fullbrightSprite;
|
||||||
|
int lightlevel;
|
||||||
|
double visibility;
|
||||||
|
uint32_t fillcolor;
|
||||||
|
uint32_t Translation;
|
||||||
|
|
||||||
Mat4f ObjectToWorld;
|
Mat4f ObjectToWorld;
|
||||||
FTexture *SkinTexture = nullptr;
|
FTexture *SkinTexture = nullptr;
|
||||||
unsigned int *IndexBuffer = nullptr;
|
unsigned int *IndexBuffer = nullptr;
|
||||||
|
|
|
@ -75,6 +75,22 @@ namespace swrenderer
|
||||||
void RenderModel::Render(RenderThread *thread, short *cliptop, short *clipbottom, int minZ, int maxZ, Fake3DTranslucent clip3DFloor)
|
void RenderModel::Render(RenderThread *thread, short *cliptop, short *clipbottom, int minZ, int maxZ, Fake3DTranslucent clip3DFloor)
|
||||||
{
|
{
|
||||||
SWModelRenderer renderer(thread, clip3DFloor, &WorldToClip, MirrorWorldToClip);
|
SWModelRenderer renderer(thread, clip3DFloor, &WorldToClip, MirrorWorldToClip);
|
||||||
|
|
||||||
|
renderer.sector = actor->Sector;
|
||||||
|
renderer.RenderStyle = actor->RenderStyle;
|
||||||
|
renderer.RenderAlpha = (float)actor->Alpha;
|
||||||
|
if (!renderer.RenderStyle.IsVisible(renderer.RenderAlpha))
|
||||||
|
return;
|
||||||
|
|
||||||
|
bool foggy = false;
|
||||||
|
int actualextralight = foggy ? 0 : PolyRenderer::Instance()->Viewpoint.extralight << 4;
|
||||||
|
bool fullbrightSprite = ((actor->renderflags & RF_FULLBRIGHT) || (actor->flags5 & MF5_BRIGHT));
|
||||||
|
int lightlevel = fullbrightSprite ? 255 : actor->Sector->lightlevel + actualextralight;
|
||||||
|
renderer.visibility = PolyRenderer::Instance()->Light.SpriteGlobVis(foggy);
|
||||||
|
|
||||||
|
renderer.fillcolor = actor->fillcolor;
|
||||||
|
renderer.Translation = actor->Translation;
|
||||||
|
|
||||||
renderer.AddLights(actor);
|
renderer.AddLights(actor);
|
||||||
renderer.RenderModel(x, y, z, smf, actor, r_viewpoint.TicFrac);
|
renderer.RenderModel(x, y, z, smf, actor, r_viewpoint.TicFrac);
|
||||||
PolyTriangleDrawer::SetModelVertexShader(thread->DrawQueue, -1, -1, 0.0f);
|
PolyTriangleDrawer::SetModelVertexShader(thread->DrawQueue, -1, -1, 0.0f);
|
||||||
|
@ -82,9 +98,47 @@ namespace swrenderer
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
static bool isBright(DPSprite *psp)
|
||||||
|
{
|
||||||
|
if (psp != nullptr && psp->GetState() != nullptr)
|
||||||
|
{
|
||||||
|
bool disablefullbright = false;
|
||||||
|
FTextureID lump = sprites[psp->GetSprite()].GetSpriteFrame(psp->GetFrame(), 0, 0., nullptr);
|
||||||
|
if (lump.isValid())
|
||||||
|
{
|
||||||
|
FTexture * tex = TexMan(lump);
|
||||||
|
if (tex) disablefullbright = tex->bDisableFullbright;
|
||||||
|
}
|
||||||
|
return psp->GetState()->GetFullbright() && !disablefullbright;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void RenderHUDModel(RenderThread *thread, DPSprite *psp, float ofsx, float ofsy)
|
void RenderHUDModel(RenderThread *thread, DPSprite *psp, float ofsx, float ofsy)
|
||||||
{
|
{
|
||||||
SWModelRenderer renderer(thread, Fake3DTranslucent(), &thread->Viewport->WorldToClip, false);
|
SWModelRenderer renderer(thread, Fake3DTranslucent(), &thread->Viewport->WorldToClip, false);
|
||||||
|
|
||||||
|
AActor *playermo = players[consoleplayer].camera;
|
||||||
|
auto rs = psp->GetRenderStyle(playermo->RenderStyle, playermo->Alpha);
|
||||||
|
renderer.sector = playermo->Sector;
|
||||||
|
renderer.RenderStyle = rs.first;
|
||||||
|
renderer.RenderAlpha = rs.second;
|
||||||
|
if (psp->Flags & PSPF_FORCEALPHA) renderer.RenderAlpha = 0.0f;
|
||||||
|
if (!renderer.RenderStyle.IsVisible(renderer.RenderAlpha))
|
||||||
|
return;
|
||||||
|
|
||||||
|
bool foggy = false;
|
||||||
|
int actualextralight = foggy ? 0 : PolyRenderer::Instance()->Viewpoint.extralight << 4;
|
||||||
|
bool fullbrightSprite = isBright(psp);
|
||||||
|
int lightlevel = fullbrightSprite ? 255 : playermo->Sector->lightlevel + actualextralight;
|
||||||
|
renderer.visibility = PolyRenderer::Instance()->Light.SpriteGlobVis(foggy);
|
||||||
|
|
||||||
|
PalEntry ThingColor = (playermo->RenderStyle.Flags & STYLEF_ColorIsFixed) ? playermo->fillcolor : 0xffffff;
|
||||||
|
ThingColor.a = 255;
|
||||||
|
|
||||||
|
renderer.fillcolor = fullbrightSprite ? ThingColor : ThingColor.Modulate(playermo->Sector->SpecialColors[sector_t::sprites]);
|
||||||
|
renderer.Translation = 0xffffffff;// playermo->Translation;
|
||||||
|
|
||||||
renderer.RenderHUDModel(psp, ofsx, ofsy);
|
renderer.RenderHUDModel(psp, ofsx, ofsy);
|
||||||
PolyTriangleDrawer::SetModelVertexShader(thread->DrawQueue, -1, -1, 0.0f);
|
PolyTriangleDrawer::SetModelVertexShader(thread->DrawQueue, -1, -1, 0.0f);
|
||||||
}
|
}
|
||||||
|
@ -162,7 +216,6 @@ namespace swrenderer
|
||||||
|
|
||||||
void SWModelRenderer::BeginDrawModel(AActor *actor, FSpriteModelFrame *smf, const VSMatrix &objectToWorldMatrix, bool mirrored)
|
void SWModelRenderer::BeginDrawModel(AActor *actor, FSpriteModelFrame *smf, const VSMatrix &objectToWorldMatrix, bool mirrored)
|
||||||
{
|
{
|
||||||
ModelActor = actor;
|
|
||||||
const_cast<VSMatrix &>(objectToWorldMatrix).copy(ObjectToWorld.Matrix);
|
const_cast<VSMatrix &>(objectToWorldMatrix).copy(ObjectToWorld.Matrix);
|
||||||
|
|
||||||
ClipTop = {};
|
ClipTop = {};
|
||||||
|
@ -209,8 +262,6 @@ namespace swrenderer
|
||||||
if (actor->RenderStyle == LegacyRenderStyles[STYLE_Normal] || !!(smf->flags & MDL_DONTCULLBACKFACES))
|
if (actor->RenderStyle == LegacyRenderStyles[STYLE_Normal] || !!(smf->flags & MDL_DONTCULLBACKFACES))
|
||||||
PolyTriangleDrawer::SetTwoSided(Thread->DrawQueue, false);
|
PolyTriangleDrawer::SetTwoSided(Thread->DrawQueue, false);
|
||||||
PolyTriangleDrawer::SetCullCCW(Thread->DrawQueue, true);
|
PolyTriangleDrawer::SetCullCCW(Thread->DrawQueue, true);
|
||||||
|
|
||||||
ModelActor = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IModelVertexBuffer *SWModelRenderer::CreateVertexBuffer(bool needindex, bool singleframe)
|
IModelVertexBuffer *SWModelRenderer::CreateVertexBuffer(bool needindex, bool singleframe)
|
||||||
|
@ -255,7 +306,6 @@ namespace swrenderer
|
||||||
|
|
||||||
void SWModelRenderer::BeginDrawHUDModel(AActor *actor, const VSMatrix &objectToWorldMatrix, bool mirrored)
|
void SWModelRenderer::BeginDrawHUDModel(AActor *actor, const VSMatrix &objectToWorldMatrix, bool mirrored)
|
||||||
{
|
{
|
||||||
ModelActor = actor;
|
|
||||||
const_cast<VSMatrix &>(objectToWorldMatrix).copy(ObjectToWorld.Matrix);
|
const_cast<VSMatrix &>(objectToWorldMatrix).copy(ObjectToWorld.Matrix);
|
||||||
ClipTop = {};
|
ClipTop = {};
|
||||||
ClipBottom = {};
|
ClipBottom = {};
|
||||||
|
@ -269,7 +319,6 @@ namespace swrenderer
|
||||||
|
|
||||||
void SWModelRenderer::EndDrawHUDModel(AActor *actor)
|
void SWModelRenderer::EndDrawHUDModel(AActor *actor)
|
||||||
{
|
{
|
||||||
ModelActor = nullptr;
|
|
||||||
PolyTriangleDrawer::SetWeaponScene(Thread->DrawQueue, false);
|
PolyTriangleDrawer::SetWeaponScene(Thread->DrawQueue, false);
|
||||||
|
|
||||||
if (actor->RenderStyle == LegacyRenderStyles[STYLE_Normal])
|
if (actor->RenderStyle == LegacyRenderStyles[STYLE_Normal])
|
||||||
|
@ -301,20 +350,11 @@ namespace swrenderer
|
||||||
|
|
||||||
void SWModelRenderer::DrawArrays(int start, int count)
|
void SWModelRenderer::DrawArrays(int start, int count)
|
||||||
{
|
{
|
||||||
const auto &viewpoint = Thread->Viewport->viewpoint;
|
|
||||||
|
|
||||||
bool foggy = false;
|
|
||||||
int actualextralight = foggy ? 0 : viewpoint.extralight << 4;
|
|
||||||
sector_t *sector = ModelActor->Sector;
|
|
||||||
|
|
||||||
bool fullbrightSprite = ((ModelActor->renderflags & RF_FULLBRIGHT) || (ModelActor->flags5 & MF5_BRIGHT));
|
|
||||||
int lightlevel = fullbrightSprite ? 255 : ModelActor->Sector->lightlevel + actualextralight;
|
|
||||||
|
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
args.SetLight(GetColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites], true), lightlevel, Thread->Light->SpriteGlobVis(foggy), fullbrightSprite);
|
args.SetLight(GetColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites], true), lightlevel, visibility, fullbrightSprite);
|
||||||
args.SetLights(Lights, NumLights);
|
args.SetLights(Lights, NumLights);
|
||||||
args.SetNormal(FVector3(0.0f, 0.0f, 0.0f));
|
args.SetNormal(FVector3(0.0f, 0.0f, 0.0f));
|
||||||
args.SetStyle(ModelActor->RenderStyle, ModelActor->Alpha, ModelActor->fillcolor, ModelActor->Translation, SkinTexture, fullbrightSprite);
|
args.SetStyle(RenderStyle, RenderAlpha, fillcolor, Translation, SkinTexture, fullbrightSprite);
|
||||||
args.SetDepthTest(true);
|
args.SetDepthTest(true);
|
||||||
args.SetWriteDepth(true);
|
args.SetWriteDepth(true);
|
||||||
args.SetWriteStencil(false);
|
args.SetWriteStencil(false);
|
||||||
|
@ -327,20 +367,11 @@ namespace swrenderer
|
||||||
|
|
||||||
void SWModelRenderer::DrawElements(int numIndices, size_t offset)
|
void SWModelRenderer::DrawElements(int numIndices, size_t offset)
|
||||||
{
|
{
|
||||||
const auto &viewpoint = Thread->Viewport->viewpoint;
|
|
||||||
|
|
||||||
bool foggy = false;
|
|
||||||
int actualextralight = foggy ? 0 : viewpoint.extralight << 4;
|
|
||||||
sector_t *sector = ModelActor->Sector;
|
|
||||||
|
|
||||||
bool fullbrightSprite = ((ModelActor->renderflags & RF_FULLBRIGHT) || (ModelActor->flags5 & MF5_BRIGHT));
|
|
||||||
int lightlevel = fullbrightSprite ? 255 : ModelActor->Sector->lightlevel + actualextralight;
|
|
||||||
|
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
args.SetLight(GetColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites], true), lightlevel, Thread->Light->SpriteGlobVis(foggy), fullbrightSprite);
|
args.SetLight(GetColorTable(sector->Colormap, sector->SpecialColors[sector_t::sprites], true), lightlevel, visibility, fullbrightSprite);
|
||||||
args.SetLights(Lights, NumLights);
|
args.SetLights(Lights, NumLights);
|
||||||
args.SetNormal(FVector3(0.0f, 0.0f, 0.0f));
|
args.SetNormal(FVector3(0.0f, 0.0f, 0.0f));
|
||||||
args.SetStyle(ModelActor->RenderStyle, ModelActor->Alpha, ModelActor->fillcolor, ModelActor->Translation, SkinTexture, fullbrightSprite);
|
args.SetStyle(RenderStyle, RenderAlpha, fillcolor, Translation, SkinTexture, fullbrightSprite);
|
||||||
args.SetDepthTest(true);
|
args.SetDepthTest(true);
|
||||||
args.SetWriteDepth(true);
|
args.SetWriteDepth(true);
|
||||||
args.SetWriteStencil(false);
|
args.SetWriteStencil(false);
|
||||||
|
|
|
@ -78,7 +78,15 @@ namespace swrenderer
|
||||||
RenderThread *Thread = nullptr;
|
RenderThread *Thread = nullptr;
|
||||||
Fake3DTranslucent Clip3DFloor;
|
Fake3DTranslucent Clip3DFloor;
|
||||||
|
|
||||||
AActor *ModelActor = nullptr;
|
FRenderStyle RenderStyle;
|
||||||
|
float RenderAlpha;
|
||||||
|
sector_t *sector;
|
||||||
|
bool fullbrightSprite;
|
||||||
|
int lightlevel;
|
||||||
|
double visibility;
|
||||||
|
uint32_t fillcolor;
|
||||||
|
uint32_t Translation;
|
||||||
|
|
||||||
Mat4f ObjectToWorld;
|
Mat4f ObjectToWorld;
|
||||||
PolyClipPlane ClipTop, ClipBottom;
|
PolyClipPlane ClipTop, ClipBottom;
|
||||||
FTexture *SkinTexture = nullptr;
|
FTexture *SkinTexture = nullptr;
|
||||||
|
|
Loading…
Reference in a new issue