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>
|
| | Mesh (Entities::Scene *owningScene, entt::entity &actor, Asset::Path asset, std::shared_ptr< Entities::SceneNode > sceneNode, bool isVisible_=true, const std::string &name_="game object") |
| | Production constructor - uses EngineManager singleton to get RenderingDataManager.
|
| | Mesh (Entities::Scene *owningScene, entt::entity &actor, Asset::Path asset, std::shared_ptr< Entities::SceneNode > sceneNode, Core::RenderingDataManager *renderingDataManager, bool isVisible_=true, const std::string &name_="game object") |
| | Testable constructor - allows injecting RenderingDataManager for testing.
|
| | ~Mesh () 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.
|
| Assets::MeshAssetRef | 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.
|
| Rendering::PipelineNames | getMaterialNames () const |
| | Gets the material name of this mesh component.
|
| std::string | getAssetName () const |
| | Gets the asset name of this mesh component (e.g. "rat")
|
| void | attachCollisionChild (Collision *collision) |
| void | attachCollisionChildren (const std::vector< Collision * > &collisions) |
| void | detachCollisionChild (const Collision *collision) |
| const std::vector< Collision * > & | getCollisionChildren () const |
| bool | ownsCollisionChild (const Logic *component) const |
| virtual void | onMeshAssetResolved (Assets::MeshAssetRef meshAsset) |
| | Logic (Entities::Scene *owningScene) |
| virtual | ~Logic ()=default |
| virtual std::string | getComponentName () const |
| | Gets the component type name for debugging/UI.
|
| virtual void | tick (double deltaTime) |
| | Called every frame if ticking is enabled.
|
| bool | hasBegunPlay () const |
| bool | canTick () const |
| | Checks if the component is currently set to tick.
|
| void | setCanTick (bool enable) |
| | Enables or disables ticking for this component.
|
| Entities::Entity * | getOwningEntity () const |
| | Gets the entity this component belongs to.
|
|
| static constexpr const char * | ComponentName = "Mesh" |
| 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.
|
| static constexpr const char * | ComponentName = "Logic" |
| | Fallback component type name. Derived classes may override getComponentName() for custom labels.
|
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 43 of file MeshComponent.h.
◆ Mesh() [1/2]
◆ Mesh() [2/2]
| Engine::Components::Mesh::Mesh |
( |
Entities::Scene * | owningScene, |
|
|
entt::entity & | actor, |
|
|
Asset::Path | asset, |
|
|
std::shared_ptr< Entities::SceneNode > | sceneNode, |
|
|
Core::RenderingDataManager * | renderingDataManager, |
|
|
bool | isVisible_ = true, |
|
|
const std::string & | name_ = "game object" ) |
Testable constructor - allows injecting RenderingDataManager for testing.
References sceneNode.
◆ ~Mesh()
| Engine::Components::Mesh::~Mesh |
( |
| ) |
|
|
overridedefault |
◆ attachCollisionChild()
| void Engine::Components::Mesh::attachCollisionChild |
( |
Collision * | collision | ) |
|
◆ attachCollisionChildren()
| void Engine::Components::Mesh::attachCollisionChildren |
( |
const std::vector< Collision * > & | collisions | ) |
|
◆ beginPlay()
| void Engine::Components::Mesh::beginPlay |
( |
| ) |
|
|
overridevirtual |
◆ detachCollisionChild()
| void Engine::Components::Mesh::detachCollisionChild |
( |
const Collision * | collision | ) |
|
◆ endPlay()
| void Engine::Components::Mesh::endPlay |
( |
| ) |
|
|
overridevirtual |
◆ getAssetName()
| std::string Engine::Components::Mesh::getAssetName |
( |
| ) |
const |
|
nodiscard |
Gets the asset name of this mesh component (e.g. "rat")
- Returns
- asset name string, or empty if not available
◆ getCollisionChildren()
| const std::vector< Collision * > & Engine::Components::Mesh::getCollisionChildren |
( |
| ) |
const |
|
nodiscard |
◆ getLocalTransform()
| glm::mat4 Engine::Components::Mesh::getLocalTransform |
( |
| ) |
const |
|
nodiscard |
Gets the local model matrix which isn't affected by its parent.
- Returns
- glm local model matrix
◆ getMaterialNames()
Gets the material name of this mesh component.
- Returns
- name of the material used or defaults ot normals if none is used
◆ getMeshAsset()
Gets the asset used by this mesh rendering component.
- Returns
- Pointer to the mesh asset used by this mesh renderer
◆ getSceneNode()
◆ getStaticMeshData()
◆ getWorldTransform()
| glm::mat4 Engine::Components::Mesh::getWorldTransform |
( |
| ) |
const |
|
nodiscard |
Getter for the world transform of the mesh component.
- Returns
- model matrix which is affected by the scene graph hierarchy
◆ isVisible()
| bool Engine::Components::Mesh::isVisible |
( |
| ) |
const |
|
nodiscard |
If this mesh component should be considered for rendering.
- Returns
- visible = true
◆ onMeshAssetResolved()
◆ ownsCollisionChild()
| bool Engine::Components::Mesh::ownsCollisionChild |
( |
const Logic * | component | ) |
const |
|
nodiscard |
◆ collisionChildren_
| std::vector<Collision *> Engine::Components::Mesh::collisionChildren_ |
|
private |
◆ componentEntity
| entt::entity Engine::Components::Mesh::componentEntity = entt::null |
|
protected |
◆ ComponentName
| const char* Engine::Components::Mesh::ComponentName = "Mesh" |
|
staticconstexpr |
◆ name
| std::string Engine::Components::Mesh::name = "game object" |
|
private |
◆ renderingDataManager_
| Core::RenderingDataManager* Engine::Components::Mesh::renderingDataManager_ = nullptr |
|
private |
◆ sceneNode
◆ staticMeshData
◆ visible
| bool Engine::Components::Mesh::visible = true |
|
private |
The documentation for this class was generated from the following file:
- /home/magerbeton/Documents/gl3-vulkan/Engine/include/Engine/Component/MeshComponent.h