Utility/Mesh: Add Build static method
This commit is contained in:
parent
e073e1a44d
commit
de6be67ea6
|
|
@ -57,6 +57,7 @@ namespace Nz
|
|||
class Mesh;
|
||||
struct Primitive;
|
||||
class PrimitiveList;
|
||||
class StaticMesh;
|
||||
class SubMesh;
|
||||
|
||||
using MeshVertex = VertexStruct_XYZ_Normal_UV_Tangent;
|
||||
|
|
@ -132,6 +133,8 @@ namespace Nz
|
|||
Mesh& operator=(const Mesh&) = delete;
|
||||
Mesh& operator=(Mesh&&) = delete;
|
||||
|
||||
static inline std::shared_ptr<Mesh> Build(std::shared_ptr<StaticMesh> staticMesh);
|
||||
|
||||
static std::shared_ptr<Mesh> LoadFromFile(const std::filesystem::path& filePath, const MeshParams& params = MeshParams());
|
||||
static std::shared_ptr<Mesh> LoadFromMemory(const void* data, std::size_t size, const MeshParams& params = MeshParams());
|
||||
static std::shared_ptr<Mesh> LoadFromStream(Stream& stream, const MeshParams& params = MeshParams());
|
||||
|
|
|
|||
|
|
@ -4,16 +4,26 @@
|
|||
|
||||
#include <Nazara/Utility/Mesh.hpp>
|
||||
#include <memory>
|
||||
#include <Nazara/Utility/StaticMesh.hpp>
|
||||
#include <Nazara/Utility/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
Mesh::Mesh() :
|
||||
inline Mesh::Mesh() :
|
||||
m_materialData(1),
|
||||
m_aabbUpdated(false),
|
||||
m_isValid(false)
|
||||
{
|
||||
}
|
||||
|
||||
inline std::shared_ptr<Mesh> Mesh::Build(std::shared_ptr<StaticMesh> staticMesh)
|
||||
{
|
||||
std::shared_ptr<Mesh> mesh = std::make_shared<Mesh>();
|
||||
mesh->CreateStatic();
|
||||
mesh->AddSubMesh(std::move(staticMesh));
|
||||
|
||||
return mesh;
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Utility/DebugOff.hpp>
|
||||
|
|
|
|||
Loading…
Reference in New Issue