mirror of
https://github.com/minetest/irrlicht.git
synced 2024-11-20 17:20:26 +01:00
Fix .x material slot parsing
Co-authored-by: hecktest <>
This commit is contained in:
parent
ae81dbd942
commit
6c78f181b5
@ -89,7 +89,6 @@ IAnimatedMesh* CXMeshFileLoader::createMesh(io::IReadFile* file)
|
||||
P=0;
|
||||
End=0;
|
||||
CurFrame=0;
|
||||
TemplateMaterials.clear();
|
||||
|
||||
delete [] Buffer;
|
||||
Buffer = 0;
|
||||
@ -519,6 +518,11 @@ bool CXMeshFileLoader::parseDataObject()
|
||||
return parseDataObjectAnimationTicksPerSecond();
|
||||
}
|
||||
else
|
||||
if (objectName == "Material")
|
||||
{
|
||||
return parseUnknownDataObject();
|
||||
}
|
||||
else
|
||||
if (objectName == "}")
|
||||
{
|
||||
os::Printer::log("} found in dataObject", ELL_WARNING);
|
||||
@ -1455,12 +1459,17 @@ bool CXMeshFileLoader::parseDataObjectMeshMaterialList(SXMesh &mesh)
|
||||
{
|
||||
// template materials now available thanks to joeWright
|
||||
objectName = getNextToken();
|
||||
for (u32 i=0; i<TemplateMaterials.size(); ++i)
|
||||
if (TemplateMaterials[i].Name == objectName)
|
||||
mesh.Materials.push_back(TemplateMaterials[i].Material);
|
||||
mesh.Materials.push_back(video::SMaterial());
|
||||
getNextToken(); // skip }
|
||||
}
|
||||
else
|
||||
if (objectName == "Material")
|
||||
{
|
||||
mesh.Materials.push_back(video::SMaterial());
|
||||
if (!parseUnknownDataObject())
|
||||
return false;
|
||||
}
|
||||
else
|
||||
if (objectName == ";")
|
||||
{
|
||||
// ignore
|
||||
|
@ -39,12 +39,6 @@ public:
|
||||
//! See IReferenceCounted::drop() for more information.
|
||||
virtual IAnimatedMesh* createMesh(io::IReadFile* file) _IRR_OVERRIDE_;
|
||||
|
||||
struct SXTemplateMaterial
|
||||
{
|
||||
core::stringc Name; // template name from Xfile
|
||||
video::SMaterial Material; // material
|
||||
};
|
||||
|
||||
struct SXMesh
|
||||
{
|
||||
SXMesh() : MaxSkinWeightsPerVertex(0), MaxSkinWeightsPerFace(0), BoneCount(0),AttachedJointID(-1),HasSkinning(false), HasVertexColors(false) {}
|
||||
@ -182,8 +176,6 @@ private:
|
||||
|
||||
core::array<SXMesh*> Meshes;
|
||||
|
||||
core::array<SXTemplateMaterial> TemplateMaterials;
|
||||
|
||||
u32 MajorVersion;
|
||||
u32 MinorVersion;
|
||||
bool BinaryFormat;
|
||||
|
Loading…
Reference in New Issue
Block a user