Topaz 5.0
Topaz Game Engine
|
Efficiently render a large number of 2D quads.
Typedefs | |
using | tz::ren::quad_handle = tz::handle<detail::quad_t> |
Represents a single quad. Owned by a quad_renderer_handle. | |
using | tz::ren::quad_renderer_handle = tz::handle<detail::quadren_t> |
Represents a single quad renderer instance. | |
Classes | |
struct | tz::ren::quad_renderer_info |
Specifies creation flags for a quad renderer. More... | |
struct | tz::ren::quad_info |
Specifies initial data for a single quad. More... | |
std::expected< quad_renderer_handle, tz::error_code > tz::ren::create_quad_renderer | ( | quad_renderer_info | info | ) |
Create a new quad renderer.
tz::error_code tz::ren::destroy_quad_renderer | ( | quad_renderer_handle | renh | ) |
Manually destroy a quad renderer.
std::expected< quad_handle, tz::error_code > tz::ren::quad_renderer_create_quad | ( | quad_renderer_handle | renh, |
quad_info | info ) |
Create a new quad to be rendered by an existing quad renderer.
Next time the quad renderer executes, this new quad will be visible with the info provided.
std::expected< std::uint32_t, tz::error_code > tz::ren::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 texture.
tz::v2f tz::ren::get_quad_position | ( | quad_renderer_handle | renh, |
quad_handle | quad ) |
Retrieve the position of a quad, in world-space.
void tz::ren::set_quad_position | ( | quad_renderer_handle | renh, |
quad_handle | quad, | ||
tz::v2f | position ) |
Set a new position of a quad, in world-space.
short tz::ren::get_quad_layer | ( | quad_renderer_handle | renh, |
quad_handle | quad ) |
Get the layer value of a given quad.
Note that layer values only have an effect if layering (see quad_renderer_flag::enable_layering) is enabled.
void tz::ren::set_quad_layer | ( | quad_renderer_handle | renh, |
quad_handle | quad, | ||
short | layer ) |
Set the layer value of a given quad.
layer | New layer value. Should be between -100 and 100. |
Note that layer values only have an effect if layering (see quad_renderer_flag::enable_layering) is enabled.
tz::v2f tz::ren::get_quad_scale | ( | quad_renderer_handle | renh, |
quad_handle | quad ) |
Retrieve the scale factor of a quad, in both dimensions.
void tz::ren::set_quad_scale | ( | quad_renderer_handle | renh, |
quad_handle | quad, | ||
tz::v2f | scale ) |
Set a new scale factor of a quad, in both dimensions.
tz::v3f tz::ren::get_quad_colour | ( | quad_renderer_handle | renh, |
quad_handle | quad ) |
Retrieve the colour of a quad.
See quad_info::colour for more details.
void tz::ren::set_quad_colour | ( | quad_renderer_handle | renh, |
quad_handle | quad, | ||
tz::v3f | colour ) |
Set a new colour of a quad.
See quad_info::colour for more details.
std::uint32_t tz::ren::get_quad_texture0 | ( | quad_renderer_handle | renh, |
quad_handle | quad ) |
Retrieve the first texture-id currently being used by a quad.
std::uint32_t tz::ren::get_quad_texture1 | ( | quad_renderer_handle | renh, |
quad_handle | quad ) |
Retrieve the second texture-id currently being used by a quad.
void tz::ren::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.
Note: Passing -1 as the texture-id will cause the quad to no longer sample from a texture.
void tz::ren::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.
Note: Passing -1 as the texture-id will cause the quad to no longer sample from a texture.
tz::gpu::graph_handle tz::ren::quad_renderer_graph | ( | quad_renderer_handle | renh | ) |
Retrieve a graph representing the quad renderer.
To actually execute a quad renderer, you must retrieve it's graph and pass it to tz::gpu::execute. See Graphs for more info.
void tz::ren::quad_renderer_update | ( | quad_renderer_handle | renh | ) |
Update internal state for a quad renderer.
using tz::ren::quad_handle = tz::handle<detail::quad_t> |
Represents a single quad. Owned by a quad_renderer_handle.
using tz::ren::quad_renderer_handle = tz::handle<detail::quadren_t> |
Represents a single quad renderer instance.
You can have multiple quad renderers at the same time. Any quad_handle retrieved from creating a quad will be owned solely by whichever quad renderer you used to create it.
enum tz::ren::quad_renderer_flag : std::int64_t |
Specifies optional, extra functionality for a quad renderer.
Enumerator | |
---|---|
alpha_clipping | If the alpha-component of any fragment in a quad (after texture sampling) is very low (<0.05f), then that fragment will be discarded. |
graph_present_after | Sets tz::gpu::graph_flag::present_after on the graph representing the quad renderer. |
allow_negative_scale | Normally if a quad has a negative scale in any dimension, the triangles are no longer in the correct winding order and will thus be invisible. Setting this flags disables face culling, meaning triangles scaled negatively (and thus in the wrong winding order) will still display as normal. |
enable_layering | Enables the use of the layer property of a quad. By default, everything is on layer 0. Layer values are between -100 and 100. A quad with a higher layer will be drawn over a quad with a lower layer. |
custom_fragment_shader | Enables the use of quad_renderer_info::custom_fragment_shader. |