Plasma Engine  2.0
Loading...
Searching...
No Matches
JoltVisColMeshComponent.h
1#pragma once
2
3#include <JoltPlugin/JoltPluginDLL.h>
4#include <JoltPlugin/Resources/JoltMeshResource.h>
5#include <RendererCore/Components/RenderComponent.h>
6#include <RendererCore/Meshes/MeshComponent.h>
7#include <RendererCore/Meshes/MeshResource.h>
8#include <RendererCore/Pipeline/RenderData.h>
9
10class plJoltVisColMeshComponentManager : public plComponentManager<class plJoltVisColMeshComponent, plBlockStorageType::Compact>
11{
12public:
14
16 : SUPER(pWorld)
17 {
18 }
19
20 void Update(const plWorldModule::UpdateContext& context);
21 void EnqueueUpdate(plComponentHandle hComponent);
22
23private:
24 void ResourceEventHandler(const plResourceEvent& e);
25
26 mutable plMutex m_Mutex;
27 plDeque<plComponentHandle> m_RequireUpdate;
28
29protected:
30 virtual void Initialize() override;
31 virtual void Deinitialize() override;
32};
33
41class PL_JOLTPLUGIN_DLL plJoltVisColMeshComponent : public plRenderComponent
42{
44
46 // plComponent
47
48public:
49 virtual void SerializeComponent(plWorldWriter& inout_stream) const override;
50 virtual void DeserializeComponent(plWorldReader& inout_stream) override;
51
52protected:
53 virtual void Initialize() override;
54
56 // plRenderComponent
57
58public:
59 virtual plResult GetLocalBounds(plBoundingBoxSphere& ref_bounds, bool& ref_bAlwaysVisible, plMsgUpdateLocalBounds& ref_msg) override;
60
62 // plJoltVisColMeshComponent
63
64public:
67
68 void SetMeshFile(const char* szFile); // [ property ]
69 const char* GetMeshFile() const; // [ property ]
70
72 void SetMesh(const plJoltMeshResourceHandle& hMesh);
73 PL_ALWAYS_INLINE const plJoltMeshResourceHandle& GetMesh() const { return m_hCollisionMesh; }
74
75protected:
76 void OnMsgExtractRenderData(plMsgExtractRenderData& msg) const;
77 void CreateCollisionRenderMesh();
78
79 plJoltMeshResourceHandle m_hCollisionMesh;
80 mutable plMeshResourceHandle m_hMesh;
81};
virtual void SerializeComponent(plWorldWriter &inout_stream) const
Override this to save the current state of the component to the given stream.
Definition Component.cpp:54
virtual void DeserializeComponent(plWorldReader &inout_stream)
Override this to load the current state of the component from the given stream.
Definition Component.cpp:58
virtual void Initialize()
Can be overridden for basic initialization that depends on a valid hierarchy and position.
Definition Component.cpp:131
Definition ComponentManager.h:88
Definition Deque.h:270
Visualizes a Jolt collision mesh that is attached to the same game object.
Definition JoltVisColMeshComponent.h:42
Definition JoltVisColMeshComponent.h:11
virtual void Deinitialize() override
This method is called before the destructor. A derived type can override this method to do deinitiali...
Definition JoltVisColMeshComponent.cpp:218
virtual void Initialize() override
This method is called after the constructor. A derived type can override this method to do initializa...
Definition JoltVisColMeshComponent.cpp:206
Provides a simple mechanism for mutual exclusion to prevent multiple threads from accessing a shared ...
Definition Mutex.h:13
Base class for objects that should be rendered.
Definition RenderComponent.h:9
virtual plResult GetLocalBounds(plBoundingBoxSphere &ref_bounds, bool &ref_bAlwaysVisible, plMsgUpdateLocalBounds &ref_msg)=0
Called by plRenderComponent::OnUpdateLocalBounds(). If PL_SUCCESS is returned, bounds and bAlwaysVisi...
A world encapsulates a scene graph of game objects and various component managers and their component...
Definition World.h:22
Reads a world description from a stream. Allows to instantiate that world multiple times in different...
Definition WorldReader.h:47
Stores an entire plWorld in a stream.
Definition WorldWriter.h:13
A handle to a component.
Definition Declarations.h:138
Definition RenderData.h:116
Definition UpdateLocalBoundsMessage.h:9
These events may be sent by a specific plResource or by the plResourceManager.
Definition Declarations.h:22
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54
Definition WorldModule.h:33