Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
illuna-minetest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
illuna-minetest
Commits
c05aac37
Commit
c05aac37
authored
8 years ago
by
paramat
Browse files
Options
Downloads
Patches
Plain Diff
Occlusion culling: Add comments, minor code improvements
Remove unnecessary code. Use '/ 2.0f' because endoff is a float.
parent
c7937002
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/clientmap.cpp
+9
-4
9 additions, 4 deletions
src/clientmap.cpp
with
9 additions
and
4 deletions
src/clientmap.cpp
+
9
−
4
View file @
c05aac37
...
...
@@ -293,14 +293,19 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver)
float
step
=
BS
*
1
;
float
stepfac
=
1.1
;
float
startoff
=
BS
*
1
;
// - Length of the diagonal of a mapblock.
// The occlusion search of 'isOccluded()' must stop short of the target
// point by distance 'endoff' (end offset) to not enter the target mapblock.
// For the 8 mapblock corners 'endoff' must therefore be the maximum diagonal
// of a mapblock, because we must consider all view angles.
// sqrt(1^2 + 1^2 + 1^2) = 1.732
float
endoff
=
-
BS
*
MAP_BLOCKSIZE
*
1.732050807569
;
v3s16
spn
=
cam_pos_nodes
+
v3s16
(
0
,
0
,
0
)
;
v3s16
spn
=
cam_pos_nodes
;
s16
bs2
=
MAP_BLOCKSIZE
/
2
+
1
;
u32
needed_count
=
1
;
if
(
occlusion_culling_enabled
&&
isOccluded
(
this
,
spn
,
cpn
+
v3s16
(
0
,
0
,
0
),
step
,
stepfac
,
startoff
,
endoff
/
2
,
needed_count
,
nodemgr
)
&&
// For the central point of the mapblock 'endoff' can be halved
isOccluded
(
this
,
spn
,
cpn
,
step
,
stepfac
,
startoff
,
endoff
/
2.0
f
,
needed_count
,
nodemgr
)
&&
isOccluded
(
this
,
spn
,
cpn
+
v3s16
(
bs2
,
bs2
,
bs2
),
step
,
stepfac
,
startoff
,
endoff
,
needed_count
,
nodemgr
)
&&
isOccluded
(
this
,
spn
,
cpn
+
v3s16
(
bs2
,
bs2
,
-
bs2
),
...
...
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