Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STJr
SRB2
Commits
cf1f3103
Commit
cf1f3103
authored
1 year ago
by
Lactozilla
Browse files
Options
Downloads
Patches
Plain Diff
Add sector portals from visplanes while rendering a portal
parent
87d40fc3
No related branches found
No related tags found
2 merge requests
!2355
fix newer versions of mixerx
,
!2139
Sector portals
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/r_main.c
+5
-2
5 additions, 2 deletions
src/r_main.c
src/r_portal.c
+12
-5
12 additions, 5 deletions
src/r_portal.c
src/r_portal.h
+3
-1
3 additions, 1 deletion
src/r_portal.h
with
20 additions
and
8 deletions
src/r_main.c
+
5
−
2
View file @
cf1f3103
...
...
@@ -1513,8 +1513,8 @@ void R_RenderPlayerView(player_t *player)
R_ClipSprites
(
drawsegs
,
NULL
);
PS_STOP_TIMING
(
ps_sw_spritecliptime
);
// Add
skybox
portals caused by
sky
visplanes.
Portal_Add
Skybox
Portals
();
// Add portals caused by visplanes.
Portal_Add
Plane
Portals
(
cv_skybox
.
value
);
// Portal rendering. Hijacks the BSP traversal.
PS_START_TIMING
(
ps_sw_portaltime
);
...
...
@@ -1559,6 +1559,9 @@ void R_RenderPlayerView(player_t *player)
R_RenderBSPNode
((
INT32
)
numnodes
-
1
);
}
// Don't add skybox portals while IN a skybox portal, because that'll cause infinite recursion
Portal_AddPlanePortals
(
!
portal
->
is_skybox
);
Mask_Post
(
&
masks
[
nummasks
-
1
]);
R_ClipSprites
(
ds_p
-
(
masks
[
nummasks
-
1
].
drawsegs
[
1
]
-
masks
[
nummasks
-
1
].
drawsegs
[
0
]),
portal
);
...
...
This diff is collapsed.
Click to expand it.
src/r_portal.c
+
12
−
5
View file @
cf1f3103
...
...
@@ -192,6 +192,7 @@ void Portal_Add2Lines (const INT32 line1, const INT32 line2, const INT32 x1, con
Portal_GetViewpointForLine
(
portal
,
start
,
dest
);
portal
->
clipline
=
line2
;
portal
->
is_skybox
=
false
;
portal
->
is_horizon
=
false
;
portal
->
horizon_sector
=
NULL
;
...
...
@@ -317,6 +318,7 @@ void Portal_AddSkybox (const visplane_t* plane)
Portal_ClipVisplane
(
plane
,
portal
);
portal
->
clipline
=
-
1
;
portal
->
is_skybox
=
true
;
portal
->
is_horizon
=
false
;
portal
->
horizon_sector
=
NULL
;
...
...
@@ -396,6 +398,7 @@ void Portal_AddSectorPortal (const visplane_t* plane)
// Shortcut
if
(
secportal
->
type
==
SECPORTAL_SKYBOX
)
{
if
(
skyboxmo
[
0
])
Portal_AddSkybox
(
plane
);
return
;
}
...
...
@@ -409,6 +412,7 @@ void Portal_AddSectorPortal (const visplane_t* plane)
portal
->
clipline
=
-
1
;
portal
->
is_horizon
=
false
;
portal
->
is_skybox
=
false
;
portal
->
horizon_sector
=
NULL
;
Portal_GetViewpointForSecPortal
(
portal
,
secportal
);
...
...
@@ -426,7 +430,7 @@ void Portal_AddTransferred (UINT32 secportalnum, const INT32 x1, const INT32 x2)
return
;
portal_t
*
portal
=
Portal_Add
(
x1
,
x2
);
portal
->
is_skybox
=
false
;
portal
->
is_horizon
=
false
;
portal
->
horizon_sector
=
NULL
;
...
...
@@ -445,10 +449,10 @@ void Portal_AddTransferred (UINT32 secportalnum, const INT32 x1, const INT32 x2)
portalline
=
true
;
}
/** Creates portals for the currently existing
sky
visplanes.
/** Creates portals for the currently existing
portal
visplanes.
* The visplanes are also removed and cleared from the list.
*/
void
Portal_Add
Skybox
Portals
(
void
)
void
Portal_Add
Plane
Portals
(
boolean
add_skyboxes
)
{
visplane_t
*
pl
;
...
...
@@ -456,6 +460,9 @@ void Portal_AddSkyboxPortals (void)
{
for
(
pl
=
visplanes
[
i
];
pl
;
pl
=
pl
->
next
)
{
if
(
pl
->
minx
>=
pl
->
maxx
)
continue
;
boolean
added_portal
=
false
;
// Render sector portal if recursiveness limit hasn't been reached
...
...
@@ -466,7 +473,7 @@ void Portal_AddSkyboxPortals (void)
}
// Render skybox portal
if
(
!
added_portal
&&
pl
->
picnum
==
skyflatnum
&&
cv
_skybox
.
valu
e
&&
skyboxmo
[
0
])
if
(
!
added_portal
&&
pl
->
picnum
==
skyflatnum
&&
add
_skyboxe
s
&&
skyboxmo
[
0
])
{
Portal_AddSkybox
(
pl
);
added_portal
=
true
;
...
...
This diff is collapsed.
Click to expand it.
src/r_portal.h
+
3
−
1
View file @
cf1f3103
...
...
@@ -34,6 +34,8 @@ typedef struct portal_s
boolean
is_horizon
;
sector_t
*
horizon_sector
;
boolean
is_skybox
;
UINT8
pass
;
/**< Keeps track of the portal's recursion depth. */
INT32
clipline
;
/**< Optional clipline for line-based portals. */
...
...
@@ -63,5 +65,5 @@ void Portal_AddTransferred (UINT32 secportalnum, const INT32 x1, const INT32 x2)
void
Portal_ClipRange
(
portal_t
*
portal
);
void
Portal_ClipApply
(
const
portal_t
*
portal
);
void
Portal_Add
Skybox
Portals
(
void
);
void
Portal_Add
Plane
Portals
(
boolean
add_skyboxes
);
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment