Grindstone Game Engine v0.2.0
An open source game engine and toolkit.
Loading...
Searching...
No Matches
Mesh3dImporter.hpp
1#pragma once
2
3#include <string>
4#include <vector>
5#include <map>
6
7#include <Common/Formats/Model.hpp>
8#include <Common/Graphics/VertexBuffer.hpp>
9#include <EngineCore/Assets/AssetImporter.hpp>
10#include "Mesh3dAsset.hpp"
11
12namespace Grindstone {
13 namespace GraphicsAPI {
14 class IndexBuffer;
15 }
16
17 class EngineCore;
18
19 class Mesh3dImporter : public SpecificAssetImporter<Mesh3dAsset, AssetType::Mesh3d> {
20 public:
21 Mesh3dImporter(EngineCore* engineCore);
22 virtual ~Mesh3dImporter() override;
23
24 virtual void* ProcessLoadedFile(Uuid uuid) override;
25 virtual void QueueReloadAsset(Uuid uuid) override;
26 void PrepareLayouts();
27 virtual void DecrementMeshCount(ECS::Entity entity, Uuid uuid);
28 private:
29 uint64_t GetTotalFileSize(Formats::Model::V1::Header& header);
30 bool ImportModelFile(Mesh3dAsset& mesh);
31 void LoadMeshImportSubmeshes(
32 Mesh3dAsset& mesh,
34 char*& sourcePtr
35 );
36 void LoadMeshImportVertices(
37 Mesh3dAsset& mesh,
39 char*& sourcePtr,
40 std::vector<GraphicsAPI::VertexBuffer*>& vertexBuffers
41 );
42 void LoadMeshImportIndices(
43 Mesh3dAsset& mesh,
45 char*& sourcePtr,
46 GraphicsAPI::IndexBuffer*& indexBuffer
47 );
48 public:
49 EngineCore* engineCore;
50 private:
51 struct VertexLayouts {
57 };
58
59 static VertexLayouts vertexLayouts;
60
61 enum class Mesh3dLayoutIndex {
62 Position = 0,
63 Normal,
64 Tangent,
65 Uv0,
66 Uv1
67 };
68 };
69}
Definition Entity.hpp:14
Definition EngineCore.hpp:57
Definition IndexBuffer.hpp:11
Definition Mesh3dImporter.hpp:19
Definition AssetImporter.hpp:29
Definition Uuid.hpp:6
Definition VertexBuffer.hpp:104
Definition Mesh3dAsset.hpp:22