|
Monad Engine da02fba2
> Undercity Codex_
|
#include <GameObject.h>
Inheritance diagram for eng::GameObject:
Collaboration diagram for eng::GameObject:Public Member Functions | |
| virtual | ~GameObject ()=default |
| virtual void | Init () |
| virtual void | LoadProperties (const nlohmann::json &json) |
| virtual void | Update (float deltaTime) |
| const std::string & | GetName () const |
| void | SetName (const std::string &name) |
| GameObject * | GetParent () |
| bool | SetParent (GameObject *parent) |
| Scene * | GetScene () |
| bool | IsAlive () const |
| void | MarkForDestroy () |
| void | SetActive (bool active) |
| bool | IsActive () const |
| void | AddComponent (Component *component) |
| template<typename T , typename = typename std::enable_if_t<std::is_base_of_v<Component, T>>> | |
| T * | GetComponent () |
| GameObject * | FindChildByName (const std::string &name) |
| const glm::vec3 & | GetPosition () const |
| glm::vec3 | GetWorldPosition () const |
| glm::vec2 | GetPosition2D () const |
| glm::vec2 | GetWorldPosition2D () const |
| void | SetPosition (const glm::vec3 &pos) |
| void | SetWorldPosition (const glm::vec3 &pos) |
| void | SetPosition2D (const glm::vec2 &pos) |
| const glm::quat & | GetRotation () const |
| glm::quat | GetWorldRotation () |
| float | GetRotation2D () const |
| void | SetRotation (const glm::quat &rot) |
| void | SetWorldRotation (const glm::quat &rot) |
| void | SetRotation2D (float rotation) |
| const glm::vec3 & | GetScale () const |
| glm::vec2 | GetScale2D () const |
| void | SetScale (const glm::vec3 &scale) |
| void | SetScale2D (const glm::vec2 &scale) |
| glm::mat4 | GetLocalTransform () const |
| glm::mat4 | GetLocalTransform2D () const |
| glm::mat4 | GetWorldTransform () const |
| glm::mat4 | GetWorldTransform2D () const |
Static Public Member Functions | |
| static GameObject * | LoadGLTF (const std::string &path, Scene *scene) |
Protected Member Functions | |
| GameObject ()=default | |
Protected Attributes | |
| std::string | m_name |
| GameObject * | m_parent = nullptr |
| Scene * | m_scene = nullptr |
| std::vector< std::unique_ptr< GameObject > > | m_children |
| std::vector< std::unique_ptr< Component > > | m_components |
| bool | m_isAlive = true |
| glm::vec3 | m_position = glm::vec3(0.0f) |
| glm::quat | m_rotation = glm::quat(1.0f, 0.0f, 0.0f, 0.0f) |
| glm::vec3 | m_scale = glm::vec3(1.0f) |
| bool | m_active = true |
Friends | |
| class | Scene |
Definition at line 14 of file GameObject.h.
|
virtualdefault |
|
protecteddefault |
| void eng::GameObject::AddComponent | ( | Component * | component | ) |
Definition at line 105 of file GameObject.cpp.
References eng::Component::Init(), m_components, and eng::Component::m_owner.
Referenced by TestObject::TestObject().
| GameObject * eng::GameObject::FindChildByName | ( | const std::string & | name | ) |
Definition at line 116 of file GameObject.cpp.
References m_children, and m_name.
Referenced by Player::Init(), and Player::Update().
|
inline |
Definition at line 34 of file GameObject.h.
References m_components.
| glm::mat4 eng::GameObject::GetLocalTransform | ( | ) | const |
Definition at line 248 of file GameObject.cpp.
References m_position, m_rotation, and m_scale.
Referenced by GetWorldTransform().
| glm::mat4 eng::GameObject::GetLocalTransform2D | ( | ) | const |
Definition at line 264 of file GameObject.cpp.
References GetRotation2D(), m_position, and m_scale.
Referenced by GetWorldTransform2D().
| const std::string & eng::GameObject::GetName | ( | ) | const |
Definition at line 55 of file GameObject.cpp.
References m_name.
| GameObject * eng::GameObject::GetParent | ( | ) |
Definition at line 65 of file GameObject.cpp.
References m_parent.
Referenced by eng::CameraComponent::GetViewMatrix(), and eng::Scene::SetParent().
| const glm::vec3 & eng::GameObject::GetPosition | ( | ) | const |
Definition at line 134 of file GameObject.cpp.
References m_position.
Referenced by eng::CameraComponent::GetViewMatrix().
| glm::vec2 eng::GameObject::GetPosition2D | ( | ) | const |
Definition at line 145 of file GameObject.cpp.
References m_position.
| const glm::quat & eng::GameObject::GetRotation | ( | ) | const |
Definition at line 181 of file GameObject.cpp.
References m_rotation.
Referenced by eng::CameraComponent::GetViewMatrix(), and eng::PlayerControllerComponent::Update().
| float eng::GameObject::GetRotation2D | ( | ) | const |
Definition at line 198 of file GameObject.cpp.
References m_rotation.
Referenced by GetLocalTransform2D().
| const glm::vec3 & eng::GameObject::GetScale | ( | ) | const |
Definition at line 228 of file GameObject.cpp.
References m_scale.
| glm::vec2 eng::GameObject::GetScale2D | ( | ) | const |
Definition at line 233 of file GameObject.cpp.
References m_scale.
| Scene * eng::GameObject::GetScene | ( | ) |
Definition at line 80 of file GameObject.cpp.
References m_scene.
Referenced by eng::ParseGLTFNode().
| glm::vec3 eng::GameObject::GetWorldPosition | ( | ) | const |
Definition at line 139 of file GameObject.cpp.
References GetWorldTransform().
Referenced by eng::PhysicsComponent::Init(), eng::PlayerControllerComponent::Init(), eng::AudioComponent::Update(), and eng::AudioListenerComponent::Update().
| glm::vec2 eng::GameObject::GetWorldPosition2D | ( | ) | const |
Definition at line 150 of file GameObject.cpp.
References GetWorldTransform2D().
| glm::quat eng::GameObject::GetWorldRotation | ( | ) |
Definition at line 186 of file GameObject.cpp.
References GetWorldRotation(), m_parent, and m_rotation.
Referenced by GetWorldRotation(), eng::PhysicsComponent::Init(), and SetWorldRotation().
| glm::mat4 eng::GameObject::GetWorldTransform | ( | ) | const |
Definition at line 282 of file GameObject.cpp.
References GetLocalTransform(), GetWorldTransform(), and m_parent.
Referenced by eng::CameraComponent::GetViewMatrix(), GetWorldPosition(), GetWorldTransform(), SetWorldPosition(), and eng::MeshComponent::Update().
| glm::mat4 eng::GameObject::GetWorldTransform2D | ( | ) | const |
Definition at line 294 of file GameObject.cpp.
References GetLocalTransform2D(), GetWorldTransform2D(), and m_parent.
Referenced by GetWorldPosition2D(), GetWorldTransform2D(), and eng::SpriteComponent::Update().
|
virtual |
Reimplemented in JumpPlatform, and Player.
Definition at line 21 of file GameObject.cpp.
| bool eng::GameObject::IsActive | ( | ) | const |
Definition at line 100 of file GameObject.cpp.
References m_active.
| bool eng::GameObject::IsAlive | ( | ) | const |
Definition at line 85 of file GameObject.cpp.
References m_isAlive.
|
static |
Definition at line 569 of file GameObject.cpp.
References eng::Scene::CreateObject(), eng::FileSystem::GetAssetsFolder(), eng::Engine::GetFileSystem(), eng::Engine::GetInstance(), eng::FileSystem::LoadAssetFileText(), eng::ParseGLTFNode(), eng::ReadOutputQuat, eng::ReadOutputVec3, eng::ReadTimes, and eng::TransformTrack::targetName.
|
virtual |
Definition at line 25 of file GameObject.cpp.
| void eng::GameObject::MarkForDestroy | ( | ) |
| void eng::GameObject::SetActive | ( | bool | active | ) |
Definition at line 95 of file GameObject.cpp.
References m_active.
| void eng::GameObject::SetName | ( | const std::string & | name | ) |
Definition at line 60 of file GameObject.cpp.
References m_name.
Referenced by eng::Scene::CreateObject().
| bool eng::GameObject::SetParent | ( | GameObject * | parent | ) |
Definition at line 70 of file GameObject.cpp.
References m_scene, and eng::Scene::SetParent().
| void eng::GameObject::SetPosition | ( | const glm::vec3 & | pos | ) |
Definition at line 156 of file GameObject.cpp.
References m_position.
Referenced by SetWorldPosition(), and eng::PlayerControllerComponent::Update().
| void eng::GameObject::SetPosition2D | ( | const glm::vec2 & | pos | ) |
Definition at line 176 of file GameObject.cpp.
References m_position.
| void eng::GameObject::SetRotation | ( | const glm::quat & | rot | ) |
Definition at line 203 of file GameObject.cpp.
References m_rotation.
Referenced by SetWorldRotation(), and eng::PlayerControllerComponent::Update().
| void eng::GameObject::SetRotation2D | ( | float | rotation | ) |
Definition at line 223 of file GameObject.cpp.
References m_rotation.
| void eng::GameObject::SetScale | ( | const glm::vec3 & | scale | ) |
Definition at line 238 of file GameObject.cpp.
References m_scale.
| void eng::GameObject::SetScale2D | ( | const glm::vec2 & | scale | ) |
Definition at line 243 of file GameObject.cpp.
References m_scale.
| void eng::GameObject::SetWorldPosition | ( | const glm::vec3 & | pos | ) |
Definition at line 161 of file GameObject.cpp.
References GetWorldTransform(), m_parent, and SetPosition().
Referenced by eng::PhysicsComponent::Update().
| void eng::GameObject::SetWorldRotation | ( | const glm::quat & | rot | ) |
Definition at line 208 of file GameObject.cpp.
References GetWorldRotation(), m_parent, and SetRotation().
Referenced by eng::PhysicsComponent::Update().
|
virtual |
Reimplemented in Bullet, Player, and TestObject.
Definition at line 29 of file GameObject.cpp.
References m_active, m_children, and m_components.
Referenced by Bullet::Update(), Player::Update(), and TestObject::Update().
|
friend |
Definition at line 93 of file GameObject.h.
|
protected |
Definition at line 91 of file GameObject.h.
Referenced by IsActive(), SetActive(), and Update().
|
protected |
Definition at line 85 of file GameObject.h.
Referenced by FindChildByName(), eng::Scene::SetParent(), and Update().
|
protected |
Definition at line 86 of file GameObject.h.
Referenced by AddComponent(), GetComponent(), and Update().
|
protected |
Definition at line 87 of file GameObject.h.
Referenced by IsAlive(), and MarkForDestroy().
|
protected |
Definition at line 82 of file GameObject.h.
Referenced by FindChildByName(), GetName(), and SetName().
|
protected |
Definition at line 83 of file GameObject.h.
Referenced by GetParent(), GetWorldRotation(), GetWorldTransform(), GetWorldTransform2D(), eng::Scene::SetParent(), SetWorldPosition(), and SetWorldRotation().
|
protected |
Definition at line 88 of file GameObject.h.
Referenced by GetLocalTransform(), GetLocalTransform2D(), GetPosition(), GetPosition2D(), SetPosition(), and SetPosition2D().
|
protected |
Definition at line 89 of file GameObject.h.
Referenced by GetLocalTransform(), GetRotation(), GetRotation2D(), GetWorldRotation(), SetRotation(), SetRotation2D(), and Player::Update().
|
protected |
Definition at line 90 of file GameObject.h.
Referenced by GetLocalTransform(), GetLocalTransform2D(), GetScale(), GetScale2D(), SetScale(), and SetScale2D().
|
protected |
Definition at line 84 of file GameObject.h.
Referenced by GetScene(), SetParent(), and Player::Update().