Remove std::function, fix CXLoader bug
Matricies in CXLoader shouldn't be flipped
MODIFY
src/irr/asset/COBJMeshFileLoader.cpp
src/irr/asset/COBJMeshFileLoader.cpp
@@ -105,14 +105,6 @@ asset::SAssetBundle COBJMeshFileLoader::loadAsset(io::IReadFile* _file, const as
bool mtlChanged=false;
bool submeshLoadedFromCache = false;
- auto performActionBasedOnOrientationSystem = [&](auto performOnRightHanded, auto performOnLeftHanded = [&](void) {})
- {
- if (_params.loaderFlags & E_LOADER_PARAMETER_FLAGS::ELPF_RIGHT_HANDED_MESHES)
- performOnRightHanded();
- else
- performOnLeftHanded();
- };
-
while(bufPtr != bufEnd)
{
switch(bufPtr[0])
@@ -140,7 +132,8 @@ asset::SAssetBundle COBJMeshFileLoader::loadAsset(io::IReadFile* _file, const as
{
core::vector3df vec;
bufPtr = readVec3(bufPtr, vec, bufEnd);
- performActionBasedOnOrientationSystem([&]() {vec.X = -vec.X;}, [&]() {});
+ if (_params.loaderFlags & E_LOADER_PARAMETER_FLAGS::ELPF_RIGHT_HANDED_MESHES)
+ performActionBasedOnOrientationSystem<float>(vec.X, [](float& varToFlip) {varToFlip = -varToFlip;});
vertexBuffer.push_back(vec);
}
break;
@@ -149,7 +142,8 @@ asset::SAssetBundle COBJMeshFileLoader::loadAsset(io::IReadFile* _file, const as
{
core::vector3df vec;
bufPtr = readVec3(bufPtr, vec, bufEnd);
- performActionBasedOnOrientationSystem([&]() {vec.X = -vec.X; }, [&]() {});
+ if (_params.loaderFlags & E_LOADER_PARAMETER_FLAGS::ELPF_RIGHT_HANDED_MESHES)
+ performActionBasedOnOrientationSystem<float>(vec.X, [](float& varToFlip) {varToFlip = -varToFlip;});
normalsBuffer.push_back(vec);
}
break;

MODIFY
src/irr/asset/COBJMeshFileLoader.h
src/irr/asset/COBJMeshFileLoader.h
@@ -236,6 +236,12 @@ private:
IAssetManager* AssetManager;
io::IFileSystem* FileSystem;
+
+ template<typename aType>
+ static inline void performActionBasedOnOrientationSystem(aType& varToHandle, void (*performOnCertainOrientation)(aType& varToHandle))
+ {
+ performOnCertainOrientation(varToHandle);
+ }
};
} // end namespace asset

MODIFY
src/irr/asset/CPLYMeshFileLoader.cpp
src/irr/asset/CPLYMeshFileLoader.cpp
@@ -241,14 +241,6 @@ asset::SAssetBundle CPLYMeshFileLoader::loadAsset(io::IReadFile* _file, const as
bool hasNormals = true;
- auto performActionBasedOnOrientationSystem = [&](auto performOnRightHanded, auto performOnLeftHanded = [&](void) {})
- {
- if (_params.loaderFlags & E_LOADER_PARAMETER_FLAGS::ELPF_RIGHT_HANDED_MESHES)
- performOnRightHanded();
- else
- performOnLeftHanded();
- };
-
// loop through each of the elements
for (uint32_t i=0; i<ctx.ElementList.size(); ++i)
{
@@ -257,7 +249,7 @@ asset::SAssetBundle CPLYMeshFileLoader::loadAsset(io::IReadFile* _file, const as
{
// loop through vertex properties
for (uint32_t j=0; j<ctx.ElementList[i]->Count; ++j)
- hasNormals &= readVertex(ctx, *ctx.ElementList[i], attribs, performActionBasedOnOrientationSystem);
+ hasNormals &= readVertex(ctx, *ctx.ElementList[i], attribs, _params);
}
else if (ctx.ElementList[i]->Name == "face")
{
@@ -308,7 +300,7 @@ asset::SAssetBundle CPLYMeshFileLoader::loadAsset(io::IReadFile* _file, const as
}
-bool CPLYMeshFileLoader::readVertex(SContext& _ctx, const SPLYElement& Element, core::vector<core::vectorSIMDf> _outAttribs[4], std::function<void(std::function<void()>, std::function<void()>)> performActionBasedOnOrientationSystem)
+bool CPLYMeshFileLoader::readVertex(SContext& _ctx, const SPLYElement& Element, core::vector<core::vectorSIMDf> _outAttribs[4], const asset::IAssetLoader::SAssetLoadParams& _params)
{
if (!_ctx.IsBinaryFile)
getNextLine(_ctx);
@@ -393,11 +385,14 @@ bool CPLYMeshFileLoader::readVertex(SContext& _ctx, const SPLYElement& Element,
for (size_t i = 0u; i < 4u; ++i)
if (attribs[i].first)
+ {
+ if (_params.loaderFlags & E_LOADER_PARAMETER_FLAGS::ELPF_RIGHT_HANDED_MESHES)
{
if (i == E_POS)
- performActionBasedOnOrientationSystem([&]() { attribs[E_POS].second.X = -attribs[E_POS].second.X; }, [&]() {});
+ performActionBasedOnOrientationSystem<float>(attribs[E_POS].second.X, [](float& varToFlip) { varToFlip = -varToFlip; });
else if (i == E_NORM)
- performActionBasedOnOrientationSystem([&]() { attribs[E_NORM].second.X = -attribs[E_NORM].second.X; }, [&]() {});
+ performActionBasedOnOrientationSystem<float>(attribs[E_NORM].second.X, [](float& varToFlip) { varToFlip = -varToFlip; });
+ }
_outAttribs[i].push_back(attribs[i].second);
}

MODIFY
src/irr/asset/CPLYMeshFileLoader.h
src/irr/asset/CPLYMeshFileLoader.h
@@ -158,7 +158,7 @@ private:
void fillBuffer(SContext& _ctx);
E_PLY_PROPERTY_TYPE getPropertyType(const char* typeString) const;
- bool readVertex(SContext& _ctx, const SPLYElement &Element, core::vector<core::vectorSIMDf> _attribs[4], std::function<void(std::function<void()>, std::function<void()>)> performActionBasedOnOrientationSystem);
+ bool readVertex(SContext& _ctx, const SPLYElement &Element, core::vector<core::vectorSIMDf> _attribs[4], const asset::IAssetLoader::SAssetLoadParams& _params);
bool readFace(SContext& _ctx, const SPLYElement &Element, core::vector<uint32_t>& _outIndices);
void skipElement(SContext& _ctx, const SPLYElement &Element);
void skipProperty(SContext& _ctx, const SPLYProperty &Property);
@@ -167,6 +167,12 @@ private:
void moveForward(SContext& _ctx, uint32_t bytes);
bool genVertBuffersForMBuffer(asset::ICPUMeshBuffer* _mbuf, const core::vector<core::vectorSIMDf> _attribs[4]) const;
+
+ template<typename aType>
+ static inline void performActionBasedOnOrientationSystem(aType& varToHandle, void (*performOnCertainOrientation)(aType& varToHandle))
+ {
+ performOnCertainOrientation(varToHandle);
+ }
};
} // end namespace scene

MODIFY
src/irr/asset/CSTLMeshFileLoader.cpp
src/irr/asset/CSTLMeshFileLoader.cpp
@@ -72,18 +72,11 @@ namespace irr
}
}
- auto performActionBasedOnOrientationSystem = [&](auto performOnRightHanded, auto performOnLeftHanded = [&](void) {})
- {
- if (_params.loaderFlags & E_LOADER_PARAMETER_FLAGS::ELPF_RIGHT_HANDED_MESHES)
- performOnRightHanded();
- else
- performOnLeftHanded();
- };
-
{
core::vectorSIMDf n;
getNextVector(_file, n, binary);
- performActionBasedOnOrientationSystem([&]() {n.x = -n.x; }, [&]() {});
+ if(_params.loaderFlags & E_LOADER_PARAMETER_FLAGS::ELPF_RIGHT_HANDED_MESHES)
+ performActionBasedOnOrientationSystem<float>(n.x, [](float& varToFlip) {varToFlip = -varToFlip;});
normals.push_back(core::normalize(n));
}
@@ -103,7 +96,8 @@ namespace irr
return {};
}
getNextVector(_file, p[i], binary);
- performActionBasedOnOrientationSystem([&]() {p[i].x = -p[i].x; }, [&]() {});
+ if (_params.loaderFlags & E_LOADER_PARAMETER_FLAGS::ELPF_RIGHT_HANDED_MESHES)
+ performActionBasedOnOrientationSystem<float>(p[i].x, [](float& varToFlip){varToFlip = -varToFlip; });
}
for (uint32_t i = 0u; i < 3u; ++i) // seems like in STL format vertices are ordered in clockwise manner...
positions.push_back(p[2u - i]);

MODIFY
src/irr/asset/CSTLMeshFileLoader.h
src/irr/asset/CSTLMeshFileLoader.h
@@ -38,6 +38,12 @@ private:
//! Read 3d vector of floats
void getNextVector(io::IReadFile* file, core::vectorSIMDf& vec, bool binary) const;
+
+ template<typename aType>
+ static inline void performActionBasedOnOrientationSystem(aType& varToHandle, void (*performOnCertainOrientation)(aType& varToHandle))
+ {
+ performOnCertainOrientation(varToHandle);
+ }
};
} // end namespace scene

