Moved InitFromFile() from Geometry to MeshLoader, added MeshLoader function for USD files, added tinyusdz library

This commit is contained in:
Vladyslav Baranovskyi
2024-08-29 21:01:42 +03:00
parent f70adcbd7f
commit 380e0f323d
7 changed files with 215 additions and 85 deletions

View File

@@ -9,14 +9,11 @@
#include "Base/ICloseable.hpp"
#include "Math/AABB.hpp"
#include "Base/Utils.hpp"
#include "Vertex.hpp"
#include <string>
class aiMesh;
namespace OpenVulkano
{
struct Vertex;
namespace Scene
{
enum class VertexIndexType
@@ -26,6 +23,7 @@ namespace OpenVulkano
class Geometry : public ICloseable
{
friend class MeshLoader;
public:
uint32_t vertexCount = 0, indexCount = 0;
Vertex* vertices = nullptr;
@@ -42,15 +40,6 @@ namespace OpenVulkano
Geometry& operator=(Geometry&& other) noexcept;
~Geometry();
static Geometry* LoadFromFile(const std::string& file)
{
Geometry* mesh = new Geometry();
mesh->InitFromFile(file);
return mesh;
}
void InitFromFile(const std::string& file);
/**
* \brief Creates the arrays for the vertices and indices. They will not be filled!
* \param vertexCount The amount of vertices that will be used
@@ -58,8 +47,6 @@ namespace OpenVulkano
*/
void Init(uint32_t vertexCount, uint32_t indexCount);
void Init(aiMesh* mesh);
void SetIndices(const uint32_t* data, uint32_t size, uint32_t dstOffset = 0) const;
void Close() override;