|
Monad Engine da02fba2
> Undercity Codex_
|
Makes a GameObject renderable by submitting its mesh each frame. More...
#include <MeshComponent.h>
Inheritance diagram for mnd::MeshComponent:
Collaboration diagram for mnd::MeshComponent:Public Member Functions | |
| MeshComponent ()=default | |
| Construct a MeshComponent with a mesh-material pair. | |
| MeshComponent (const std::shared_ptr< Material > &material, const std::shared_ptr< Mesh > &mesh) | |
| void | Update (f32 deltaTime) override |
| Submit a RenderCommand for this object's current world transform. | |
| void | SetMaterial (const std::shared_ptr< Material > &material) |
| void | SetMesh (const std::shared_ptr< Mesh > &mesh) |
| void | LoadProperties (const nlohmann::json &json) override |
| virtual void | Init () |
| virtual size_t | GetTypeId () const =0 |
| GameObject * | GetOwner () |
Static Public Member Functions | |
| template<typename T > | |
| static size_t | StaticTypeId () |
Protected Attributes | |
| GameObject * | m_owner = nullptr |
Makes a GameObject renderable by submitting its mesh each frame.
Update() packages (Mesh + Material + owner world transform) into a RenderCommand and hands it to the engine's RenderQueue. The actual draw call happens later in RenderQueue::Draw().
Definition at line 40 of file MeshComponent.h.
|
default |
Construct a MeshComponent with a mesh-material pair.
| material | The surface description (shader + uniforms + textures). |
| mesh | The GPU geometry to draw. |
| mnd::MeshComponent::MeshComponent | ( | const std::shared_ptr< Material > & | material, |
| const std::shared_ptr< Mesh > & | mesh | ||
| ) |
Definition at line 13 of file MeshComponent.cpp.
|
inherited |
Definition at line 12 of file Component.cpp.
References mnd::Component::m_owner.
Referenced by Update(), and mnd::SkinnedMeshComponent::Update().
|
pure virtualinherited |
|
virtualinherited |
Reimplemented in mnd::PhysicsComponent, and mnd::PlayerControllerComponent.
Definition at line 10 of file Component.cpp.
Referenced by mnd::GameObject::AddComponent().
|
overridevirtual |
Reimplemented from mnd::Component.
Definition at line 53 of file MeshComponent.cpp.
References mnd::Mesh::CreateBox(), mnd::Mesh::CreateSphere(), mnd::Texture::Load(), mnd::Material::Load(), mesh, SetMaterial(), and SetMesh().
| void mnd::MeshComponent::SetMaterial | ( | const std::shared_ptr< Material > & | material | ) |
Definition at line 43 of file MeshComponent.cpp.
References material.
Referenced by LoadProperties().
| void mnd::MeshComponent::SetMesh | ( | const std::shared_ptr< Mesh > & | mesh | ) |
|
inlinestaticinherited |
Definition at line 50 of file Component.h.
|
overridevirtual |
Submit a RenderCommand for this object's current world transform.
| deltaTime | Not used directly, but keeps the Component interface uniform. |
Implements mnd::Component.
Definition at line 19 of file MeshComponent.cpp.
References mnd::Engine::GetInstance(), mnd::GameObject::GetName(), mnd::Component::GetOwner(), mnd::Engine::GetRenderQueue(), mnd::GameObject::GetWorldTransform(), LOG_WARN, mnd::RenderCommand::material, mnd::RenderCommand::mesh, mnd::RenderCommand::modelMatrix, and mnd::RenderQueue::Submit().
|
protectedinherited |
Definition at line 57 of file Component.h.
Referenced by mnd::GameObject::AddComponent(), mnd::HealthComponent::ApplyDamage(), mnd::Component::GetOwner(), mnd::CameraComponent::GetViewMatrix(), mnd::PhysicsComponent::Init(), mnd::PlayerControllerComponent::Init(), mnd::PlayerControllerComponent::Update(), mnd::AudioComponent::Update(), mnd::AudioListenerComponent::Update(), and mnd::PhysicsComponent::Update().