From e884a418f88bb340cfaeea4165c938b0c46b2e85 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 22 Mar 2021 12:07:29 +0100 Subject: [PATCH] - portal WIP --- source/common/rendering/hwrenderer/data/hw_renderstate.h | 2 +- source/common/rendering/hwrenderer/data/hw_skydome.cpp | 2 +- source/common/rendering/hwrenderer/data/hw_skydome.h | 2 +- source/core/rendering/scene/hw_drawinfo.cpp | 2 -- source/core/rendering/scene/hw_flats.cpp | 2 +- source/core/rendering/scene/hw_portal.h | 3 +-- source/core/rendering/scene/hw_sky.cpp | 2 +- source/core/rendering/scene/hw_skyportal.cpp | 2 +- source/core/rendering/scene/hw_walls.cpp | 4 ++-- 9 files changed, 9 insertions(+), 12 deletions(-) diff --git a/source/common/rendering/hwrenderer/data/hw_renderstate.h b/source/common/rendering/hwrenderer/data/hw_renderstate.h index 9cf1015d2..5f373adfc 100644 --- a/source/common/rendering/hwrenderer/data/hw_renderstate.h +++ b/source/common/rendering/hwrenderer/data/hw_renderstate.h @@ -274,7 +274,7 @@ public: mSpecialEffect = EFF_NONE; mLightIndex = -1; mStreamData.uInterpolationFactor = 0; - mRenderStyle = DefaultRenderStyle(); + mRenderStyle = LegacyRenderStyles[STYLE_Translucent]; mMaterial.Reset(); mBias.Reset(); mPassType = NORMAL_PASS; diff --git a/source/common/rendering/hwrenderer/data/hw_skydome.cpp b/source/common/rendering/hwrenderer/data/hw_skydome.cpp index ebd0d35bc..87bad9928 100644 --- a/source/common/rendering/hwrenderer/data/hw_skydome.cpp +++ b/source/common/rendering/hwrenderer/data/hw_skydome.cpp @@ -436,7 +436,7 @@ void FSkyVertexBuffer::RenderDome(FRenderState& state, FGameTexture* tex, float // //----------------------------------------------------------------------------- -void FSkyVertexBuffer::RenderBox(FRenderState& state, FTextureID texno, FSkyBox* tex, float x_offset, bool sky2, float stretch, const FVector3& skyrotatevector, const FVector3& skyrotatevector2) +void FSkyVertexBuffer::RenderBox(FRenderState& state, FSkyBox* tex, float x_offset, bool sky2, float stretch, const FVector3& skyrotatevector, const FVector3& skyrotatevector2) { int faces; diff --git a/source/common/rendering/hwrenderer/data/hw_skydome.h b/source/common/rendering/hwrenderer/data/hw_skydome.h index f095458a2..fd9ec91e2 100644 --- a/source/common/rendering/hwrenderer/data/hw_skydome.h +++ b/source/common/rendering/hwrenderer/data/hw_skydome.h @@ -85,6 +85,6 @@ public: void RenderRow(FRenderState& state, EDrawType prim, int row, bool apply = true); void RenderDome(FRenderState& state, FGameTexture* tex, float x_offset, float y_offset, bool mirror, int mode, bool tiled); - void RenderBox(FRenderState& state, FTextureID texno, FSkyBox* tex, float x_offset, bool sky2, float stretch, const FVector3& skyrotatevector, const FVector3& skyrotatevector2); + void RenderBox(FRenderState& state, FSkyBox* tex, float x_offset, bool sky2, float stretch, const FVector3& skyrotatevector, const FVector3& skyrotatevector2); }; diff --git a/source/core/rendering/scene/hw_drawinfo.cpp b/source/core/rendering/scene/hw_drawinfo.cpp index e37abb3a1..c6e73a311 100644 --- a/source/core/rendering/scene/hw_drawinfo.cpp +++ b/source/core/rendering/scene/hw_drawinfo.cpp @@ -421,7 +421,6 @@ void HWDrawInfo::RenderTranslucent(FRenderState &state) void HWDrawInfo::RenderPortal(HWPortal *p, FRenderState &state, bool usestencil) { -#if 0 auto gp = static_cast(p); gp->SetupStencil(this, state, usestencil); auto new_di = StartDrawInfo(this, Viewpoint, &VPUniforms); @@ -432,7 +431,6 @@ void HWDrawInfo::RenderPortal(HWPortal *p, FRenderState &state, bool usestencil) state.SetVertexBuffer(screen->mVertexData); screen->mViewpoints->Bind(state, vpIndex); gp->RemoveStencil(this, state, usestencil); -#endif } //----------------------------------------------------------------------------- diff --git a/source/core/rendering/scene/hw_flats.cpp b/source/core/rendering/scene/hw_flats.cpp index a2c61a4a6..f0e8c1003 100644 --- a/source/core/rendering/scene/hw_flats.cpp +++ b/source/core/rendering/scene/hw_flats.cpp @@ -170,7 +170,7 @@ void HWFlat::DrawFlat(HWDrawInfo *di, FRenderState &state, bool translucent) state.Draw(DT_Triangles, vertindex, vertcount); vertexcount += vertcount; - if (translucent) state.SetRenderStyle(DefaultRenderStyle()); + if (translucent) state.SetRenderStyle(LegacyRenderStyles[STYLE_Translucent]); //state.SetObjectColor(0xffffffff); //state.SetAddColor(0); //state.ApplyTextureManipulation(nullptr); diff --git a/source/core/rendering/scene/hw_portal.h b/source/core/rendering/scene/hw_portal.h index d6581eff6..6e163c94d 100644 --- a/source/core/rendering/scene/hw_portal.h +++ b/source/core/rendering/scene/hw_portal.h @@ -20,11 +20,10 @@ enum struct HWSkyInfo { float x_offset; - float y_offset; // doubleskies don't have a y-offset + float y_offset; float y_scale; int shade; FGameTexture * texture; - FTextureID skytexno1; PalEntry fadecolor; bool operator==(const HWSkyInfo & inf) diff --git a/source/core/rendering/scene/hw_sky.cpp b/source/core/rendering/scene/hw_sky.cpp index a9e377404..4de3382db 100644 --- a/source/core/rendering/scene/hw_sky.cpp +++ b/source/core/rendering/scene/hw_sky.cpp @@ -66,7 +66,7 @@ void initSkyInfo(HWDrawInfo *di, HWSkyInfo* sky, sectortype* sector, int plane, sky->y_offset = FixedToFloat(dapyoffs) + ypanning * (float)ti * (1.f / 256.f); sky->x_offset = xpanning / (1 << (realskybits - dapskybits)); sky->fadecolor = FadeColor; - sky->shade = plane == plane_ceiling ? sector->ceilingshade : sector->floorshade; + sky->shade = 0;// clamp(plane == plane_ceiling ? sector->ceilingshade : sector->floorshade, 0, numshades - 1); sky->texture = skytex; } diff --git a/source/core/rendering/scene/hw_skyportal.cpp b/source/core/rendering/scene/hw_skyportal.cpp index 1c3ae10c6..0bc02d43a 100644 --- a/source/core/rendering/scene/hw_skyportal.cpp +++ b/source/core/rendering/scene/hw_skyportal.cpp @@ -54,7 +54,7 @@ void HWSkyPortal::DrawContents(HWDrawInfo *di, FRenderState &state) auto skybox = origin->texture ? dynamic_cast(origin->texture->GetTexture()) : nullptr; if (skybox) { - vertexBuffer->RenderBox(state, origin->skytexno1, skybox, origin->x_offset, false, /*di->Level->info->pixelstretch*/1, { 0, 0, 1 }, { 0, 0, 1 }); + vertexBuffer->RenderBox(state, skybox, origin->x_offset, false, /*di->Level->info->pixelstretch*/1, { 0, 0, 1 }, { 0, 0, 1 }); } else { diff --git a/source/core/rendering/scene/hw_walls.cpp b/source/core/rendering/scene/hw_walls.cpp index 2cb5e7dfb..b7b309235 100644 --- a/source/core/rendering/scene/hw_walls.cpp +++ b/source/core/rendering/scene/hw_walls.cpp @@ -870,7 +870,7 @@ void HWWall::DoMidTexture(HWDrawInfo* di, walltype* wal, // todo: transparency. DoTexture(di, wal, wal, refheight, topleft, topright, bottomleft, bottomright); - RenderStyle = STYLE_Normal; + RenderStyle = STYLE_Translucent; alpha = 1.f; } @@ -928,7 +928,7 @@ void HWWall::Process(HWDrawInfo *di, walltype *wal, sectortype* frontsector, sec visibility = sectorVisibility(frontsector); alpha = 1.0f; - RenderStyle = STYLE_Normal; + RenderStyle = STYLE_Translucent; texture = NULL; /*