1#ifndef TOPAZ_REN_QUAD_HPP
2#define TOPAZ_REN_QUAD_HPP
3#include "tz/core/handle.hpp"
4#include "tz/core/vector.hpp"
5#include "tz/gpu/graph.hpp"
62 return static_cast<int>(lhs) &
static_cast<int>(rhs);
77 []()->std::span<const tz::gpu::resource_handle>
81 return {std::begin(default_targets), std::end(default_targets)};
83 std::span<const tz::gpu::resource_handle> extra_resources = {};
Represents a generic opaque handle.
Definition handle.hpp:32
error_code
Error codes for Topaz.
Definition error.hpp:14
constexpr nullhand_t nullhand
Definition handle.hpp:22
constexpr auto window_resource
Corresponds to either the window image (as a colour target) or the system depth image (as a depth tar...
Definition resource.hpp:127
quad_renderer_flag
Specifies optional, extra functionality for a quad renderer.
Definition quad.hpp:42
short get_quad_layer(quad_renderer_handle renh, quad_handle quad)
Get the layer value of a given quad.
void set_quad_texture0(quad_renderer_handle renh, quad_handle quad, std::uint32_t texture_id)
Set a new first texture-id to be used by a quad.
tz::v2f get_quad_scale(quad_renderer_handle renh, quad_handle quad)
Retrieve the scale factor of a quad, in both dimensions.
void set_quad_position(quad_renderer_handle renh, quad_handle quad, tz::v2f position)
Set a new position of a quad, in world-space.
std::expected< std::uint32_t, tz::error_code > quad_renderer_add_texture(quad_renderer_handle renh, tz::gpu::resource_handle image)
Associate an existing image resource with the provided quad renderer, allowing quads to use it as a t...
std::expected< quad_handle, tz::error_code > quad_renderer_create_quad(quad_renderer_handle renh, quad_info info)
Create a new quad to be rendered by an existing quad renderer.
std::uint32_t get_quad_texture1(quad_renderer_handle renh, quad_handle quad)
Retrieve the second texture-id currently being used by a quad.
void set_quad_colour(quad_renderer_handle renh, quad_handle quad, tz::v3f colour)
Set a new colour of a quad.
void set_quad_scale(quad_renderer_handle renh, quad_handle quad, tz::v2f scale)
Set a new scale factor of a quad, in both dimensions.
std::uint32_t get_quad_texture0(quad_renderer_handle renh, quad_handle quad)
Retrieve the first texture-id currently being used by a quad.
void set_quad_layer(quad_renderer_handle renh, quad_handle quad, short layer)
Set the layer value of a given quad.
tz::error_code destroy_quad_renderer(quad_renderer_handle renh)
Manually destroy a quad renderer.
tz::v3f get_quad_colour(quad_renderer_handle renh, quad_handle quad)
Retrieve the colour of a quad.
void set_quad_texture1(quad_renderer_handle renh, quad_handle quad, std::uint32_t texture_id)
Set a new second texture-id to be used by a quad.
void quad_renderer_update(quad_renderer_handle renh)
Update internal state for a quad renderer.
tz::gpu::graph_handle quad_renderer_graph(quad_renderer_handle renh)
Retrieve a graph representing the quad renderer.
std::expected< quad_renderer_handle, tz::error_code > create_quad_renderer(quad_renderer_info info)
Create a new quad renderer.
tz::v2f get_quad_position(quad_renderer_handle renh, quad_handle quad)
Retrieve the position of a quad, in world-space.
@ custom_fragment_shader
Enables the use of quad_renderer_info::custom_fragment_shader.
Definition quad.hpp:52
@ enable_layering
Enables the use of the layer property of a quad. By default, everything is on layer 0....
Definition quad.hpp:50
@ allow_negative_scale
Normally if a quad has a negative scale in any dimension, the triangles are no longer in the correct ...
Definition quad.hpp:48
@ graph_present_after
Sets tz::gpu::graph_flag::present_after on the graph representing the quad renderer.
Definition quad.hpp:46
@ alpha_clipping
If the alpha-component of any fragment in a quad (after texture sampling) is very low (<0....
Definition quad.hpp:44
Specifies initial data for a single quad.
Definition quad.hpp:112
tz::v2f position
Position of the quad, in world-space. You can change this later via set_quad_position.
Definition quad.hpp:114
std::uint32_t texture_id1
First texture to display on the quad. Defaults to -1 (no texture). If no texture is used,...
Definition quad.hpp:122
tz::v2f scale
Scale factors of the quad, in both dimensions. You can change this later via set_quad_scale.
Definition quad.hpp:118
std::uint32_t texture_id0
First texture to display on the quad. Defaults to -1 (no texture). If no texture is used,...
Definition quad.hpp:120
float rotation
Rotation of the quads, in radians.
Definition quad.hpp:116
tz::v3f colour
Colour of the quad. If the quad has no texture, this will be the exact colour of the whole quad....
Definition quad.hpp:124
short layer
Layer value. Has no effect if layering is not enabled (see quad_renderer_flag::enable_layering for mo...
Definition quad.hpp:126
Specifies creation flags for a quad renderer.
Definition quad.hpp:72
std::size_t extra_data_per_quad
How much extraneous GPU memory should be allocated per quad? If you want to store extra data per quad...
Definition quad.hpp:90
tz::v4f clear_colour
When the main pass is executed, the colour target will be cleared to this colour value.
Definition quad.hpp:74
std::span< const tz::gpu::resource_handle > colour_targets
Specifies the colour target to render into. By default, this is the window resource (i....
Definition quad.hpp:76
std::string_view custom_fragment_shader
Custom fragment shader. Unless quad_renderer_flag::custom_fragment_shader is specified,...
Definition quad.hpp:88
quad_renderer_flag flags
Any extra optional flags to specify?
Definition quad.hpp:86
static constexpr vector< float, N > zero()
Definition vector.hpp:26
static constexpr vector< float, N > filled(float t)
Definition vector.hpp:32