@@ -507,6 +507,7 @@ bool HWMirrorPortal::Setup(HWDrawInfo *di, FRenderState &rstate, Clipper *clippe
507
507
}
508
508
509
509
auto &vp = di->Viewpoint ;
510
+ state->vpIsAllowedOoB = vp.IsAllowedOoB ();
510
511
di->UpdateCurrentMapSection ();
511
512
512
513
di->mClipPortal = this ;
@@ -611,6 +612,7 @@ bool HWLineToLinePortal::Setup(HWDrawInfo *di, FRenderState &rstate, Clipper *cl
611
612
return false ;
612
613
}
613
614
auto &vp = di->Viewpoint ;
615
+ state->vpIsAllowedOoB = vp.IsAllowedOoB ();
614
616
di->mClipPortal = this ;
615
617
616
618
line_t *origin = glport->lines [0 ]->mOrigin ;
@@ -690,6 +692,7 @@ bool HWSkyboxPortal::Setup(HWDrawInfo *di, FRenderState &rstate, Clipper *clippe
690
692
return false ;
691
693
}
692
694
auto &vp = di->Viewpoint ;
695
+ state->vpIsAllowedOoB = vp.IsAllowedOoB ();
693
696
694
697
state->skyboxrecursion ++;
695
698
state->PlaneMirrorMode = 0 ;
@@ -801,6 +804,7 @@ bool HWSectorStackPortal::Setup(HWDrawInfo *di, FRenderState &rstate, Clipper *c
801
804
802
805
FSectorPortalGroup *portal = origin;
803
806
auto &vp = di->Viewpoint ;
807
+ state->vpIsAllowedOoB = vp.IsAllowedOoB ();
804
808
805
809
vp.Pos += origin->mDisplacement ;
806
810
vp.ActorPos += origin->mDisplacement ;
@@ -836,16 +840,23 @@ bool HWSectorStackPortal::Setup(HWDrawInfo *di, FRenderState &rstate, Clipper *c
836
840
837
841
void HWSectorStackPortal::DrawPortalStencil (FRenderState &state, int pass)
838
842
{
839
- bool isceiling = planesused & (1 << sector_t ::ceiling);
840
- for (unsigned int i = 0 ; i < lines.Size (); i++)
843
+ if (mState ->vpIsAllowedOoB )
841
844
{
842
- flat.section = lines[i].sub ->section ;
843
- flat.iboindex = lines[i].sub ->sector ->iboindex [isceiling ? sector_t ::ceiling : sector_t ::floor ];
844
- flat.plane .GetFromSector (lines[i].sub ->sector , isceiling ? sector_t ::ceiling : sector_t ::floor );
845
- // if (isceiling) flat.plane.plane.FlipVert(); // Doesn't do anything. Stencil is a screen-space projection
845
+ bool isceiling = planesused & (1 << sector_t ::ceiling);
846
+ for (unsigned int i = 0 ; i < lines.Size (); i++)
847
+ {
848
+ flat.section = lines[i].sub ->section ;
849
+ flat.iboindex = lines[i].sub ->sector ->iboindex [isceiling ? sector_t ::ceiling : sector_t ::floor ];
850
+ flat.plane .GetFromSector (lines[i].sub ->sector , isceiling ? sector_t ::ceiling : sector_t ::floor );
851
+ // if (isceiling) flat.plane.plane.FlipVert(); // Doesn't do anything. Stencil is a screen-space projection
846
852
847
- state.SetNormal (flat.plane .plane .Normal ().X , flat.plane .plane .Normal ().Z , flat.plane .plane .Normal ().Y );
848
- state.DrawIndexed (DT_Triangles, flat.iboindex + flat.section ->vertexindex , flat.section ->vertexcount , i == 0 );
853
+ state.SetNormal (flat.plane .plane .Normal ().X , flat.plane .plane .Normal ().Z , flat.plane .plane .Normal ().Y );
854
+ state.DrawIndexed (DT_Triangles, flat.iboindex + flat.section ->vertexindex , flat.section ->vertexcount , i == 0 );
855
+ }
856
+ }
857
+ else
858
+ {
859
+ HWPortal::DrawPortalStencil (state, pass);
849
860
}
850
861
}
851
862
@@ -884,6 +895,7 @@ bool HWPlaneMirrorPortal::Setup(HWDrawInfo *di, FRenderState &rstate, Clipper *c
884
895
std::swap (screen->instack [sector_t ::floor ], screen->instack [sector_t ::ceiling]);
885
896
886
897
auto &vp = di->Viewpoint ;
898
+ state->vpIsAllowedOoB = vp.IsAllowedOoB ();
887
899
old_pm = state->PlaneMirrorMode ;
888
900
889
901
// the player is always visible in a mirror.
@@ -908,16 +920,23 @@ bool HWPlaneMirrorPortal::Setup(HWDrawInfo *di, FRenderState &rstate, Clipper *c
908
920
909
921
void HWPlaneMirrorPortal::DrawPortalStencil (FRenderState &state, int pass)
910
922
{
911
- bool isceiling = planesused & (1 << sector_t ::ceiling);
912
- for (unsigned int i = 0 ; i < lines.Size (); i++)
923
+ if (mState ->vpIsAllowedOoB )
913
924
{
914
- flat.section = lines[i].sub ->section ;
915
- flat.iboindex = lines[i].sub ->sector ->iboindex [isceiling ? sector_t ::ceiling : sector_t ::floor ];
916
- flat.plane .GetFromSector (lines[i].sub ->sector , isceiling ? sector_t ::ceiling : sector_t ::floor );
917
- // if (isceiling) flat.plane.plane.FlipVert(); // Doesn't do anything. Stencil is a screen-space projection
925
+ bool isceiling = planesused & (1 << sector_t ::ceiling);
926
+ for (unsigned int i = 0 ; i < lines.Size (); i++)
927
+ {
928
+ flat.section = lines[i].sub ->section ;
929
+ flat.iboindex = lines[i].sub ->sector ->iboindex [isceiling ? sector_t ::ceiling : sector_t ::floor ];
930
+ flat.plane .GetFromSector (lines[i].sub ->sector , isceiling ? sector_t ::ceiling : sector_t ::floor );
931
+ // if (isceiling) flat.plane.plane.FlipVert(); // Doesn't do anything. Stencil is a screen-space projection
918
932
919
- state.SetNormal (flat.plane .plane .Normal ().X , flat.plane .plane .Normal ().Z , flat.plane .plane .Normal ().Y );
920
- state.DrawIndexed (DT_Triangles, flat.iboindex + flat.section ->vertexindex , flat.section ->vertexcount , i == 0 );
933
+ state.SetNormal (flat.plane .plane .Normal ().X , flat.plane .plane .Normal ().Z , flat.plane .plane .Normal ().Y );
934
+ state.DrawIndexed (DT_Triangles, flat.iboindex + flat.section ->vertexindex , flat.section ->vertexcount , i == 0 );
935
+ }
936
+ }
937
+ else
938
+ {
939
+ HWPortal::DrawPortalStencil (state, pass);
921
940
}
922
941
}
923
942
0 commit comments