Worked a bit on prefabs of all things
This commit is contained in:
		
							
								
								
									
										14
									
								
								src/dawn/prefab/Prefab.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								src/dawn/prefab/Prefab.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | |||||||
|  | // Copyright (c) 2024 Dominic Masters | ||||||
|  | //  | ||||||
|  | // This software is released under the MIT License. | ||||||
|  | // https://opensource.org/licenses/MIT | ||||||
|  |  | ||||||
|  | #pragma once | ||||||
|  | #include "scene/Scene.hpp" | ||||||
|  |  | ||||||
|  | namespace Dawn { | ||||||
|  |   struct Prefab { | ||||||
|  |     public: | ||||||
|  |       std::shared_ptr<SceneItem> item; | ||||||
|  |   }; | ||||||
|  | } | ||||||
| @@ -4,32 +4,32 @@ | |||||||
| // https://opensource.org/licenses/MIT | // https://opensource.org/licenses/MIT | ||||||
|  |  | ||||||
| #include "SimpleSpinningCube.hpp" | #include "SimpleSpinningCube.hpp" | ||||||
| #include "component/display/MeshRenderer.hpp" |  | ||||||
| #include "component/display/material/SimpleTexturedMaterial.hpp" |  | ||||||
| #include "display/mesh/CubeMesh.hpp" | #include "display/mesh/CubeMesh.hpp" | ||||||
| #include "component/SimpleComponent.hpp" | #include "component/SimpleComponent.hpp" | ||||||
|  |  | ||||||
| using namespace Dawn; | using namespace Dawn; | ||||||
|  |  | ||||||
| std::shared_ptr<SceneItem> Dawn::createSimpleSpinningCube(Scene &s) { | struct SimpleSpinningCube Dawn::createSimpleSpinningCube(Scene &s) { | ||||||
|  |   struct SimpleSpinningCube cube; | ||||||
|  |  | ||||||
|   // Create the scene item. |   // Create the scene item. | ||||||
|   auto cubeItem = s.createSceneItem(); |   cube.item = s.createSceneItem(); | ||||||
|  |  | ||||||
|   // Create a simple cube mesh. |   // Create a simple cube mesh. | ||||||
|   auto cubeMesh = std::make_shared<Mesh>(); |   cube.mesh = std::make_shared<Mesh>(); | ||||||
|   cubeMesh->createBuffers(CUBE_VERTICE_COUNT, CUBE_INDICE_COUNT); |   cube.mesh->createBuffers(CUBE_VERTICE_COUNT, CUBE_INDICE_COUNT); | ||||||
|   CubeMesh::buffer(cubeMesh, glm::vec3(-1, -1, -1), glm::vec3(2, 2, 2), 0, 0); |   CubeMesh::buffer(cube.mesh, glm::vec3(-1, -1, -1), glm::vec3(2, 2, 2), 0, 0); | ||||||
|  |  | ||||||
|   // Add a renderer to the scene item. |   // Add a renderer to the scene item. | ||||||
|   auto cubeMeshRenderer = cubeItem->addComponent<MeshRenderer>(); |   cube.meshRenderer = cube.item->addComponent<MeshRenderer>(); | ||||||
|   cubeMeshRenderer->mesh = cubeMesh; |   cube.meshRenderer->mesh = cube.mesh; | ||||||
|  |  | ||||||
|   // Add a material to the scene item. |   // Add a material to the scene item. | ||||||
|   auto cubeMaterial = cubeItem->addComponent<SimpleTexturedMaterial>(); |   cube.material = cube.item->addComponent<SimpleTexturedMaterial>(); | ||||||
|   cubeMaterial->setColor(COLOR_MAGENTA); |   cube.material->setColor(COLOR_MAGENTA); | ||||||
|  |  | ||||||
|   // Add a simple event listener component to the scene item. |   // Add a simple event listener component to the scene item. | ||||||
|   addSimpleComponent(cubeItem, [](auto &cmp, auto &events) { |   addSimpleComponent(cube.item, [](auto &cmp, auto &events) { | ||||||
|     // Note that add component cannot receive a self reference, so we must |     // Note that add component cannot receive a self reference, so we must | ||||||
|     // capture the component by reference instead. |     // capture the component by reference instead. | ||||||
|     events.push_back(cmp.getScene()->onUnpausedUpdate.listen([&]( |     events.push_back(cmp.getScene()->onUnpausedUpdate.listen([&]( | ||||||
| @@ -45,5 +45,5 @@ std::shared_ptr<SceneItem> Dawn::createSimpleSpinningCube(Scene &s) { | |||||||
|     })); |     })); | ||||||
|   }); |   }); | ||||||
|  |  | ||||||
|   return cubeItem; |   return cube; | ||||||
| } | } | ||||||
| @@ -4,8 +4,23 @@ | |||||||
| // https://opensource.org/licenses/MIT | // https://opensource.org/licenses/MIT | ||||||
|  |  | ||||||
| #pragma once | #pragma once | ||||||
| #include "scene/Scene.hpp" | #include "prefab/Prefab.hpp" | ||||||
|  | #include "component/display/MeshRenderer.hpp" | ||||||
|  | #include "component/display/material/SimpleTexturedMaterial.hpp" | ||||||
|  |  | ||||||
| namespace Dawn { | namespace Dawn { | ||||||
|   std::shared_ptr<SceneItem> createSimpleSpinningCube(Scene &s); |   struct SimpleSpinningCube : public Prefab { | ||||||
|  |     public: | ||||||
|  |       std::shared_ptr<Mesh> mesh; | ||||||
|  |       std::shared_ptr<MeshRenderer> meshRenderer; | ||||||
|  |       std::shared_ptr<SimpleTexturedMaterial> material; | ||||||
|  |   }; | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |    * Creates a simple spinning cube prefab on the scene. | ||||||
|  |    *  | ||||||
|  |    * @param s Scene to add the simple spinning cube to. | ||||||
|  |    * @return The simple spinning cube prefab. | ||||||
|  |    */ | ||||||
|  |   struct SimpleSpinningCube createSimpleSpinningCube(Scene &s); | ||||||
| } | } | ||||||
| @@ -44,17 +44,23 @@ void SceneComponent::dispose() { | |||||||
| } | } | ||||||
|  |  | ||||||
| std::shared_ptr<SceneItem> SceneComponent::getItem() { | std::shared_ptr<SceneItem> SceneComponent::getItem() { | ||||||
|   return this->item.lock(); |   auto item = this->item.lock(); | ||||||
|  |   assertNotNull(item, "Item cannot be null?"); | ||||||
|  |   return item; | ||||||
| } | } | ||||||
|  |  | ||||||
| std::shared_ptr<Scene> SceneComponent::getScene() { | std::shared_ptr<Scene> SceneComponent::getScene() { | ||||||
|   auto item = this->getItem(); |   auto item = this->getItem(); | ||||||
|   return item->getScene(); |   auto scene = item->getScene(); | ||||||
|  |   assertNotNull(scene, "Scene cannot be null?"); | ||||||
|  |   return scene; | ||||||
| } | } | ||||||
|  |  | ||||||
| std::shared_ptr<Game> SceneComponent::getGame() { | std::shared_ptr<Game> SceneComponent::getGame() { | ||||||
|   auto scene = this->getScene(); |   auto scene = this->getScene(); | ||||||
|   return scene->getGame(); |   auto game = scene->getGame(); | ||||||
|  |   assertNotNull(game, "Game cannot be null?"); | ||||||
|  |   return game; | ||||||
| } | } | ||||||
|  |  | ||||||
| SceneComponent::~SceneComponent() { | SceneComponent::~SceneComponent() { | ||||||
|   | |||||||
| @@ -13,6 +13,7 @@ namespace Dawn { | |||||||
|   class Game; |   class Game; | ||||||
|   class Scene; |   class Scene; | ||||||
|   class SceneItem; |   class SceneItem; | ||||||
|  |   class SceneItemComponents; | ||||||
|  |  | ||||||
|   class SceneComponent : std::enable_shared_from_this<SceneComponent> { |   class SceneComponent : std::enable_shared_from_this<SceneComponent> { | ||||||
|     private: |     private: | ||||||
| @@ -70,5 +71,8 @@ namespace Dawn { | |||||||
|        * Disposes this scene component. |        * Disposes this scene component. | ||||||
|        */ |        */ | ||||||
|       virtual ~SceneComponent(); |       virtual ~SceneComponent(); | ||||||
|  |  | ||||||
|  |       friend class SceneItem; | ||||||
|  |       friend class SceneItemComponents; | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
| @@ -43,6 +43,7 @@ namespace Dawn { | |||||||
|         this->components.push_back( |         this->components.push_back( | ||||||
|           static_pointer_cast<SceneComponent>(component) |           static_pointer_cast<SceneComponent>(component) | ||||||
|         ); |         ); | ||||||
|  |         component->item = this->sceneItemComponentsSelf(); | ||||||
|         return component; |         return component; | ||||||
|       } |       } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,6 +16,8 @@ target_sources(${DAWN_TARGET_NAME} | |||||||
| ) | ) | ||||||
|  |  | ||||||
| # Subdirs | # Subdirs | ||||||
|  | add_subdirectory(component) | ||||||
|  | add_subdirectory(prefab) | ||||||
| add_subdirectory(scenes) | add_subdirectory(scenes) | ||||||
|  |  | ||||||
| # Assets | # Assets | ||||||
|   | |||||||
							
								
								
									
										7
									
								
								src/dawnrpg/component/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								src/dawnrpg/component/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | |||||||
|  | # Copyright (c) 2024 Dominic Masters | ||||||
|  | #  | ||||||
|  | # This software is released under the MIT License. | ||||||
|  | # https://opensource.org/licenses/MIT | ||||||
|  |  | ||||||
|  | add_subdirectory(entity) | ||||||
|  | add_subdirectory(world) | ||||||
							
								
								
									
										9
									
								
								src/dawnrpg/component/entity/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								src/dawnrpg/component/entity/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | |||||||
|  | # Copyright (c) 2024 Dominic Masters | ||||||
|  | #  | ||||||
|  | # This software is released under the MIT License. | ||||||
|  | # https://opensource.org/licenses/MIT | ||||||
|  |  | ||||||
|  | target_sources(${DAWN_TARGET_NAME} | ||||||
|  |   PRIVATE | ||||||
|  |     Entity.cpp | ||||||
|  | ) | ||||||
							
								
								
									
										18
									
								
								src/dawnrpg/component/entity/Entity.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								src/dawnrpg/component/entity/Entity.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | |||||||
|  | // Copyright (c) 2024 Dominic Masters | ||||||
|  | //  | ||||||
|  | // This software is released under the MIT License. | ||||||
|  | // https://opensource.org/licenses/MIT | ||||||
|  |  | ||||||
|  | #include "Entity.hpp" | ||||||
|  | #include "assert/assert.hpp" | ||||||
|  |  | ||||||
|  | using namespace Dawn; | ||||||
|  |  | ||||||
|  | void Entity::onInit() { | ||||||
|  |   auto world = this->world.lock(); | ||||||
|  |   assertNotNull(world, "World is no longer active."); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void Entity::onDispose() { | ||||||
|  |    | ||||||
|  | } | ||||||
							
								
								
									
										21
									
								
								src/dawnrpg/component/entity/Entity.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								src/dawnrpg/component/entity/Entity.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | |||||||
|  | // Copyright (c) 2024 Dominic Masters | ||||||
|  | //  | ||||||
|  | // This software is released under the MIT License. | ||||||
|  | // https://opensource.org/licenses/MIT | ||||||
|  |  | ||||||
|  | #pragma once | ||||||
|  | #include "scene/SceneComponent.hpp" | ||||||
|  |  | ||||||
|  | typedef uint32_t entityid_t; | ||||||
|  |  | ||||||
|  | namespace Dawn { | ||||||
|  |   class World; | ||||||
|  |  | ||||||
|  |   class Entity final : public SceneComponent { | ||||||
|  |     public: | ||||||
|  |       std::weak_ptr<World> world; | ||||||
|  |        | ||||||
|  |       void onInit() override; | ||||||
|  |       void onDispose() override; | ||||||
|  |   }; | ||||||
|  | } | ||||||
							
								
								
									
										9
									
								
								src/dawnrpg/component/world/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								src/dawnrpg/component/world/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | |||||||
|  | # Copyright (c) 2024 Dominic Masters | ||||||
|  | #  | ||||||
|  | # This software is released under the MIT License. | ||||||
|  | # https://opensource.org/licenses/MIT | ||||||
|  |  | ||||||
|  | target_sources(${DAWN_TARGET_NAME} | ||||||
|  |   PRIVATE | ||||||
|  |     World.cpp | ||||||
|  | ) | ||||||
							
								
								
									
										14
									
								
								src/dawnrpg/component/world/World.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								src/dawnrpg/component/world/World.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | |||||||
|  | // Copyright (c) 2024 Dominic Masters | ||||||
|  | //  | ||||||
|  | // This software is released under the MIT License. | ||||||
|  | // https://opensource.org/licenses/MIT | ||||||
|  |  | ||||||
|  | #include "World.hpp" | ||||||
|  |  | ||||||
|  | using namespace Dawn; | ||||||
|  |  | ||||||
|  | void World::onInit() { | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void World::onDispose() { | ||||||
|  | } | ||||||
							
								
								
									
										18
									
								
								src/dawnrpg/component/world/World.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								src/dawnrpg/component/world/World.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | |||||||
|  | // Copyright (c) 2024 Dominic Masters | ||||||
|  | //  | ||||||
|  | // This software is released under the MIT License. | ||||||
|  | // https://opensource.org/licenses/MIT | ||||||
|  |  | ||||||
|  | #pragma once | ||||||
|  | #include "component/entity/Entity.hpp" | ||||||
|  |  | ||||||
|  | namespace Dawn { | ||||||
|  |   class World : public SceneComponent { | ||||||
|  |     private: | ||||||
|  |       std::map<entityid_t, std::shared_ptr<Entity>> entities;  | ||||||
|  |  | ||||||
|  |     public: | ||||||
|  |       void onInit() override; | ||||||
|  |       void onDispose() override; | ||||||
|  |   }; | ||||||
|  | } | ||||||
| @@ -8,5 +8,5 @@ | |||||||
| using namespace Dawn; | using namespace Dawn; | ||||||
|  |  | ||||||
| const std::function<void(Scene&)> Scene::getInitialScene() { | const std::function<void(Scene&)> Scene::getInitialScene() { | ||||||
|   return Dawn::testScene; |   return Dawn::worldScene; | ||||||
| } | } | ||||||
							
								
								
									
										10
									
								
								src/dawnrpg/prefab/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								src/dawnrpg/prefab/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | |||||||
|  | # Copyright (c) 2024 Dominic Masters | ||||||
|  | #  | ||||||
|  | # This software is released under the MIT License. | ||||||
|  | # https://opensource.org/licenses/MIT | ||||||
|  |  | ||||||
|  | target_sources(${DAWN_TARGET_NAME} | ||||||
|  |   PRIVATE | ||||||
|  |     PlayerPrefab.cpp | ||||||
|  |     WorldPrefab.cpp | ||||||
|  | ) | ||||||
							
								
								
									
										20
									
								
								src/dawnrpg/prefab/PlayerPrefab.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								src/dawnrpg/prefab/PlayerPrefab.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | |||||||
|  | // Copyright (c) 2024 Dominic Masters | ||||||
|  | //  | ||||||
|  | // This software is released under the MIT License. | ||||||
|  | // https://opensource.org/licenses/MIT | ||||||
|  |  | ||||||
|  | #include "PlayerPrefab.hpp" | ||||||
|  |  | ||||||
|  | using namespace Dawn; | ||||||
|  |  | ||||||
|  | struct PlayerPrefab Dawn::createPlayerPrefab( | ||||||
|  |   const std::shared_ptr<World> world | ||||||
|  | ) { | ||||||
|  |   struct PlayerPrefab player; | ||||||
|  |   player.item = world->getScene()->createSceneItem(); | ||||||
|  |  | ||||||
|  |   player.entity = player.item->addComponent<Entity>(); | ||||||
|  |   player.entity->world = world; | ||||||
|  |  | ||||||
|  |   return player; | ||||||
|  | } | ||||||
							
								
								
									
										17
									
								
								src/dawnrpg/prefab/PlayerPrefab.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/dawnrpg/prefab/PlayerPrefab.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | |||||||
|  | // Copyright (c) 2024 Dominic Masters | ||||||
|  | //  | ||||||
|  | // This software is released under the MIT License. | ||||||
|  | // https://opensource.org/licenses/MIT | ||||||
|  |  | ||||||
|  | #pragma once | ||||||
|  | #include "prefab/Prefab.hpp" | ||||||
|  | #include "component/world/World.hpp" | ||||||
|  |  | ||||||
|  | namespace Dawn { | ||||||
|  |   struct PlayerPrefab : public Prefab { | ||||||
|  |     public: | ||||||
|  |       std::shared_ptr<Entity> entity; | ||||||
|  |   }; | ||||||
|  |  | ||||||
|  |   struct PlayerPrefab createPlayerPrefab(const std::shared_ptr<World> world); | ||||||
|  | } | ||||||
							
								
								
									
										17
									
								
								src/dawnrpg/prefab/WorldPrefab.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/dawnrpg/prefab/WorldPrefab.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | |||||||
|  | // Copyright (c) 2024 Dominic Masters | ||||||
|  | //  | ||||||
|  | // This software is released under the MIT License. | ||||||
|  | // https://opensource.org/licenses/MIT | ||||||
|  |  | ||||||
|  | #include "WorldPrefab.hpp" | ||||||
|  |  | ||||||
|  | using namespace Dawn; | ||||||
|  |  | ||||||
|  | struct WorldPrefab Dawn::createWorldPrefab(Scene &s) { | ||||||
|  |   struct WorldPrefab world; | ||||||
|  |  | ||||||
|  |   world.item = s.createSceneItem(); | ||||||
|  |   world.world = world.item->addComponent<World>(); | ||||||
|  |  | ||||||
|  |   return world; | ||||||
|  | } | ||||||
							
								
								
									
										17
									
								
								src/dawnrpg/prefab/WorldPrefab.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/dawnrpg/prefab/WorldPrefab.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | |||||||
|  | // Copyright (c) 2024 Dominic Masters | ||||||
|  | //  | ||||||
|  | // This software is released under the MIT License. | ||||||
|  | // https://opensource.org/licenses/MIT | ||||||
|  |  | ||||||
|  | #pragma once | ||||||
|  | #include "prefab/Prefab.hpp" | ||||||
|  | #include "component/world/World.hpp" | ||||||
|  |  | ||||||
|  | namespace Dawn { | ||||||
|  |   struct WorldPrefab : public Prefab { | ||||||
|  |     public: | ||||||
|  |       std::shared_ptr<World> world; | ||||||
|  |   }; | ||||||
|  |  | ||||||
|  |   struct WorldPrefab createWorldPrefab(Scene &scene); | ||||||
|  | } | ||||||
| @@ -6,4 +6,5 @@ | |||||||
| target_sources(${DAWN_TARGET_NAME} | target_sources(${DAWN_TARGET_NAME} | ||||||
|   PRIVATE |   PRIVATE | ||||||
|     TestScene.cpp |     TestScene.cpp | ||||||
|  |     WorldScene.cpp | ||||||
| ) | ) | ||||||
| @@ -8,4 +8,5 @@ | |||||||
|  |  | ||||||
| namespace Dawn { | namespace Dawn { | ||||||
|   void testScene(Scene &scene); |   void testScene(Scene &scene); | ||||||
|  |   void worldScene(Scene &scene); | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										46
									
								
								src/dawnrpg/scenes/WorldScene.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								src/dawnrpg/scenes/WorldScene.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,46 @@ | |||||||
|  |  | ||||||
|  | // Copyright (c) 2023 Dominic Masters | ||||||
|  | //  | ||||||
|  | // This software is released under the MIT License. | ||||||
|  | // https://opensource.org/licenses/MIT | ||||||
|  |  | ||||||
|  | #include "scenes/SceneList.hpp" | ||||||
|  | #include "prefab/PlayerPrefab.hpp" | ||||||
|  | #include "prefab/WorldPrefab.hpp" | ||||||
|  | // #include "component/display/Camera.hpp" | ||||||
|  | // #include "prefab/SimpleSpinningCube.hpp" | ||||||
|  | // #include "component/display/material/SimpleTexturedMaterial.hpp" | ||||||
|  | // #include "display/mesh/CubeMesh.hpp" | ||||||
|  |  | ||||||
|  | // #include "component/ui/UICanvas.hpp" | ||||||
|  | // #include "ui/elements/UIRectangle.hpp" | ||||||
|  | // #include "ui/elements/UILabel.hpp" | ||||||
|  | // #include "ui/UIMenu.hpp" | ||||||
|  | // #include "ui/container/UIRowContainer.hpp" | ||||||
|  | // #include "ui/container/UIPaddingContainer.hpp" | ||||||
|  |  | ||||||
|  | // #include "poker/PokerGame.hpp" | ||||||
|  |  | ||||||
|  | using namespace Dawn; | ||||||
|  |  | ||||||
|  | void Dawn::worldScene(Scene &s) { | ||||||
|  |   // auto cameraItem = s.createSceneItem(); | ||||||
|  |   // auto camera = cameraItem->addComponent<Camera>(); | ||||||
|  |   // cameraItem->lookAt({ 3, 3, 3 }, { 0, 0, 0 }, { 0, 1, 0 }); | ||||||
|  |   // camera->clipFar = 99999.99f; | ||||||
|  |  | ||||||
|  |   // auto cube = s.createSceneItem(); | ||||||
|  |   // auto cubeMesh = std::make_shared<Mesh>(); | ||||||
|  |   // auto cubeRenderer = cube->addComponent<MeshRenderer>(); | ||||||
|  |   // auto cubeMaterial = cube->addComponent<SimpleTexturedMaterial>(); | ||||||
|  |    | ||||||
|  |   // cubeRenderer->mesh = cubeMesh; | ||||||
|  |   // cubeMesh->createBuffers(CUBE_VERTICE_COUNT, CUBE_INDICE_COUNT); | ||||||
|  |   // CubeMesh::buffer(cubeMesh, glm::vec3(0,0,0), glm::vec3(1, 1, 1), 0, 0); | ||||||
|  |  | ||||||
|  |   // auto canvasItem = s.createSceneItem(); | ||||||
|  |   // auto canvas = canvasItem->addComponent<UICanvas>(); | ||||||
|  |    | ||||||
|  |   auto world = createWorldPrefab(s); | ||||||
|  |   auto player = createPlayerPrefab(world.world); | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user