Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
Engine::Components::CollidableMesh Class Reference

#include <CollidableMeshComponent.h>

Inheritance diagram for Engine::Components::CollidableMesh:
Collaboration diagram for Engine::Components::CollidableMesh:

Public Member Functions

 CollidableMesh (Entities::Scene *owningScene, entt::entity &actor, Asset::Path asset, std::shared_ptr< Entities::SceneNode > sceneNode, bool isVisible_=true, const std::string &name_="game object")
 CollidableMesh (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")
void endPlay () override
 Called when the component is removed or the game ends.
void enableCollision (bool enabled)
bool isCollisionEnabled () const
void setCollisionProperties (const Assets::Loaders::GltfLoader::VulkanSchneeExtension::CollisionProperties &properties)
void clearCollisionProperties ()
void setCollisionStatic (bool isStatic)
void onMeshAssetResolved (Assets::MeshAssetRef meshAsset) override
Public Member Functions inherited from Engine::Components::Mesh
 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
Public Member Functions inherited from Engine::Components::Logic
 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::EntitygetOwningEntity () const
 Gets the entity this component belongs to.

Static Public Attributes

static constexpr const char * ComponentName = "CollidableMesh"
Static Public Attributes inherited from Engine::Components::Mesh
static constexpr const char * ComponentName = "Mesh"
Static Public Attributes inherited from Engine::Components::Logic
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.

Private Types

using CollisionProperties = Assets::Loaders::GltfLoader::VulkanSchneeExtension::CollisionProperties

Private Member Functions

void rebuildOwnedCollision ()
bool createCollisionFromProperties ()
bool createFallbackBoxCollision ()
void ensurePhysicsBody ()
void removeOwnedCollision ()

Private Attributes

std::optional< CollisionPropertiescollisionProperties_
std::vector< Collision * > ownedCollisionChildren_
bool collisionRequested_ = false
bool collisionStatic_ = false

Additional Inherited Members

Protected Member Functions inherited from Engine::Components::Mesh
std::shared_ptr< Entities::SceneNodegetSceneNode () const
Ecs::StaticMeshDatagetStaticMeshData () const
Protected Member Functions inherited from Engine::Components::Logic
Entities::ScenegetScene () const
 Gets the scene this component belongs to.
Core::SceneManagergetSceneManager () const
 Helper to get the SceneManager from the owning scene.
Protected Attributes inherited from Engine::Components::Mesh
entt::entity componentEntity = entt::null
std::optional< std::shared_ptr< Entities::SceneNode > > sceneNode
Ecs::StaticMeshDatastaticMeshData = nullptr

Detailed Description

Definition at line 10 of file CollidableMeshComponent.h.

Member Typedef Documentation

◆ CollisionProperties

Constructor & Destructor Documentation

◆ CollidableMesh() [1/2]

Engine::Components::CollidableMesh::CollidableMesh ( Entities::Scene * owningScene,
entt::entity & actor,
Asset::Path asset,
std::shared_ptr< Entities::SceneNode > sceneNode,
bool isVisible_ = true,
const std::string & name_ = "game object" )

◆ CollidableMesh() [2/2]

Engine::Components::CollidableMesh::CollidableMesh ( 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" )

Member Function Documentation

◆ clearCollisionProperties()

void Engine::Components::CollidableMesh::clearCollisionProperties ( )

◆ createCollisionFromProperties()

bool Engine::Components::CollidableMesh::createCollisionFromProperties ( )
private

◆ createFallbackBoxCollision()

bool Engine::Components::CollidableMesh::createFallbackBoxCollision ( )
private

◆ enableCollision()

void Engine::Components::CollidableMesh::enableCollision ( bool enabled)

◆ endPlay()

void Engine::Components::CollidableMesh::endPlay ( )
overridevirtual

Called when the component is removed or the game ends.

Reimplemented from Engine::Components::Logic.

◆ ensurePhysicsBody()

void Engine::Components::CollidableMesh::ensurePhysicsBody ( )
private

◆ isCollisionEnabled()

bool Engine::Components::CollidableMesh::isCollisionEnabled ( ) const
nodiscard

◆ onMeshAssetResolved()

void Engine::Components::CollidableMesh::onMeshAssetResolved ( Assets::MeshAssetRef meshAsset)
overridevirtual

Reimplemented from Engine::Components::Mesh.

◆ rebuildOwnedCollision()

void Engine::Components::CollidableMesh::rebuildOwnedCollision ( )
private

◆ removeOwnedCollision()

void Engine::Components::CollidableMesh::removeOwnedCollision ( )
private

◆ setCollisionProperties()

void Engine::Components::CollidableMesh::setCollisionProperties ( const Assets::Loaders::GltfLoader::VulkanSchneeExtension::CollisionProperties & properties)

◆ setCollisionStatic()

void Engine::Components::CollidableMesh::setCollisionStatic ( bool isStatic)

Member Data Documentation

◆ collisionProperties_

std::optional<CollisionProperties> Engine::Components::CollidableMesh::collisionProperties_
private

Definition at line 56 of file CollidableMeshComponent.h.

◆ collisionRequested_

bool Engine::Components::CollidableMesh::collisionRequested_ = false
private

Definition at line 58 of file CollidableMeshComponent.h.

◆ collisionStatic_

bool Engine::Components::CollidableMesh::collisionStatic_ = false
private

Definition at line 59 of file CollidableMeshComponent.h.

◆ ComponentName

const char* Engine::Components::CollidableMesh::ComponentName = "CollidableMesh"
staticconstexpr

Definition at line 13 of file CollidableMeshComponent.h.

◆ ownedCollisionChildren_

std::vector<Collision *> Engine::Components::CollidableMesh::ownedCollisionChildren_
private

Definition at line 57 of file CollidableMeshComponent.h.


The documentation for this class was generated from the following file: