SpiecsEngine
 
Loading...
Searching...
No Matches

◆ CreateMeshEntity() [1/2]

void Spices::WorldFunctions::CreateMeshEntity ( World * world,
const std::string & name,
const std::shared_ptr< Mesh > & mesh,
std::function< void(Entity &)> onAdded = nullptr )
staticprivate

Create Entity with MeshComponent. Lightweight for game thread.

Parameters
[in]worldWhich world entity belongs to.
[in]nameEntity name.
[in]meshEntity MeshComponent Mesh.
[in]onAddedfunction executed after Entity has been added to world.

Mark World with MeshAddedToWorld bits.

Mark World with MeshAddedToWorld bits.

Definition at line 30 of file WorldFunctions.cpp.

36 {
38
39 SPICES_PROFILE_ZONEN("CreateMeshEntity");
40
41 Entity entity = world->CreateEntity(name);
42 auto& meshComp = entity.AddComponent<MeshComponent>();
43
44 meshComp.SetMesh(mesh);
45
46 if(onAdded) onAdded(entity);
47
52 });
53 }
#define SPICES_PROFILE_ZONEN(...)
@ MeshAddedToWorld
Definition World.h:47
void AsyncMainTask(ThreadPoolEnum pool, Func &&func, Args &&...args)