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
296748d3
Commit
296748d3
authored
13 years ago
by
Perttu Ahola
Browse files
Options
Downloads
Patches
Plain Diff
Fixed liquid mesh generation
parent
ad408f26
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/content_mapblock.cpp
+23
-9
23 additions, 9 deletions
src/content_mapblock.cpp
with
23 additions
and
9 deletions
src/content_mapblock.cpp
+
23
−
9
View file @
296748d3
...
...
@@ -386,8 +386,8 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
if
(
n2
.
getContent
()
==
c_source
)
level
=
(
-
0.5
+
node_liquid_level
)
*
BS
;
else
if
(
n2
.
getContent
()
==
c_flowing
)
level
=
(
-
0.5
+
((
float
)
n2
.
param2
+
0.5
)
/
8.0
*
node_liquid_level
)
*
BS
;
level
=
(
-
0.5
+
((
float
)
(
n2
.
param2
&
LIQUID_LEVEL_MASK
)
+
0.5
)
/
8.0
*
node_liquid_level
)
*
BS
;
// Check node above neighbor.
// NOTE: This doesn't get executed if neighbor
...
...
@@ -404,9 +404,6 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
neighbor_flags
.
insert
(
neighbor_dirs
[
i
],
flags
);
}
//float liquid_level = (-0.5 + ((float)n.param2 + 0.5) / 8.0) * BS;
//float liquid_level = neighbor_levels[v3s16(0,0,0)];
// Corner heights (average between four liquids)
f32
corner_levels
[
4
];
...
...
@@ -421,29 +418,46 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
v3s16
cornerdir
=
halfdirs
[
i
];
float
cornerlevel
=
0
;
u32
valid_count
=
0
;
u32
air_count
=
0
;
for
(
u32
j
=
0
;
j
<
4
;
j
++
)
{
v3s16
neighbordir
=
cornerdir
-
halfdirs
[
j
];
u8
content
=
neighbor_contents
[
neighbordir
];
// Special case for source nodes
if
(
content
==
c_source
)
// If top is liquid, draw starting from top of node
if
(
neighbor_flags
[
neighbordir
]
&
neighborflag_top_is_same_liquid
)
{
cornerlevel
=
0.5
*
BS
;
valid_count
=
1
;
break
;
}
// Source is always the same height
else
if
(
content
==
c_source
)
{
cornerlevel
=
(
-
0.5
+
node_liquid_level
)
*
BS
;
valid_count
=
1
;
break
;
}
// Flowing liquid has level information
else
if
(
content
==
c_flowing
)
{
cornerlevel
+=
neighbor_levels
[
neighbordir
];
valid_count
++
;
}
else
if
(
content
==
CONTENT_AIR
)
{
air_count
++
;
}
/*// Air is liquid level 0
else if(content == CONTENT_AIR)
{
cornerlevel += -0.5*BS;
valid_count++;
}
}
*/
}
if
(
valid_count
>
0
)
if
(
air_count
>=
2
)
cornerlevel
=
-
0.5
*
BS
;
else
if
(
valid_count
>
0
)
cornerlevel
/=
valid_count
;
corner_levels
[
i
]
=
cornerlevel
;
}
...
...
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