Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
CollidableMeshComponent.h
Go to the documentation of this file.
1#pragma once
2
5
6#include <optional>
7
8namespace Engine::Components
9{
10 class CollidableMesh : public Mesh
11 {
12 public:
13 static constexpr const char* ComponentName = "CollidableMesh";
14
16 Entities::Scene * owningScene,
17 entt::entity & actor,
18 Asset::Path asset,
19 std::shared_ptr<Entities::SceneNode> sceneNode,
20 bool isVisible_ = true,
21 const std::string & name_ = "game object"
22 );
23
25 Entities::Scene * owningScene,
26 entt::entity & actor,
27 Asset::Path asset,
28 std::shared_ptr<Entities::SceneNode> sceneNode,
29 Core::RenderingDataManager * renderingDataManager,
30 bool isVisible_ = true,
31 const std::string & name_ = "game object"
32 );
33
34 void endPlay() override;
35
36 void enableCollision(bool enabled);
37 [[nodiscard]] bool isCollisionEnabled() const;
38
41 );
43 void setCollisionStatic(bool isStatic);
44
45 void onMeshAssetResolved(Assets::MeshAssetRef meshAsset) override;
46
47 private:
49
55
56 std::optional<CollisionProperties> collisionProperties_;
57 std::vector<Collision *> ownedCollisionChildren_;
58 bool collisionRequested_ = false;
59 bool collisionStatic_ = false;
60 };
61} // namespace Engine::Components
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")
static constexpr const char * ComponentName
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")
void setCollisionProperties(const Assets::Loaders::GltfLoader::VulkanSchneeExtension::CollisionProperties &properties)
Assets::Loaders::GltfLoader::VulkanSchneeExtension::CollisionProperties CollisionProperties
void endPlay() override
Called when the component is removed or the game ends.
void onMeshAssetResolved(Assets::MeshAssetRef meshAsset) override
void enableCollision(bool enabled)
void setCollisionStatic(bool isStatic)
std::optional< CollisionProperties > collisionProperties_
std::vector< Collision * > ownedCollisionChildren_
std::optional< std::shared_ptr< Entities::SceneNode > > sceneNode
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.
A scene is the overarching structure which can spawn, contain and destroy actors or entities.
Definition Scene.h:56
Asset::Ref< Asset::Path, Mesh > MeshAssetRef
Stores collision shape properties imported from Blender.
Definition GltfLoader.h:160