summaryrefslogtreecommitdiff
path: root/src/object_properties.cpp
diff options
context:
space:
mode:
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>2012-10-23 20:03:06 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-11-25 18:14:14 +0200
commit0a020dbcc848ae2debec664846e08bd097d70320 (patch)
tree5c43fc7d023d002dc5fb637eea55022265bde0c8 /src/object_properties.cpp
parentac97a7f70eefd4b8065e006c634a0a5baf236b62 (diff)
downloadminetest-0a020dbcc848ae2debec664846e08bd097d70320.tar.gz
minetest-0a020dbcc848ae2debec664846e08bd097d70320.tar.bz2
minetest-0a020dbcc848ae2debec664846e08bd097d70320.zip
Properly read the mesh from LUA.
Players can now be set to meshes using the following test script: function switch_player_visual() prop = { mesh="player.obj", texture="player.png", visual="mesh", } for _, obj in pairs(minetest.get_connected_players()) do obj:set_properties(prop) end minetest.after(1.0, switch_player_visual) end minetest.after(1.0, switch_player_visual)
Diffstat (limited to 'src/object_properties.cpp')
-rw-r--r--src/object_properties.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/object_properties.cpp b/src/object_properties.cpp
index e67b78b52..3a36addc7 100644
--- a/src/object_properties.cpp
+++ b/src/object_properties.cpp
@@ -30,6 +30,8 @@ ObjectProperties::ObjectProperties():
weight(5),
collisionbox(-0.5,-0.5,-0.5, 0.5,0.5,0.5),
visual("sprite"),
+ mesh(""),
+ texture(""),
visual_size(1,1),
spritediv(1,1),
initial_sprite_basepos(0,0),
@@ -48,6 +50,8 @@ std::string ObjectProperties::dump()
os<<", weight="<<weight;
os<<", collisionbox="<<PP(collisionbox.MinEdge)<<","<<PP(collisionbox.MaxEdge);
os<<", visual="<<visual;
+ os<<", mesh="<<mesh;
+ os<<", texture="<<texture;
os<<", visual_size="<<PP2(visual_size);
os<<", textures=[";
for(u32 i=0; i<textures.size(); i++){
@@ -71,6 +75,8 @@ void ObjectProperties::serialize(std::ostream &os) const
writeV3F1000(os, collisionbox.MinEdge);
writeV3F1000(os, collisionbox.MaxEdge);
os<<serializeString(visual);
+ os<<serializeString(mesh);
+ os<<serializeString(texture);
writeV2F1000(os, visual_size);
writeU16(os, textures.size());
for(u32 i=0; i<textures.size(); i++){
@@ -94,6 +100,8 @@ void ObjectProperties::deSerialize(std::istream &is)
collisionbox.MinEdge = readV3F1000(is);
collisionbox.MaxEdge = readV3F1000(is);
visual = deSerializeString(is);
+ mesh = deSerializeString(is);
+ texture = deSerializeString(is);
visual_size = readV2F1000(is);
textures.clear();
u32 texture_count = readU16(is);