Plasma Engine  2.0
Loading...
Searching...
No Matches
InstanceDataProvider.h
1#pragma once
2
3#include <RendererCore/Declarations.h>
4#include <RendererCore/Pipeline/FrameDataProvider.h>
5#include <RendererCore/Shader/ConstantBufferStorage.h>
6
7struct plPerInstanceData;
10
11struct PL_RENDERERCORE_DLL plInstanceData
12{
13 PL_DISALLOW_COPY_AND_ASSIGN(plInstanceData);
14
15public:
16 plInstanceData(plUInt32 uiMaxInstanceCount = 1024);
18
19 plGALBufferHandle m_hInstanceDataBuffer;
20
21 plConstantBufferStorageHandle m_hConstantBuffer;
22
23 void BindResources(plRenderContext* pRenderContext);
24
25 plArrayPtr<plPerInstanceData> GetInstanceData(plUInt32 uiCount, plUInt32& out_uiOffset);
26 void UpdateInstanceData(plRenderContext* pRenderContext, plUInt32 uiCount);
27
28private:
31
32 void CreateBuffer(plUInt32 uiSize);
33 void Reset();
34
35 plUInt32 m_uiBufferSize = 0;
36 plUInt32 m_uiBufferOffset = 0;
38};
39
40class PL_RENDERERCORE_DLL plInstanceDataProvider : public plFrameDataProvider<plInstanceData>
41{
42 PL_ADD_DYNAMIC_REFLECTION(plInstanceDataProvider, plFrameDataProviderBase);
43
44public:
47
48private:
49 virtual void* UpdateData(const plRenderViewContext& renderViewContext, const plExtractedRenderData& extractedData) override;
50
51 plInstanceData m_Data;
52};
This class encapsulates an array and it's size. It is recommended to use this class instead of plain ...
Definition ArrayPtr.h:37
Definition ConstantBufferStorage.h:54
Definition DynamicArray.h:81
Definition ExtractedRenderData.h:10
Definition FrameDataProvider.h:6
Definition FrameDataProvider.h:26
Definition RendererFoundationDLL.h:418
Definition InstanceDataProvider.h:41
Renders multiple instances of the same mesh.
Definition InstancedMeshComponent.h:86
Definition RenderContext.h:30
Definition InstanceDataProvider.h:12
Definition Declarations.h:51