MODIFY
src/irr/asset/CXMeshFileLoader.cpp
src/irr/asset/CXMeshFileLoader.cpp
@@ -88,15 +88,7 @@ asset::SAssetBundle CXMeshFileLoader::loadAsset(io::IReadFile* _file, const asse
ctx.AnimatedMesh = new asset::CCPUSkinnedMesh();
asset::ICPUMesh* retVal = nullptr;
- auto performActionBasedOnOrientationSystem = [&](auto performOnRightHanded, auto performOnLeftHanded = [&](void) {})
- {
- if (_params.loaderFlags & E_LOADER_PARAMETER_FLAGS::ELPF_RIGHT_HANDED_MESHES)
- performOnRightHanded();
- else
- performOnLeftHanded();
- };
-
- if (load(ctx, _file, performActionBasedOnOrientationSystem))
+ if (load(ctx, _file, _params))
{
ctx.AnimatedMesh->finalize();
if (ctx.AnimatedMesh->isStatic())
@@ -233,12 +225,12 @@ core::matrix4x3 getGlobalMatrix_evil(asset::ICPUSkinnedMesh::SJoint* joint)
}
-bool CXMeshFileLoader::load(SContext& _ctx, io::IReadFile* file, orientationFunction performActionBasedOnOrientationSystem)
+bool CXMeshFileLoader::load(SContext& _ctx, io::IReadFile* file, const asset::IAssetLoader::SAssetLoadParams& _params)
{
if (!readFileIntoMemory(_ctx, file))
return false;
- if (!parseFile(_ctx, performActionBasedOnOrientationSystem))
+ if (!parseFile(_ctx, _params))
return false;
for (uint32_t n=0; n<_ctx.Meshes.size(); ++n)
@@ -702,9 +694,9 @@ bool CXMeshFileLoader::readFileIntoMemory(SContext& _ctx, io::IReadFile* file)
//! Parses the file
-bool CXMeshFileLoader::parseFile(SContext& _ctx, orientationFunction performActionBasedOnOrientationSystem)
+bool CXMeshFileLoader::parseFile(SContext& _ctx, const asset::IAssetLoader::SAssetLoadParams& _params)
{
- while(parseDataObject(_ctx, performActionBasedOnOrientationSystem))
+ while(parseDataObject(_ctx, _params))
{
// loop
}
@@ -714,7 +706,7 @@ bool CXMeshFileLoader::parseFile(SContext& _ctx, orientationFunction performActi
//! Parses the next Data object in the file
-bool CXMeshFileLoader::parseDataObject(SContext& _ctx, orientationFunction performActionBasedOnOrientationSystem)
+bool CXMeshFileLoader::parseDataObject(SContext& _ctx, const asset::IAssetLoader::SAssetLoadParams& _params)
{
std::string objectName = getNextToken(_ctx);
@@ -731,7 +723,7 @@ bool CXMeshFileLoader::parseDataObject(SContext& _ctx, orientationFunction perfo
else
if (objectName == "Frame")
{
- return parseDataObjectFrame( _ctx, 0 , performActionBasedOnOrientationSystem);
+ return parseDataObjectFrame( _ctx, 0 , _params);
}
else
if (objectName == "Mesh")
@@ -744,12 +736,12 @@ bool CXMeshFileLoader::parseDataObject(SContext& _ctx, orientationFunction perfo
//mesh->Buffer=AnimatedMesh->addMeshBuffer();
_ctx.Meshes.push_back(mesh);
- return parseDataObjectMesh(_ctx, *mesh, performActionBasedOnOrientationSystem);
+ return parseDataObjectMesh(_ctx, *mesh, _params);
}
else
if (objectName == "AnimationSet")
{
- return parseDataObjectAnimationSet(_ctx, performActionBasedOnOrientationSystem);
+ return parseDataObjectAnimationSet(_ctx, _params);
}
else
if (objectName == "Material")
@@ -808,7 +800,7 @@ bool CXMeshFileLoader::parseDataObjectTemplate(SContext& _ctx)
}
-bool CXMeshFileLoader::parseDataObjectFrame(SContext& _ctx, asset::ICPUSkinnedMesh::SJoint *Parent, orientationFunction performActionBasedOnOrientationSystem)
+bool CXMeshFileLoader::parseDataObjectFrame(SContext& _ctx, asset::ICPUSkinnedMesh::SJoint *Parent, const asset::IAssetLoader::SAssetLoadParams& _params)
{
#ifdef _XREADER_DEBUG
os::Printer::log("CXFileReader: Reading frame", ELL_DEBUG);
@@ -890,13 +882,13 @@ bool CXMeshFileLoader::parseDataObjectFrame(SContext& _ctx, asset::ICPUSkinnedMe
if (objectName == "Frame")
{
- if (!parseDataObjectFrame(_ctx, joint, performActionBasedOnOrientationSystem))
+ if (!parseDataObjectFrame(_ctx, joint, _params))
return false;
}
else
if (objectName == "FrameTransformMatrix")
{
- if (!parseDataObjectTransformationMatrix(_ctx, joint->LocalMatrix, performActionBasedOnOrientationSystem))
+ if (!parseDataObjectTransformationMatrix(_ctx, joint->LocalMatrix, _params))
return false;
//joint->LocalAnimatedMatrix
@@ -917,7 +909,7 @@ bool CXMeshFileLoader::parseDataObjectFrame(SContext& _ctx, asset::ICPUSkinnedMe
_ctx.Meshes.push_back(mesh);
- if (!parseDataObjectMesh(_ctx, *mesh, performActionBasedOnOrientationSystem))
+ if (!parseDataObjectMesh(_ctx, *mesh, _params))
return false;
}
else
@@ -932,7 +924,7 @@ bool CXMeshFileLoader::parseDataObjectFrame(SContext& _ctx, asset::ICPUSkinnedMe
}
-bool CXMeshFileLoader::parseDataObjectTransformationMatrix(SContext& _ctx, core::matrix4x3 &mat, orientationFunction performActionBasedOnOrientationSystem)
+bool CXMeshFileLoader::parseDataObjectTransformationMatrix(SContext& _ctx, core::matrix4x3 &mat, const asset::IAssetLoader::SAssetLoadParams& _params)
{
#ifdef _XREADER_DEBUG
os::Printer::log("CXFileReader: Reading Transformation Matrix", ELL_DEBUG);
@@ -945,7 +937,7 @@ bool CXMeshFileLoader::parseDataObjectTransformationMatrix(SContext& _ctx, core:
return false;
}
- readMatrix(_ctx, mat, performActionBasedOnOrientationSystem);
+ readMatrix(_ctx, mat, _params);
if (!checkForOneFollowingSemicolons(_ctx))
{
@@ -964,7 +956,7 @@ bool CXMeshFileLoader::parseDataObjectTransformationMatrix(SContext& _ctx, core:
}
-bool CXMeshFileLoader::parseDataObjectMesh(SContext& _ctx, SXMesh &mesh, orientationFunction performActionBasedOnOrientationSystem)
+bool CXMeshFileLoader::parseDataObjectMesh(SContext& _ctx, SXMesh &mesh, const asset::IAssetLoader::SAssetLoadParams& _params)
{
std::string name;
@@ -990,7 +982,8 @@ bool CXMeshFileLoader::parseDataObjectMesh(SContext& _ctx, SXMesh &mesh, orienta
for (uint32_t n=0; n<nVertices; ++n)
{
readVector3(_ctx, mesh.Vertices[n].Pos);
- performActionBasedOnOrientationSystem([&]() {mesh.Vertices[n].Pos.X = -mesh.Vertices[n].Pos.X; }, [&]() {});
+ if (_params.loaderFlags & E_LOADER_PARAMETER_FLAGS::ELPF_RIGHT_HANDED_MESHES)
+ performActionBasedOnOrientationSystem<float>(mesh.Vertices[n].Pos.X, [](float& varToFlip) {varToFlip = -varToFlip;});
}
if (!checkForTwoFollowingSemicolons(_ctx))
@@ -1078,7 +1071,7 @@ bool CXMeshFileLoader::parseDataObjectMesh(SContext& _ctx, SXMesh &mesh, orienta
if (objectName == "MeshNormals")
{
- if (!parseDataObjectMeshNormals(_ctx, mesh, performActionBasedOnOrientationSystem))
+ if (!parseDataObjectMeshNormals(_ctx, mesh, _params))
return false;
}
else
@@ -1299,7 +1292,7 @@ bool CXMeshFileLoader::parseDataObjectMesh(SContext& _ctx, SXMesh &mesh, orienta
{
//mesh.SkinWeights.push_back(SXSkinWeight());
//if (!parseDataObjectSkinWeights(mesh.SkinWeights.back()))
- if (!parseDataObjectSkinWeights(_ctx, mesh, performActionBasedOnOrientationSystem))
+ if (!parseDataObjectSkinWeights(_ctx, mesh, _params))
return false;
}
else
@@ -1314,7 +1307,7 @@ bool CXMeshFileLoader::parseDataObjectMesh(SContext& _ctx, SXMesh &mesh, orienta
}
-bool CXMeshFileLoader::parseDataObjectSkinWeights(SContext& _ctx, SXMesh &mesh, orientationFunction performActionBasedOnOrientationSystem)
+bool CXMeshFileLoader::parseDataObjectSkinWeights(SContext& _ctx, SXMesh &mesh, const asset::IAssetLoader::SAssetLoadParams& _params)
{
#ifdef _XREADER_DEBUG
os::Printer::log("CXFileReader: Reading mesh skin weights", ELL_DEBUG);
@@ -1398,7 +1391,7 @@ bool CXMeshFileLoader::parseDataObjectSkinWeights(SContext& _ctx, SXMesh &mesh,
// transforms the mesh vertices to the space of the bone
// When concatenated to the bone's transform, this provides the
// world space coordinates of the mesh as affected by the bone
- readMatrix(_ctx, joint->GlobalInversedMatrix, performActionBasedOnOrientationSystem);
+ readMatrix(_ctx, joint->GlobalInversedMatrix, _params);
if (!checkForOneFollowingSemicolons(_ctx))
{
@@ -1450,7 +1443,7 @@ bool CXMeshFileLoader::parseDataObjectSkinMeshHeader(SContext& _ctx, SXMesh& mes
}
-bool CXMeshFileLoader::parseDataObjectMeshNormals(SContext& _ctx, SXMesh &mesh, std::function<void(std::function<void()>, std::function<void()>)> performActionBasedOnOrientationSystem)
+bool CXMeshFileLoader::parseDataObjectMeshNormals(SContext& _ctx, SXMesh &mesh, const asset::IAssetLoader::SAssetLoadParams& _params)
{
#ifdef _XREADER_DEBUG
os::Printer::log("CXFileReader: reading mesh normals", ELL_DEBUG);
@@ -1472,7 +1465,9 @@ bool CXMeshFileLoader::parseDataObjectMeshNormals(SContext& _ctx, SXMesh &mesh,
for (uint32_t i=0; i<nNormals; ++i)
{
readVector3(_ctx, normals[i]);
- performActionBasedOnOrientationSystem([&]() {normals[i].X = -normals[i].X; }, [&]() {});
+
+ if (_params.loaderFlags & E_LOADER_PARAMETER_FLAGS::ELPF_RIGHT_HANDED_MESHES)
+ performActionBasedOnOrientationSystem<float>(normals[i].X, [](float& varToFlip) {varToFlip = -varToFlip; });
}
if (!checkForTwoFollowingSemicolons(_ctx))
@@ -1818,7 +1813,7 @@ bool CXMeshFileLoader::parseDataObjectMaterial(SContext& _ctx, video::SCPUMateri
}
-bool CXMeshFileLoader::parseDataObjectAnimationSet(SContext& _ctx, orientationFunction performActionBasedOnOrientationSystem)
+bool CXMeshFileLoader::parseDataObjectAnimationSet(SContext& _ctx, const asset::IAssetLoader::SAssetLoadParams& _params)
{
#ifdef _XREADER_DEBUG
os::Printer::log("CXFileReader: Reading animation set", ELL_DEBUG);
@@ -1852,7 +1847,7 @@ bool CXMeshFileLoader::parseDataObjectAnimationSet(SContext& _ctx, orientationFu
else
if (objectName == "Animation")
{
- if (!parseDataObjectAnimation(_ctx, performActionBasedOnOrientationSystem))
+ if (!parseDataObjectAnimation(_ctx, _params))
return false;
}
else
@@ -1866,7 +1861,7 @@ bool CXMeshFileLoader::parseDataObjectAnimationSet(SContext& _ctx, orientationFu
}
-bool CXMeshFileLoader::parseDataObjectAnimation(SContext& _ctx, std::function<void(std::function<void()>, std::function<void()>)> performActionBasedOnOrientationSystem)
+bool CXMeshFileLoader::parseDataObjectAnimation(SContext& _ctx, const asset::IAssetLoader::SAssetLoadParams& _params)
{
#ifdef _XREADER_DEBUG
os::Printer::log("CXFileReader: reading animation", ELL_DEBUG);
@@ -1903,7 +1898,7 @@ bool CXMeshFileLoader::parseDataObjectAnimation(SContext& _ctx, std::function<vo
else
if (objectName == "AnimationKey")
{
- if (!parseDataObjectAnimationKey(_ctx, &animationDump, performActionBasedOnOrientationSystem))
+ if (!parseDataObjectAnimationKey(_ctx, &animationDump, _params))
return false;
}
else
@@ -1985,7 +1980,7 @@ bool CXMeshFileLoader::parseDataObjectAnimation(SContext& _ctx, std::function<vo
}
-bool CXMeshFileLoader::parseDataObjectAnimationKey(SContext& _ctx, asset::ICPUSkinnedMesh::SJoint *joint, std::function<void(std::function<void()>, std::function<void()>)> performActionBasedOnOrientationSystem)
+bool CXMeshFileLoader::parseDataObjectAnimationKey(SContext& _ctx, asset::ICPUSkinnedMesh::SJoint *joint, const asset::IAssetLoader::SAssetLoadParams& _params)
{
#ifdef _XREADER_DEBUG
os::Printer::log("CXFileReader: reading animation key", ELL_DEBUG);
@@ -2107,7 +2102,7 @@ bool CXMeshFileLoader::parseDataObjectAnimationKey(SContext& _ctx, asset::ICPUSk
// read matrix
core::matrix4x3 mat4x3;
- readMatrix(_ctx, mat4x3, performActionBasedOnOrientationSystem);
+ readMatrix(_ctx, mat4x3, _params);
//mat=joint->LocalMatrix*mat;
if (!checkForOneFollowingSemicolons(_ctx))
@@ -2628,23 +2623,12 @@ bool CXMeshFileLoader::readRGBA(SContext& _ctx, video::SColor& color)
// read matrix from list of floats
-bool CXMeshFileLoader::readMatrix(SContext& _ctx, core::matrix4x3& mat, std::function<void(std::function<void()>, std::function<void()>)> performActionBasedOnOrientationSystem)
+bool CXMeshFileLoader::readMatrix(SContext& _ctx, core::matrix4x3& mat, const asset::IAssetLoader::SAssetLoadParams& _params)
{
for (uint32_t j=0u; j<4u; j++)
{
for (uint32_t i = 0u; i < 3u; i++)
- performActionBasedOnOrientationSystem
- (
- [&]()
- {
- constexpr uint32_t xPosID = 0;
- mat(i, j) = (i == xPosID ? readFloat(_ctx) : -readFloat(_ctx));
- },
- [&]()
- {
mat(i, j) = readFloat(_ctx);
- }
- );
readFloat(_ctx);
}
return checkForOneFollowingSemicolons(_ctx);

MODIFY
src/irr/asset/CXMeshFileLoader.h
src/irr/asset/CXMeshFileLoader.h
@@ -163,29 +163,27 @@ private:
asset::IAssetLoader::IAssetLoaderOverride* loaderOverride;
};
- using orientationFunction = std::function<void(std::function<void()>, std::function<void()>)>;
-
- bool load(SContext& _ctx, io::IReadFile* file, orientationFunction performActionBasedOnOrientationSystem);
+ bool load(SContext& _ctx, io::IReadFile* file, const asset::IAssetLoader::SAssetLoadParams& _params);
bool readFileIntoMemory(SContext& _ctx, io::IReadFile* file);
- bool parseFile(SContext& _ctx, orientationFunction performActionBasedOnOrientationSystem);
+ bool parseFile(SContext& _ctx, const asset::IAssetLoader::SAssetLoadParams& _params);
- bool parseDataObject(SContext& _ctx, orientationFunction performActionBasedOnOrientationSystem);
+ bool parseDataObject(SContext& _ctx, const asset::IAssetLoader::SAssetLoadParams& _params);
bool parseDataObjectTemplate(SContext& _ctx);
- bool parseDataObjectFrame(SContext& _ctx, asset::ICPUSkinnedMesh::SJoint *parent, orientationFunction performActionBasedOnOrientationSystem);
+ bool parseDataObjectFrame(SContext& _ctx, asset::ICPUSkinnedMesh::SJoint *parent, const asset::IAssetLoader::SAssetLoadParams& _params);
- bool parseDataObjectTransformationMatrix(SContext& _ctx, core::matrix4x3 &mat, orientationFunction performActionBasedOnOrientationSystem);
+ bool parseDataObjectTransformationMatrix(SContext& _ctx, core::matrix4x3 &mat, const asset::IAssetLoader::SAssetLoadParams& _params);
- bool parseDataObjectMesh(SContext& _ctx, SXMesh &mesh, orientationFunction performActionBasedOnOrientationSystem);
+ bool parseDataObjectMesh(SContext& _ctx, SXMesh &mesh, const asset::IAssetLoader::SAssetLoadParams& _params);
- bool parseDataObjectSkinWeights(SContext& _ctx, SXMesh &mesh, orientationFunction performActionBasedOnOrientationSystem);
+ bool parseDataObjectSkinWeights(SContext& _ctx, SXMesh &mesh, const asset::IAssetLoader::SAssetLoadParams& _params);
bool parseDataObjectSkinMeshHeader(SContext& _ctx, SXMesh &mesh);
- bool parseDataObjectMeshNormals(SContext& _ctx, SXMesh &mesh, orientationFunction performActionBasedOnOrientationSystem);
+ bool parseDataObjectMeshNormals(SContext& _ctx, SXMesh &mesh, const asset::IAssetLoader::SAssetLoadParams& _params);
bool parseDataObjectMeshTextureCoords(SContext& _ctx, SXMesh &mesh);
@@ -195,11 +193,11 @@ private:
bool parseDataObjectMaterial(SContext& _ctx, video::SCPUMaterial& material);
- bool parseDataObjectAnimationSet(SContext& _ctx, orientationFunction performActionBasedOnOrientationSystem);
+ bool parseDataObjectAnimationSet(SContext& _ctx, const asset::IAssetLoader::SAssetLoadParams& _params);
- bool parseDataObjectAnimation(SContext& _ctx, orientationFunction performActionBasedOnOrientationSystem);
+ bool parseDataObjectAnimation(SContext& _ctx, const asset::IAssetLoader::SAssetLoadParams& _params);
- bool parseDataObjectAnimationKey(SContext& _ctx, asset::ICPUSkinnedMesh::SJoint *joint, orientationFunction performActionBasedOnOrientationSystem);
+ bool parseDataObjectAnimationKey(SContext& _ctx, asset::ICPUSkinnedMesh::SJoint *joint, const asset::IAssetLoader::SAssetLoadParams& _params);
bool parseDataObjectTextureFilename(SContext& _ctx, std::string& texturename);
@@ -238,12 +236,18 @@ private:
float readFloat(SContext& _ctx);
bool readVector2(SContext& _ctx, core::vector2df& vec);
bool readVector3(SContext& _ctx, core::vector3df& vec);
- bool readMatrix(SContext& _ctx, core::matrix4x3& mat, orientationFunction performActionBasedOnOrientationSystem);
+ bool readMatrix(SContext& _ctx, core::matrix4x3& mat, const asset::IAssetLoader::SAssetLoadParams& _params);
bool readRGB(SContext& _ctx, video::SColor& color);
bool readRGBA(SContext& _ctx, video::SColor& color);
IAssetManager* AssetManager;
io::IFileSystem* FileSystem;
+
+ template<typename aType>
+ static inline void performActionBasedOnOrientationSystem(aType& varToHandle, void (*performOnCertainOrientation)(aType& varToHandle))
+ {
+ performOnCertainOrientation(varToHandle);
+ }
};
} // end namespace asset

Remove std::function, fix CXLoader bug

Matricies in CXLoader shouldn't be flipped