SpiecsEngine
 
Loading...
Searching...
No Matches
EditorWorld.cpp
Go to the documentation of this file.
1/**
2* @file EditorWorld.cpp.
3* @brief The EditorWorld Class Implementation.
4* @author Spices.
5*/
6
7#include "Pchheader.h"
8#include "EditorWorld.h"
9#include "World/Entity.h"
10#include "Render/FrameInfo.h"
11#include "Systems/SystemManager.h"
12#include "GamePlay/CameraController.h"
13
14namespace Spices {
15
17 {
19
20 // camera
21 {
22 Entity cameraentity = CreateEntity("EditorCamera");
23 CameraComponent& camComp = cameraentity.AddComponent<CameraComponent>(true);
24 camComp.SetCamera(std::make_shared<Camera>());
25 camComp.GetCamera()->SetPerspective(45.0f, 0.001f, 100000.0f);
26 //camComp.GetCamera()->SetOrthographic(-100.0f, 100.0f, 100.0f, -100.0f, 0.001f, 100000.0f);
27 TransformComponent& transformComp = cameraentity.GetComponent<TransformComponent>();
28 transformComp.SetPosition({ 30.0f, 6.0f, 15.0f });
29 transformComp.SetRotation({8.0f, -90.0f, 0.0f});
30
31 cameraentity.AddComponent<NativeScriptComponent>(std::make_shared<CameraController>());
32 }
33
34 // skybox
35 {
36 Entity skyboxentity = CreateEntity("SkyBox");
37 SkyBoxComponent& skyboxComp = skyboxentity.AddComponent<SkyBoxComponent>();
38 skyboxComp.SetMaterial("BasePassRenderer.SkyBox.little_paris_eiffel_tower_4k");
39 TransformComponent& transformComp = skyboxentity.GetComponent<TransformComponent>();
40 transformComp.SetScale({50000000.0f, 50000000.0f, 50000000.0f});
41 }
42
43 // directionallight
44 {
45 Entity dirlightentity = CreateEntity("DirectionalLight_0");
46 TransformComponent& transformComp = dirlightentity.GetComponent<TransformComponent>();
47 DirectionalLightComponent& dirlightComp = dirlightentity.AddComponent<DirectionalLightComponent>();
48 transformComp.SetRotation({0.0f, 25.0f, 50.0f});
49 dirlightComp.SetColor({ 1.0f, 1.0f, 1.0f });
50 dirlightComp.SetIntensity(5.0f);
51 }
52 }
53
55 {
57
59 }
60
62 {
63
64 }
65}
#define SPICES_PROFILE_ZONE
void SetCamera(std::shared_ptr< Camera > camera)
Set the camera this component handled.
CameraComponent Class. This class defines the specific behaves of CameraComponent.
CameraController Class. This class inherit from NativeScriptComponent. It receives Mouse Event and Ke...
Camera Class. This class just encapsulate Projection Matrix.
Definition Camera.h:59
void SetIntensity(float intensity)
Set the DirectionalLight intensity.
DirectionalLightComponent Class. This class defines the specific behaves of DirectionalLightComponent...
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.
Definition EditorWorld.h:18
Entity Class. This class defines the specific behaves of Entity.
Definition Entity.h:20
NativeScriptComponent Class. This class defines the specific behaves of NativeScriptComponent....
void SetMaterial(const std::string &materialPath)
Set SkyBox Material.
SkyBoxComponent Class. This class defines the specific behaves of SkyBoxComponent.
static void Run(TimeStep &ts)
Update all system that pushed to this manager.
SystemManager Class. This class defines the behave of SystemManager.
This Class handles our engine time step during frames. Global Unique.
Definition TimeStep.h:22
TransformComponent Class. This class defines the specific behaves of TransformComponent.
Entity CreateEntity(const std::string &name="None")
Create a new empty entity in this world.
Definition World.cpp:13