candlewick
0.6.0
A tiny cross-platform renderer based on SDL3
Loading...
Searching...
No Matches
DepthViz.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
../Core.h
"
4
#include <SDL3/SDL_gpu.h>
5
#include "
../Camera.h
"
6
7
namespace
candlewick
{
8
9
struct
DepthDebugPass
{
10
enum
VizStyle
:
int
{
VIZ_GRAYSCALE
,
VIZ_HEATMAP
};
11
struct
Options
{
12
VizStyle
mode
;
13
float
near
;
14
float
far
;
15
CameraProjection
cam_proj
=
CameraProjection::PERSPECTIVE
;
16
};
17
SDL_GPUTexture *
depthTexture
;
18
SDL_GPUSampler *
sampler
;
19
SDL_GPUGraphicsPipeline *
pipeline
;
20
21
static
DepthDebugPass
create
(
const
RenderContext
&renderer,
22
SDL_GPUTexture *
depthTexture
);
23
24
void
release
(SDL_GPUDevice *device);
25
};
26
27
inline
void
DepthDebugPass::release
(SDL_GPUDevice *device) {
28
if
(
sampler
) {
29
SDL_ReleaseGPUSampler(device,
sampler
);
30
sampler
= NULL;
31
}
32
if
(
pipeline
) {
33
SDL_ReleaseGPUGraphicsPipeline(device,
pipeline
);
34
pipeline
= NULL;
35
}
36
}
37
38
void
renderDepthDebug
(
const
RenderContext
&renderer,
CommandBuffer
&cmdBuf,
39
const
DepthDebugPass
&pass,
40
const
DepthDebugPass::Options
&opts);
41
42
}
// namespace candlewick
Camera.h
Core.h
candlewick::CommandBuffer
Definition
CommandBuffer.h:17
candlewick
Definition
Camera.h:8
candlewick::CameraProjection
CameraProjection
Definition
Camera.h:16
candlewick::CameraProjection::PERSPECTIVE
@ PERSPECTIVE
Definition
Camera.h:16
candlewick::renderDepthDebug
void renderDepthDebug(const RenderContext &renderer, CommandBuffer &cmdBuf, const DepthDebugPass &pass, const DepthDebugPass::Options &opts)
candlewick::DepthDebugPass::Options
Definition
DepthViz.h:11
candlewick::DepthDebugPass::Options::far
float far
Definition
DepthViz.h:14
candlewick::DepthDebugPass::Options::mode
VizStyle mode
Definition
DepthViz.h:12
candlewick::DepthDebugPass::Options::cam_proj
CameraProjection cam_proj
Definition
DepthViz.h:15
candlewick::DepthDebugPass::Options::near
float near
Definition
DepthViz.h:13
candlewick::DepthDebugPass
Definition
DepthViz.h:9
candlewick::DepthDebugPass::depthTexture
SDL_GPUTexture * depthTexture
Definition
DepthViz.h:17
candlewick::DepthDebugPass::sampler
SDL_GPUSampler * sampler
Definition
DepthViz.h:18
candlewick::DepthDebugPass::VizStyle
VizStyle
Definition
DepthViz.h:10
candlewick::DepthDebugPass::VIZ_GRAYSCALE
@ VIZ_GRAYSCALE
Definition
DepthViz.h:10
candlewick::DepthDebugPass::VIZ_HEATMAP
@ VIZ_HEATMAP
Definition
DepthViz.h:10
candlewick::DepthDebugPass::release
void release(SDL_GPUDevice *device)
Definition
DepthViz.h:27
candlewick::DepthDebugPass::create
static DepthDebugPass create(const RenderContext &renderer, SDL_GPUTexture *depthTexture)
candlewick::DepthDebugPass::pipeline
SDL_GPUGraphicsPipeline * pipeline
Definition
DepthViz.h:19
candlewick::RenderContext
The RenderContext class provides a rendering context for a graphical application.
Definition
RenderContext.h:20
src
candlewick
core
debug
DepthViz.h
Generated by
1.13.2