Compare commits
91 Commits
0.4.dev-20
...
0.4.dev-20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
569156b013 | ||
|
|
6d4bc012f0 | ||
|
|
2f5c28aaf1 | ||
|
|
4f2c1e36a1 | ||
|
|
bc743ca7ce | ||
|
|
f9d7e399b2 | ||
|
|
3e6f824e6c | ||
|
|
6286c555d4 | ||
|
|
4630281318 | ||
|
|
cd0019acd2 | ||
|
|
e82a76e438 | ||
|
|
ab57fbe4ca | ||
|
|
56f55ab1af | ||
|
|
2445cbbbdc | ||
|
|
48131bf988 | ||
|
|
2b9596fe9b | ||
|
|
0e1f448b61 | ||
|
|
ff82b95800 | ||
|
|
49b7055cb3 | ||
|
|
cb88f7b6d4 | ||
|
|
9425fb8192 | ||
|
|
e48ccd7943 | ||
|
|
6be5441176 | ||
|
|
d5ba7ebaf0 | ||
|
|
270a482740 | ||
|
|
e0b4890794 | ||
|
|
247e8b6e5d | ||
|
|
b760e2ba23 | ||
|
|
103173fc9b | ||
|
|
70ed371d0c | ||
|
|
81d3485109 | ||
|
|
7b7b68cdab | ||
|
|
135a65e200 | ||
|
|
123529e5eb | ||
|
|
e81989a0d8 | ||
|
|
1c15f53318 | ||
|
|
7937813c98 | ||
|
|
ad4040d982 | ||
|
|
69579306dd | ||
|
|
bd21f00f0a | ||
|
|
012bcbcb48 | ||
|
|
e06d4555bf | ||
|
|
abd106bacb | ||
|
|
008de2fb8f | ||
|
|
2e67fa3e48 | ||
|
|
ea36951bc4 | ||
|
|
09c48b60bd | ||
|
|
4cc117ddf6 | ||
|
|
ceaf8edade | ||
|
|
520200d597 | ||
|
|
ab67985d21 | ||
|
|
bc5cc638fc | ||
|
|
bff8be8b76 | ||
|
|
3e95b8a158 | ||
|
|
e8539d4dae | ||
|
|
1907b31da7 | ||
|
|
6145a135bd | ||
|
|
97c3bc408b | ||
|
|
a00e908f52 | ||
|
|
4ad8891e05 | ||
|
|
2b8b2a4f30 | ||
|
|
5c24450e54 | ||
|
|
3a689a5c4f | ||
|
|
44e36d9aad | ||
|
|
62f7f72d20 | ||
|
|
829c632511 | ||
|
|
8730dfb1f9 | ||
|
|
6764365994 | ||
|
|
8addbc9655 | ||
|
|
658d1a7235 | ||
|
|
4b00d4d9d2 | ||
|
|
6a5829788e | ||
|
|
03074cd23e | ||
|
|
2620e8eada | ||
|
|
9b5e676ffa | ||
|
|
fd1ef11617 | ||
|
|
9fa567a6ce | ||
|
|
fc6c00cbe1 | ||
|
|
66f90a6101 | ||
|
|
1fe5c58d56 | ||
|
|
f23616acaf | ||
|
|
7d37913ea4 | ||
|
|
ac56053c74 | ||
|
|
d566ffaa5f | ||
|
|
d06d7cb9a4 | ||
|
|
e494b5d422 | ||
|
|
fdf7b3bcdf | ||
|
|
871e6c0c73 | ||
|
|
392485aa45 | ||
|
|
275a348b75 | ||
|
|
189689716c |
@@ -10,7 +10,7 @@ project(minetest)
|
||||
# Also remember to set PROTOCOL_VERSION in clientserver.h when releasing
|
||||
set(VERSION_MAJOR 0)
|
||||
set(VERSION_MINOR 4)
|
||||
set(VERSION_PATCH dev-20111203-2)
|
||||
set(VERSION_PATCH dev-20120106-1)
|
||||
set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
||||
|
||||
MESSAGE(STATUS "*** Will build version ${VERSION_STRING} ***")
|
||||
|
||||
@@ -97,7 +97,6 @@ minetest.register_nodedef_defaults({
|
||||
post_effect_color = {a=0, r=0, g=0, b=0},
|
||||
paramtype = "none",
|
||||
is_ground_content = false,
|
||||
light_propagates = false,
|
||||
sunlight_propagates = false,
|
||||
walkable = true,
|
||||
pointable = true,
|
||||
@@ -133,7 +132,6 @@ minetest.register_nodedef_defaults({
|
||||
minetest.register_node("air", {
|
||||
drawtype = "airlike",
|
||||
paramtype = "light",
|
||||
light_propagates = true,
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
@@ -145,7 +143,6 @@ minetest.register_node("air", {
|
||||
minetest.register_node("ignore", {
|
||||
drawtype = "airlike",
|
||||
paramtype = "none",
|
||||
light_propagates = false,
|
||||
sunlight_propagates = false,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
@@ -304,7 +301,20 @@ end
|
||||
test_stackstring()
|
||||
|
||||
--
|
||||
-- craftitem helpers
|
||||
-- NodeItem helpers
|
||||
--
|
||||
|
||||
minetest.inventorycube = function(img1, img2, img3)
|
||||
img2 = img2 or img1
|
||||
img3 = img3 or img1
|
||||
return "[inventorycube"
|
||||
.. "{" .. img1:gsub("%^", "&")
|
||||
.. "{" .. img2:gsub("%^", "&")
|
||||
.. "{" .. img3:gsub("%^", "&")
|
||||
end
|
||||
|
||||
--
|
||||
-- CraftItem helpers
|
||||
--
|
||||
|
||||
minetest.craftitem_place_item = function(item, placer, pos)
|
||||
@@ -327,6 +337,77 @@ minetest.craftitem_eat = function(hp_change)
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
-- Default material types
|
||||
--
|
||||
|
||||
function minetest.digprop_constanttime(time)
|
||||
return {
|
||||
diggability = "constant",
|
||||
constant_time = time,
|
||||
}
|
||||
end
|
||||
|
||||
function minetest.digprop_stonelike(toughness)
|
||||
return {
|
||||
diggablity = "normal",
|
||||
weight = toughness * 5,
|
||||
crackiness = 1,
|
||||
crumbliness = -0.1,
|
||||
cuttability = -0.2,
|
||||
}
|
||||
end
|
||||
|
||||
function minetest.digprop_dirtlike(toughness)
|
||||
return {
|
||||
diggablity = "normal",
|
||||
weight = toughness * 1.2,
|
||||
crackiness = 0,
|
||||
crumbliness = 1.2,
|
||||
cuttability = -0.4,
|
||||
}
|
||||
end
|
||||
|
||||
function minetest.digprop_gravellike(toughness)
|
||||
return {
|
||||
diggablity = "normal",
|
||||
weight = toughness * 2,
|
||||
crackiness = 0.2,
|
||||
crumbliness = 1.5,
|
||||
cuttability = -1.0,
|
||||
}
|
||||
end
|
||||
|
||||
function minetest.digprop_woodlike(toughness)
|
||||
return {
|
||||
diggablity = "normal",
|
||||
weight = toughness * 1.0,
|
||||
crackiness = 0.75,
|
||||
crumbliness = -1.0,
|
||||
cuttability = 1.5,
|
||||
}
|
||||
end
|
||||
|
||||
function minetest.digprop_leaveslike(toughness)
|
||||
return {
|
||||
diggablity = "normal",
|
||||
weight = toughness * (-0.5),
|
||||
crackiness = 0,
|
||||
crumbliness = 0,
|
||||
cuttability = 2.0,
|
||||
}
|
||||
end
|
||||
|
||||
function minetest.digprop_glasslike(toughness)
|
||||
return {
|
||||
diggablity = "normal",
|
||||
weight = toughness * 0.1,
|
||||
crackiness = 2.0,
|
||||
crumbliness = -1.0,
|
||||
cuttability = -1.0,
|
||||
}
|
||||
end
|
||||
|
||||
--
|
||||
-- Creative inventory
|
||||
--
|
||||
@@ -354,6 +435,7 @@ minetest.registered_on_dignodes, minetest.register_on_dignode = make_registratio
|
||||
minetest.registered_on_punchnodes, minetest.register_on_punchnode = make_registration()
|
||||
minetest.registered_on_generateds, minetest.register_on_generated = make_registration()
|
||||
minetest.registered_on_newplayers, minetest.register_on_newplayer = make_registration()
|
||||
minetest.registered_on_dieplayers, minetest.register_on_dieplayer = make_registration()
|
||||
minetest.registered_on_respawnplayers, minetest.register_on_respawnplayer = make_registration()
|
||||
|
||||
-- END
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
-- bucket (Minetest 0.4 mod)
|
||||
-- A bucket, which can pick up water and lava
|
||||
|
||||
minetest.alias_craftitem("bucket", "bucket:bucket_empty")
|
||||
minetest.alias_craftitem("bucket_water", "bucket:bucket_water")
|
||||
minetest.alias_craftitem("bucket_lava", "bucket:bucket_lava")
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'craft "bucket:bucket_empty" 1',
|
||||
recipe = {
|
||||
@@ -14,11 +21,11 @@ minetest.register_craftitem("bucket:bucket_empty", {
|
||||
on_use = function(item, player, pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
n = minetest.env:get_node(pointed_thing.under)
|
||||
if n.name == "water_source" then
|
||||
if n.name == "default:water_source" then
|
||||
minetest.env:add_node(pointed_thing.under, {name="air"})
|
||||
player:add_to_inventory_later('craft "bucket:bucket_water" 1')
|
||||
return true
|
||||
elseif n.name == "lava_source" then
|
||||
elseif n.name == "default:lava_source" then
|
||||
minetest.env:add_node(pointed_thing.under, {name="air"})
|
||||
player:add_to_inventory_later('craft "bucket:bucket_lava" 1')
|
||||
return true
|
||||
@@ -29,19 +36,19 @@ minetest.register_craftitem("bucket:bucket_empty", {
|
||||
})
|
||||
|
||||
minetest.register_craftitem("bucket:bucket_water", {
|
||||
image = "bucket:bucket_water.png",
|
||||
image = "bucket_water.png",
|
||||
stack_max = 1,
|
||||
liquids_pointable = true,
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
on_use = function(item, player, pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
n = minetest.env:get_node(pointed_thing.under)
|
||||
if n.name == "water_source" then
|
||||
if n.name == "default:water_source" then
|
||||
-- unchanged
|
||||
elseif n.name == "water_flowing" or n.name == "lava_source" or n.name == "lava_flowing" then
|
||||
minetest.env:add_node(pointed_thing.under, {name="water_source"})
|
||||
elseif n.name == "default:water_flowing" or n.name == "default:lava_source" or n.name == "default:lava_flowing" then
|
||||
minetest.env:add_node(pointed_thing.under, {name="default:water_source"})
|
||||
else
|
||||
minetest.env:add_node(pointed_thing.above, {name="water_source"})
|
||||
minetest.env:add_node(pointed_thing.above, {name="default:water_source"})
|
||||
end
|
||||
player:add_to_inventory_later('craft "bucket:bucket_empty" 1')
|
||||
return true
|
||||
@@ -51,19 +58,19 @@ minetest.register_craftitem("bucket:bucket_water", {
|
||||
})
|
||||
|
||||
minetest.register_craftitem("bucket:bucket_lava", {
|
||||
image = "bucket:bucket_lava.png",
|
||||
image = "bucket_lava.png",
|
||||
stack_max = 1,
|
||||
liquids_pointable = true,
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
on_use = function(item, player, pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
n = minetest.env:get_node(pointed_thing.under)
|
||||
if n.name == "lava_source" then
|
||||
if n.name == "default:lava_source" then
|
||||
-- unchanged
|
||||
elseif n.name == "water_source" or n.name == "water_flowing" or n.name == "lava_flowing" then
|
||||
minetest.env:add_node(pointed_thing.under, {name="lava_source"})
|
||||
elseif n.name == "default:water_source" or n.name == "default:water_flowing" or n.name == "default:lava_flowing" then
|
||||
minetest.env:add_node(pointed_thing.under, {name="default:lava_source"})
|
||||
else
|
||||
minetest.env:add_node(pointed_thing.above, {name="lava_source"})
|
||||
minetest.env:add_node(pointed_thing.above, {name="default:lava_source"})
|
||||
end
|
||||
player:add_to_inventory_later('craft "bucket:bucket_empty" 1')
|
||||
return true
|
||||
|
||||
|
Before Width: | Height: | Size: 203 B After Width: | Height: | Size: 203 B |
|
Before Width: | Height: | Size: 292 B After Width: | Height: | Size: 292 B |
|
Before Width: | Height: | Size: 597 B After Width: | Height: | Size: 597 B |
|
Before Width: | Height: | Size: 604 B After Width: | Height: | Size: 604 B |
|
Before Width: | Height: | Size: 279 B After Width: | Height: | Size: 279 B |
|
Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 236 B |
|
Before Width: | Height: | Size: 167 B After Width: | Height: | Size: 167 B |
|
Before Width: | Height: | Size: 224 B After Width: | Height: | Size: 224 B |
|
Before Width: | Height: | Size: 151 B After Width: | Height: | Size: 151 B |
|
Before Width: | Height: | Size: 142 B After Width: | Height: | Size: 142 B |
|
Before Width: | Height: | Size: 613 B After Width: | Height: | Size: 613 B |
|
Before Width: | Height: | Size: 249 B After Width: | Height: | Size: 249 B |
|
Before Width: | Height: | Size: 210 B After Width: | Height: | Size: 210 B |
|
Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 118 B |
|
Before Width: | Height: | Size: 933 B After Width: | Height: | Size: 933 B |
|
Before Width: | Height: | Size: 830 B After Width: | Height: | Size: 830 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 539 B After Width: | Height: | Size: 539 B |
|
Before Width: | Height: | Size: 246 B After Width: | Height: | Size: 246 B |
|
Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 236 B |
|
Before Width: | Height: | Size: 978 B After Width: | Height: | Size: 978 B |
|
Before Width: | Height: | Size: 874 B After Width: | Height: | Size: 874 B |
|
Before Width: | Height: | Size: 856 B After Width: | Height: | Size: 856 B |
|
Before Width: | Height: | Size: 878 B After Width: | Height: | Size: 878 B |
|
Before Width: | Height: | Size: 591 B After Width: | Height: | Size: 591 B |
|
Before Width: | Height: | Size: 936 B After Width: | Height: | Size: 936 B |
|
Before Width: | Height: | Size: 672 B After Width: | Height: | Size: 672 B |
|
Before Width: | Height: | Size: 502 B After Width: | Height: | Size: 502 B |
|
Before Width: | Height: | Size: 507 B After Width: | Height: | Size: 507 B |
|
Before Width: | Height: | Size: 395 B After Width: | Height: | Size: 395 B |
|
Before Width: | Height: | Size: 357 B After Width: | Height: | Size: 357 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 203 B After Width: | Height: | Size: 203 B |
|
Before Width: | Height: | Size: 965 B After Width: | Height: | Size: 965 B |
|
Before Width: | Height: | Size: 303 B After Width: | Height: | Size: 303 B |
|
Before Width: | Height: | Size: 410 B After Width: | Height: | Size: 410 B |
|
Before Width: | Height: | Size: 203 B After Width: | Height: | Size: 203 B |
|
Before Width: | Height: | Size: 260 B After Width: | Height: | Size: 260 B |
|
Before Width: | Height: | Size: 242 B After Width: | Height: | Size: 242 B |
|
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 366 B |
|
Before Width: | Height: | Size: 507 B After Width: | Height: | Size: 507 B |
|
Before Width: | Height: | Size: 555 B After Width: | Height: | Size: 555 B |
|
Before Width: | Height: | Size: 545 B After Width: | Height: | Size: 545 B |
|
Before Width: | Height: | Size: 542 B After Width: | Height: | Size: 542 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 772 B After Width: | Height: | Size: 772 B |
|
Before Width: | Height: | Size: 502 B After Width: | Height: | Size: 502 B |
|
Before Width: | Height: | Size: 233 B After Width: | Height: | Size: 233 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 489 B After Width: | Height: | Size: 489 B |
|
Before Width: | Height: | Size: 219 B After Width: | Height: | Size: 219 B |
|
Before Width: | Height: | Size: 207 B After Width: | Height: | Size: 207 B |
|
Before Width: | Height: | Size: 182 B After Width: | Height: | Size: 182 B |
|
Before Width: | Height: | Size: 806 B After Width: | Height: | Size: 806 B |
|
Before Width: | Height: | Size: 161 B After Width: | Height: | Size: 161 B |
|
Before Width: | Height: | Size: 186 B After Width: | Height: | Size: 186 B |
|
Before Width: | Height: | Size: 264 B After Width: | Height: | Size: 264 B |
|
Before Width: | Height: | Size: 252 B After Width: | Height: | Size: 252 B |
|
Before Width: | Height: | Size: 927 B After Width: | Height: | Size: 927 B |
|
Before Width: | Height: | Size: 271 B After Width: | Height: | Size: 271 B |
|
Before Width: | Height: | Size: 216 B After Width: | Height: | Size: 216 B |
|
Before Width: | Height: | Size: 291 B After Width: | Height: | Size: 291 B |
|
Before Width: | Height: | Size: 931 B After Width: | Height: | Size: 931 B |
|
Before Width: | Height: | Size: 262 B After Width: | Height: | Size: 262 B |
|
Before Width: | Height: | Size: 203 B After Width: | Height: | Size: 203 B |
|
Before Width: | Height: | Size: 301 B After Width: | Height: | Size: 301 B |
|
Before Width: | Height: | Size: 927 B After Width: | Height: | Size: 927 B |
|
Before Width: | Height: | Size: 245 B After Width: | Height: | Size: 245 B |
|
Before Width: | Height: | Size: 203 B After Width: | Height: | Size: 203 B |
|
Before Width: | Height: | Size: 255 B After Width: | Height: | Size: 255 B |
|
Before Width: | Height: | Size: 925 B After Width: | Height: | Size: 925 B |
|
Before Width: | Height: | Size: 913 B After Width: | Height: | Size: 913 B |
|
Before Width: | Height: | Size: 917 B After Width: | Height: | Size: 917 B |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 518 B After Width: | Height: | Size: 518 B |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
@@ -2,29 +2,46 @@
|
||||
-- Experimental things
|
||||
--
|
||||
|
||||
-- For testing random stuff
|
||||
|
||||
function on_step(dtime)
|
||||
-- print("experimental on_step")
|
||||
--[[
|
||||
objs = minetest.env:get_objects_inside_radius({x=0,y=0,z=0}, 10)
|
||||
for k, obj in pairs(objs) do
|
||||
name = obj:get_player_name()
|
||||
if name then
|
||||
print(name.." at "..dump(obj:getpos()))
|
||||
print(name.." dir: "..dump(obj:get_look_dir()))
|
||||
print(name.." pitch: "..dump(obj:get_look_pitch()))
|
||||
print(name.." yaw: "..dump(obj:get_look_yaw()))
|
||||
else
|
||||
print("Some object at "..dump(obj:getpos()))
|
||||
end
|
||||
end
|
||||
--]]
|
||||
end
|
||||
minetest.register_globalstep(on_step)
|
||||
|
||||
-- An example furnace-thing implemented in Lua
|
||||
|
||||
minetest.register_node("experimental:luafurnace", {
|
||||
tile_images = {"lava.png", "furnace_side.png", "furnace_side.png",
|
||||
"furnace_side.png", "furnace_side.png", "furnace_front.png"},
|
||||
tile_images = {"default_lava.png", "default_furnace_side.png",
|
||||
"default_furnace_side.png", "default_furnace_side.png",
|
||||
"default_furnace_side.png", "default_furnace_front.png"},
|
||||
--inventory_image = "furnace_front.png",
|
||||
inventory_image = inventorycube("furnace_front.png"),
|
||||
inventory_image = minetest.inventorycube("default_furnace_front.png"),
|
||||
paramtype = "facedir_simple",
|
||||
metadata_name = "generic",
|
||||
material = digprop_stonelike(3.0),
|
||||
material = minetest.digprop_stonelike(3.0),
|
||||
})
|
||||
|
||||
minetest.register_on_placenode(function(pos, newnode, placer)
|
||||
if newnode.name == "experimental:luafurnace" then
|
||||
print("get_meta");
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
print("inventory_set_list");
|
||||
meta:inventory_set_list("fuel", {""})
|
||||
print("inventory_set_list");
|
||||
meta:inventory_set_list("src", {""})
|
||||
print("inventory_set_list");
|
||||
meta:inventory_set_list("dst", {"","","",""})
|
||||
print("set_inventory_draw_spec");
|
||||
meta:set_inventory_draw_spec(
|
||||
"invsize[8,9;]"
|
||||
.."list[current_name;fuel;2,3;1,1;]"
|
||||
@@ -34,13 +51,132 @@ minetest.register_on_placenode(function(pos, newnode, placer)
|
||||
)
|
||||
|
||||
local total_cooked = 0;
|
||||
print("set_string")
|
||||
meta:set_string("total_cooked", total_cooked)
|
||||
print("set_infotext");
|
||||
meta:set_infotext("Lua Furnace: total cooked: "..total_cooked)
|
||||
end
|
||||
end)
|
||||
|
||||
local get_item_definition = function(item)
|
||||
if not item then return nil end
|
||||
if item.type == "node" then
|
||||
return minetest.registered_nodes[item.name]
|
||||
elseif item.type == "craft" then
|
||||
return minetest.registered_craftitems[item.name]
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"experimental:luafurnace"},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
for i, name in ipairs({
|
||||
"fuel_totaltime",
|
||||
"fuel_time",
|
||||
"src_totaltime",
|
||||
"src_time"
|
||||
}) do
|
||||
if not meta:get_string(name) then
|
||||
meta:set_string(name, 0)
|
||||
end
|
||||
end
|
||||
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
local fuelitem = inv:get_stack("fuel", 1):peek_item()
|
||||
local srcitem = inv:get_stack("src", 1):peek_item()
|
||||
--print("fuelitem="..dump(fuelitem))
|
||||
--print("srcitem="..dump(srcitem))
|
||||
|
||||
local was_active = false
|
||||
|
||||
local src_cooktime = -1
|
||||
local result_stackstring = nil
|
||||
|
||||
if srcitem then
|
||||
local prop = get_item_definition(srcitem)
|
||||
if prop and prop.cookresult_itemstring ~= "" then
|
||||
result_stackstring = prop.cookresult_itemstring
|
||||
src_cooktime = prop.furnace_cooktime or 3
|
||||
end
|
||||
end
|
||||
|
||||
print("src_cooktime="..dump(src_cooktime))
|
||||
print("result_stackstring="..dump(result_stackstring))
|
||||
|
||||
if tonumber(meta:get_string("fuel_time")) < tonumber(meta:get_string("fuel_totaltime")) then
|
||||
was_active = true
|
||||
meta:set_string("fuel_time", tonumber(meta:get_string("fuel_time")) + 1)
|
||||
meta:set_string("src_time", tonumber(meta:get_string("src_time")) + 1)
|
||||
--print("result_stackstring="..dump(result_stackstring))
|
||||
--print('tonumber(meta:get_string("src_time"))='..dump(tonumber(meta:get_string("src_time"))))
|
||||
--print("src_cooktime="..dump(src_cooktime))
|
||||
if result_stackstring and tonumber(meta:get_string("src_time")) >= src_cooktime and src_cooktime >= 0 then
|
||||
-- Put result in "dst" list
|
||||
success = inv:autoinsert_stackstring("dst", result_stackstring)
|
||||
if not success then
|
||||
print("Could not autoinsert '"..result_stackstring.."'")
|
||||
end
|
||||
-- If succeeded, take stuff from "src" list
|
||||
if success then
|
||||
srcstack = inv:get_stack("src", 1)
|
||||
srcstack:take_item()
|
||||
inv:set_stack("src", 1, srcstack)
|
||||
end
|
||||
meta:set_string("src_time", 0)
|
||||
end
|
||||
end
|
||||
|
||||
if tonumber(meta:get_string("fuel_time")) < tonumber(meta:get_string("fuel_totaltime")) then
|
||||
meta:set_infotext("Furnace active: "..(tonumber(meta:get_string("fuel_time"))/tonumber(meta:get_string("fuel_totaltime"))*100).."%")
|
||||
return
|
||||
end
|
||||
|
||||
local srcitem = inv:get_stack("src", 1):peek_item()
|
||||
|
||||
local src_cooktime = 0
|
||||
local result_stackstring = nil
|
||||
|
||||
if srcitem then
|
||||
local prop = get_item_definition(srcitem)
|
||||
if prop and prop.cookresult_itemstring ~= "" then
|
||||
result_stackstring = prop.cookresult_itemstring
|
||||
src_cooktime = prop.furnace_cooktime or 3
|
||||
end
|
||||
end
|
||||
|
||||
local fuelitem = inv:get_stack("fuel", 1):peek_item()
|
||||
|
||||
if not result_stackstring or not fuelitem then
|
||||
if was_active then
|
||||
meta:set_infotext("Furnace is empty")
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local burntime = -1
|
||||
if fuelitem then
|
||||
local prop = get_item_definition(fuelitem)
|
||||
if prop then
|
||||
burntime = prop.furnace_burntime or -1
|
||||
end
|
||||
end
|
||||
|
||||
if burntime <= 0 then
|
||||
meta:set_infotext("Furnace out of fuel")
|
||||
return
|
||||
end
|
||||
|
||||
meta:set_string("fuel_totaltime", burntime)
|
||||
meta:set_string("fuel_time", 0)
|
||||
|
||||
local stack = inv:get_stack("fuel", 1)
|
||||
stack:take_item()
|
||||
inv:set_stack("fuel", 1, stack)
|
||||
end,
|
||||
})
|
||||
--[[
|
||||
minetest.register_abm({
|
||||
nodenames = {"experimental:luafurnace"},
|
||||
interval = 1.0,
|
||||
@@ -95,13 +231,13 @@ minetest.register_abm({
|
||||
meta:set_infotext("Lua Furnace: total cooked: "..total_cooked)
|
||||
end,
|
||||
})
|
||||
|
||||
--]]
|
||||
minetest.register_craft({
|
||||
output = 'node "experimental:luafurnace" 1',
|
||||
recipe = {
|
||||
{'node "cobble"', 'node "cobble"', 'node "cobble"'},
|
||||
{'node "cobble"', 'node "cobble"', 'node "cobble"'},
|
||||
{'node "cobble"', 'node "cobble"', 'node "cobble"'},
|
||||
{'node "default:cobble"', 'node "default:cobble"', 'node "default:cobble"'},
|
||||
{'node "default:cobble"', 'node "default:steel_ingot"', 'node "default:cobble"'},
|
||||
{'node "default:cobble"', 'node "default:cobble"', 'node "default:cobble"'},
|
||||
}
|
||||
})
|
||||
|
||||
@@ -110,8 +246,8 @@ minetest.register_craft({
|
||||
--
|
||||
|
||||
--[[
|
||||
minetest.register_tool("horribletool", {
|
||||
image = "lava.png",
|
||||
minetest.register_tool("experimental:horribletool", {
|
||||
image = "default_lava.png",
|
||||
basetime = 2.0
|
||||
dt_weight = 0.2
|
||||
dt_crackiness = 0.2
|
||||
@@ -125,16 +261,17 @@ minetest.register_tool("horribletool", {
|
||||
})
|
||||
--]]
|
||||
|
||||
minetest.register_craft({
|
||||
--[[minetest.register_craft({
|
||||
output = 'node "somenode" 4',
|
||||
recipe = {
|
||||
{'craft "Stick" 1'},
|
||||
{'craft "default_tick" 1'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("experimental:somenode", {
|
||||
tile_images = {"lava.png", "mese.png", "stone.png", "grass.png", "cobble.png", "tree_top.png"},
|
||||
inventory_image = "treeprop.png",
|
||||
inventory_image = minetest.inventorycube("lava.png", "mese.png", "stone.png"),
|
||||
--inventory_image = "treeprop.png",
|
||||
material = {
|
||||
diggability = "normal",
|
||||
weight = 0,
|
||||
@@ -144,7 +281,7 @@ minetest.register_node("experimental:somenode", {
|
||||
flammability = 0
|
||||
},
|
||||
metadata_name = "chest",
|
||||
})
|
||||
})]]
|
||||
|
||||
--
|
||||
-- TNT (not functional)
|
||||
@@ -153,15 +290,18 @@ minetest.register_node("experimental:somenode", {
|
||||
minetest.register_craft({
|
||||
output = 'node "experimental:tnt" 4',
|
||||
recipe = {
|
||||
{'node "wood" 1'},
|
||||
{'craft "lump_of_coal" 1'},
|
||||
{'node "wood" 1'}
|
||||
{'node "default:wood" 1'},
|
||||
{'craft "default:coal_lump" 1'},
|
||||
{'node "default:wood" 1'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("experimental:tnt", {
|
||||
tile_images = {"tnt_top.png", "tnt_bottom.png", "tnt_side.png", "tnt_side.png", "tnt_side.png", "tnt_side.png"},
|
||||
inventory_image = "tnt_side.png",
|
||||
tile_images = {"default_tnt_top.png", "default_tnt_bottom.png",
|
||||
"default_tnt_side.png", "default_tnt_side.png",
|
||||
"default_tnt_side.png", "default_tnt_side.png"},
|
||||
inventory_image = minetest.inventorycube("default_tnt_top.png",
|
||||
"default_tnt_side.png", "default_tnt_side.png"),
|
||||
dug_item = '', -- Get nothing
|
||||
material = {
|
||||
diggability = "not",
|
||||
@@ -171,7 +311,7 @@ minetest.register_node("experimental:tnt", {
|
||||
minetest.register_on_punchnode(function(p, node)
|
||||
if node.name == "experimental:tnt" then
|
||||
minetest.env:remove_node(p)
|
||||
minetest.env:add_luaentity(p, "experimental:tnt")
|
||||
minetest.env:add_entity(p, "experimental:tnt")
|
||||
nodeupdate(p)
|
||||
end
|
||||
end)
|
||||
@@ -182,7 +322,9 @@ local TNT = {
|
||||
-- weight = 5,
|
||||
collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
|
||||
visual = "cube",
|
||||
textures = {"tnt_top.png","tnt_bottom.png","tnt_side.png","tnt_side.png","tnt_side.png","tnt_side.png"},
|
||||
textures = {"default_tnt_top.png", "default_tnt_bottom.png",
|
||||
"default_tnt_side.png", "default_tnt_side.png",
|
||||
"default_tnt_side.png", "default_tnt_side.png"},
|
||||
-- Initial value for our timer
|
||||
timer = 0,
|
||||
-- Number of punches required to defuse
|
||||
@@ -237,6 +379,9 @@ end
|
||||
--print("Registering TNT");
|
||||
minetest.register_entity("experimental:tnt", TNT)
|
||||
|
||||
-- Add TNT's old name also
|
||||
minetest.alias_node("TNT", "experimental:tnt")
|
||||
|
||||
--
|
||||
-- A test entity for testing animated and yaw-modulated sprites
|
||||
--
|
||||
@@ -287,8 +432,8 @@ minetest.register_on_generated(function(minp, maxp)
|
||||
end)
|
||||
|
||||
-- Example setting get
|
||||
print("setting max_users = " .. dump(minetest.setting_get("max_users")))
|
||||
print("setting asdf = " .. dump(minetest.setting_get("asdf")))
|
||||
--print("setting max_users = " .. dump(minetest.setting_get("max_users")))
|
||||
--print("setting asdf = " .. dump(minetest.setting_get("asdf")))
|
||||
|
||||
minetest.register_on_chat_message(function(name, message)
|
||||
--[[print("on_chat_message: name="..dump(name).." message="..dump(message))
|
||||
@@ -402,4 +547,6 @@ minetest.register_abm({
|
||||
end,
|
||||
})--]]
|
||||
|
||||
print("experimental modpath="..dump(minetest.get_modpath("experimental")))
|
||||
|
||||
-- END
|
||||
|
||||
2
data/mods/legacy/depends.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
default
|
||||
|
||||
101
data/mods/legacy/init.lua
Normal file
@@ -0,0 +1,101 @@
|
||||
-- legacy (Minetest 0.4 mod)
|
||||
-- Provides as much backwards-compatibility as feasible
|
||||
|
||||
--
|
||||
-- Aliases to support loading 0.3 and old 0.4 worlds and inventories
|
||||
--
|
||||
|
||||
minetest.alias_node("stone", "default:stone")
|
||||
minetest.alias_node("dirt_with_grass", "default:dirt_with_grass")
|
||||
minetest.alias_node("dirt_with_grass_footsteps", "default:dirt_with_grass_footsteps")
|
||||
minetest.alias_node("dirt", "default:dirt")
|
||||
minetest.alias_node("sand", "default:sand")
|
||||
minetest.alias_node("gravel", "default:gravel")
|
||||
minetest.alias_node("sandstone", "default:sandstone")
|
||||
minetest.alias_node("clay", "default:clay")
|
||||
minetest.alias_node("brick", "default:brick")
|
||||
minetest.alias_node("tree", "default:tree")
|
||||
minetest.alias_node("jungletree", "default:jungletree")
|
||||
minetest.alias_node("junglegrass", "default:junglegrass")
|
||||
minetest.alias_node("leaves", "default:leaves")
|
||||
minetest.alias_node("cactus", "default:cactus")
|
||||
minetest.alias_node("papyrus", "default:papyrus")
|
||||
minetest.alias_node("bookshelf", "default:bookshelf")
|
||||
minetest.alias_node("glass", "default:glass")
|
||||
minetest.alias_node("wooden_fence", "default:fence_wood")
|
||||
minetest.alias_node("rail", "default:rail")
|
||||
minetest.alias_node("ladder", "default:ladder")
|
||||
minetest.alias_node("wood", "default:wood")
|
||||
minetest.alias_node("mese", "default:mese")
|
||||
minetest.alias_node("cloud", "default:cloud")
|
||||
minetest.alias_node("water_flowing", "default:water_flowing")
|
||||
minetest.alias_node("water_source", "default:water_source")
|
||||
minetest.alias_node("lava_flowing", "default:lava_flowing")
|
||||
minetest.alias_node("lava_source", "default:lava_source")
|
||||
minetest.alias_node("torch", "default:torch")
|
||||
minetest.alias_node("sign_wall", "default:sign_wall")
|
||||
minetest.alias_node("furnace", "default:furnace")
|
||||
minetest.alias_node("chest", "default:chest")
|
||||
minetest.alias_node("locked_chest", "default:chest_locked")
|
||||
minetest.alias_node("cobble", "default:cobble")
|
||||
minetest.alias_node("mossycobble", "default:mossycobble")
|
||||
minetest.alias_node("steelblock", "default:steelblock")
|
||||
minetest.alias_node("nyancat", "default:nyancat")
|
||||
minetest.alias_node("nyancat_rainbow", "default:nyancat_rainbow")
|
||||
minetest.alias_node("sapling", "default:sapling")
|
||||
minetest.alias_node("apple", "default:apple")
|
||||
|
||||
minetest.alias_tool("WPick", "default:pick_wood")
|
||||
minetest.alias_tool("STPick", "default:pick_stone")
|
||||
minetest.alias_tool("SteelPick", "default:pick_steel")
|
||||
minetest.alias_tool("MesePick", "default:pick_mese")
|
||||
minetest.alias_tool("WShovel", "default:shovel_wood")
|
||||
minetest.alias_tool("STShovel", "default:shovel_stone")
|
||||
minetest.alias_tool("SteelShovel", "default:shovel_steel")
|
||||
minetest.alias_tool("WAxe", "default:axe_wood")
|
||||
minetest.alias_tool("STAxe", "default:axe_stone")
|
||||
minetest.alias_tool("SteelAxe", "default:axe_steel")
|
||||
minetest.alias_tool("WSword", "default:sword_wood")
|
||||
minetest.alias_tool("STSword", "default:sword_stone")
|
||||
minetest.alias_tool("SteelSword", "default:sword_steel")
|
||||
|
||||
minetest.alias_craftitem("Stick", "default:stick")
|
||||
minetest.alias_craftitem("paper", "default:paper")
|
||||
minetest.alias_craftitem("book", "default:book")
|
||||
minetest.alias_craftitem("lump_of_coal", "default:coal_lump")
|
||||
minetest.alias_craftitem("lump_of_iron", "default:iron_lump")
|
||||
minetest.alias_craftitem("lump_of_clay", "default:clay_lump")
|
||||
minetest.alias_craftitem("steel_ingot", "default:steel_ingot")
|
||||
minetest.alias_craftitem("clay_brick", "default:clay_brick")
|
||||
minetest.alias_craftitem("scorched_stuff", "default:scorched_stuff")
|
||||
minetest.alias_craftitem("apple", "default:apple")
|
||||
|
||||
--
|
||||
-- Old items
|
||||
--
|
||||
|
||||
minetest.register_craftitem(":rat", {
|
||||
image = "rat.png",
|
||||
cookresult_itemstring = 'craft "cooked_rat" 1',
|
||||
on_drop = function(item, dropper, pos)
|
||||
minetest.env:add_rat(pos)
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craftitem(":cooked_rat", {
|
||||
image = "cooked_rat.png",
|
||||
cookresult_itemstring = 'craft "scorched_stuff" 1',
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
on_use = minetest.craftitem_eat(6),
|
||||
})
|
||||
|
||||
minetest.register_craftitem(":firefly", {
|
||||
image = "firefly.png",
|
||||
on_drop = function(item, dropper, pos)
|
||||
minetest.env:add_firefly(pos)
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
-- END
|
||||
|
Before Width: | Height: | Size: 207 B After Width: | Height: | Size: 207 B |
|
Before Width: | Height: | Size: 239 B After Width: | Height: | Size: 239 B |
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 603 B After Width: | Height: | Size: 603 B |
|
Before Width: | Height: | Size: 116 B After Width: | Height: | Size: 116 B |
|
Before Width: | Height: | Size: 952 B After Width: | Height: | Size: 952 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 250 B After Width: | Height: | Size: 250 B |
|
Before Width: | Height: | Size: 341 B After Width: | Height: | Size: 341 B |
|
Before Width: | Height: | Size: 920 B After Width: | Height: | Size: 920 B |
@@ -94,6 +94,7 @@ configure_file(
|
||||
)
|
||||
|
||||
set(common_SRCS
|
||||
inventorymanager.cpp
|
||||
mods.cpp
|
||||
serverremoteplayer.cpp
|
||||
content_abm.cpp
|
||||
@@ -158,9 +159,9 @@ endif()
|
||||
# Client sources
|
||||
set(minetest_SRCS
|
||||
${common_SRCS}
|
||||
MyBillboardSceneNode.cpp
|
||||
content_mapblock.cpp
|
||||
content_cao.cpp
|
||||
mesh.cpp
|
||||
mapblock_mesh.cpp
|
||||
farmesh.cpp
|
||||
keycode.cpp
|
||||
|
||||
@@ -1,202 +0,0 @@
|
||||
// Copyright (C) 2002-2010 Nikolaus Gebhardt
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||
|
||||
#include "MyBillboardSceneNode.h"
|
||||
#include "IVideoDriver.h"
|
||||
#include "ISceneManager.h"
|
||||
#include "ICameraSceneNode.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace scene
|
||||
{
|
||||
|
||||
//! constructor
|
||||
MyBillboardSceneNode::MyBillboardSceneNode(ISceneNode* parent,
|
||||
ISceneManager* mgr, s32 id,
|
||||
const core::vector3df& position, const core::dimension2d<f32>& size)
|
||||
: IBillboardSceneNode(parent, mgr, id, position)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("MyBillboardSceneNode");
|
||||
#endif
|
||||
|
||||
setSize(size);
|
||||
|
||||
indices[0] = 0;
|
||||
indices[1] = 2;
|
||||
indices[2] = 1;
|
||||
indices[3] = 0;
|
||||
indices[4] = 3;
|
||||
indices[5] = 2;
|
||||
|
||||
video::SColor colorTop = video::SColor(0xFFFFFFFF);
|
||||
video::SColor colorBottom = video::SColor(0xFFFFFFFF);
|
||||
|
||||
vertices[0].TCoords.set(1.0f, 1.0f);
|
||||
vertices[0].Color = colorBottom;
|
||||
|
||||
vertices[1].TCoords.set(1.0f, 0.0f);
|
||||
vertices[1].Color = colorTop;
|
||||
|
||||
vertices[2].TCoords.set(0.0f, 0.0f);
|
||||
vertices[2].Color = colorTop;
|
||||
|
||||
vertices[3].TCoords.set(0.0f, 1.0f);
|
||||
vertices[3].Color = colorBottom;
|
||||
}
|
||||
|
||||
|
||||
//! pre render event
|
||||
void MyBillboardSceneNode::OnRegisterSceneNode()
|
||||
{
|
||||
if (IsVisible)
|
||||
SceneManager->registerNodeForRendering(this);
|
||||
|
||||
ISceneNode::OnRegisterSceneNode();
|
||||
}
|
||||
|
||||
|
||||
//! render
|
||||
void MyBillboardSceneNode::render()
|
||||
{
|
||||
video::IVideoDriver* driver = SceneManager->getVideoDriver();
|
||||
ICameraSceneNode* camera = SceneManager->getActiveCamera();
|
||||
|
||||
if (!camera || !driver)
|
||||
return;
|
||||
|
||||
// make billboard look to camera
|
||||
|
||||
core::vector3df pos = getAbsolutePosition();
|
||||
|
||||
core::vector3df campos = camera->getAbsolutePosition();
|
||||
core::vector3df target = camera->getTarget();
|
||||
core::vector3df up = camera->getUpVector();
|
||||
core::vector3df view = target - campos;
|
||||
view.normalize();
|
||||
|
||||
core::vector3df horizontal = up.crossProduct(view);
|
||||
if ( horizontal.getLength() == 0 )
|
||||
{
|
||||
horizontal.set(up.Y,up.X,up.Z);
|
||||
}
|
||||
horizontal.normalize();
|
||||
horizontal *= 0.5f * Size.Width;
|
||||
|
||||
core::vector3df vertical = horizontal.crossProduct(view);
|
||||
vertical.normalize();
|
||||
vertical *= 0.5f * Size.Height;
|
||||
|
||||
view *= -1.0f;
|
||||
|
||||
for (s32 i=0; i<4; ++i)
|
||||
vertices[i].Normal = view;
|
||||
|
||||
vertices[0].Pos = pos + horizontal + vertical;
|
||||
vertices[1].Pos = pos + horizontal - vertical;
|
||||
vertices[2].Pos = pos - horizontal - vertical;
|
||||
vertices[3].Pos = pos - horizontal + vertical;
|
||||
|
||||
// draw
|
||||
|
||||
if ( DebugDataVisible & scene::EDS_BBOX )
|
||||
{
|
||||
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
|
||||
video::SMaterial m;
|
||||
m.Lighting = false;
|
||||
driver->setMaterial(m);
|
||||
driver->draw3DBox(BBox, video::SColor(0,208,195,152));
|
||||
}
|
||||
|
||||
driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
|
||||
|
||||
driver->setMaterial(Material);
|
||||
|
||||
driver->drawIndexedTriangleList(vertices, 4, indices, 2);
|
||||
}
|
||||
|
||||
|
||||
//! returns the axis aligned bounding box of this node
|
||||
const core::aabbox3d<f32>& MyBillboardSceneNode::getBoundingBox() const
|
||||
{
|
||||
return BBox;
|
||||
}
|
||||
|
||||
|
||||
//! sets the size of the billboard
|
||||
void MyBillboardSceneNode::setSize(const core::dimension2d<f32>& size)
|
||||
{
|
||||
Size = size;
|
||||
|
||||
if (Size.Width == 0.0f)
|
||||
Size.Width = 1.0f;
|
||||
|
||||
if (Size.Height == 0.0f )
|
||||
Size.Height = 1.0f;
|
||||
|
||||
f32 avg = (size.Width + size.Height)/6;
|
||||
BBox.MinEdge.set(-avg,-avg,-avg);
|
||||
BBox.MaxEdge.set(avg,avg,avg);
|
||||
}
|
||||
|
||||
|
||||
video::SMaterial& MyBillboardSceneNode::getMaterial(u32 i)
|
||||
{
|
||||
return Material;
|
||||
}
|
||||
|
||||
|
||||
//! returns amount of materials used by this scene node.
|
||||
u32 MyBillboardSceneNode::getMaterialCount() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
//! gets the size of the billboard
|
||||
const core::dimension2d<f32>& MyBillboardSceneNode::getSize() const
|
||||
{
|
||||
return Size;
|
||||
}
|
||||
|
||||
|
||||
//! Set the color of all vertices of the billboard
|
||||
//! \param overallColor: the color to set
|
||||
void MyBillboardSceneNode::setColor(const video::SColor & overallColor)
|
||||
{
|
||||
for(u32 vertex = 0; vertex < 4; ++vertex)
|
||||
vertices[vertex].Color = overallColor;
|
||||
}
|
||||
|
||||
|
||||
//! Set the color of the top and bottom vertices of the billboard
|
||||
//! \param topColor: the color to set the top vertices
|
||||
//! \param bottomColor: the color to set the bottom vertices
|
||||
void MyBillboardSceneNode::setColor(const video::SColor & topColor, const video::SColor & bottomColor)
|
||||
{
|
||||
vertices[0].Color = bottomColor;
|
||||
vertices[1].Color = topColor;
|
||||
vertices[2].Color = topColor;
|
||||
vertices[3].Color = bottomColor;
|
||||
}
|
||||
|
||||
|
||||
//! Gets the color of the top and bottom vertices of the billboard
|
||||
//! \param[out] topColor: stores the color of the top vertices
|
||||
//! \param[out] bottomColor: stores the color of the bottom vertices
|
||||
void MyBillboardSceneNode::getColor(video::SColor & topColor, video::SColor & bottomColor) const
|
||||
{
|
||||
bottomColor = vertices[0].Color;
|
||||
topColor = vertices[1].Color;
|
||||
}
|
||||
|
||||
void MyBillboardSceneNode::setTCoords(u32 i, core::vector2d<f32> c)
|
||||
{
|
||||
vertices[i].TCoords = c;
|
||||
}
|
||||
|
||||
} // end namespace scene
|
||||
} // end namespace irr
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
// Copyright (C) 2002-2010 Nikolaus Gebhardt
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||
|
||||
#ifndef __C_BILLBOARD_SCENE_NODE_H_INCLUDED__
|
||||
#define __C_BILLBOARD_SCENE_NODE_H_INCLUDED__
|
||||
|
||||
#include "IBillboardSceneNode.h"
|
||||
#include "S3DVertex.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace scene
|
||||
{
|
||||
|
||||
//! Scene node which is a billboard. A billboard is like a 3d sprite: A 2d element,
|
||||
//! which always looks to the camera.
|
||||
class MyBillboardSceneNode : virtual public IBillboardSceneNode
|
||||
{
|
||||
public:
|
||||
|
||||
//! constructor
|
||||
MyBillboardSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
|
||||
const core::vector3df& position, const core::dimension2d<f32>& size);
|
||||
|
||||
//! pre render event
|
||||
virtual void OnRegisterSceneNode();
|
||||
|
||||
//! render
|
||||
virtual void render();
|
||||
|
||||
//! returns the axis aligned bounding box of this node
|
||||
virtual const core::aabbox3d<f32>& getBoundingBox() const;
|
||||
|
||||
//! sets the size of the billboard
|
||||
virtual void setSize(const core::dimension2d<f32>& size);
|
||||
|
||||
//! gets the size of the billboard
|
||||
virtual const core::dimension2d<f32>& getSize() const;
|
||||
|
||||
virtual video::SMaterial& getMaterial(u32 i);
|
||||
|
||||
//! returns amount of materials used by this scene node.
|
||||
virtual u32 getMaterialCount() const;
|
||||
|
||||
//! Set the color of all vertices of the billboard
|
||||
//! \param overallColor: the color to set
|
||||
virtual void setColor(const video::SColor & overallColor);
|
||||
|
||||
//! Set the color of the top and bottom vertices of the billboard
|
||||
//! \param topColor: the color to set the top vertices
|
||||
//! \param bottomColor: the color to set the bottom vertices
|
||||
virtual void setColor(const video::SColor & topColor, const video::SColor & bottomColor);
|
||||
|
||||
//! Gets the color of the top and bottom vertices of the billboard
|
||||
//! \param[out] topColor: stores the color of the top vertices
|
||||
//! \param[out] bottomColor: stores the color of the bottom vertices
|
||||
virtual void getColor(video::SColor& topColor, video::SColor& bottomColor) const;
|
||||
|
||||
virtual void setTCoords(u32 i, core::vector2d<f32> c);
|
||||
|
||||
private:
|
||||
|
||||
core::dimension2d<f32> Size;
|
||||
core::aabbox3d<f32> BBox;
|
||||
video::SMaterial Material;
|
||||
|
||||
video::S3DVertex vertices[4];
|
||||
u16 indices[6];
|
||||
};
|
||||
|
||||
|
||||
} // end namespace scene
|
||||
} // end namespace irr
|
||||
|
||||
#endif
|
||||
|
||||
293
src/camera.cpp
@@ -22,21 +22,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "client.h"
|
||||
#include "main.h" // for g_settings
|
||||
#include "map.h"
|
||||
#include "mesh.h"
|
||||
#include "player.h"
|
||||
#include "tile.h"
|
||||
#include <cmath>
|
||||
#include <SAnimatedMesh.h>
|
||||
#include "settings.h"
|
||||
#include "nodedef.h" // For wield visualization
|
||||
|
||||
// In Irrlicht 1.8 the signature of ITexture::lock was changed from
|
||||
// (bool, u32) to (E_TEXTURE_LOCK_MODE, u32).
|
||||
#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR <= 7
|
||||
#define MY_ETLM_READ_ONLY true
|
||||
#else
|
||||
#define MY_ETLM_READ_ONLY video::ETLM_READ_ONLY
|
||||
#endif
|
||||
|
||||
Camera::Camera(scene::ISceneManager* smgr, MapDrawControl& draw_control):
|
||||
m_smgr(smgr),
|
||||
m_playernode(NULL),
|
||||
@@ -480,7 +472,6 @@ void Camera::wield(const InventoryItem* item, IGameDef *gamedef)
|
||||
case NDT_ALLFACES:
|
||||
case NDT_ALLFACES_OPTIONAL:
|
||||
m_wieldnode->setCube(ndef->get(content).tiles);
|
||||
m_wieldnode->setScale(v3f(30));
|
||||
isCube = true;
|
||||
break;
|
||||
default:
|
||||
@@ -492,7 +483,6 @@ void Camera::wield(const InventoryItem* item, IGameDef *gamedef)
|
||||
if (!isCube)
|
||||
{
|
||||
m_wieldnode->setSprite(item->getImageRaw());
|
||||
m_wieldnode->setScale(v3f(40));
|
||||
}
|
||||
|
||||
m_wieldnode->setVisible(true);
|
||||
@@ -501,7 +491,6 @@ void Camera::wield(const InventoryItem* item, IGameDef *gamedef)
|
||||
{
|
||||
// Bare hands
|
||||
m_wieldnode->setSprite(gamedef->tsrc()->getTextureRaw("wieldhand.png"));
|
||||
m_wieldnode->setScale(v3f(40));
|
||||
m_wieldnode->setVisible(true);
|
||||
}
|
||||
}
|
||||
@@ -536,7 +525,6 @@ ExtrudedSpriteSceneNode::ExtrudedSpriteSceneNode(
|
||||
ISceneNode(parent, mgr, id, position, rotation, scale)
|
||||
{
|
||||
m_meshnode = mgr->addMeshSceneNode(NULL, this, -1, v3f(0,0,0), v3f(0,0,0), v3f(1,1,1), true);
|
||||
m_thickness = 0.1;
|
||||
m_cubemesh = NULL;
|
||||
m_is_cube = false;
|
||||
m_light = LIGHT_MAX;
|
||||
@@ -551,6 +539,8 @@ ExtrudedSpriteSceneNode::~ExtrudedSpriteSceneNode()
|
||||
|
||||
void ExtrudedSpriteSceneNode::setSprite(video::ITexture* texture)
|
||||
{
|
||||
const v3f sprite_scale(40.0, 40.0, 4.0); // width, height, thickness
|
||||
|
||||
if (texture == NULL)
|
||||
{
|
||||
m_meshnode->setVisible(false);
|
||||
@@ -568,7 +558,9 @@ void ExtrudedSpriteSceneNode::setSprite(video::ITexture* texture)
|
||||
else
|
||||
{
|
||||
// Texture was not yet extruded, do it now and save in cache
|
||||
mesh = extrude(texture);
|
||||
mesh = createExtrudedMesh(texture,
|
||||
SceneManager->getVideoDriver(),
|
||||
sprite_scale);
|
||||
if (mesh == NULL)
|
||||
{
|
||||
dstream << "Warning: failed to extrude sprite" << std::endl;
|
||||
@@ -580,7 +572,6 @@ void ExtrudedSpriteSceneNode::setSprite(video::ITexture* texture)
|
||||
mesh->drop();
|
||||
}
|
||||
|
||||
m_meshnode->setScale(v3f(1, 1, m_thickness));
|
||||
m_meshnode->getMaterial(0).setTexture(0, texture);
|
||||
m_meshnode->getMaterial(0).setFlag(video::EMF_LIGHTING, false);
|
||||
m_meshnode->getMaterial(0).setFlag(video::EMF_BILINEAR_FILTER, false);
|
||||
@@ -592,11 +583,14 @@ void ExtrudedSpriteSceneNode::setSprite(video::ITexture* texture)
|
||||
|
||||
void ExtrudedSpriteSceneNode::setCube(const TileSpec tiles[6])
|
||||
{
|
||||
const v3f cube_scale(30.0, 30.0, 30.0);
|
||||
|
||||
if (m_cubemesh == NULL)
|
||||
m_cubemesh = createCubeMesh();
|
||||
{
|
||||
m_cubemesh = createCubeMesh(cube_scale);
|
||||
}
|
||||
|
||||
m_meshnode->setMesh(m_cubemesh);
|
||||
m_meshnode->setScale(v3f(1));
|
||||
for (int i = 0; i < 6; ++i)
|
||||
{
|
||||
// Get the tile texture and atlas transformation
|
||||
@@ -626,7 +620,7 @@ void ExtrudedSpriteSceneNode::updateLight(u8 light)
|
||||
// Set brightness one lower than incoming light
|
||||
diminish_light(li);
|
||||
video::SColor color(255,li,li,li);
|
||||
setMeshVerticesColor(m_meshnode->getMesh(), color);
|
||||
setMeshColor(m_meshnode->getMesh(), color);
|
||||
}
|
||||
|
||||
void ExtrudedSpriteSceneNode::removeSpriteFromCache(video::ITexture* texture)
|
||||
@@ -637,13 +631,6 @@ void ExtrudedSpriteSceneNode::removeSpriteFromCache(video::ITexture* texture)
|
||||
cache->removeMesh(mesh);
|
||||
}
|
||||
|
||||
void ExtrudedSpriteSceneNode::setSpriteThickness(f32 thickness)
|
||||
{
|
||||
m_thickness = thickness;
|
||||
if (!m_is_cube)
|
||||
m_meshnode->setScale(v3f(1, 1, thickness));
|
||||
}
|
||||
|
||||
const core::aabbox3d<f32>& ExtrudedSpriteSceneNode::getBoundingBox() const
|
||||
{
|
||||
return m_meshnode->getBoundingBox();
|
||||
@@ -667,259 +654,3 @@ io::path ExtrudedSpriteSceneNode::getExtrudedName(video::ITexture* texture)
|
||||
path.append("/[extruded]");
|
||||
return path;
|
||||
}
|
||||
|
||||
scene::IAnimatedMesh* ExtrudedSpriteSceneNode::extrudeARGB(u32 width, u32 height, u8* data)
|
||||
{
|
||||
const s32 argb_wstep = 4 * width;
|
||||
const s32 alpha_threshold = 1;
|
||||
|
||||
scene::IMeshBuffer* buf = new scene::SMeshBuffer();
|
||||
video::SColor c(255,255,255,255);
|
||||
|
||||
// Front and back
|
||||
{
|
||||
video::S3DVertex vertices[8] =
|
||||
{
|
||||
video::S3DVertex(-0.5,-0.5,-0.5, 0,0,-1, c, 0,1),
|
||||
video::S3DVertex(-0.5,+0.5,-0.5, 0,0,-1, c, 0,0),
|
||||
video::S3DVertex(+0.5,+0.5,-0.5, 0,0,-1, c, 1,0),
|
||||
video::S3DVertex(+0.5,-0.5,-0.5, 0,0,-1, c, 1,1),
|
||||
video::S3DVertex(+0.5,-0.5,+0.5, 0,0,+1, c, 1,1),
|
||||
video::S3DVertex(+0.5,+0.5,+0.5, 0,0,+1, c, 1,0),
|
||||
video::S3DVertex(-0.5,+0.5,+0.5, 0,0,+1, c, 0,0),
|
||||
video::S3DVertex(-0.5,-0.5,+0.5, 0,0,+1, c, 0,1),
|
||||
};
|
||||
u16 indices[12] = {0,1,2,2,3,0,4,5,6,6,7,4};
|
||||
buf->append(vertices, 8, indices, 12);
|
||||
}
|
||||
|
||||
// "Interior"
|
||||
// (add faces where a solid pixel is next to a transparent one)
|
||||
u8* solidity = new u8[(width+2) * (height+2)];
|
||||
u32 wstep = width + 2;
|
||||
for (u32 y = 0; y < height + 2; ++y)
|
||||
{
|
||||
u8* scanline = solidity + y * wstep;
|
||||
if (y == 0 || y == height + 1)
|
||||
{
|
||||
for (u32 x = 0; x < width + 2; ++x)
|
||||
scanline[x] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
scanline[0] = 0;
|
||||
u8* argb_scanline = data + (y - 1) * argb_wstep;
|
||||
for (u32 x = 0; x < width; ++x)
|
||||
scanline[x+1] = (argb_scanline[x*4+3] >= alpha_threshold);
|
||||
scanline[width + 1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// without this, there would be occasional "holes" in the mesh
|
||||
f32 eps = 0.01;
|
||||
|
||||
for (u32 y = 0; y <= height; ++y)
|
||||
{
|
||||
u8* scanline = solidity + y * wstep + 1;
|
||||
for (u32 x = 0; x <= width; ++x)
|
||||
{
|
||||
if (scanline[x] && !scanline[x + wstep])
|
||||
{
|
||||
u32 xx = x + 1;
|
||||
while (scanline[xx] && !scanline[xx + wstep])
|
||||
++xx;
|
||||
f32 vx1 = (x - eps) / (f32) width - 0.5;
|
||||
f32 vx2 = (xx + eps) / (f32) width - 0.5;
|
||||
f32 vy = 0.5 - (y - eps) / (f32) height;
|
||||
f32 tx1 = x / (f32) width;
|
||||
f32 tx2 = xx / (f32) width;
|
||||
f32 ty = (y - 0.5) / (f32) height;
|
||||
video::S3DVertex vertices[8] =
|
||||
{
|
||||
video::S3DVertex(vx1,vy,-0.5, 0,-1,0, c, tx1,ty),
|
||||
video::S3DVertex(vx2,vy,-0.5, 0,-1,0, c, tx2,ty),
|
||||
video::S3DVertex(vx2,vy,+0.5, 0,-1,0, c, tx2,ty),
|
||||
video::S3DVertex(vx1,vy,+0.5, 0,-1,0, c, tx1,ty),
|
||||
};
|
||||
u16 indices[6] = {0,1,2,2,3,0};
|
||||
buf->append(vertices, 4, indices, 6);
|
||||
x = xx - 1;
|
||||
}
|
||||
if (!scanline[x] && scanline[x + wstep])
|
||||
{
|
||||
u32 xx = x + 1;
|
||||
while (!scanline[xx] && scanline[xx + wstep])
|
||||
++xx;
|
||||
f32 vx1 = (x - eps) / (f32) width - 0.5;
|
||||
f32 vx2 = (xx + eps) / (f32) width - 0.5;
|
||||
f32 vy = 0.5 - (y + eps) / (f32) height;
|
||||
f32 tx1 = x / (f32) width;
|
||||
f32 tx2 = xx / (f32) width;
|
||||
f32 ty = (y + 0.5) / (f32) height;
|
||||
video::S3DVertex vertices[8] =
|
||||
{
|
||||
video::S3DVertex(vx1,vy,-0.5, 0,1,0, c, tx1,ty),
|
||||
video::S3DVertex(vx1,vy,+0.5, 0,1,0, c, tx1,ty),
|
||||
video::S3DVertex(vx2,vy,+0.5, 0,1,0, c, tx2,ty),
|
||||
video::S3DVertex(vx2,vy,-0.5, 0,1,0, c, tx2,ty),
|
||||
};
|
||||
u16 indices[6] = {0,1,2,2,3,0};
|
||||
buf->append(vertices, 4, indices, 6);
|
||||
x = xx - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (u32 x = 0; x <= width; ++x)
|
||||
{
|
||||
u8* scancol = solidity + x + wstep;
|
||||
for (u32 y = 0; y <= height; ++y)
|
||||
{
|
||||
if (scancol[y * wstep] && !scancol[y * wstep + 1])
|
||||
{
|
||||
u32 yy = y + 1;
|
||||
while (scancol[yy * wstep] && !scancol[yy * wstep + 1])
|
||||
++yy;
|
||||
f32 vx = (x - eps) / (f32) width - 0.5;
|
||||
f32 vy1 = 0.5 - (y - eps) / (f32) height;
|
||||
f32 vy2 = 0.5 - (yy + eps) / (f32) height;
|
||||
f32 tx = (x - 0.5) / (f32) width;
|
||||
f32 ty1 = y / (f32) height;
|
||||
f32 ty2 = yy / (f32) height;
|
||||
video::S3DVertex vertices[8] =
|
||||
{
|
||||
video::S3DVertex(vx,vy1,-0.5, 1,0,0, c, tx,ty1),
|
||||
video::S3DVertex(vx,vy1,+0.5, 1,0,0, c, tx,ty1),
|
||||
video::S3DVertex(vx,vy2,+0.5, 1,0,0, c, tx,ty2),
|
||||
video::S3DVertex(vx,vy2,-0.5, 1,0,0, c, tx,ty2),
|
||||
};
|
||||
u16 indices[6] = {0,1,2,2,3,0};
|
||||
buf->append(vertices, 4, indices, 6);
|
||||
y = yy - 1;
|
||||
}
|
||||
if (!scancol[y * wstep] && scancol[y * wstep + 1])
|
||||
{
|
||||
u32 yy = y + 1;
|
||||
while (!scancol[yy * wstep] && scancol[yy * wstep + 1])
|
||||
++yy;
|
||||
f32 vx = (x + eps) / (f32) width - 0.5;
|
||||
f32 vy1 = 0.5 - (y - eps) / (f32) height;
|
||||
f32 vy2 = 0.5 - (yy + eps) / (f32) height;
|
||||
f32 tx = (x + 0.5) / (f32) width;
|
||||
f32 ty1 = y / (f32) height;
|
||||
f32 ty2 = yy / (f32) height;
|
||||
video::S3DVertex vertices[8] =
|
||||
{
|
||||
video::S3DVertex(vx,vy1,-0.5, -1,0,0, c, tx,ty1),
|
||||
video::S3DVertex(vx,vy2,-0.5, -1,0,0, c, tx,ty2),
|
||||
video::S3DVertex(vx,vy2,+0.5, -1,0,0, c, tx,ty2),
|
||||
video::S3DVertex(vx,vy1,+0.5, -1,0,0, c, tx,ty1),
|
||||
};
|
||||
u16 indices[6] = {0,1,2,2,3,0};
|
||||
buf->append(vertices, 4, indices, 6);
|
||||
y = yy - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add to mesh
|
||||
scene::SMesh* mesh = new scene::SMesh();
|
||||
buf->recalculateBoundingBox();
|
||||
mesh->addMeshBuffer(buf);
|
||||
buf->drop();
|
||||
mesh->recalculateBoundingBox();
|
||||
scene::SAnimatedMesh* anim_mesh = new scene::SAnimatedMesh(mesh);
|
||||
mesh->drop();
|
||||
return anim_mesh;
|
||||
}
|
||||
|
||||
scene::IAnimatedMesh* ExtrudedSpriteSceneNode::extrude(video::ITexture* texture)
|
||||
{
|
||||
scene::IAnimatedMesh* mesh = NULL;
|
||||
core::dimension2d<u32> size = texture->getSize();
|
||||
video::ECOLOR_FORMAT format = texture->getColorFormat();
|
||||
if (format == video::ECF_A8R8G8B8)
|
||||
{
|
||||
// Texture is in the correct color format, we can pass it
|
||||
// to extrudeARGB right away.
|
||||
void* data = texture->lock(MY_ETLM_READ_ONLY);
|
||||
if (data == NULL)
|
||||
return NULL;
|
||||
mesh = extrudeARGB(size.Width, size.Height, (u8*) data);
|
||||
texture->unlock();
|
||||
}
|
||||
else
|
||||
{
|
||||
video::IVideoDriver* driver = SceneManager->getVideoDriver();
|
||||
|
||||
video::IImage* img1 = driver->createImageFromData(format, size, texture->lock(MY_ETLM_READ_ONLY));
|
||||
if (img1 == NULL)
|
||||
return NULL;
|
||||
|
||||
// img1 is in the texture's color format, convert to 8-bit ARGB
|
||||
video::IImage* img2 = driver->createImage(video::ECF_A8R8G8B8, size);
|
||||
if (img2 != NULL)
|
||||
{
|
||||
img1->copyTo(img2);
|
||||
img1->drop();
|
||||
|
||||
mesh = extrudeARGB(size.Width, size.Height, (u8*) img2->lock());
|
||||
img2->unlock();
|
||||
img2->drop();
|
||||
}
|
||||
img1->drop();
|
||||
}
|
||||
return mesh;
|
||||
}
|
||||
|
||||
scene::IMesh* ExtrudedSpriteSceneNode::createCubeMesh()
|
||||
{
|
||||
video::SColor c(255,255,255,255);
|
||||
video::S3DVertex vertices[24] =
|
||||
{
|
||||
// Up
|
||||
video::S3DVertex(-0.5,+0.5,-0.5, 0,1,0, c, 0,1),
|
||||
video::S3DVertex(-0.5,+0.5,+0.5, 0,1,0, c, 0,0),
|
||||
video::S3DVertex(+0.5,+0.5,+0.5, 0,1,0, c, 1,0),
|
||||
video::S3DVertex(+0.5,+0.5,-0.5, 0,1,0, c, 1,1),
|
||||
// Down
|
||||
video::S3DVertex(-0.5,-0.5,-0.5, 0,-1,0, c, 0,0),
|
||||
video::S3DVertex(+0.5,-0.5,-0.5, 0,-1,0, c, 1,0),
|
||||
video::S3DVertex(+0.5,-0.5,+0.5, 0,-1,0, c, 1,1),
|
||||
video::S3DVertex(-0.5,-0.5,+0.5, 0,-1,0, c, 0,1),
|
||||
// Right
|
||||
video::S3DVertex(+0.5,-0.5,-0.5, 1,0,0, c, 0,1),
|
||||
video::S3DVertex(+0.5,+0.5,-0.5, 1,0,0, c, 0,0),
|
||||
video::S3DVertex(+0.5,+0.5,+0.5, 1,0,0, c, 1,0),
|
||||
video::S3DVertex(+0.5,-0.5,+0.5, 1,0,0, c, 1,1),
|
||||
// Left
|
||||
video::S3DVertex(-0.5,-0.5,-0.5, -1,0,0, c, 1,1),
|
||||
video::S3DVertex(-0.5,-0.5,+0.5, -1,0,0, c, 0,1),
|
||||
video::S3DVertex(-0.5,+0.5,+0.5, -1,0,0, c, 0,0),
|
||||
video::S3DVertex(-0.5,+0.5,-0.5, -1,0,0, c, 1,0),
|
||||
// Back
|
||||
video::S3DVertex(-0.5,-0.5,+0.5, 0,0,1, c, 1,1),
|
||||
video::S3DVertex(+0.5,-0.5,+0.5, 0,0,1, c, 0,1),
|
||||
video::S3DVertex(+0.5,+0.5,+0.5, 0,0,1, c, 0,0),
|
||||
video::S3DVertex(-0.5,+0.5,+0.5, 0,0,1, c, 1,0),
|
||||
// Front
|
||||
video::S3DVertex(-0.5,-0.5,-0.5, 0,0,-1, c, 0,1),
|
||||
video::S3DVertex(-0.5,+0.5,-0.5, 0,0,-1, c, 0,0),
|
||||
video::S3DVertex(+0.5,+0.5,-0.5, 0,0,-1, c, 1,0),
|
||||
video::S3DVertex(+0.5,-0.5,-0.5, 0,0,-1, c, 1,1),
|
||||
};
|
||||
|
||||
u16 indices[6] = {0,1,2,2,3,0};
|
||||
|
||||
scene::SMesh* mesh = new scene::SMesh();
|
||||
for (u32 i=0; i<6; ++i)
|
||||
{
|
||||
scene::IMeshBuffer* buf = new scene::SMeshBuffer();
|
||||
buf->append(vertices + 4 * i, 4, indices, 6);
|
||||
buf->recalculateBoundingBox();
|
||||
mesh->addMeshBuffer(buf);
|
||||
buf->drop();
|
||||
}
|
||||
mesh->recalculateBoundingBox();
|
||||
return mesh;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
|
||||
#include "common_irrlicht.h"
|
||||
#include "inventory.h"
|
||||
#include "mesh.h"
|
||||
#include "tile.h"
|
||||
#include "utility.h"
|
||||
#include <ICameraSceneNode.h>
|
||||
@@ -206,9 +207,6 @@ class ExtrudedSpriteSceneNode: public scene::ISceneNode
|
||||
void setSprite(video::ITexture* texture);
|
||||
void setCube(const TileSpec tiles[6]);
|
||||
|
||||
f32 getSpriteThickness() const { return m_thickness; }
|
||||
void setSpriteThickness(f32 thickness);
|
||||
|
||||
void updateLight(u8 light);
|
||||
|
||||
void removeSpriteFromCache(video::ITexture* texture);
|
||||
@@ -219,16 +217,11 @@ class ExtrudedSpriteSceneNode: public scene::ISceneNode
|
||||
|
||||
private:
|
||||
scene::IMeshSceneNode* m_meshnode;
|
||||
f32 m_thickness;
|
||||
scene::IMesh* m_cubemesh;
|
||||
bool m_is_cube;
|
||||
u8 m_light;
|
||||
|
||||
// internal extrusion helper methods
|
||||
io::path getExtrudedName(video::ITexture* texture);
|
||||
scene::IAnimatedMesh* extrudeARGB(u32 width, u32 height, u8* data);
|
||||
scene::IAnimatedMesh* extrude(video::ITexture* texture);
|
||||
scene::IMesh* createCubeMesh();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||