SpiecsEngine
 
Loading...
Searching...
No Matches
MeshController.h
Go to the documentation of this file.
1#pragma once
2#include "Core/Core.h"
3#include "Camera.h"
4#include "World/Components/NativeScriptComponent.h"
5#include "World/Components/TransformComponent.h"
6
7#include <any>
8
9namespace Spices {
10
12 {
13 public:
14 MeshController() = default;
15 virtual ~MeshController() override = default;
16
17 virtual void OnSerialize() override {}
18 virtual void OnDeSerialize() override {}
19
20 virtual void OnConstruction() override;
21 virtual void OnTick(TimeStep& ts) override;
22 virtual void OnEvent(Event& e) override;
23
24 glm::vec3 GetUpDirection() const;
25 glm::vec3 GetRightDirection() const;
27 glm::quat GetOrientation() const;
28
29 private:
31
32 void MousePan(const glm::vec2& delta);
33 void MouseRotate(const glm::vec2& delta) const;
34 void MouseZoom(float delta);
35
36 std::pair<float, float> PanSpeed() const;
37 float RotationSpeed() const;
38 float ZoomSpeed() const;
39
40 void UpdateView() const;
41 glm::vec3 CalculatePosition() const;
42
43 private:
45
46 // TODO: param
47 float m_ViewportWidth = 1920, m_ViewportHeight = 1080;
48 float m_Distance = 10.0f;
49 glm::vec2 m_InitialMousePosition = { 0.0f, 0.0f };
50 glm::vec3 m_FocalPoint = { 0.0f, 0.0f, 0.0f };
51 };
52}
#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.
Definition EditorWorld.h:18
T & AddComponent(Args &&... args)
Template Function. Used for add specific component to entity.
Definition Entity.h:53
T & GetComponent() const
Get Component owned by this entity.
Definition Entity.h:75
void RemoveComponent() const
Remove Component owned from this entity.
Definition Entity.h:85
Entity()=default
Constructor Function.
void AddToRoot()
Add a entity to this world root.
Definition Entity.h:101
World * m_World
A specific world Pointer.
Definition Entity.h:171
const UUID GetUUID()
Get UUID form UUIDComponent.
Definition Entity.h:121
Entity(entt::entity handle, World *world)
Constructor Function. Init class variable. Usually call it.
Definition Entity.h:35
void RemoveFromRoot()
Remove a entity from this world root.
Definition Entity.h:93
operator bool() const
Empty Operation.
Definition Entity.h:127
virtual ~Entity()=default
Destructor Function.
bool HasComponent() const
If Component is owned by this entity or not.
Definition Entity.h:112
operator uint32_t() const
Empty Operation.
Definition Entity.h:133
Entity Class. This class defines the specific behaves of Entity.
Definition Entity.h:20
This Class is the basic Event Class. Inherit from it and create specific event class.
Definition Event.h:96
Wrapper of Gltf file data.
This Class is inherited from KeyEvent Class.
Definition KeyEvent.h:57
void MouseZoom(float delta)
bool OnKeyPressed(KeyPressedEvent &e)
glm::vec3 GetForwardDirection() const
glm::vec3 GetRightDirection() const
virtual void OnEvent(Event &e) override
This interface defines the behaves on specific component event happened.
virtual void OnTick(TimeStep &ts) override
This interface defines the behaves on specific component tick every frame.
virtual void OnSerialize() override
This interface defines how to serialize.
virtual void OnDeSerialize() override
This interface defines how to deserialize.
std::pair< float, float > PanSpeed() const
virtual ~MeshController() override=default
void MouseRotate(const glm::vec2 &delta) const
glm::vec3 CalculatePosition() const
virtual void OnConstruction() override
This interface defines the behaves on specific component added.
glm::quat GetOrientation() const
void MousePan(const glm::vec2 &delta)
glm::vec3 GetUpDirection() const
NativeScriptComponent Class. This class defines the specific behaves of NativeScriptComponent....
This Class handles our engine time step during frames. Global Unique.
Definition TimeStep.h:22
UUIDComponent Class. This class defines the specific behaves of UUIDComponent.
This class helps to generate a uuid for one resource.
Definition UUID.h:16
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.
virtual void OnPreActivate() override
This interface define the specific world behave before on activated.
void RemoveFromRoot(Entity &entity)
Remove a entity from this world root.
Definition World.cpp:58
void AddToRoot(Entity &entity)
Add a entity to this world root.
Definition World.cpp:67
World Class. This class defines the basic behaves of World. When we create an new world,...
Definition World.h:41