VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
renderPassShaderQuad.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2025-2026 Arnis Lektauers
3//
4//
5#pragma once
6
7#include <array>
8#include <memory>
9#include <optional>
10
11#include "core/math/vector4.h"
17
18namespace visutwin::canvas
19{
20 class QuadRender;
21 class Shader;
22 class Texture;
23
28 {
29 public:
30 explicit RenderPassShaderQuad(const std::shared_ptr<GraphicsDevice>& device)
31 : RenderPass(device) {}
32
33 void setShader(const std::shared_ptr<Shader>& shader);
34 std::shared_ptr<Shader> shader() const { return _shader; }
35 void setQuadTextureBinding(const size_t slot, Texture* texture)
36 {
37 if (slot < _quadTextureBindings.size()) {
38 _quadTextureBindings[slot] = texture;
39 }
40 }
41 void clearQuadTextureBindings() { _quadTextureBindings.fill(nullptr); }
42
43 void execute() override;
44
46 // DEVIATION: BlendState::NOBLEND singleton is not implemented yet; default BlendState maps to no-blend.
47 std::shared_ptr<BlendState> blendState = std::make_shared<BlendState>();
48 // DEVIATION: DepthState::NODEPTH singleton is not implemented yet; default depth state is used.
49 std::shared_ptr<DepthState> depthState = std::make_shared<DepthState>();
50 std::shared_ptr<StencilParameters> stencilFront = nullptr;
51 std::shared_ptr<StencilParameters> stencilBack = nullptr;
52 std::optional<Vector4> viewport;
53 std::optional<Vector4> scissor;
54
55 private:
56 std::shared_ptr<Shader> _shader = nullptr;
57 std::shared_ptr<QuadRender> _quadRender = nullptr;
58 std::array<Texture*, 8> _quadTextureBindings{};
59 };
60}
std::shared_ptr< GraphicsDevice > device() const
Definition renderPass.h:124
RenderPass(const std::shared_ptr< GraphicsDevice > &device)
Definition renderPass.h:66
std::shared_ptr< Shader > shader() const
void setShader(const std::shared_ptr< Shader > &shader)
std::shared_ptr< DepthState > depthState
void setQuadTextureBinding(const size_t slot, Texture *texture)
std::shared_ptr< StencilParameters > stencilFront
std::shared_ptr< BlendState > blendState
std::shared_ptr< StencilParameters > stencilBack
RenderPassShaderQuad(const std::shared_ptr< GraphicsDevice > &device)
GPU texture resource supporting 2D, cubemap, volume, and array formats with mipmap management.
Definition texture.h:57