VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
renderPassDepthGrab.cpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: Apache-2.0
2
// Copyright 2025-2026 Arnis Lektauers
3
//
4
// Created by Arnis Lektauers on 13.02.2026.
5
//
6
#include "
renderPassDepthGrab.h
"
7
8
#include "
platform/graphics/graphicsDevice.h
"
9
#include "
scene/camera.h
"
10
11
namespace
visutwin::canvas
12
{
13
void
RenderPassDepthGrab::before
()
14
{
15
if
(!_camera) {
16
return
;
17
}
18
19
// depth grab publishes scene depth to a globally available slot.
20
// On Metal in this port we can directly reference the depth texture from the source RT.
21
const
auto
device
= this->
device
();
22
if
(!
device
) {
23
return
;
24
}
25
26
const
auto
sourceTarget = _camera->renderTarget();
27
Texture
* sceneDepth = sourceTarget ? sourceTarget->depthBuffer() :
nullptr
;
28
if
(!sceneDepth) {
29
sceneDepth =
device
->backBuffer() ?
device
->backBuffer()->depthBuffer() :
nullptr
;
30
}
31
device
->setSceneDepthMap(sceneDepth);
32
}
33
34
void
RenderPassDepthGrab::execute
()
35
{
36
// DEVIATION: no copy pass needed on current Metal path because scene depth is sampled directly.
37
}
38
}
camera.h
visutwin::canvas::RenderPassDepthGrab::before
void before() override
Definition
renderPassDepthGrab.cpp:13
visutwin::canvas::RenderPassDepthGrab::execute
void execute() override
Definition
renderPassDepthGrab.cpp:34
visutwin::canvas::RenderPass::device
std::shared_ptr< GraphicsDevice > device() const
Definition
renderPass.h:124
visutwin::canvas::Texture
GPU texture resource supporting 2D, cubemap, volume, and array formats with mipmap management.
Definition
texture.h:57
graphicsDevice.h
visutwin::canvas
Definition
eventHandler.cpp:9
renderPassDepthGrab.h
scene
graphics
renderPassDepthGrab.cpp
Generated by
1.16.1