VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
shadowMap.h
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 Lektauets on 02.10.2025.
5//
6#pragma once
7#include <memory>
8
11
12namespace visutwin::canvas
13{
14 class GraphicsDevice;
15 class Light;
16
18 {
19 public:
20 const std::vector<std::shared_ptr<RenderTarget>>& renderTargets() const { return _renderTargets; }
21
22 // Returns the depth texture used for shadow sampling in the forward pass.
23 Texture* shadowTexture() const { return _shadowTexture.get(); }
24
25 // Creates a shadow map for the given light, allocating depth texture and render target.
26 static std::unique_ptr<ShadowMap> create(GraphicsDevice* device, Light* light);
27
28 private:
29 // An array of render targets:
30 // 1 for directional and spotlight
31 // 6 for omni light
32 std::vector<std::shared_ptr<RenderTarget>> _renderTargets;
33
34 // The depth texture backing the shadow map, owned by this ShadowMap.
35 std::shared_ptr<Texture> _shadowTexture;
36 };
37}
Abstract GPU interface for resource creation, state management, and draw submission.
Directional, point, spot, or area light with shadow mapping and cookie projection.
Definition light.h:54
Texture * shadowTexture() const
Definition shadowMap.h:23
static std::unique_ptr< ShadowMap > create(GraphicsDevice *device, Light *light)
Definition shadowMap.cpp:15
const std::vector< std::shared_ptr< RenderTarget > > & renderTargets() const
Definition shadowMap.h:20
GPU texture resource supporting 2D, cubemap, volume, and array formats with mipmap management.
Definition texture.h:57