From a48a0e77eb48a0afe8b2d66f3f5ea75e39b9d504 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Tue, 15 Nov 2011 15:32:09 +0200 Subject: Prepare more for node definition serialization --- src/nodedef.cpp | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) (limited to 'src/nodedef.cpp') 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; jtiles[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; jspecial_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 -- cgit v1.2.3