Voltray Engine Docs
Loading...
Searching...
No Matches
IFormatLoader.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <vector>
5#include <memory>
6#include "../Graphics/Mesh.h"
7
9{
14 struct MeshData
15 {
16 std::vector<float> vertices; // Position(3) + Normal(3) + TexCoord(2) per vertex
17 std::vector<unsigned int> indices;
18 std::string name;
19 std::string materialName; // Optional material reference
20 };
21
27 {
28 public:
29 virtual ~IFormatLoader() = default;
30
36 virtual bool CanLoad(const std::string &extension) const = 0;
37
43 virtual std::vector<MeshData> LoadMeshData(const std::string &filepath) = 0;
44
49 virtual std::string GetLoaderName() const = 0;
50 };
56 {
57 public:
58 bool CanLoad(const std::string &extension) const override;
59 std::vector<MeshData> LoadMeshData(const std::string &filepath) override;
60 std::string GetLoaderName() const override { return "Assimp Loader"; }
61
62 private:
69 MeshData ProcessMesh(void *mesh, void *scene);
70 };
71}
Loader using Assimp library for multiple formats Supports: FBX, GLTF, GLB, 3DS, DAE,...
Definition IFormatLoader.h:56
bool CanLoad(const std::string &extension) const override
Check if this loader can handle the given file extension.
Definition AssimpLoader.cpp:16
std::vector< MeshData > LoadMeshData(const std::string &filepath) override
Load mesh data from file.
Definition AssimpLoader.cpp:84
std::string GetLoaderName() const override
Get the name of this loader.
Definition IFormatLoader.h:60
Abstract base class for different mesh format loaders.
Definition IFormatLoader.h:27
virtual std::vector< MeshData > LoadMeshData(const std::string &filepath)=0
Load mesh data from file.
virtual std::string GetLoaderName() const =0
Get the name of this loader.
virtual bool CanLoad(const std::string &extension) const =0
Check if this loader can handle the given file extension.
virtual ~IFormatLoader()=default
Definition IFormatLoader.h:9
Raw mesh data loaded from files.
Definition IFormatLoader.h:15
std::string materialName
Definition IFormatLoader.h:19
std::vector< unsigned int > indices
Definition IFormatLoader.h:17
std::vector< float > vertices
Definition IFormatLoader.h:16
std::string name
Definition IFormatLoader.h:18