SpiecsEngine
 
Loading...
Searching...
No Matches
GltfPack.h
Go to the documentation of this file.
1/**
2* @file GltfPack.h
3* @brief The GltfPack Class Definitions.
4* @author Spices.
5*/
6
7#pragma once
8#include "Core/Core.h"
9#include "Resources/Mesh/MeshPack.h"
10#include "../Object/GltfMeshes.h"
11
12namespace Spices {
13
14 /**
15 * @brief GltfPack Class.
16 * This class defines gltf type meshPack.
17 */
18 class GltfPack : public MeshPack
19 {
20 public:
21
22 /**
23 * @brief Constructor Function.
24 * @param[in] name pack name.
25 * @param[in] f function pointer of createPack.
26 * @param[in] instanced true if instance from resourcePool.
27 */
28 GltfPack(const std::string& name, const std::function<void(GltfPack*)>& f, bool instanced = true)
29 : MeshPack(name, instanced)
30 , m_Func(f)
31 {
32 m_PackType = "GltfPack";
33 }
34
35 /**
36 * @brief Destructor Function.
37 */
38 virtual ~GltfPack() override = default;
39
40 /**
41 * @brief This interface is used for build specific meshPack data.
42 * @param[in] isCreateBuffer Whether it needs to create buffer.
43 * @return Returns true if Create Pack successfully.
44 */
45 virtual bool OnCreatePack(bool isCreateBuffer = true) override;
46
47 private:
48
49 /**
50 * @brief function pointer of createPack.
51 */
52 std::function<void(GltfPack*)> m_Func;
53
54 /**
55 * @brief Allow GltfLoader access all data this class.
56 */
57 friend class GltfLoader;
58 };
59}
#define SPICES_PROFILE_ZONE
EntityComponent Class. This class defines the specific behaves of EntityComponent.
Entity Class. This class defines the specific behaves of Entity.
Definition Entity.h:20
Wrapper of Gltf Json Accessors.
Wrapper of Gltf Json BufferViews.
Wrapper of Gltf Json Buffers.
Definition GltfBuffers.h:17
Entity CreateEntityRecursive(World *world, const std::string &tag, uint32_t node, const glm::mat4 &model, std::shared_ptr< LoadingState > loadingState)
Create Entity recursive from gltf file nodes.
GltfCollection(const std::string &path)
Constructor Function.
void CreateEntity(World *world, const std::string &tag, Transform transform={})
Create Entity instance from gltf file.
Wrapper of Gltf file data.
Wrapper of Gltf Json Images.
Definition GltfImages.h:21
static bool Load(const std::string &fileName, GltfCollection *collection)
Load a gltf file to GltfCollection.
static bool LoadPack(GltfPack *pack, const GltfMeshes::Primitive &primitive, GltfAccessors *accessors, GltfBuffers *buffers, GltfBufferViews *bufferViews)
Load a gltf mesh to GltfPack.
static std::shared_ptr< Material > LoadMaterial(const GltfMaterials::Item &material, GltfImages *images)
Load a Material from Gltf file material component.
Loader of load gltf file or items.
Definition GltfLoader.h:23
Wrapper of Gltf Json Materials.
Wrapper of Gltf Json Meshes.
Definition GltfMeshes.h:17
Wrapper of Gltf Json Nodes.
Definition GltfNodes.h:19
std::function< void(GltfPack *) m_Func)
function pointer of createPack.
Definition GltfPack.h:52
GltfPack(const std::string &name, const std::function< void(GltfPack *)> &f, bool instanced=true)
Constructor Function.
Definition GltfPack.h:28
virtual ~GltfPack() override=default
Destructor Function.
virtual bool OnCreatePack(bool isCreateBuffer=true) override
This interface is used for build specific meshPack data.
Definition GltfPack.cpp:13
GltfPack Class. This class defines gltf type meshPack.
Definition GltfPack.h:19
Material Class. This class contains a branch of parameter and shader, also descriptor.
Definition Material.h:62
MeshComponent Class. This class defines the specific behaves of MeshComponent.
MeshPack(const std::string &name, bool instanced)
Constructor Function.
Definition MeshPack.cpp:78
std::string m_PackType
specific mesh pack type.
Definition MeshPack.h:363
MeshPack Class. This class defines some basic behaves and variables. This class need to be inherited ...
Definition MeshPack.h:156
Builder Class. This class helps to create a mesh.
Definition Mesh.h:29
MeshRenderer Class. This class is a wrapper of mashpack.
Definition Mesh.h:21
TransformComponent Class. This class defines the specific behaves of TransformComponent.
void Mark(WorldMarkFlags flags)
Mark WorldMarkFlags with flags.
Definition World.h:125
Entity CreateEntity(const std::string &name="None")
Create a new empty entity in this world.
Definition World.cpp:13
@ MeshAddedToWorld
Definition World.h:47
World Class. This class defines the basic behaves of World. When we create an new world,...
Definition World.h:41
Materials Item data.
Primitive Item data.
Definition GltfMeshes.h:24
Nodes Item data.
Definition GltfNodes.h:26
Wrapper of 3D Transform.
Definition Transform.h:16