Guarded assimp-related code
This commit is contained in:
@@ -16,10 +16,13 @@
|
|||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
|
|
||||||
|
#if __has_include("assimp/Exporter.hpp")
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
#include <assimp/Exporter.hpp>
|
#include <assimp/Exporter.hpp>
|
||||||
#include <assimp/mesh.h>
|
#include <assimp/mesh.h>
|
||||||
#include <assimp/material.h>
|
#include <assimp/material.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace OpenVulkano::Scene
|
namespace OpenVulkano::Scene
|
||||||
{
|
{
|
||||||
@@ -89,6 +92,7 @@ namespace OpenVulkano::Scene
|
|||||||
|
|
||||||
void MeshWriter::WriteAsFBX(Geometry* geometry, const std::string& texturePath, const std::string& fbxPath)
|
void MeshWriter::WriteAsFBX(Geometry* geometry, const std::string& texturePath, const std::string& fbxPath)
|
||||||
{
|
{
|
||||||
|
#if __has_include("assimp/Exporter.hpp")
|
||||||
aiNode rootNode;
|
aiNode rootNode;
|
||||||
|
|
||||||
aiScene scene;
|
aiScene scene;
|
||||||
@@ -177,5 +181,8 @@ namespace OpenVulkano::Scene
|
|||||||
{
|
{
|
||||||
throw std::runtime_error("Unable to write a fbx file to " + fbxPath + ": " + exporter.GetErrorString());
|
throw std::runtime_error("Unable to write a fbx file to " + fbxPath + ": " + exporter.GetErrorString());
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
throw std::runtime_error("Unable to convert the scene to FBX: Assimp is not available!");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user