summaryrefslogtreecommitdiff
path: root/src/itemdef.cpp
diff options
context:
space:
mode:
authorKahrl <kahrl@gmx.net>2012-03-13 18:56:12 +0100
committerPerttu Ahola <celeron55@gmail.com>2012-03-15 21:45:44 +0200
commit807a0d313ba667356ee8af8ef5ae82b6c4881d15 (patch)
treec4674e1c193cfcf8359c788ed5894d3cc1849648 /src/itemdef.cpp
parentf9a66c5d46b225d0ddbbad939232348bc5ebf959 (diff)
downloadminetest-807a0d313ba667356ee8af8ef5ae82b6c4881d15.tar.gz
minetest-807a0d313ba667356ee8af8ef5ae82b6c4881d15.tar.bz2
minetest-807a0d313ba667356ee8af8ef5ae82b6c4881d15.zip
MapBlockMesh, mesh animation system, urgent mesh updates, athmospheric light, removed footprints
Diffstat (limited to 'src/itemdef.cpp')
-rw-r--r--src/itemdef.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/itemdef.cpp b/src/itemdef.cpp
index ace9c253f..a646134af 100644
--- a/src/itemdef.cpp
+++ b/src/itemdef.cpp
@@ -381,17 +381,20 @@ public:
content_t id = nodedef->getId(def->name);
const ContentFeatures &f = nodedef->get(id);
+ u8 param1 = 0;
+ if(f.param_type == CPT_LIGHT)
+ param1 = 0xee;
+
/*
Make a mesh from the node
*/
- MeshMakeData mesh_make_data;
- MapNode mesh_make_node(
- id,
- (f.param_type == CPT_LIGHT) ? 0xee : 0,
- 0);
- mesh_make_data.fillSingleNode(1000, &mesh_make_node);
- scene::IMesh *node_mesh =
- makeMapBlockMesh(&mesh_make_data, gamedef);
+ MeshMakeData mesh_make_data(gamedef);
+ MapNode mesh_make_node(id, param1, 0);
+ mesh_make_data.fillSingleNode(&mesh_make_node);
+ MapBlockMesh mapblock_mesh(&mesh_make_data);
+
+ scene::IMesh *node_mesh = mapblock_mesh.getMesh();
+ assert(node_mesh);
setMeshColor(node_mesh, video::SColor(255, 255, 255, 255));
/*
@@ -404,7 +407,7 @@ public:
/*
Draw node mesh into a render target texture
*/
- if(def->inventory_texture == NULL && node_mesh != NULL)
+ if(def->inventory_texture == NULL)
{
core::dimension2d<u32> dim(64,64);
std::string rtt_texture_name = "INVENTORY_"
@@ -443,7 +446,7 @@ public:
/*
Use the node mesh as the wield mesh
*/
- if(def->wield_mesh == NULL && node_mesh != NULL)
+ if(def->wield_mesh == NULL)
{
// Scale to proper wield mesh proportions
scaleMesh(node_mesh, v3f(30.0, 30.0, 30.0)
@@ -452,9 +455,7 @@ public:
def->wield_mesh->grab();
}
-
- if(node_mesh != NULL)
- node_mesh->drop();
+ // falling outside of here deletes node_mesh
}
}
#endif