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