libER 0.1.4.2
ELDEN RING API library
Loading...
Searching...
No Matches
draw.hpp
Go to the documentation of this file.
1
8#pragma once
9
10#include <coresystem/task.hpp>
11
12// D3D12 resource forward declarations
13struct ID3D12Device;
14struct ID3D12RootSignature;
15struct ID3D12CommandQueue;
16
17struct D3D12_VIEWPORT;
18struct D3D12_CPU_DESCRIPTOR_HANDLE;
19
20struct tagRECT;
21
23using D3D12_RECT = tagRECT;
24using HANDLE = void*;
26
27namespace from {
28namespace GXBS {
45class GXDrawTask : private CS::CSEzTask {
46public:
57 enum scene {
58 HDR_SCENE,
59 UI_SCENE
60 };
61
63
74 CS::CSTaskGroup task_group = CS::CSTaskGroup::INVALID) override {
75 CS::CSEzTask::register_task(CS::CSTaskGroup::GraphicsStep);
76 }
77
86 virtual void draw() = 0;
87
93 scene get_scene() const noexcept {
94 return this->draw_scene;
95 }
96
102 void set_scene(scene new_scene) noexcept {
103 this->draw_scene = new_scene;
104 }
105
114 ID3D12Device& get_device() noexcept {
115 return *this->device;
116 }
117
123 ID3D12RootSignature& get_root_signature() noexcept {
124 return *this->root_signature;
125 }
126
132 ID3D12CommandQueue& get_command_queue() noexcept {
133 return *this->command_queue;
134 }
135
141 D3D12_CPU_DESCRIPTOR_HANDLE& get_render_target_view() noexcept {
142 return *this->render_target_view;
143 }
144
150 D3D12_CPU_DESCRIPTOR_HANDLE& get_depth_stencil_view() noexcept {
151 return *this->depth_stencil_view;
152 }
153
159 const D3D12_VIEWPORT& get_viewport() noexcept {
160 return *this->viewport;
161 }
162
168 const D3D12_RECT& get_scissor_rect() noexcept {
169 return *this->scissor_rect;
170 }
171
177 float get_delta_time() noexcept {
178 return this->delta_time;
179 }
180
186 int get_times_called() noexcept {
187 return this->times_called;
188 }
189
190private:
191 LIBERAPI void eztask_execute(FD4::FD4TaskData* data) override final;
192
193 friend bool liber_draw_callback(uintptr_t device_context, GXDrawTask* task);
194
195 ID3D12Device* device = nullptr;
196 ID3D12RootSignature* root_signature = nullptr;
197 ID3D12CommandQueue* command_queue = nullptr;
198 D3D12_CPU_DESCRIPTOR_HANDLE* render_target_view = nullptr;
199 D3D12_CPU_DESCRIPTOR_HANDLE* depth_stencil_view = nullptr;
200 D3D12_VIEWPORT* viewport = nullptr;
201 D3D12_RECT* scissor_rect = nullptr;
202 scene draw_scene = HDR_SCENE;
203 float delta_time = 0.0f;
204 int times_called = 0;
205};
206} // namespace GXBS
207} // namespace from
Inherit from this minimal task interface to create a custom task.
Definition task.hpp:51
virtual LIBERAPI void register_task(CSTaskGroup task_group)
Register a task to be called in a specified task group.
Abstract graphics draw task base.
Definition draw.hpp:45
scene get_scene() const noexcept
Get the scene, which selects the layer to draw on.
Definition draw.hpp:93
virtual void draw()=0
The abstract method that is called whenever the task executes after being registered by from::GXBS::G...
void set_scene(scene new_scene) noexcept
Set the scene object, which selects the layer to draw on.
Definition draw.hpp:102
int get_times_called() noexcept
Get how many times this draw task has been called.
Definition draw.hpp:186
scene
Whether the task should draw on top of the UI.
Definition draw.hpp:57
const D3D12_VIEWPORT & get_viewport() noexcept
Get the current viewport dimensions.
Definition draw.hpp:159
D3D12_CPU_DESCRIPTOR_HANDLE & get_render_target_view() noexcept
Get the render target view handle.
Definition draw.hpp:141
D3D12_CPU_DESCRIPTOR_HANDLE & get_depth_stencil_view() noexcept
Get the depth stencil view handle.
Definition draw.hpp:150
ID3D12CommandQueue & get_command_queue() noexcept
Get the ID3D12CommandQueue interface.
Definition draw.hpp:132
ID3D12RootSignature & get_root_signature() noexcept
Get the ID3D12RootSignature interface.
Definition draw.hpp:123
void register_task(CS::CSTaskGroup task_group=CS::CSTaskGroup::INVALID) override
Register the draw task, i.e. start its execution.
Definition draw.hpp:73
float get_delta_time() noexcept
Get the delta time of this frame.
Definition draw.hpp:177
ID3D12Device & get_device() noexcept
Get the ID3D12Device interface.
Definition draw.hpp:114
const D3D12_RECT & get_scissor_rect() noexcept
Get the scissor rect dimensions.
Definition draw.hpp:168
The data passed to tasks on execution.
Definition fd4_task.hpp:55
Namespace CS task interface.