|
Vulkan Schnee 0.0.1
High-performance rendering engine
|
A component which can be attached as many times to an actor as one wants. It makes it possible to render a mesh attached to an object. More...
#include <MeshComponent.h>
Public Member Functions | |
| MeshComponent (Scene *owningScene, entt::entity &actor, Asset::Path asset, std::shared_ptr< SceneNode > sceneNode, bool isVisible_=true, const std::string &name_="game object") | |
| Production constructor - uses EngineManager singleton to get RenderingDataManager. | |
| MeshComponent (Scene *owningScene, entt::entity &actor, Asset::Path asset, std::shared_ptr< SceneNode > sceneNode, RenderingDataManager *renderingDataManager, bool isVisible_=true, const std::string &name_="game object") | |
| Testable constructor - allows injecting RenderingDataManager for testing. | |
| ~MeshComponent () override=default | |
| void | beginPlay () override |
| Called when the component is added to the scene or the game starts. | |
| void | endPlay () override |
| Called when the component is removed or the game ends. | |
| bool | isVisible () const |
| If this mesh component should be considered for rendering. | |
| MeshAsset * | getMeshAsset () const |
| Gets the asset used by this mesh rendering component. | |
| glm::mat4 | getWorldTransform () const |
| Getter for the world transform of the mesh component. | |
| glm::mat4 | getLocalTransform () const |
| Gets the local model matrix which isn't affected by its parent. | |
| PipelineNames | getMaterialNames () const |
| Gets the material name of this mesh component. | |
| Public Member Functions inherited from EngineCore::LogicComponent | |
| LogicComponent (Scene *owningScene) | |
| virtual | ~LogicComponent ()=default |
| virtual void | tick (double deltaTime) |
| Called every frame if ticking is enabled. | |
| bool | canTick () const |
| Checks if the component is currently set to tick. | |
| void | setCanTick (bool enable) |
| Enables or disables ticking for this component. | |
| Entity * | getOwningEntity () const |
| Gets the entity this component belongs to. | |
Private Attributes | |
| std::string | name = "game object" |
| bool | visible = true |
| entt::entity | componentEntity = entt::null |
| std::optional< std::shared_ptr< SceneNode > > | sceneNode |
| Ecs::StaticMeshData * | staticMeshData = nullptr |
| RenderingDataManager * | renderingDataManager_ = nullptr |
Additional Inherited Members | |
| Static Public Attributes inherited from EngineCore::LogicComponent | |
| static constexpr bool | IsUnique = false |
| Defines whether multiple instances of this component can exist on the same entity. Defaults to false (multiple allowed). Override in derived classes with static constexpr bool IsUnique = true; if needed. | |
| Protected Member Functions inherited from EngineCore::LogicComponent | |
| Scene * | getScene () const |
| Gets the scene this component belongs to. | |
| SceneManager * | getSceneManager () const |
| Helper to get the SceneManager from the owning scene. | |
A component which can be attached as many times to an actor as one wants. It makes it possible to render a mesh attached to an object.
Definition at line 27 of file MeshComponent.h.
| EngineCore::MeshComponent::MeshComponent | ( | Scene * | owningScene, |
| entt::entity & | actor, | ||
| Asset::Path | asset, | ||
| std::shared_ptr< SceneNode > | sceneNode, | ||
| bool | isVisible_ = true, | ||
| const std::string & | name_ = "game object" ) |
Production constructor - uses EngineManager singleton to get RenderingDataManager.
Definition at line 9 of file MeshComponent.cpp.
References MeshComponent(), and sceneNode.
Referenced by MeshComponent().
| EngineCore::MeshComponent::MeshComponent | ( | Scene * | owningScene, |
| entt::entity & | actor, | ||
| Asset::Path | asset, | ||
| std::shared_ptr< SceneNode > | sceneNode, | ||
| RenderingDataManager * | renderingDataManager, | ||
| bool | isVisible_ = true, | ||
| const std::string & | name_ = "game object" ) |
Testable constructor - allows injecting RenderingDataManager for testing.
Definition at line 21 of file MeshComponent.cpp.
References componentEntity, Ecs::RegistryManager::get(), EngineCore::Scene::getAssetManager(), EngineCore::AssetManager::getMeshAsset(), EngineCore::LogicComponent::LogicComponent(), name, Ecs::Parent::parent, renderingDataManager_, sceneNode, staticMeshData, and visible.
|
overridedefault |
|
overridevirtual |
Called when the component is added to the scene or the game starts.
Reimplemented from EngineCore::LogicComponent.
Definition at line 57 of file MeshComponent.cpp.
References EngineCore::LogicComponent::beginPlay(), Ecs::RegistryManager::get(), EngineCore::EngineManager::getEngineModule(), EngineCore::EngineManager::getInstance(), EngineCore::Engine::getRenderer(), EngineCore::Renderer::getRenderingDataManager(), renderingDataManager_, and sceneNode.
|
overridevirtual |
Called when the component is removed or the game ends.
Reimplemented from EngineCore::LogicComponent.
Definition at line 86 of file MeshComponent.cpp.
References EngineCore::LogicComponent::endPlay(), Ecs::RegistryManager::get(), renderingDataManager_, and sceneNode.
|
nodiscard |
Gets the local model matrix which isn't affected by its parent.
Definition at line 123 of file MeshComponent.cpp.
References sceneNode.
|
nodiscard |
Gets the material name of this mesh component.
Definition at line 128 of file MeshComponent.cpp.
References EngineCore::NORMALS_SHADER.
|
nodiscard |
Gets the asset used by this mesh rendering component.
Definition at line 112 of file MeshComponent.cpp.
References staticMeshData.
Referenced by EngineCore::RenderingDataManager::snapshotRenderableMeshes(), EngineCore::RenderingDataManager::updatePrimitiveData(), EngineCore::RenderingDataManager::updatePrimitiveDataInstanced(), and EngineCore::RenderingDataManager::updateTransforms().
|
nodiscard |
Getter for the world transform of the mesh component.
Definition at line 118 of file MeshComponent.cpp.
References sceneNode.
Referenced by EngineCore::RenderingDataManager::updatePrimitiveData(), EngineCore::RenderingDataManager::updatePrimitiveDataInstanced(), and EngineCore::RenderingDataManager::updateTransforms().
|
nodiscard |
If this mesh component should be considered for rendering.
Definition at line 107 of file MeshComponent.cpp.
References visible.
Referenced by EngineCore::RenderingDataManager::snapshotRenderableMeshes(), EngineCore::RenderingDataManager::updatePrimitiveData(), EngineCore::RenderingDataManager::updatePrimitiveDataInstanced(), and EngineCore::RenderingDataManager::updateTransforms().
|
private |
Definition at line 93 of file MeshComponent.h.
Referenced by MeshComponent().
|
private |
Definition at line 29 of file MeshComponent.h.
Referenced by MeshComponent().
|
private |
Definition at line 97 of file MeshComponent.h.
Referenced by beginPlay(), endPlay(), and MeshComponent().
|
private |
Definition at line 94 of file MeshComponent.h.
Referenced by beginPlay(), endPlay(), getLocalTransform(), getWorldTransform(), MeshComponent(), and MeshComponent().
|
private |
Definition at line 96 of file MeshComponent.h.
Referenced by getMeshAsset(), and MeshComponent().
|
private |
Definition at line 30 of file MeshComponent.h.
Referenced by isVisible(), and MeshComponent().