Improve waving defintions
- Allow more drawtypes to use waving - Don't hardcode waving type, defined by nodedef - Make leaves_with_apples wave :)
This commit is contained in:
parent
3264b59fc7
commit
0d27cd1c2a
@ -204,3 +204,8 @@ function core.raillike_group(name)
|
||||
end
|
||||
return id
|
||||
end
|
||||
|
||||
local waving_groups = {leaves = 1, plants = 2}
|
||||
function core.get_waving_group(name)
|
||||
return waving_groups[name] or 0
|
||||
end
|
||||
|
@ -2335,6 +2335,9 @@ These functions return the leftover itemstack.
|
||||
* Returns rating of the connect_to_raillike group corresponding to name
|
||||
* If name is not yet the name of a connect_to_raillike group, a new group id
|
||||
* is created, with that name
|
||||
* `core.get_waving_group(name)`: returns a rating
|
||||
* name can be "leaves" or "plants"
|
||||
* returned rating defines which kind of waving is used by shaders
|
||||
* `minetest.get_content_id(name)`: returns an integer
|
||||
* Gets the internal content ID of `name`
|
||||
* `minetest.get_name_from_content_id(content_id)`: returns a string
|
||||
|
@ -2,14 +2,14 @@
|
||||
# www.blender.org
|
||||
mtllib default_leaves_apple.mtl
|
||||
o Cube_Cube.001
|
||||
v -0.494900 0.507706 0.497315
|
||||
v -0.494900 0.507706 -0.498102
|
||||
v -0.494900 -0.497234 -0.498102
|
||||
v -0.494900 -0.497234 0.497315
|
||||
v 0.497295 0.507706 -0.498102
|
||||
v 0.497295 -0.497234 -0.498102
|
||||
v 0.497295 0.507706 0.497315
|
||||
v 0.497295 -0.497234 0.497315
|
||||
v -0.494900 -0.492294 -0.498102
|
||||
v -0.494900 -0.492294 0.497315
|
||||
v 0.497295 0.502766 -0.498102
|
||||
v 0.497295 0.502766 0.497315
|
||||
v 0.497295 -0.492294 0.497315
|
||||
v -0.494900 0.502766 -0.498102
|
||||
v 0.497295 -0.492294 -0.498102
|
||||
v -0.494900 0.502766 0.497315
|
||||
v 0.158101 0.160790 -0.112246
|
||||
v 0.158101 -0.131804 -0.112246
|
||||
v 0.158101 0.160790 0.180347
|
||||
@ -26,6 +26,22 @@ v 0.047132 0.159064 0.069418
|
||||
v 0.047132 0.279774 0.069418
|
||||
v 0.047132 0.159064 -0.002894
|
||||
v 0.047132 0.279774 -0.002894
|
||||
v 0.503668 -0.490861 -0.498102
|
||||
v -0.494900 -0.497234 -0.498102
|
||||
v 0.503668 0.501334 -0.498102
|
||||
v 0.497295 -0.492472 0.502076
|
||||
v -0.501272 0.501333 -0.498102
|
||||
v 0.497295 -0.492472 -0.502863
|
||||
v -0.501272 0.501334 0.497315
|
||||
v -0.494900 -0.497234 0.497315
|
||||
v -0.501272 -0.490862 0.497315
|
||||
v 0.497295 0.502944 0.502076
|
||||
v 0.503668 0.501333 0.497315
|
||||
v -0.494900 0.507706 0.497315
|
||||
v 0.503668 -0.490862 0.497315
|
||||
v 0.497295 0.502944 -0.502863
|
||||
v -0.501272 -0.490862 -0.498102
|
||||
v -0.494900 0.507706 -0.498102
|
||||
vt 0.499998 0.999901
|
||||
vt -0.000002 0.999897
|
||||
vt 0.000002 -0.000002
|
||||
@ -51,30 +67,30 @@ vt 0.875000 0.687500
|
||||
vt 0.625000 0.687500
|
||||
vt 0.875000 0.687429
|
||||
vn -1.000000 0.000000 0.000000
|
||||
vn 0.000000 0.000000 -1.000000
|
||||
vn -0.000000 0.000000 -1.000000
|
||||
vn 1.000000 0.000000 0.000000
|
||||
vn 0.000000 -0.000000 1.000000
|
||||
vn -0.000000 -0.000000 1.000000
|
||||
vn 0.000000 1.000000 -0.000000
|
||||
vn 0.000000 -1.000000 -0.000000
|
||||
vn 0.000000 1.000000 0.000000
|
||||
usemtl None
|
||||
s off
|
||||
f 1/1/1 2/2/1 3/3/1 4/4/1
|
||||
f 2/4/2 5/5/2 6/6/2 3/3/2
|
||||
f 5/4/3 7/5/3 8/6/3 6/3/3
|
||||
f 7/4/4 1/5/4 4/6/4 8/3/4
|
||||
f 36/1/1 40/2/1 26/3/1 32/4/1
|
||||
f 39/4/2 29/5/2 27/6/2 25/3/2
|
||||
f 30/4/3 38/5/3 34/6/3 28/3/3
|
||||
f 37/4/4 35/5/4 31/6/4 33/3/4
|
||||
f 4/2/5 3/3/5 6/4/5 8/1/5
|
||||
f 2/4/6 1/1/6 7/2/6 5/3/6
|
||||
f 18/7/1 20/8/1 19/9/1 17/10/1
|
||||
f 20/7/2 24/8/2 23/9/2 19/10/2
|
||||
f 24/11/3 22/7/3 21/8/3 23/12/3
|
||||
f 22/11/4 18/13/4 17/14/4 21/12/4
|
||||
f 22/10/6 24/15/6 20/16/6 18/9/6
|
||||
f 22/10/5 24/15/5 20/16/5 18/9/5
|
||||
usemtl None_NONE
|
||||
f 17/3/5 19/3/5 23/3/5 21/3/5
|
||||
f 17/3/6 19/3/6 23/3/6 21/3/6
|
||||
usemtl None_torches_torch.png
|
||||
f 10/17/1 12/18/1 11/19/1 9/20/1
|
||||
f 12/20/2 16/17/2 15/18/2 11/19/2
|
||||
f 16/17/3 14/18/3 13/19/3 15/20/3
|
||||
f 14/18/4 10/19/4 9/20/4 13/17/4
|
||||
f 9/21/5 11/22/5 15/23/5 13/18/5
|
||||
f 14/17/6 16/18/6 12/21/6 10/24/6
|
||||
f 9/21/6 11/22/6 15/23/6 13/18/6
|
||||
f 14/17/5 16/18/5 12/21/5 10/24/5
|
||||
|
@ -1,7 +1,7 @@
|
||||
minetest.register_node("default:junglegrass", {
|
||||
description = "Jungle Grass",
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
waving = core.get_waving_group("plants"),
|
||||
visual_scale = 1.3,
|
||||
tiles = {"default_junglegrass.png"},
|
||||
inventory_image = "default_junglegrass.png",
|
||||
@ -21,7 +21,7 @@ minetest.register_node("default:junglegrass", {
|
||||
minetest.register_node("default:dry_shrub", {
|
||||
description = "Dry Shrub",
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
waving = core.get_waving_group("plants"),
|
||||
visual_scale = 1.0,
|
||||
tiles = {"default_dry_shrub.png"},
|
||||
inventory_image = "default_dry_shrub.png",
|
||||
@ -41,7 +41,7 @@ minetest.register_node("default:dry_shrub", {
|
||||
minetest.register_node("default:grass_5", {
|
||||
description = "Grass",
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
waving = core.get_waving_group("plants"),
|
||||
tiles = {"default_grass_5.png"},
|
||||
inventory_image = "default_grass_3.png",
|
||||
--wield_image = "default_grass_3.png",
|
||||
@ -68,7 +68,7 @@ minetest.register_node("default:grass_5", {
|
||||
minetest.register_node("default:dry_grass_5", {
|
||||
description = "Dry Grass",
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
waving = core.get_waving_group("plants"),
|
||||
tiles = {"default_dry_grass_5.png"},
|
||||
inventory_image = "default_dry_grass_3.png",
|
||||
--wield_image = "default_dry_grass_3.png",
|
||||
@ -96,7 +96,7 @@ for i = 1, 4 do
|
||||
minetest.register_node("default:grass_" .. i, {
|
||||
description = "Grass",
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
waving = core.get_waving_group("plants"),
|
||||
tiles = {"default_grass_" .. i .. ".png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
@ -115,7 +115,7 @@ for i = 1, 4 do
|
||||
minetest.register_node("default:dry_grass_" .. i, {
|
||||
description = "Dry Grass",
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
waving = core.get_waving_group("plants"),
|
||||
tiles = {"default_dry_grass_" .. i .. ".png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
|
@ -1,7 +1,7 @@
|
||||
local leaves_def = {
|
||||
description = "Leaves",
|
||||
drawtype = "allfaces_optional",
|
||||
waving = 1,
|
||||
waving = core.get_waving_group("leaves"),
|
||||
visual_scale = 1.3,
|
||||
tiles = {"default_leaves.png"},
|
||||
special_tiles = {"default_leaves_simple.png"},
|
||||
@ -73,17 +73,7 @@ default.register_leaves("default:acacia_leaves", {
|
||||
|
||||
|
||||
-- Leaves with apple
|
||||
if core.setting_getbool("enable_shaders") and core.setting_getbool("enable_waving_leaves") == true then
|
||||
default.register_leaves("default:leaves_with_apple", {
|
||||
description = "Leaves",
|
||||
tiles = {"default_apple.png^default_leaves.png"},
|
||||
special_tiles = {"default_leaves_simple.png"},
|
||||
drop = "default:apple",
|
||||
after_place_node = function(...)
|
||||
end,
|
||||
})
|
||||
else
|
||||
minetest.register_node("default:leaves_with_apple", {
|
||||
minetest.register_node("default:leaves_with_apple", {
|
||||
description = "Leaves with Apple",
|
||||
drawtype = "mesh",
|
||||
mesh = "leaves_with_apple.obj",
|
||||
@ -93,8 +83,8 @@ else
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
drop = "default:apple",
|
||||
waving = core.get_waving_group("leaves"),
|
||||
groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1, fuel = 2,
|
||||
not_in_creative_inventory = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
end
|
||||
})
|
||||
|
@ -277,7 +277,7 @@ farming.register_plant = function(name, def)
|
||||
nodegroups[pname] = i
|
||||
minetest.register_node(":" .. mname .. ":" .. pname .. "_" .. i, {
|
||||
drawtype = def.drawtype or "plantlike",
|
||||
waving = 1,
|
||||
waving = def.waving or 0,
|
||||
tiles = {mname .. "_" .. pname .. "_" .. i .. ".png"},
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
|
@ -6,7 +6,8 @@ farming.register_plant("farming:wheat", {
|
||||
steps = 8,
|
||||
minlight = 13,
|
||||
maxlight = default.LIGHT_MAX,
|
||||
fertility = {"grassland"}
|
||||
fertility = {"grassland"},
|
||||
waving = core.get_waving_group("plants"),
|
||||
})
|
||||
|
||||
-- Cotton
|
||||
@ -28,5 +29,6 @@ farming.register_plant("farming:potato", {
|
||||
minlight = 13,
|
||||
maxlight = default.LIGHT_MAX,
|
||||
fertility = {"grassland"},
|
||||
on_use = minetest.item_eat(1)
|
||||
on_use = minetest.item_eat(1),
|
||||
waving = core.get_waving_group("plants"),
|
||||
})
|
||||
|
@ -39,7 +39,7 @@ local function add_simple_flower(name, desc, box, f_groups)
|
||||
minetest.register_node("flowers:" .. name, {
|
||||
description = desc,
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
waving = core.get_waving_group("plants"),
|
||||
tiles = {"flowers_" .. name .. ".png"},
|
||||
inventory_image = "flowers_" .. name .. ".png",
|
||||
wield_image = "flowers_" .. name .. ".png",
|
||||
|
@ -809,6 +809,10 @@ void CNodeDefManager::updateTextures(IGameDef *gamedef,
|
||||
|
||||
u32 size = m_content_features.size();
|
||||
|
||||
// TILE_MATERIAL_* offset, used for waving parameter
|
||||
// e.g. use TILE_MATERIAL_WAVING_PLANTS = f->waving + offset (which is 5)
|
||||
const u8 offset = 3;
|
||||
|
||||
for (u32 i = 0; i < size; i++) {
|
||||
ContentFeatures *f = &m_content_features[i];
|
||||
|
||||
@ -893,23 +897,27 @@ void CNodeDefManager::updateTextures(IGameDef *gamedef,
|
||||
for (u32 i = 0; i < 6; i++)
|
||||
tiledef[i].name += std::string("^[noalpha");
|
||||
}
|
||||
if (f->waving == 1)
|
||||
material_type = TILE_MATERIAL_WAVING_LEAVES;
|
||||
if (f->waving > 0)
|
||||
material_type = offset + f->waving;
|
||||
break;
|
||||
case NDT_PLANTLIKE:
|
||||
case NDT_CROPLIKE:
|
||||
f->solidness = 0;
|
||||
f->backface_culling = false;
|
||||
if (f->waving == 1)
|
||||
material_type = TILE_MATERIAL_WAVING_PLANTS;
|
||||
if (f->waving > 0)
|
||||
material_type = offset + f->waving;
|
||||
break;
|
||||
case NDT_FIRELIKE:
|
||||
f->backface_culling = false;
|
||||
f->solidness = 0;
|
||||
if (f->waving > 0)
|
||||
material_type = offset + f->waving;
|
||||
break;
|
||||
case NDT_MESH:
|
||||
f->solidness = 0;
|
||||
f->backface_culling = false;
|
||||
if (f->waving > 0)
|
||||
material_type = offset + f->waving;
|
||||
break;
|
||||
case NDT_TORCHLIKE:
|
||||
case NDT_SIGNLIKE:
|
||||
|
Loading…
x
Reference in New Issue
Block a user