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
fc89f467
Commit
fc89f467
authored
9 years ago
by
paramat
Browse files
Options
Downloads
Patches
Plain Diff
Decoration API: Fix missing low density decorations
For a decoration count between 0 and 1 calculate a chance for 1
parent
987d6a82
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/mg_decoration.cpp
+9
-1
9 additions, 1 deletion
src/mg_decoration.cpp
with
9 additions
and
1 deletion
src/mg_decoration.cpp
+
9
−
1
View file @
fc89f467
...
...
@@ -117,7 +117,15 @@ size_t Decoration::placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax)
float
nval
=
(
flags
&
DECO_USE_NOISE
)
?
NoisePerlin2D
(
&
np
,
p2d_center
.
X
,
p2d_center
.
Y
,
mapseed
)
:
fill_ratio
;
u32
deco_count
=
area
*
MYMAX
(
nval
,
0.
f
);
u32
deco_count
=
0
;
float
deco_count_f
=
(
float
)
area
*
nval
;
if
(
deco_count_f
>=
1.
f
)
{
deco_count
=
deco_count_f
;
}
else
if
(
deco_count_f
>
0.
f
)
{
// For low density decorations calculate a chance for 1 decoration
if
(
ps
.
range
(
1000
)
<=
deco_count_f
*
1000.
f
)
deco_count
=
1
;
}
for
(
u32
i
=
0
;
i
<
deco_count
;
i
++
)
{
s16
x
=
ps
.
range
(
p2d_min
.
X
,
p2d_max
.
X
);
...
...
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