1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Prepare more for node definition serialization

This commit is contained in:
Perttu Ahola 2011-11-15 15:32:09 +02:00
parent cf6e22e9a6
commit a48a0e77eb
4 changed files with 92 additions and 86 deletions

View file

@ -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