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
1cd83510
Commit
1cd83510
authored
12 years ago
by
kwolekr
Committed by
Perttu Ahola
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix MapgenV6::getGroundLevelAtPoint()
parent
631a835e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/mapgen.h
+1
-1
1 addition, 1 deletion
src/mapgen.h
src/mapgen_v6.cpp
+33
-2
33 additions, 2 deletions
src/mapgen_v6.cpp
src/noise.h
+22
-2
22 additions, 2 deletions
src/noise.h
with
56 additions
and
5 deletions
src/mapgen.h
+
1
−
1
View file @
1cd83510
...
...
@@ -202,7 +202,7 @@ class MapgenV6 : public Mapgen {
void
makeChunk
(
BlockMakeData
*
data
);
int
getGroundLevelAtPoint
(
v2s16
p
);
double
baseRockLevelFromNoise
(
v2s16
p
);
static
s16
find_ground_level
(
VoxelManipulator
&
vmanip
,
v2s16
p2d
,
INodeDefManager
*
ndef
);
static
s16
find_stone_level
(
VoxelManipulator
&
vmanip
,
v2s16
p2d
,
INodeDefManager
*
ndef
);
void
make_tree
(
ManualMapVoxelManipulator
&
vmanip
,
v3s16
p0
,
bool
is_apple_tree
,
INodeDefManager
*
ndef
);
...
...
This diff is collapsed.
Click to expand it.
src/mapgen_v6.cpp
+
33
−
2
View file @
1cd83510
...
...
@@ -311,9 +311,40 @@ double MapgenV6::base_rock_level_2d(u64 seed, v2s16 p)
return
h
;
}
double
MapgenV6
::
baseRockLevelFromNoise
(
v2s16
p
)
{
double
base
=
water_level
+
NoisePerlin2DPosOffset
(
noise_terrain_base
->
np
,
p
.
X
,
0.5
,
p
.
Y
,
0.5
,
seed
);
double
higher
=
water_level
+
NoisePerlin2DPosOffset
(
noise_terrain_higher
->
np
,
p
.
X
,
0.5
,
p
.
Y
,
0.5
,
seed
);
if
(
higher
<
base
)
higher
=
base
;
double
b
=
NoisePerlin2DPosOffset
(
noise_steepness
->
np
,
p
.
X
,
0.5
,
p
.
Y
,
0.5
,
seed
);
b
=
rangelim
(
b
,
0.0
,
1000.0
);
b
=
b
*
b
*
b
*
b
*
b
*
b
*
b
;
b
*=
5
;
b
=
rangelim
(
b
,
0.5
,
1000.0
);
if
(
b
>
1.5
&&
b
<
100.0
){
if
(
b
<
10.0
)
b
=
1.5
;
else
b
=
100.0
;
}
double
a_off
=
-
0.20
;
double
a
=
0.5
+
b
*
(
a_off
+
NoisePerlin2DNoTxfmPosOffset
(
noise_height_select
->
np
,
p
.
X
,
0.5
,
p
.
Y
,
0.5
,
seed
));
a
=
rangelim
(
a
,
0.0
,
1.0
);
return
base
*
(
1.0
-
a
)
+
higher
*
a
;
}
s16
MapgenV6
::
find_ground_level_from_noise
(
u64
seed
,
v2s16
p2d
,
s16
precision
)
{
return
base
_r
ock
_l
evel
_2d
(
seed
,
p2d
)
+
AVERAGE_MUD_AMOUNT
;
return
base
R
ock
L
evel
FromNoise
(
p2d
)
+
AVERAGE_MUD_AMOUNT
;
}
double
MapgenV6
::
get_mud_add_amount
(
u64
seed
,
v2s16
p
)
...
...
@@ -363,7 +394,7 @@ u32 MapgenV6::get_blockseed(u64 seed, v3s16 p)
int
MapgenV6
::
getGroundLevelAtPoint
(
v2s16
p
)
{
return
base
_r
ock
_l
evel
_2d
(
seed
,
p
)
+
AVERAGE_MUD_AMOUNT
;
return
base
R
ock
L
evel
FromNoise
(
p
)
+
AVERAGE_MUD_AMOUNT
;
}
...
...
This diff is collapsed.
Click to expand it.
src/noise.h
+
22
−
2
View file @
1cd83510
...
...
@@ -132,8 +132,28 @@ inline float easeCurve(float t) {
return
t
*
t
*
t
*
(
t
*
(
6.
f
*
t
-
15.
f
)
+
10.
f
);
}
#define NoisePerlin2D(np, x, y, s) ((np)->offset + (np)->scale * \
noise2d_perlin((float)(x) / (np)->spread.X, (float)(y) / (np)->spread.Y, \
#define NoisePerlin2D(np, x, y, s) \
((np)->offset + (np)->scale * noise2d_perlin( \
(float)(x) / (np)->spread.X, \
(float)(y) / (np)->spread.Y, \
(s) + (np)->seed, (np)->octaves, (np)->persist))
#define NoisePerlin2DNoTxfm(np, x, y, s) \
(noise2d_perlin( \
(float)(x) / (np)->spread.X, \
(float)(y) / (np)->spread.Y, \
(s) + (np)->seed, (np)->octaves, (np)->persist))
#define NoisePerlin2DPosOffset(np, x, xoff, y, yoff, s) \
((np)->offset + (np)->scale * noise2d_perlin( \
(float)(xoff) + (float)(x) / (np)->spread.X, \
(float)(yoff) + (float)(y) / (np)->spread.Y, \
(s) + (np)->seed, (np)->octaves, (np)->persist))
#define NoisePerlin2DNoTxfmPosOffset(np, x, xoff, y, yoff, s) \
(noise2d_perlin( \
(float)(xoff) + (float)(x) / (np)->spread.X, \
(float)(yoff) + (float)(y) / (np)->spread.Y, \
(s) + (np)->seed, (np)->octaves, (np)->persist))
#define NoisePerlin3D(np, x, y, z, s) ((np)->offset + (np)->scale * \
...
...
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