mirror of
https://github.com/minetest/irrlicht.git
synced 2025-07-01 15:50:27 +02:00
Remove unused attribute saving and loading (#86)
This commit is contained in:
@ -170,8 +170,8 @@ void CMeshSceneNode::render()
|
||||
if (DebugDataVisible & scene::EDS_NORMALS)
|
||||
{
|
||||
// draw normals
|
||||
const f32 debugNormalLength = SceneManager->getParameters()->getAttributeAsFloat(DEBUG_NORMAL_LENGTH);
|
||||
const video::SColor debugNormalColor = SceneManager->getParameters()->getAttributeAsColor(DEBUG_NORMAL_COLOR);
|
||||
const f32 debugNormalLength = 1.f;
|
||||
const video::SColor debugNormalColor = video::SColor(255, 34, 221, 221);
|
||||
const u32 count = Mesh->getMeshBufferCount();
|
||||
|
||||
for (u32 i=0; i != count; ++i)
|
||||
@ -276,75 +276,6 @@ void CMeshSceneNode::copyMaterials()
|
||||
}
|
||||
|
||||
|
||||
//! Writes attributes of the scene node.
|
||||
void CMeshSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
|
||||
{
|
||||
IMeshSceneNode::serializeAttributes(out, options);
|
||||
|
||||
if (options && (options->Flags&io::EARWF_USE_RELATIVE_PATHS) && options->Filename)
|
||||
{
|
||||
const io::path path = SceneManager->getFileSystem()->getRelativeFilename(
|
||||
SceneManager->getFileSystem()->getAbsolutePath(SceneManager->getMeshCache()->getMeshName(Mesh).getPath()),
|
||||
options->Filename);
|
||||
out->addString("Mesh", path.c_str());
|
||||
}
|
||||
else
|
||||
out->addString("Mesh", SceneManager->getMeshCache()->getMeshName(Mesh).getPath().c_str());
|
||||
out->addBool("ReadOnlyMaterials", ReadOnlyMaterials);
|
||||
}
|
||||
|
||||
|
||||
//! Reads attributes of the scene node.
|
||||
void CMeshSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
|
||||
{
|
||||
io::path oldMeshStr = SceneManager->getMeshCache()->getMeshName(Mesh);
|
||||
io::path newMeshStr = in->getAttributeAsString("Mesh");
|
||||
ReadOnlyMaterials = in->getAttributeAsBool("ReadOnlyMaterials");
|
||||
|
||||
if (newMeshStr != "" && oldMeshStr != newMeshStr)
|
||||
{
|
||||
IMesh* newMesh = 0;
|
||||
IAnimatedMesh* newAnimatedMesh = SceneManager->getMesh(newMeshStr.c_str());
|
||||
|
||||
if (newAnimatedMesh)
|
||||
newMesh = newAnimatedMesh->getMesh(0);
|
||||
|
||||
if (newMesh)
|
||||
setMesh(newMesh);
|
||||
}
|
||||
|
||||
// optional attribute to assign the hint to the whole mesh
|
||||
if (in->existsAttribute("HardwareMappingHint") &&
|
||||
in->existsAttribute("HardwareMappingBufferType"))
|
||||
{
|
||||
scene::E_HARDWARE_MAPPING mapping = scene::EHM_NEVER;
|
||||
scene::E_BUFFER_TYPE bufferType = scene::EBT_NONE;
|
||||
|
||||
core::stringc smapping = in->getAttributeAsString("HardwareMappingHint");
|
||||
if (smapping.equals_ignore_case("static"))
|
||||
mapping = scene::EHM_STATIC;
|
||||
else if (smapping.equals_ignore_case("dynamic"))
|
||||
mapping = scene::EHM_DYNAMIC;
|
||||
else if (smapping.equals_ignore_case("stream"))
|
||||
mapping = scene::EHM_STREAM;
|
||||
|
||||
core::stringc sbufferType = in->getAttributeAsString("HardwareMappingBufferType");
|
||||
if (sbufferType.equals_ignore_case("vertex"))
|
||||
bufferType = scene::EBT_VERTEX;
|
||||
else if (sbufferType.equals_ignore_case("index"))
|
||||
bufferType = scene::EBT_INDEX;
|
||||
else if (sbufferType.equals_ignore_case("vertexindex"))
|
||||
bufferType = scene::EBT_VERTEX_AND_INDEX;
|
||||
|
||||
IMesh* mesh = getMesh();
|
||||
if (mesh)
|
||||
mesh->setHardwareMappingHint(mapping, bufferType);
|
||||
}
|
||||
|
||||
IMeshSceneNode::deserializeAttributes(in, options);
|
||||
}
|
||||
|
||||
|
||||
//! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
|
||||
/* In this way it is possible to change the materials a mesh causing all mesh scene nodes
|
||||
referencing this mesh to change too. */
|
||||
|
Reference in New Issue
Block a user