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
c367f730
Commit
c367f730
authored
10 years ago
by
paramat
Committed by
kwolekr
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Mapgen V5: Move cave generation from base terrain loop to optional function
This fixes biome surface in tunnels
parent
a77c85fa
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mapgen_v5.cpp
+31
-6
31 additions, 6 deletions
src/mapgen_v5.cpp
src/mapgen_v5.h
+1
-0
1 addition, 0 deletions
src/mapgen_v5.h
with
32 additions
and
6 deletions
src/mapgen_v5.cpp
+
31
−
6
View file @
c367f730
...
@@ -268,6 +268,10 @@ void MapgenV5::makeChunk(BlockMakeData *data)
...
@@ -268,6 +268,10 @@ void MapgenV5::makeChunk(BlockMakeData *data)
// Actually place the biome-specific nodes
// Actually place the biome-specific nodes
generateBiomes
();
generateBiomes
();
// Generate caves
if
((
flags
&
MG_CAVES
)
&&
(
stone_surface_max_y
>=
node_min
.
Y
))
generateCaves
();
// Generate dungeons and desert temples
// Generate dungeons and desert temples
if
((
flags
&
MG_DUNGEONS
)
&&
(
stone_surface_max_y
>=
node_min
.
Y
))
{
if
((
flags
&
MG_DUNGEONS
)
&&
(
stone_surface_max_y
>=
node_min
.
Y
))
{
DungeonGen
dgen
(
this
,
NULL
);
DungeonGen
dgen
(
this
,
NULL
);
...
@@ -309,8 +313,11 @@ void MapgenV5::calculateNoise()
...
@@ -309,8 +313,11 @@ void MapgenV5::calculateNoise()
noise_factor
->
perlinMap2D
(
x
,
z
);
noise_factor
->
perlinMap2D
(
x
,
z
);
noise_height
->
perlinMap2D
(
x
,
z
);
noise_height
->
perlinMap2D
(
x
,
z
);
noise_cave1
->
perlinMap3D
(
x
,
y
,
z
);
if
(
flags
&
MG_CAVES
)
{
noise_cave2
->
perlinMap3D
(
x
,
y
,
z
);
noise_cave1
->
perlinMap3D
(
x
,
y
,
z
);
noise_cave2
->
perlinMap3D
(
x
,
y
,
z
);
}
noise_ground
->
perlinMap3D
(
x
,
y
,
z
);
noise_ground
->
perlinMap3D
(
x
,
y
,
z
);
if
(
spflags
&
MGV5_BLOBS
)
{
if
(
spflags
&
MGV5_BLOBS
)
{
...
@@ -363,16 +370,12 @@ int MapgenV5::generateBaseTerrain()
...
@@ -363,16 +370,12 @@ int MapgenV5::generateBaseTerrain()
else
if
(
f
>=
1.0
)
else
if
(
f
>=
1.0
)
f
*=
1.6
;
f
*=
1.6
;
float
h
=
water_level
+
noise_height
->
result
[
index2d
];
float
h
=
water_level
+
noise_height
->
result
[
index2d
];
float
d1
=
contour
(
noise_cave1
->
result
[
index
]);
float
d2
=
contour
(
noise_cave2
->
result
[
index
]);
if
(
noise_ground
->
result
[
index
]
*
f
<
y
-
h
)
{
if
(
noise_ground
->
result
[
index
]
*
f
<
y
-
h
)
{
if
(
y
<=
water_level
)
if
(
y
<=
water_level
)
vm
->
m_data
[
i
]
=
MapNode
(
c_water_source
);
vm
->
m_data
[
i
]
=
MapNode
(
c_water_source
);
else
else
vm
->
m_data
[
i
]
=
MapNode
(
CONTENT_AIR
);
vm
->
m_data
[
i
]
=
MapNode
(
CONTENT_AIR
);
}
else
if
(
d1
*
d2
>
0.2
)
{
vm
->
m_data
[
i
]
=
MapNode
(
CONTENT_AIR
);
}
else
{
}
else
{
vm
->
m_data
[
i
]
=
MapNode
(
c_stone
);
vm
->
m_data
[
i
]
=
MapNode
(
c_stone
);
if
(
y
>
stone_surface_max_y
)
if
(
y
>
stone_surface_max_y
)
...
@@ -508,6 +511,28 @@ void MapgenV5::generateBiomes()
...
@@ -508,6 +511,28 @@ void MapgenV5::generateBiomes()
}
}
void
MapgenV5
::
generateCaves
()
{
u32
index
=
0
;
for
(
s16
z
=
node_min
.
Z
;
z
<=
node_max
.
Z
;
z
++
)
{
for
(
s16
y
=
node_min
.
Y
-
1
;
y
<=
node_max
.
Y
+
1
;
y
++
)
{
u32
i
=
vm
->
m_area
.
index
(
node_min
.
X
,
y
,
z
);
for
(
s16
x
=
node_min
.
X
;
x
<=
node_max
.
X
;
x
++
,
i
++
,
index
++
)
{
content_t
c
=
vm
->
m_data
[
i
].
getContent
();
if
(
c
==
CONTENT_AIR
||
c
==
c_water_source
)
continue
;
float
d1
=
contour
(
noise_cave1
->
result
[
index
]);
float
d2
=
contour
(
noise_cave2
->
result
[
index
]);
if
(
d1
*
d2
>
0.2
)
vm
->
m_data
[
i
]
=
MapNode
(
CONTENT_AIR
);
}
}
}
}
void
MapgenV5
::
dustTopNodes
()
void
MapgenV5
::
dustTopNodes
()
{
{
v3s16
em
=
vm
->
m_area
.
getExtent
();
v3s16
em
=
vm
->
m_area
.
getExtent
();
...
...
This diff is collapsed.
Click to expand it.
src/mapgen_v5.h
+
1
−
0
View file @
c367f730
...
@@ -97,6 +97,7 @@ class MapgenV5 : public Mapgen {
...
@@ -97,6 +97,7 @@ class MapgenV5 : public Mapgen {
int
generateBaseTerrain
();
int
generateBaseTerrain
();
void
generateBlobs
();
void
generateBlobs
();
void
generateBiomes
();
void
generateBiomes
();
void
generateCaves
();
void
dustTopNodes
();
void
dustTopNodes
();
};
};
...
...
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