Plasma Engine  2.0
Loading...
Searching...
No Matches
LodComponent.h
1#pragma once
2
3#include <RendererCore/RendererCoreDLL.h>
4
5#include <RendererCore/Components/RenderComponent.h>
6
8
11
33class PL_RENDERERCORE_DLL plLodComponent : public plRenderComponent
34{
35 PL_DECLARE_COMPONENT_TYPE(plLodComponent, plRenderComponent, plLodComponentManager);
36
38 // plComponent
39
40public:
41 virtual void SerializeComponent(plWorldWriter& inout_stream) const override;
42 virtual void DeserializeComponent(plWorldReader& inout_stream) override;
43
44protected:
45 virtual void OnActivated() override;
46 virtual void OnDeactivated() override;
47
49 // plRenderComponent
50
51public:
52 virtual plResult GetLocalBounds(plBoundingBoxSphere& out_bounds, bool& out_bAlwaysVisible, plMsgUpdateLocalBounds& ref_msg) override;
53
54
56 // plLodComponent
57
58public:
61
63 void SetShowDebugInfo(bool bShow); // [ property ]
64 bool GetShowDebugInfo() const; // [ property ]
65
67 void SetOverlapRanges(bool bOverlap); // [ property ]
68 bool GetOverlapRanges() const; // [ property ]
69
70protected:
71 void OnMsgExtractRenderData(plMsgExtractRenderData& msg) const;
72 void OnMsgComponentInternalTrigger(plMsgComponentInternalTrigger& msg);
73
74 plInt8 m_iCurLod = -1;
75 plVec3 m_vBoundsOffset = plVec3::MakeZero();
76 float m_fBoundsRadius = 1.0f;
77 plStaticArray<float, 4> m_LodThresholds;
78};
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
Definition ComponentManager.h:88
Switches child objects named 'LODn' (with n from 0 to 4) on and off, depending on how close this obje...
Definition LodComponent.h:34
Base class for objects that should be rendered.
Definition RenderComponent.h:9
virtual void OnActivated() override
This method is called when the component gets activated.
Definition RenderComponent.cpp:33
virtual void OnDeactivated() override
This method is called when the component gets deactivated.
Definition RenderComponent.cpp:38
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...
Wraps a C-style array, which has a fixed size at compile-time, with a more convenient interface.
Definition StaticArray.h:13
static plVec3Template< float > MakeZero()
Definition Vec3.h:38
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
For internal use by components to trigger some known behavior. Usually components will post this mess...
Definition TriggerMessage.h:26
Definition RenderData.h:116
Definition UpdateLocalBoundsMessage.h:9
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54