mirror of
https://github.com/minetest/irrlicht.git
synced 2025-02-11 00:50:23 +01:00
Add GLTF mesh file loader
This commit is contained in:
parent
520569c1e3
commit
4860523223
@ -53,6 +53,9 @@ namespace scene
|
||||
//! Halflife MDL model file
|
||||
EAMT_MDL_HALFLIFE,
|
||||
|
||||
//! Graphics Language Transmission Format 2.0 (.gltf) mesh
|
||||
EAMT_GLTF2,
|
||||
|
||||
//! generic skinned mesh
|
||||
EAMT_SKINNED,
|
||||
|
||||
|
@ -349,6 +349,12 @@ B3D, MS3D or X meshes */
|
||||
#undef _IRR_COMPILE_WITH_OBJ_LOADER_
|
||||
#endif
|
||||
|
||||
//! Define _IRR_COMPILE_WITH_GLTF_LOADER_ if you want to load glTF files
|
||||
#define _IRR_COMPILE_WITH_GLTF_LOADER_
|
||||
#ifdef NO_IRR_COMPILE_WITH_GLTF_LOADER_
|
||||
#undef _IRR_COMPILE_WITH_GLTF_LOADER_
|
||||
#endif
|
||||
|
||||
//! Define _IRR_COMPILE_WITH_BMP_LOADER_ if you want to load .bmp files
|
||||
//! Disabling this loader will also disable the built-in font
|
||||
#define _IRR_COMPILE_WITH_BMP_LOADER_
|
||||
|
31
source/Irrlicht/CGLTFMeshFileLoader.cpp
Normal file
31
source/Irrlicht/CGLTFMeshFileLoader.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
#include "CGLTFMeshFileLoader.h"
|
||||
#include "coreutil.h"
|
||||
#include "IAnimatedMesh.h"
|
||||
#include "IReadFile.h"
|
||||
#include "path.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
||||
namespace scene
|
||||
{
|
||||
|
||||
CGLTFMeshFileLoader::CGLTFMeshFileLoader()
|
||||
{
|
||||
}
|
||||
|
||||
bool CGLTFMeshFileLoader::isALoadableFileExtension(
|
||||
const io::path& filename) const
|
||||
{
|
||||
return core::hasFileExtension(filename, "gltf");
|
||||
}
|
||||
|
||||
IAnimatedMesh* CGLTFMeshFileLoader::createMesh(io::IReadFile* file)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace irr
|
||||
|
||||
} // namespace scene
|
||||
|
31
source/Irrlicht/CGLTFMeshFileLoader.h
Normal file
31
source/Irrlicht/CGLTFMeshFileLoader.h
Normal file
@ -0,0 +1,31 @@
|
||||
#ifndef __C_GLTF_MESH_FILE_LOADER_INCLUDED__
|
||||
#define __C_GLTF_MESH_FILE_LOADER_INCLUDED__
|
||||
|
||||
#include "IAnimatedMesh.h"
|
||||
#include "IMeshLoader.h"
|
||||
#include "IReadFile.h"
|
||||
#include "path.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
||||
namespace scene
|
||||
{
|
||||
|
||||
class CGLTFMeshFileLoader : public IMeshLoader
|
||||
{
|
||||
public:
|
||||
CGLTFMeshFileLoader();
|
||||
|
||||
bool isALoadableFileExtension(const io::path& filename) const override;
|
||||
|
||||
IAnimatedMesh* createMesh(io::IReadFile* file) override;
|
||||
|
||||
};
|
||||
|
||||
} // namespace scene
|
||||
|
||||
} // namespace irr
|
||||
|
||||
#endif // __C_GLTF_MESH_FILE_LOADER_INCLUDED__
|
||||
|
@ -161,6 +161,7 @@ set(IRRMESHLOADER
|
||||
CB3DMeshFileLoader.cpp
|
||||
COBJMeshFileLoader.cpp
|
||||
CXMeshFileLoader.cpp
|
||||
CGLTFMeshFileLoader.cpp
|
||||
)
|
||||
|
||||
add_library(IRRMESHOBJ OBJECT
|
||||
|
@ -33,6 +33,10 @@
|
||||
#include "CB3DMeshFileLoader.h"
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_GLTF_LOADER_
|
||||
#include "CGLTFMeshFileLoader.h"
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_BILLBOARD_SCENENODE_
|
||||
#include "CBillboardSceneNode.h"
|
||||
#endif // _IRR_COMPILE_WITH_BILLBOARD_SCENENODE_
|
||||
@ -105,6 +109,9 @@ CSceneManager::CSceneManager(video::IVideoDriver* driver, io::IFileSystem* fs,
|
||||
#ifdef _IRR_COMPILE_WITH_B3D_LOADER_
|
||||
MeshLoaderList.push_back(new CB3DMeshFileLoader(this));
|
||||
#endif
|
||||
#ifdef _IRR_COMPILE_WITH_GLTF_LOADER_
|
||||
MeshLoaderList.push_back(new CGLTFMeshFileLoader());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user