diff options
Diffstat (limited to 'src/nodedef.cpp')
-rw-r--r-- | src/nodedef.cpp | 43 |
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 |