SleakEngine
0.1.0
C++23 multi-backend game engine
Toggle main menu visibility
Loading...
Searching...
No Matches
ConstantBuffer.hpp
Go to the documentation of this file.
1
#ifndef _CONSTANTBUFFER_H_
2
#define _CONSTANTBUFFER_H_
3
4
#include <
Math/Matrix.hpp
>
5
#include <
Math/Color.hpp
>
6
#include <cstdint>
7
8
namespace
Sleak
{
9
namespace
RenderEngine
{
10
11
/// Well-known constant buffer slot identifiers.
12
enum class
CBIds
{
13
Transformation
= 0,
14
Material
= 1,
15
Lighting
= 2
16
};
17
18
// Per-light GPU entry (64 bytes = 4 x 16-byte rows)
19
/// One light's packed GPU representation, laid out for std140/cbuffer alignment.
20
struct
alignas
(16)
LightGPUEntry
{
21
// Row 0: Position.xyz + Type
22
float
PositionX
,
PositionY
,
PositionZ
;
23
uint32_t
Type
;
// 0=dir, 1=point, 2=spot, 3=area
24
25
// Row 1: Direction.xyz + Intensity
26
float
DirectionX
,
DirectionY
,
DirectionZ
;
27
float
Intensity
;
28
29
// Row 2: Color.rgb + Range
30
float
ColorR
,
ColorG
,
ColorB
;
31
float
Range
;
32
33
// Row 3: SpotInnerCos + SpotOuterCos + AreaWidth + AreaHeight
34
float
SpotInnerCos
;
35
float
SpotOuterCos
;
36
float
AreaWidth
;
37
float
AreaHeight
;
38
};
39
40
// Full lighting constant buffer (64 + 64*16 + 32 trailing = 1120 bytes).
41
// The trailing fog gradient + height-fog block is appended AFTER the
42
// Lights[] array so that older shader UBO declarations (which stop at
43
// Lights[]) still read a valid prefix. Don't reorder.
44
static
constexpr
uint32_t
MAX_LIGHTS
= 16;
45
46
/// Full per-frame lighting UBO: camera, ambient, fog, and the packed light array.
47
struct
alignas
(16)
LightCBData
{
48
// Header Row 0: CameraPos.xyz + NumActiveLights
49
float
CameraPosX
,
CameraPosY
,
CameraPosZ
;
50
uint32_t
NumActiveLights
;
51
52
// Header Row 1: AmbientColor.rgb + AmbientIntensity
53
float
AmbientR
,
AmbientG
,
AmbientB
;
54
float
AmbientIntensity
;
55
56
// Header Row 2: Fog color (HORIZON)
57
float
FogColorR
,
FogColorG
,
FogColorB
,
FogColorA
;
58
59
// Header Row 3: Fog distances + reserved
60
float
FogStart
,
FogEnd
;
61
float
_reserved
[2];
62
63
// Per-light array
64
LightGPUEntry
Lights
[
MAX_LIGHTS
];
65
66
// ---- Trailing sky-matched + height fog block ----
67
float
FogColorZenith
[4];
// ZENITH color of fog gradient
68
float
HeightFogTop
;
// world Y above which height fog goes to 0
69
float
HeightFogDensity
;
// max density at low elevations [0..1]
70
float
HeightFogFalloff
;
// exponential falloff per world unit
71
float
HeightFogEnabled
;
// 0 = off, 1 = on
72
};
73
74
/// Interface for a CPU-side payload that can be uploaded to a GPU constant buffer.
75
struct
ConstantBuffer
{
76
public
:
77
virtual
void
*
GetData
()
const
= 0;
78
79
virtual
uint16_t
GetSize
()
const
= 0;
80
};
81
82
/// Per-draw world-view-projection and world matrices.
83
struct
alignas
(16)
TransformBuffer
:
public
ConstantBuffer
{
84
85
/// Composes WVP from world/view/proj and keeps World separately for lighting.
86
TransformBuffer
(
const
Sleak::Math::Matrix4
& world,
87
const
Sleak::Math::Matrix4
& view,
88
const
Sleak::Math::Matrix4
& proj)
89
: WVP(world * view * proj), World(world) {
90
}
91
92
/// Takes a pre-composed WVP with an identity world matrix (e.g. skybox, UI).
93
explicit
TransformBuffer
(
const
Sleak::Math::Matrix4
& mvp)
94
: WVP(mvp), World(
Sleak
::
Math
::
Matrix4
::Identity()) {
95
}
96
97
virtual
void
*
GetData
()
const override
{
98
return
(
void
*) &WVP;
99
}
100
101
virtual
uint16_t
GetSize
()
const override
{
102
return
sizeof
(
Sleak::Math::Matrix4
) * 2;
103
}
104
105
private
:
106
Sleak::Math::Matrix4
WVP;
107
Sleak::Math::Matrix4
World;
108
};
109
110
// GPU-aligned POD struct for material constant buffer data.
111
// Total: 128 bytes (8 x 16-byte rows), matches all shader backends.
112
/// Packed PBR material parameters uploaded to the material constant buffer.
113
struct
alignas
(16)
MaterialGPUData
{
114
// Row 0: Texture presence flags (16 bytes)
115
uint32_t
HasDiffuseMap
;
116
uint32_t
HasNormalMap
;
117
uint32_t
HasSpecularMap
;
118
uint32_t
HasRoughnessMap
;
119
120
// Row 1: More texture flags (16 bytes)
121
uint32_t
HasMetallicMap
;
122
uint32_t
HasAOMap
;
123
uint32_t
HasEmissiveMap
;
124
uint32_t
_pad0
;
125
126
// Row 2: Diffuse/Albedo color RGBA (16 bytes)
127
float
DiffuseR
,
DiffuseG
,
DiffuseB
,
DiffuseA
;
128
129
// Row 3: Specular color RGB + Shininess (16 bytes)
130
float
SpecularR
,
SpecularG
,
SpecularB
;
131
float
Shininess
;
132
133
// Row 4: Emissive color RGB + Intensity (16 bytes)
134
float
EmissiveR
,
EmissiveG
,
EmissiveB
;
135
float
EmissiveIntensity
;
136
137
// Row 5: PBR factors (16 bytes)
138
float
Metallic
;
139
float
Roughness
;
140
float
AO
;
141
float
NormalIntensity
;
142
143
// Row 6: UV transform (16 bytes)
144
float
TilingX
,
TilingY
;
145
float
OffsetX
,
OffsetY
;
146
147
// Row 7: Alpha properties (16 bytes)
148
float
Opacity
;
149
float
AlphaCutoff
;
150
float
_pad1
,
_pad2
;
151
};
152
153
/// ConstantBuffer wrapper around MaterialGPUData.
154
struct
alignas
(16)
MaterialBuffer
:
public
ConstantBuffer
{
155
156
MaterialBuffer
() :
gpuData
{} {}
157
158
MaterialBuffer
(
const
MaterialGPUData
& data)
159
:
gpuData
(data) {}
160
161
virtual
void
*
GetData
()
const override
{
162
return
(
void
*) &
gpuData
;
163
}
164
165
virtual
uint16_t
GetSize
()
const override
{
166
return
sizeof
(
MaterialGPUData
);
167
}
168
169
MaterialGPUData
gpuData
;
170
};
171
172
// GPU-aligned struct for light + shadow data, bound via UBO (set 2, binding 0)
173
// NOTE: trailing fog/sky fields are appended in fixed order — do not
174
// reorder. Shader UBO declarations may stop short of the full struct
175
// (size mismatch in that direction is fine for std140/cbuffer reads).
176
/// Shadow-pass UBO: light/shadow parameters, fog, and extra fill lights (set 2, binding 0).
177
struct
alignas
(16)
ShadowLightUBO
{
178
float
LightDir
[4];
// xyz + normalBias
179
float
LightColor
[4];
// rgb + intensity
180
float
Ambient
[4];
// rgb + intensity
181
float
CameraPos
[4];
// xyz + sceneClock
182
float
LightVP
[16];
// mat4 (light view-projection)
183
float
ShadowBias
;
184
float
ShadowStrength
;
185
float
ShadowTexelSize
;
186
float
LightSize
;
// world-space light size for PCSS penumbra
187
float
FogColor
[4];
// rgb + a — HORIZON color of the fog gradient
188
float
FogStart
;
// distance where fog begins
189
float
FogEnd
;
// distance where fog fully obscures
190
float
_fogPad
[2];
191
float
FogColorZenith
[4];
// rgb + pad — ZENITH color of the fog gradient
192
float
HeightFogTop
;
// world Y above which height fog density goes to 0
193
float
HeightFogDensity
;
// max density at low elevations [0..1]
194
float
HeightFogFalloff
;
// exponential falloff per world unit (e^-(top-y)*falloff)
195
float
HeightFogEnabled
;
// 0 = off, 1 = on
196
197
// Extra directional lights (fill, rim, etc.) — no shadow casting
198
float
ExtraLightDir
[3][4];
// xyz + unused (w=0)
199
float
ExtraLightColor
[3][4];
// rgb + intensity
200
uint32_t
NumExtraLights
;
// 0-3
201
float
_extraPad
[3];
202
203
// NDC -> shadow clip, composed on CPU (InvViewProj * LightVP).
204
// Shadow coords must use this — a per-fragment round trip
205
// through reconstructed world position shimmers under rotation.
206
float
NdcToShadow
[16];
207
};
208
209
// GPU-aligned POD struct for post-process settings constant buffer.
210
// Total: 16 bytes (1 x 16-byte row).
211
/// Tonemapping/exposure settings uploaded to the post-process pass.
212
struct
alignas
(16)
PostProcessGPUData
{
213
float
Exposure
;
// HDR exposure multiplier (default 1.0)
214
float
Gamma
;
// Gamma correction exponent (default 2.2)
215
uint32_t
TonemapEnabled
;
// 0 = passthrough, 1 = ACES tonemap
216
uint32_t
_ppPad0
;
217
};
218
219
// GPU-aligned POD struct for SSAO settings constant buffer.
220
// Total: 64 bytes (4 x 16-byte rows).
221
static
constexpr
uint32_t
SSAO_KERNEL_SIZE
= 64;
222
223
/// SSAO pass parameters: kernel size, radius/bias/power, and screen/near-far metrics.
224
struct
alignas
(16)
SSAOSettingsGPUData
{
225
// Row 0
226
float
Radius
;
// Sample hemisphere radius (default 0.5)
227
float
Bias
;
// Depth bias to prevent self-occlusion (default 0.025)
228
float
Power
;
// AO power exponent (default 2.0)
229
uint32_t
KernelSize
;
// Number of samples (default 64)
230
231
// Row 1
232
float
ScreenWidth
;
233
float
ScreenHeight
;
234
uint32_t
SSAOEnabled
;
// 0 = disabled, 1 = enabled
235
uint32_t
_ssaoPad0
;
236
237
// Row 2: near/far plane for linearizing depth
238
float
NearPlane
;
239
float
FarPlane
;
240
float
_ssaoPad1
,
_ssaoPad2
;
241
242
// Row 3: reserved
243
float
_ssaoPad3
[4];
244
};
245
246
// GPU-aligned POD struct for PCSS shadow settings (used in PBR shader, DX11/OpenGL).
247
// Total: 96 bytes (6 x 16-byte rows).
248
/// PCSS soft-shadow parameters for the DX11/OpenGL PBR shader path.
249
struct
alignas
(16)
PCSSShadowGPUData
{
250
// Row 0-3: Light view-projection matrix (64 bytes)
251
float
LightVP
[16];
252
253
// Row 4: Shadow parameters
254
float
ShadowBias
;
255
float
ShadowStrength
;
256
float
ShadowTexelSize
;
257
float
ShadowLightSize
;
258
259
// Row 5: Toggles
260
uint32_t
PCSSEnabled
;
261
uint32_t
ShadowMapEnabled
;
262
float
_shadowPad0
,
_shadowPad1
;
263
264
// Row 6-9: NDC -> shadow clip (see ShadowLightUBO::NdcToShadow)
265
float
NdcToShadow
[16];
266
};
267
268
// GPU-aligned POD struct for SSAO composite settings (used in PBR shader).
269
// Total: 16 bytes (1 x 16-byte row).
270
/// Controls whether the forward PBR shader multiplies in the SSAO texture.
271
struct
alignas
(16)
SSAOCompositeGPUData
{
272
uint32_t
SSAOCompositeEnabled
;
// 0 = disabled, 1 = multiply AO by SSAO texture
273
float
ScreenWidth
;
274
float
ScreenHeight
;
275
float
_ssaoCompPad
;
276
};
277
278
// GPU-aligned POD struct for IBL settings constant buffer.
279
// Total: 16 bytes (1 x 16-byte row).
280
/// Image-based lighting toggle, intensity, and prefiltered-map LOD range.
281
struct
alignas
(16)
IBLSettingsGPUData
{
282
uint32_t
IBLEnabled
;
// 0 = disabled, 1 = enabled
283
float
IBLIntensity
;
// multiplier for IBL contribution (default 1.0)
284
float
MaxReflectionLOD
;
// max mip level for prefiltered env map (default 4.0)
285
uint32_t
_iblPad0
;
286
};
287
288
/// ConstantBuffer wrapper around LightCBData.
289
struct
alignas
(16)
LightBuffer
:
public
ConstantBuffer
{
290
LightBuffer
() :
gpuData
{} {}
291
LightBuffer
(
const
LightCBData
& data)
292
:
gpuData
(data) {}
293
294
virtual
void
*
GetData
()
const override
{
295
return
(
void
*)&
gpuData
;
296
}
297
298
virtual
uint16_t
GetSize
()
const override
{
299
return
sizeof
(
LightCBData
);
300
}
301
302
LightCBData
gpuData
;
303
};
304
305
// Per-frame CB for the deferred lighting pass (bound at slot 3).
306
// Provides inverse view-projection for world-position reconstruction from depth.
307
// Total: 80 bytes (5 x 16-byte rows).
308
/// Per-frame deferred lighting pass CB: inverse view-projection plus screen/near-far metrics.
309
struct
alignas
(16)
DeferredCBData
{
310
// Rows 0-3: Inverse view-projection matrix (64 bytes)
311
float
InvViewProj
[16];
312
313
// Row 4: Screen size + near/far planes
314
float
ScreenWidth
;
315
float
ScreenHeight
;
316
float
NearPlane
;
317
float
FarPlane
;
318
};
319
320
/// ConstantBuffer wrapper around DeferredCBData.
321
struct
alignas
(16)
DeferredBuffer
:
public
ConstantBuffer
{
322
DeferredBuffer
() :
gpuData
{} {}
323
DeferredBuffer
(
const
DeferredCBData
& data) :
gpuData
(data) {}
324
325
virtual
void
*
GetData
()
const override
{
return
(
void
*)&
gpuData
; }
326
virtual
uint16_t
GetSize
()
const override
{
return
sizeof
(
DeferredCBData
); }
327
328
DeferredCBData
gpuData
;
329
};
330
}
331
}
332
333
#endif
Color.hpp
Matrix.hpp
Sleak::Material
Definition
Material.hpp:90
Sleak::Math
Vectors, matrices, quaternions, colors, AABBs, and random helpers.
Definition
GameObject.hpp:13
Sleak::Math::Matrix4
Matrix< float, 4, 4 > Matrix4
Definition
Matrix.hpp:413
Sleak::RenderEngine
Backend-facing rendering layer shared by the four graphics backends.
Definition
Application.hpp:60
Sleak::RenderEngine::SSAO_KERNEL_SIZE
static constexpr uint32_t SSAO_KERNEL_SIZE
Definition
ConstantBuffer.hpp:221
Sleak::RenderEngine::MAX_LIGHTS
static constexpr uint32_t MAX_LIGHTS
Definition
ConstantBuffer.hpp:44
Sleak::RenderEngine::CBIds
CBIds
Well-known constant buffer slot identifiers.
Definition
ConstantBuffer.hpp:12
Sleak::RenderEngine::CBIds::Lighting
@ Lighting
Definition
ConstantBuffer.hpp:15
Sleak::RenderEngine::CBIds::Transformation
@ Transformation
Definition
ConstantBuffer.hpp:13
Sleak
Root namespace for everything the engine exposes.
Definition
Camera.hpp:10
Sleak::RenderEngine::ConstantBuffer
Interface for a CPU-side payload that can be uploaded to a GPU constant buffer.
Definition
ConstantBuffer.hpp:75
Sleak::RenderEngine::ConstantBuffer::GetSize
virtual uint16_t GetSize() const =0
Sleak::RenderEngine::ConstantBuffer::GetData
virtual void * GetData() const =0
Sleak::RenderEngine::DeferredBuffer::GetSize
virtual uint16_t GetSize() const override
Definition
ConstantBuffer.hpp:326
Sleak::RenderEngine::DeferredBuffer::gpuData
DeferredCBData gpuData
Definition
ConstantBuffer.hpp:328
Sleak::RenderEngine::DeferredBuffer::DeferredBuffer
DeferredBuffer()
Definition
ConstantBuffer.hpp:322
Sleak::RenderEngine::DeferredBuffer::DeferredBuffer
DeferredBuffer(const DeferredCBData &data)
Definition
ConstantBuffer.hpp:323
Sleak::RenderEngine::DeferredBuffer::GetData
virtual void * GetData() const override
Definition
ConstantBuffer.hpp:325
Sleak::RenderEngine::DeferredCBData
Per-frame deferred lighting pass CB: inverse view-projection plus screen/near-far metrics.
Definition
ConstantBuffer.hpp:309
Sleak::RenderEngine::DeferredCBData::NearPlane
float NearPlane
Definition
ConstantBuffer.hpp:316
Sleak::RenderEngine::DeferredCBData::InvViewProj
float InvViewProj[16]
Definition
ConstantBuffer.hpp:311
Sleak::RenderEngine::DeferredCBData::FarPlane
float FarPlane
Definition
ConstantBuffer.hpp:317
Sleak::RenderEngine::DeferredCBData::ScreenWidth
float ScreenWidth
Definition
ConstantBuffer.hpp:314
Sleak::RenderEngine::DeferredCBData::ScreenHeight
float ScreenHeight
Definition
ConstantBuffer.hpp:315
Sleak::RenderEngine::IBLSettingsGPUData
Image-based lighting toggle, intensity, and prefiltered-map LOD range.
Definition
ConstantBuffer.hpp:281
Sleak::RenderEngine::IBLSettingsGPUData::_iblPad0
uint32_t _iblPad0
Definition
ConstantBuffer.hpp:285
Sleak::RenderEngine::IBLSettingsGPUData::IBLIntensity
float IBLIntensity
Definition
ConstantBuffer.hpp:283
Sleak::RenderEngine::IBLSettingsGPUData::IBLEnabled
uint32_t IBLEnabled
Definition
ConstantBuffer.hpp:282
Sleak::RenderEngine::IBLSettingsGPUData::MaxReflectionLOD
float MaxReflectionLOD
Definition
ConstantBuffer.hpp:284
Sleak::RenderEngine::LightBuffer::GetSize
virtual uint16_t GetSize() const override
Definition
ConstantBuffer.hpp:298
Sleak::RenderEngine::LightBuffer::gpuData
LightCBData gpuData
Definition
ConstantBuffer.hpp:302
Sleak::RenderEngine::LightBuffer::LightBuffer
LightBuffer(const LightCBData &data)
Definition
ConstantBuffer.hpp:291
Sleak::RenderEngine::LightBuffer::LightBuffer
LightBuffer()
Definition
ConstantBuffer.hpp:290
Sleak::RenderEngine::LightBuffer::GetData
virtual void * GetData() const override
Definition
ConstantBuffer.hpp:294
Sleak::RenderEngine::LightCBData
Full per-frame lighting UBO: camera, ambient, fog, and the packed light array.
Definition
ConstantBuffer.hpp:47
Sleak::RenderEngine::LightCBData::HeightFogDensity
float HeightFogDensity
Definition
ConstantBuffer.hpp:69
Sleak::RenderEngine::LightCBData::CameraPosZ
float CameraPosZ
Definition
ConstantBuffer.hpp:49
Sleak::RenderEngine::LightCBData::FogStart
float FogStart
Definition
ConstantBuffer.hpp:60
Sleak::RenderEngine::LightCBData::AmbientB
float AmbientB
Definition
ConstantBuffer.hpp:53
Sleak::RenderEngine::LightCBData::FogColorB
float FogColorB
Definition
ConstantBuffer.hpp:57
Sleak::RenderEngine::LightCBData::HeightFogFalloff
float HeightFogFalloff
Definition
ConstantBuffer.hpp:70
Sleak::RenderEngine::LightCBData::FogColorZenith
float FogColorZenith[4]
Definition
ConstantBuffer.hpp:67
Sleak::RenderEngine::LightCBData::_reserved
float _reserved[2]
Definition
ConstantBuffer.hpp:61
Sleak::RenderEngine::LightCBData::FogColorG
float FogColorG
Definition
ConstantBuffer.hpp:57
Sleak::RenderEngine::LightCBData::FogColorA
float FogColorA
Definition
ConstantBuffer.hpp:57
Sleak::RenderEngine::LightCBData::CameraPosY
float CameraPosY
Definition
ConstantBuffer.hpp:49
Sleak::RenderEngine::LightCBData::AmbientIntensity
float AmbientIntensity
Definition
ConstantBuffer.hpp:54
Sleak::RenderEngine::LightCBData::FogColorR
float FogColorR
Definition
ConstantBuffer.hpp:57
Sleak::RenderEngine::LightCBData::NumActiveLights
uint32_t NumActiveLights
Definition
ConstantBuffer.hpp:50
Sleak::RenderEngine::LightCBData::HeightFogEnabled
float HeightFogEnabled
Definition
ConstantBuffer.hpp:71
Sleak::RenderEngine::LightCBData::HeightFogTop
float HeightFogTop
Definition
ConstantBuffer.hpp:68
Sleak::RenderEngine::LightCBData::AmbientG
float AmbientG
Definition
ConstantBuffer.hpp:53
Sleak::RenderEngine::LightCBData::FogEnd
float FogEnd
Definition
ConstantBuffer.hpp:60
Sleak::RenderEngine::LightCBData::AmbientR
float AmbientR
Definition
ConstantBuffer.hpp:53
Sleak::RenderEngine::LightCBData::Lights
LightGPUEntry Lights[MAX_LIGHTS]
Definition
ConstantBuffer.hpp:64
Sleak::RenderEngine::LightCBData::CameraPosX
float CameraPosX
Definition
ConstantBuffer.hpp:49
Sleak::RenderEngine::LightGPUEntry
One light's packed GPU representation, laid out for std140/cbuffer alignment.
Definition
ConstantBuffer.hpp:20
Sleak::RenderEngine::LightGPUEntry::SpotInnerCos
float SpotInnerCos
Definition
ConstantBuffer.hpp:34
Sleak::RenderEngine::LightGPUEntry::Range
float Range
Definition
ConstantBuffer.hpp:31
Sleak::RenderEngine::LightGPUEntry::AreaHeight
float AreaHeight
Definition
ConstantBuffer.hpp:37
Sleak::RenderEngine::LightGPUEntry::AreaWidth
float AreaWidth
Definition
ConstantBuffer.hpp:36
Sleak::RenderEngine::LightGPUEntry::Type
uint32_t Type
Definition
ConstantBuffer.hpp:23
Sleak::RenderEngine::LightGPUEntry::DirectionY
float DirectionY
Definition
ConstantBuffer.hpp:26
Sleak::RenderEngine::LightGPUEntry::PositionY
float PositionY
Definition
ConstantBuffer.hpp:22
Sleak::RenderEngine::LightGPUEntry::Intensity
float Intensity
Definition
ConstantBuffer.hpp:27
Sleak::RenderEngine::LightGPUEntry::PositionX
float PositionX
Definition
ConstantBuffer.hpp:22
Sleak::RenderEngine::LightGPUEntry::ColorB
float ColorB
Definition
ConstantBuffer.hpp:30
Sleak::RenderEngine::LightGPUEntry::DirectionX
float DirectionX
Definition
ConstantBuffer.hpp:26
Sleak::RenderEngine::LightGPUEntry::DirectionZ
float DirectionZ
Definition
ConstantBuffer.hpp:26
Sleak::RenderEngine::LightGPUEntry::ColorG
float ColorG
Definition
ConstantBuffer.hpp:30
Sleak::RenderEngine::LightGPUEntry::SpotOuterCos
float SpotOuterCos
Definition
ConstantBuffer.hpp:35
Sleak::RenderEngine::LightGPUEntry::ColorR
float ColorR
Definition
ConstantBuffer.hpp:30
Sleak::RenderEngine::LightGPUEntry::PositionZ
float PositionZ
Definition
ConstantBuffer.hpp:22
Sleak::RenderEngine::MaterialBuffer::MaterialBuffer
MaterialBuffer(const MaterialGPUData &data)
Definition
ConstantBuffer.hpp:158
Sleak::RenderEngine::MaterialBuffer::GetData
virtual void * GetData() const override
Definition
ConstantBuffer.hpp:161
Sleak::RenderEngine::MaterialBuffer::MaterialBuffer
MaterialBuffer()
Definition
ConstantBuffer.hpp:156
Sleak::RenderEngine::MaterialBuffer::gpuData
MaterialGPUData gpuData
Definition
ConstantBuffer.hpp:169
Sleak::RenderEngine::MaterialBuffer::GetSize
virtual uint16_t GetSize() const override
Definition
ConstantBuffer.hpp:165
Sleak::RenderEngine::MaterialGPUData
Packed PBR material parameters uploaded to the material constant buffer.
Definition
ConstantBuffer.hpp:113
Sleak::RenderEngine::MaterialGPUData::DiffuseA
float DiffuseA
Definition
ConstantBuffer.hpp:127
Sleak::RenderEngine::MaterialGPUData::Roughness
float Roughness
Definition
ConstantBuffer.hpp:139
Sleak::RenderEngine::MaterialGPUData::SpecularG
float SpecularG
Definition
ConstantBuffer.hpp:130
Sleak::RenderEngine::MaterialGPUData::TilingX
float TilingX
Definition
ConstantBuffer.hpp:144
Sleak::RenderEngine::MaterialGPUData::EmissiveG
float EmissiveG
Definition
ConstantBuffer.hpp:134
Sleak::RenderEngine::MaterialGPUData::Opacity
float Opacity
Definition
ConstantBuffer.hpp:148
Sleak::RenderEngine::MaterialGPUData::HasSpecularMap
uint32_t HasSpecularMap
Definition
ConstantBuffer.hpp:117
Sleak::RenderEngine::MaterialGPUData::NormalIntensity
float NormalIntensity
Definition
ConstantBuffer.hpp:141
Sleak::RenderEngine::MaterialGPUData::TilingY
float TilingY
Definition
ConstantBuffer.hpp:144
Sleak::RenderEngine::MaterialGPUData::HasAOMap
uint32_t HasAOMap
Definition
ConstantBuffer.hpp:122
Sleak::RenderEngine::MaterialGPUData::OffsetX
float OffsetX
Definition
ConstantBuffer.hpp:145
Sleak::RenderEngine::MaterialGPUData::DiffuseB
float DiffuseB
Definition
ConstantBuffer.hpp:127
Sleak::RenderEngine::MaterialGPUData::Shininess
float Shininess
Definition
ConstantBuffer.hpp:131
Sleak::RenderEngine::MaterialGPUData::OffsetY
float OffsetY
Definition
ConstantBuffer.hpp:145
Sleak::RenderEngine::MaterialGPUData::HasRoughnessMap
uint32_t HasRoughnessMap
Definition
ConstantBuffer.hpp:118
Sleak::RenderEngine::MaterialGPUData::EmissiveR
float EmissiveR
Definition
ConstantBuffer.hpp:134
Sleak::RenderEngine::MaterialGPUData::HasDiffuseMap
uint32_t HasDiffuseMap
Definition
ConstantBuffer.hpp:115
Sleak::RenderEngine::MaterialGPUData::_pad2
float _pad2
Definition
ConstantBuffer.hpp:150
Sleak::RenderEngine::MaterialGPUData::HasMetallicMap
uint32_t HasMetallicMap
Definition
ConstantBuffer.hpp:121
Sleak::RenderEngine::MaterialGPUData::AlphaCutoff
float AlphaCutoff
Definition
ConstantBuffer.hpp:149
Sleak::RenderEngine::MaterialGPUData::AO
float AO
Definition
ConstantBuffer.hpp:140
Sleak::RenderEngine::MaterialGPUData::SpecularB
float SpecularB
Definition
ConstantBuffer.hpp:130
Sleak::RenderEngine::MaterialGPUData::EmissiveIntensity
float EmissiveIntensity
Definition
ConstantBuffer.hpp:135
Sleak::RenderEngine::MaterialGPUData::SpecularR
float SpecularR
Definition
ConstantBuffer.hpp:130
Sleak::RenderEngine::MaterialGPUData::_pad1
float _pad1
Definition
ConstantBuffer.hpp:150
Sleak::RenderEngine::MaterialGPUData::_pad0
uint32_t _pad0
Definition
ConstantBuffer.hpp:124
Sleak::RenderEngine::MaterialGPUData::HasEmissiveMap
uint32_t HasEmissiveMap
Definition
ConstantBuffer.hpp:123
Sleak::RenderEngine::MaterialGPUData::HasNormalMap
uint32_t HasNormalMap
Definition
ConstantBuffer.hpp:116
Sleak::RenderEngine::MaterialGPUData::DiffuseG
float DiffuseG
Definition
ConstantBuffer.hpp:127
Sleak::RenderEngine::MaterialGPUData::DiffuseR
float DiffuseR
Definition
ConstantBuffer.hpp:127
Sleak::RenderEngine::MaterialGPUData::EmissiveB
float EmissiveB
Definition
ConstantBuffer.hpp:134
Sleak::RenderEngine::MaterialGPUData::Metallic
float Metallic
Definition
ConstantBuffer.hpp:138
Sleak::RenderEngine::PCSSShadowGPUData
PCSS soft-shadow parameters for the DX11/OpenGL PBR shader path.
Definition
ConstantBuffer.hpp:249
Sleak::RenderEngine::PCSSShadowGPUData::ShadowStrength
float ShadowStrength
Definition
ConstantBuffer.hpp:255
Sleak::RenderEngine::PCSSShadowGPUData::ShadowLightSize
float ShadowLightSize
Definition
ConstantBuffer.hpp:257
Sleak::RenderEngine::PCSSShadowGPUData::NdcToShadow
float NdcToShadow[16]
Definition
ConstantBuffer.hpp:265
Sleak::RenderEngine::PCSSShadowGPUData::LightVP
float LightVP[16]
Definition
ConstantBuffer.hpp:251
Sleak::RenderEngine::PCSSShadowGPUData::ShadowMapEnabled
uint32_t ShadowMapEnabled
Definition
ConstantBuffer.hpp:261
Sleak::RenderEngine::PCSSShadowGPUData::_shadowPad1
float _shadowPad1
Definition
ConstantBuffer.hpp:262
Sleak::RenderEngine::PCSSShadowGPUData::PCSSEnabled
uint32_t PCSSEnabled
Definition
ConstantBuffer.hpp:260
Sleak::RenderEngine::PCSSShadowGPUData::_shadowPad0
float _shadowPad0
Definition
ConstantBuffer.hpp:262
Sleak::RenderEngine::PCSSShadowGPUData::ShadowTexelSize
float ShadowTexelSize
Definition
ConstantBuffer.hpp:256
Sleak::RenderEngine::PCSSShadowGPUData::ShadowBias
float ShadowBias
Definition
ConstantBuffer.hpp:254
Sleak::RenderEngine::PostProcessGPUData
Tonemapping/exposure settings uploaded to the post-process pass.
Definition
ConstantBuffer.hpp:212
Sleak::RenderEngine::PostProcessGPUData::Gamma
float Gamma
Definition
ConstantBuffer.hpp:214
Sleak::RenderEngine::PostProcessGPUData::Exposure
float Exposure
Definition
ConstantBuffer.hpp:213
Sleak::RenderEngine::PostProcessGPUData::TonemapEnabled
uint32_t TonemapEnabled
Definition
ConstantBuffer.hpp:215
Sleak::RenderEngine::PostProcessGPUData::_ppPad0
uint32_t _ppPad0
Definition
ConstantBuffer.hpp:216
Sleak::RenderEngine::SSAOCompositeGPUData
Controls whether the forward PBR shader multiplies in the SSAO texture.
Definition
ConstantBuffer.hpp:271
Sleak::RenderEngine::SSAOCompositeGPUData::ScreenWidth
float ScreenWidth
Definition
ConstantBuffer.hpp:273
Sleak::RenderEngine::SSAOCompositeGPUData::_ssaoCompPad
float _ssaoCompPad
Definition
ConstantBuffer.hpp:275
Sleak::RenderEngine::SSAOCompositeGPUData::ScreenHeight
float ScreenHeight
Definition
ConstantBuffer.hpp:274
Sleak::RenderEngine::SSAOCompositeGPUData::SSAOCompositeEnabled
uint32_t SSAOCompositeEnabled
Definition
ConstantBuffer.hpp:272
Sleak::RenderEngine::SSAOSettingsGPUData
SSAO pass parameters: kernel size, radius/bias/power, and screen/near-far metrics.
Definition
ConstantBuffer.hpp:224
Sleak::RenderEngine::SSAOSettingsGPUData::ScreenHeight
float ScreenHeight
Definition
ConstantBuffer.hpp:233
Sleak::RenderEngine::SSAOSettingsGPUData::_ssaoPad0
uint32_t _ssaoPad0
Definition
ConstantBuffer.hpp:235
Sleak::RenderEngine::SSAOSettingsGPUData::ScreenWidth
float ScreenWidth
Definition
ConstantBuffer.hpp:232
Sleak::RenderEngine::SSAOSettingsGPUData::NearPlane
float NearPlane
Definition
ConstantBuffer.hpp:238
Sleak::RenderEngine::SSAOSettingsGPUData::_ssaoPad1
float _ssaoPad1
Definition
ConstantBuffer.hpp:240
Sleak::RenderEngine::SSAOSettingsGPUData::SSAOEnabled
uint32_t SSAOEnabled
Definition
ConstantBuffer.hpp:234
Sleak::RenderEngine::SSAOSettingsGPUData::Bias
float Bias
Definition
ConstantBuffer.hpp:227
Sleak::RenderEngine::SSAOSettingsGPUData::FarPlane
float FarPlane
Definition
ConstantBuffer.hpp:239
Sleak::RenderEngine::SSAOSettingsGPUData::_ssaoPad2
float _ssaoPad2
Definition
ConstantBuffer.hpp:240
Sleak::RenderEngine::SSAOSettingsGPUData::KernelSize
uint32_t KernelSize
Definition
ConstantBuffer.hpp:229
Sleak::RenderEngine::SSAOSettingsGPUData::_ssaoPad3
float _ssaoPad3[4]
Definition
ConstantBuffer.hpp:243
Sleak::RenderEngine::SSAOSettingsGPUData::Power
float Power
Definition
ConstantBuffer.hpp:228
Sleak::RenderEngine::SSAOSettingsGPUData::Radius
float Radius
Definition
ConstantBuffer.hpp:226
Sleak::RenderEngine::ShadowLightUBO
Shadow-pass UBO: light/shadow parameters, fog, and extra fill lights (set 2, binding 0).
Definition
ConstantBuffer.hpp:177
Sleak::RenderEngine::ShadowLightUBO::ShadowBias
float ShadowBias
Definition
ConstantBuffer.hpp:183
Sleak::RenderEngine::ShadowLightUBO::FogStart
float FogStart
Definition
ConstantBuffer.hpp:188
Sleak::RenderEngine::ShadowLightUBO::LightSize
float LightSize
Definition
ConstantBuffer.hpp:186
Sleak::RenderEngine::ShadowLightUBO::ExtraLightDir
float ExtraLightDir[3][4]
Definition
ConstantBuffer.hpp:198
Sleak::RenderEngine::ShadowLightUBO::FogColor
float FogColor[4]
Definition
ConstantBuffer.hpp:187
Sleak::RenderEngine::ShadowLightUBO::FogEnd
float FogEnd
Definition
ConstantBuffer.hpp:189
Sleak::RenderEngine::ShadowLightUBO::ShadowTexelSize
float ShadowTexelSize
Definition
ConstantBuffer.hpp:185
Sleak::RenderEngine::ShadowLightUBO::ExtraLightColor
float ExtraLightColor[3][4]
Definition
ConstantBuffer.hpp:199
Sleak::RenderEngine::ShadowLightUBO::NdcToShadow
float NdcToShadow[16]
Definition
ConstantBuffer.hpp:206
Sleak::RenderEngine::ShadowLightUBO::LightColor
float LightColor[4]
Definition
ConstantBuffer.hpp:179
Sleak::RenderEngine::ShadowLightUBO::LightVP
float LightVP[16]
Definition
ConstantBuffer.hpp:182
Sleak::RenderEngine::ShadowLightUBO::_fogPad
float _fogPad[2]
Definition
ConstantBuffer.hpp:190
Sleak::RenderEngine::ShadowLightUBO::NumExtraLights
uint32_t NumExtraLights
Definition
ConstantBuffer.hpp:200
Sleak::RenderEngine::ShadowLightUBO::_extraPad
float _extraPad[3]
Definition
ConstantBuffer.hpp:201
Sleak::RenderEngine::ShadowLightUBO::HeightFogFalloff
float HeightFogFalloff
Definition
ConstantBuffer.hpp:194
Sleak::RenderEngine::ShadowLightUBO::FogColorZenith
float FogColorZenith[4]
Definition
ConstantBuffer.hpp:191
Sleak::RenderEngine::ShadowLightUBO::HeightFogDensity
float HeightFogDensity
Definition
ConstantBuffer.hpp:193
Sleak::RenderEngine::ShadowLightUBO::HeightFogEnabled
float HeightFogEnabled
Definition
ConstantBuffer.hpp:195
Sleak::RenderEngine::ShadowLightUBO::CameraPos
float CameraPos[4]
Definition
ConstantBuffer.hpp:181
Sleak::RenderEngine::ShadowLightUBO::LightDir
float LightDir[4]
Definition
ConstantBuffer.hpp:178
Sleak::RenderEngine::ShadowLightUBO::Ambient
float Ambient[4]
Definition
ConstantBuffer.hpp:180
Sleak::RenderEngine::ShadowLightUBO::ShadowStrength
float ShadowStrength
Definition
ConstantBuffer.hpp:184
Sleak::RenderEngine::ShadowLightUBO::HeightFogTop
float HeightFogTop
Definition
ConstantBuffer.hpp:192
Sleak::RenderEngine::TransformBuffer::TransformBuffer
TransformBuffer(const Sleak::Math::Matrix4 &world, const Sleak::Math::Matrix4 &view, const Sleak::Math::Matrix4 &proj)
Composes WVP from world/view/proj and keeps World separately for lighting.
Definition
ConstantBuffer.hpp:86
Sleak::RenderEngine::TransformBuffer::TransformBuffer
TransformBuffer(const Sleak::Math::Matrix4 &mvp)
Takes a pre-composed WVP with an identity world matrix (e.g. skybox, UI).
Definition
ConstantBuffer.hpp:93
Sleak::RenderEngine::TransformBuffer::GetSize
virtual uint16_t GetSize() const override
Definition
ConstantBuffer.hpp:101
Sleak::RenderEngine::TransformBuffer::GetData
virtual void * GetData() const override
Definition
ConstantBuffer.hpp:97
include
private
Graphics
Common
ConstantBuffer.hpp
Generated on
for SleakEngine by
1.18.0