2#include <World/Entity.h>
3#include <Resources/Loader/MaterialLoader.h>
4#include <GamePlay/MeshController.h>
5#include <Resources/ResourcePool/ResourcePool.h>
6#include <Systems/ResourceSystem.h>
7#include <Extensions/Gltf/GltfCollection.h>
15 ResourceSystem::RegistryResourceFolder(SPICES_GAME_ASSETS_PATH);
22
23
24
25
26
27
28
29
30
35 WorldFunctions::CreateMeshEntity(
this,
"DefaultMesh", []() {
37 std::shared_ptr<FilePack> pack1 = std::make_shared<FilePack>(
"interior_stair_wl3ieamdw_01");
38 std::shared_ptr<FilePack> pack2 = std::make_shared<FilePack>(
"interior_stair_wl3ieamdw_02");
39 std::shared_ptr<FilePack> pack3 = std::make_shared<FilePack>(
"interior_stair_wl3ieamdw_03");
40 std::shared_ptr<FilePack> pack4 = std::make_shared<FilePack>(
"interior_stair_wl3ieamdw_04");
41 std::shared_ptr<FilePack> pack5 = std::make_shared<FilePack>(
"interior_stair_wl3ieamdw_05");
43 pack1->SetMaterial(
"BasePassRenderer.Mesh.interior_stair_wl3ieamdw");
44 pack2->SetMaterial(
"BasePassRenderer.Mesh.interior_stair_wl3ieamdw");
45 pack3->SetMaterial(
"BasePassRenderer.Mesh.interior_stair_wl3ieamdw");
46 pack4->SetMaterial(
"BasePassRenderer.Mesh.interior_stair_wl3ieamdw");
47 pack5->SetMaterial(
"BasePassRenderer.Mesh.interior_stair_wl3ieamdw");
49 return Mesh::Builder().AddPack(pack1).AddPack(pack2).AddPack(pack3).AddPack(pack4).AddPack(pack5).Build();
53 auto& transform = e.GetComponent<TransformComponent>();
54 transform.SetPosition({ 10.0f, 2.0f, 30.0f });
55 transform.SetRotation({ -180.0f, 0.0f, -180.0f });
62 for(
int i = 0; i < 3; i++)
65 ss <<
"CornellBox_" << i;
67 WorldFunctions::CreateMeshEntity(
this, ss.str(), [=]() {
69 std::shared_ptr<FilePack> pack = std::make_shared<FilePack>(
"Test_room");
71 std::stringstream mss;
72 mss <<
"BasePassRenderer.Mesh.CornellBox" << i;
73 pack->SetMaterial(mss.str());
74 return Mesh::Builder().AddPack(pack).Build();
78 auto& transform = e.GetComponent<TransformComponent>();
79 transform.SetPosition({ -7.0f, 5.0f, 5.0f + i * 10.0f });
80 transform.SetRotation({ 0.0f, -90.0f, 0.0f });
88 for(
int i = 0; i < 4; i++)
90 for(
int j = 0; j < 10; j++)
93 ss <<
"Sphere_" << 10 * i + j;
95 WorldFunctions::CreateMeshEntity(
this, ss.str(), [=]() {
97 std::shared_ptr<SpherePack> pack = std::make_shared<SpherePack>(100, 100);
99 std::stringstream mss;
100 mss <<
"BasePassRenderer.Mesh." << 10 * i + j;
102 pack->SetMaterial(mss.str());
103 return Mesh::Builder().AddPack(pack).Build();
107 auto& transform = e.GetComponent<TransformComponent>();
108 transform.SetPosition({ 3.0f * i, 0.0f, 3.0f * j });
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
148 WorldFunctions::CreateMeshEntity(
this,
"Ground", []() {
150 std::shared_ptr<PlanePack> pack = std::make_shared<PlanePack>(1000, 1000);
152 pack->SetMaterial(
"BasePassRenderer.Mesh.ground");
153 return Mesh::Builder().AddPack(pack).Build();
157 auto& transform = e.GetComponent<TransformComponent>();
158 transform.SetPosition({ 0.0f, -1.1f, 15.0f });
159 transform.SetRotation({ 90.0f, 0.0f, 0.0f });
160 transform.SetScale({ 500.0f, 500.0f, 500.0f });
168 plightComp.SetColor(glm::vec3(1.0f, 1.0f, 0.0f));
171 sprite
.SetMaterial(
"SpriteRenderer.Sprite.S_LightPoint");
173 transformComp.SetPosition({ -7.0f, 7.0f, 5.0f });
178 plightComp.SetColor(glm::vec3(1.0f, 0.0f, 1.0f));
181 sprite
.SetMaterial(
"SpriteRenderer.Sprite.S_LightPoint");
183 transformComp.SetPosition({ -7.0f, 5.0f, 15.0f });
188 plightComp.SetColor(glm::vec3(1.0f, 1.0f, 1.0f));
191 sprite
.SetMaterial(
"SpriteRenderer.Sprite.S_LightPoint");
193 transformComp.SetPosition({ -7.0f, 5.0f, 25.0f });
197
198
199
#define SPICES_PROFILE_ZONE
virtual void OnPreActivate() override
This interface define the specific world behave before on activated.
virtual void OnDeactivate() override
This interface defines the specific world behave after on activated.
virtual void OnActivate(TimeStep &ts) override
This interface define the specific world behave on activated.
EditorWorld Class. This class defines the specific behave of EditorWorld.
Entity Class. This class defines the specific behaves of Entity.
virtual void OnActivate(TimeStep &ts) override
This interface define the specific world behave on activated.
virtual void OnDeactivate() override
This interface defines the specific world behave after on activated.
virtual void OnPreActivate() override
This interface define the specific world behave before on activated.
void SetIntensity(float intensity)
Set PointLight Intensity.
PointLightComponent Class. This class defines the specific behaves of PointLightComponent.
void SetMaterial(const std::string &materialPath)
Set Sprite Material.
SpriteComponent Class. This class defines the specific behaves of SpriteComponent.
This Class handles our engine time step during frames. Global Unique.
Entity CreateEntity(const std::string &name="None")
Create a new empty entity in this world.