summaryrefslogtreecommitdiff
path: root/src/nodedef.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-12-02 02:57:14 +0200
committerPerttu Ahola <celeron55@gmail.com>2012-12-02 02:59:15 +0200
commit3e07c5bf822afe01525a9a3ef499ae895c22a130 (patch)
tree384ef75570c59eda5b6af738282ed19d824eff1c /src/nodedef.cpp
parentca16119adbec2b2f5225435bac76a3c5eb081dfa (diff)
downloadminetest-3e07c5bf822afe01525a9a3ef499ae895c22a130.tar.gz
minetest-3e07c5bf822afe01525a9a3ef499ae895c22a130.tar.bz2
minetest-3e07c5bf822afe01525a9a3ef499ae895c22a130.zip
Fix tile MaterialType to make sense and make lava surface be shader'd lower like water
Diffstat (limited to 'src/nodedef.cpp')
-rw-r--r--src/nodedef.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/nodedef.cpp b/src/nodedef.cpp
index c48e2ff97..36fa798fd 100644
--- a/src/nodedef.cpp
+++ b/src/nodedef.cpp
@@ -555,6 +555,7 @@ public:
tiledef[j].name = "unknown_block.png";
}
+ bool is_liquid = false;
switch(f->drawtype){
default:
case NDT_NORMAL:
@@ -573,12 +574,14 @@ public:
f->solidness = 1;
f->backface_culling = false;
}
+ is_liquid = true;
break;
case NDT_FLOWINGLIQUID:
assert(f->liquid_type == LIQUID_FLOWING);
f->solidness = 0;
if(opaque_water)
f->alpha = 255;
+ is_liquid = true;
break;
case NDT_GLASSLIKE:
f->solidness = 0;
@@ -611,16 +614,24 @@ public:
break;
}
+ u8 material_type = 0;
+ if(is_liquid){
+ if(f->alpha == 255)
+ material_type = TILE_MATERIAL_LIQUID_OPAQUE;
+ else
+ material_type = TILE_MATERIAL_LIQUID_TRANSPARENT;
+ } else{
+ material_type = TILE_MATERIAL_BASIC;
+ }
+
// Tiles (fill in f->tiles[])
for(u16 j=0; j<6; j++){
// Texture
f->tiles[j].texture = tsrc->getTexture(tiledef[j].name);
// Alpha
f->tiles[j].alpha = f->alpha;
- if(f->alpha == 255)
- f->tiles[j].material_type = MATERIAL_ALPHA_SIMPLE;
- else
- f->tiles[j].material_type = MATERIAL_ALPHA_VERTEX;
+ // Material type
+ f->tiles[j].material_type = material_type;
// Material flags
f->tiles[j].material_flags = 0;
if(f->backface_culling)
@@ -661,10 +672,8 @@ public:
tsrc->getTexture(f->tiledef_special[j].name);
// Alpha
f->special_tiles[j].alpha = f->alpha;
- if(f->alpha == 255)
- f->special_tiles[j].material_type = MATERIAL_ALPHA_SIMPLE;
- else
- f->special_tiles[j].material_type = MATERIAL_ALPHA_VERTEX;
+ // Material type
+ f->special_tiles[j].material_type = material_type;
// Material flags
f->special_tiles[j].material_flags = 0;
if(f->tiledef_special[j].backface_culling)