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
Package registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
twi
SRB2
Commits
64c4579b
Unverified
Commit
64c4579b
authored
1 year ago
by
Hanicef
Browse files
Options
Downloads
Patches
Plain Diff
Retain skybox and horizon line order
parent
ee724de4
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/hardware/hw_batching.c
+10
-4
10 additions, 4 deletions
src/hardware/hw_batching.c
src/hardware/hw_batching.h
+1
-1
1 addition, 1 deletion
src/hardware/hw_batching.h
with
11 additions
and
5 deletions
src/hardware/hw_batching.c
+
10
−
4
View file @
64c4579b
...
@@ -116,15 +116,20 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
...
@@ -116,15 +116,20 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
polygonArray
[
polygonArraySize
].
texture
=
current_texture
;
polygonArray
[
polygonArraySize
].
texture
=
current_texture
;
polygonArray
[
polygonArraySize
].
shader
=
shader
;
polygonArray
[
polygonArraySize
].
shader
=
shader
;
polygonArray
[
polygonArraySize
].
horizonSpecial
=
horizonSpecial
;
polygonArray
[
polygonArraySize
].
horizonSpecial
=
horizonSpecial
;
polygonArray
[
polygonArraySize
].
hash
=
0
;
// default to polygonArraySize so we don't lose order on horizon lines
// (yes, it's supposed to be negative, since we're sorting in that direction)
polygonArray
[
polygonArraySize
].
hash
=
-
polygonArraySize
;
polygonArraySize
++
;
polygonArraySize
++
;
if
(
!
(
PolyFlags
&
PF_NoTexture
)
&&
!
horizonSpecial
)
if
(
!
(
PolyFlags
&
PF_NoTexture
)
&&
!
horizonSpecial
)
{
{
// use FNV-1a to hash polygons for later sorting.
// use FNV-1a to hash polygons for later sorting.
int32_t
hash
=
0x811c9dc5
;
INT32
hash
=
0x811c9dc5
;
#define DIGEST(h, x) h ^= (x); h *= 0x01000193
#define DIGEST(h, x) h ^= (x); h *= 0x01000193
if
(
current_texture
)
{
DIGEST
(
hash
,
current_texture
->
downloaded
);
DIGEST
(
hash
,
current_texture
->
downloaded
);
}
DIGEST
(
hash
,
PolyFlags
);
DIGEST
(
hash
,
PolyFlags
);
DIGEST
(
hash
,
pSurf
->
PolyColor
.
rgba
);
DIGEST
(
hash
,
pSurf
->
PolyColor
.
rgba
);
if
(
cv_glshaders
.
value
&&
gl_shadersavailable
)
if
(
cv_glshaders
.
value
&&
gl_shadersavailable
)
...
@@ -137,7 +142,8 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
...
@@ -137,7 +142,8 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
DIGEST
(
hash
,
pSurf
->
LightInfo
.
fade_end
);
DIGEST
(
hash
,
pSurf
->
LightInfo
.
fade_end
);
}
}
#undef DIGEST
#undef DIGEST
polygonArray
[
polygonArraySize
-
1
].
hash
=
hash
;
// remove the sign bit to ensure that skybox and horizon line comes first.
polygonArray
[
polygonArraySize
-
1
].
hash
=
(
hash
&
INT32_MAX
);
}
}
memcpy
(
&
unsortedVertexArray
[
unsortedVertexArraySize
],
pOutVerts
,
iNumPts
*
sizeof
(
FOutVector
));
memcpy
(
&
unsortedVertexArray
[
unsortedVertexArraySize
],
pOutVerts
,
iNumPts
*
sizeof
(
FOutVector
));
...
...
This diff is collapsed.
Click to expand it.
src/hardware/hw_batching.h
+
1
−
1
View file @
64c4579b
...
@@ -26,7 +26,7 @@ typedef struct
...
@@ -26,7 +26,7 @@ typedef struct
int
shader
;
int
shader
;
// this tells batching that the plane belongs to a horizon line and must be drawn in correct order with the skywalls
// this tells batching that the plane belongs to a horizon line and must be drawn in correct order with the skywalls
boolean
horizonSpecial
;
boolean
horizonSpecial
;
uint32_t
hash
;
INT32
hash
;
}
PolygonArrayEntry
;
}
PolygonArrayEntry
;
void
HWR_StartBatching
(
void
);
void
HWR_StartBatching
(
void
);
...
...
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