SpiecsEngine
 
Loading...
Searching...
No Matches

◆ CreateEntity()

void Spices::GltfCollection::CreateEntity ( World * world,
const std::string & tag,
Transform transform = {} )

Create Entity instance from gltf file.

Parameters
[in]worldWorld Pointer.
[in]tagEntity name.
[in]transformGLTF Instance transform

Calaulate model matrix.

InfoBar output.

Calaulate model matrix.

InfoBar output.

Definition at line 27 of file GltfCollection.cpp.

28 {
30
31 const std::shared_ptr<LoadingState> loadingState = std::make_shared<LoadingState>();
32
36 for (auto& item : m_Scenes->m_ScenesData)
37 {
38 for (const auto& node : item.nodes)
39 {
40 CreateEntityRecursive(world, tag, node, transform.ToMatrix(), loadingState);
41 }
42 }
43
47 std::stringstream ss;
48 ss << "GLTF: " << tag << " is on Loading...";
49
50 auto self = shared_from_this();
51 SlateInfoBar::Create<float>(ss.str(), [=]() -> float {
52 return static_cast<float>(loadingState->loadedMeshes.load()) / static_cast<float>(self->m_Meshes->GetNMeshes());
53 }, [=](SlateInfoBar* that) {
54 return std::any_cast<float>(that->GetRate()) >= 1.0f;
55 });
56
58 }
#define SPICES_PROFILE_ZONE
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.
std::unique_ptr< GltfScenes > m_Scenes
@ MeshAddedToWorld
Definition World.h:47

References Spices::World::Mark(), and Spices::World::MeshAddedToWorld.