Plasma Engine  2.0
Loading...
Searching...
No Matches
GridRenderer.h
1#pragma once
2
3#include <Core/ResourceManager/ResourceHandle.h>
4#include <RendererCore/Meshes/MeshBufferResource.h>
5#include <RendererCore/Pipeline/Extractor.h>
6#include <RendererCore/Pipeline/RenderData.h>
7#include <RendererCore/Pipeline/Renderer.h>
8
10class plSceneContext;
11
13
15{
16 PL_ADD_DYNAMIC_REFLECTION(plGridRenderData, plRenderData);
17
18public:
19 float m_fDensity;
20 plInt32 m_iFirstLine1;
21 plInt32 m_iLastLine1;
22 plInt32 m_iFirstLine2;
23 plInt32 m_iLastLine2;
24 bool m_bOrthoMode;
25 bool m_bGlobal;
26};
27
29{
30 PL_ADD_DYNAMIC_REFLECTION(plEditorGridExtractor, plExtractor);
31
32public:
33 plEditorGridExtractor(const char* szName = "EditorGridExtractor");
34
35 virtual void Extract(const plView& view, const plDynamicArray<const plGameObject*>& visibleObjects, plExtractedRenderData& ref_extractedRenderData) override;
36 virtual plResult Serialize(plStreamWriter& inout_stream) const override;
37 virtual plResult Deserialize(plStreamReader& inout_stream) override;
38
39 void SetSceneContext(plSceneContext* pSceneContext) { m_pSceneContext = pSceneContext; }
40 plSceneContext* GetSceneContext() const { return m_pSceneContext; }
41
42private:
43 plSceneContext* m_pSceneContext;
44};
45
46struct alignas(16) GridVertex
47{
48 plVec3 m_position;
49 plColorLinearUB m_color;
50};
51
53{
54 PL_ADD_DYNAMIC_REFLECTION(plGridRenderer, plRenderer);
55 PL_DISALLOW_COPY_AND_ASSIGN(plGridRenderer);
56
57public:
59
60 // plRenderer implementation
61 virtual void GetSupportedRenderDataTypes(plHybridArray<const plRTTI*, 8>& ref_types) const override;
62 virtual void GetSupportedRenderDataCategories(plHybridArray<plRenderData::Category, 8>& ref_categories) const override;
63 virtual void RenderBatch(const plRenderViewContext& renderContext, const plRenderPipelinePass* pPass, const plRenderDataBatch& batch) const override;
64
65protected:
66 void CreateVertexBuffer();
67
68 static constexpr plUInt32 s_uiBufferSize = 1024 * 8;
69 static constexpr plUInt32 s_uiLineVerticesPerBatch = s_uiBufferSize / sizeof(GridVertex);
70
71 plShaderResourceHandle m_hShader;
72 plGALBufferHandle m_hVertexBuffer;
73 plVertexDeclarationInfo m_VertexDeclarationInfo;
75
76private:
77 void CreateGrid(const plGridRenderData& rd) const;
78};
A 8bit per channel unsigned normalized (values interpreted as 0-1) color storage format that represen...
Definition Color8UNorm.h:61
Definition DynamicArray.h:81
Definition GridRenderer.h:29
Definition ExtractedRenderData.h:10
Definition Extractor.h:9
Definition RendererFoundationDLL.h:418
Definition GridRenderer.h:15
Definition GridRenderer.h:53
A hybrid array uses in-place storage to handle the first few elements without any allocation....
Definition HybridArray.h:12
Definition RenderDataBatch.h:6
Base class for all render data. Render data must contain all information that is needed to render the...
Definition RenderData.h:14
Definition RenderPipelinePass.h:26
This is the base class for types that handle rendering of different object types.
Definition Renderer.h:9
Definition SceneContext.h:25
Interface for binary in (read) streams.
Definition Stream.h:22
Interface for binary out (write) streams.
Definition Stream.h:107
Encapsulates a view on the given world through the given camera and rendered with the specified Rende...
Definition View.h:21
Definition GridRenderer.h:47
Definition Declarations.h:51
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54
Definition MeshBufferResource.h:24