summaryrefslogtreecommitdiff
path: root/src/nodedef.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-11-15 15:32:09 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-11-29 19:13:43 +0200
commita48a0e77eb48a0afe8b2d66f3f5ea75e39b9d504 (patch)
treebd21bdf708a654e7cda88cd4a31a9626e8976ea7 /src/nodedef.cpp
parentcf6e22e9a690c5654a3d4edf7365e1d1115083b1 (diff)
downloadminetest-a48a0e77eb48a0afe8b2d66f3f5ea75e39b9d504.tar.gz
minetest-a48a0e77eb48a0afe8b2d66f3f5ea75e39b9d504.tar.bz2
minetest-a48a0e77eb48a0afe8b2d66f3f5ea75e39b9d504.zip
Prepare more for node definition serialization
Diffstat (limited to 'src/nodedef.cpp')
-rw-r--r--src/nodedef.cpp43
1 files changed, 28 insertions, 15 deletions
diff --git a/src/nodedef.cpp b/src/nodedef.cpp
index 84b5f1d3d..6fa410cc2 100644
--- a/src/nodedef.cpp
+++ b/src/nodedef.cpp
@@ -30,8 +30,10 @@ ContentFeatures::~ContentFeatures()
{
delete initial_metadata;
#ifndef SERVER
- delete special_material;
- delete special_atlas;
+ for(u16 j=0; j<CF_SPECIAL_COUNT; j++){
+ delete special_materials[j];
+ delete special_aps[j];
+ }
#endif
}
@@ -198,19 +200,30 @@ public:
else
f->tiles[j].material_flags &= ~MATERIAL_FLAG_BACKFACE_CULLING;
}
- // Special texture
- if(f->tname_special != ""){
- if(!f->special_atlas)
- f->special_atlas = new AtlasPointer(
- tsrc->getTexture(f->tname_special));
- else
- *(f->special_atlas) =
- tsrc->getTexture(f->tname_special);
- // Special material textures
- if(f->special_material)
- f->special_material->setTexture(0, f->special_atlas->atlas);
- if(f->special_material2)
- f->special_material2->setTexture(0, f->special_atlas->atlas);
+ // Special textures
+ for(u16 j=0; j<CF_SPECIAL_COUNT; j++){
+ // Remove all stuff
+ if(f->special_aps[j]){
+ delete f->special_aps[j];
+ f->special_aps[j] = NULL;
+ }
+ if(f->special_materials[j]){
+ delete f->special_materials[j];
+ f->special_materials[j] = NULL;
+ }
+ // Skip if should not exist
+ if(f->mspec_special[j].tname == "")
+ continue;
+ // Create all stuff
+ f->special_aps[j] = new AtlasPointer(
+ tsrc->getTexture(f->mspec_special[j].tname));
+ f->special_materials[j] = new video::SMaterial;
+ f->special_materials[j]->setFlag(video::EMF_LIGHTING, false);
+ f->special_materials[j]->setFlag(video::EMF_BACK_FACE_CULLING,
+ f->mspec_special[j].backface_culling);
+ f->special_materials[j]->setFlag(video::EMF_BILINEAR_FILTER, false);
+ f->special_materials[j]->setFlag(video::EMF_FOG_ENABLE, true);
+ f->special_materials[j]->setTexture(0, f->special_aps[j]->atlas);
}
}
#endif