lxgui
|
Abstract type for implementation specific management. More...
#include <gui_renderer.hpp>
Public Member Functions | |
renderer ()=default | |
Constructor. | |
renderer (const renderer &)=delete | |
Non-copiable. | |
renderer (renderer &&)=delete | |
Non-movable. | |
renderer & | operator= (const renderer &)=delete |
Non-copiable. | |
renderer & | operator= (renderer &&)=delete |
Non-movable. | |
virtual | ~renderer ()=default |
Destructor. | |
virtual std::string | get_name () const =0 |
Returns a human-readable name for this renderer. | |
virtual bool | is_texture_vertex_color_supported () const =0 |
Checks if the renderer supports setting colors for each vertex of a textured quad. | |
bool | is_quad_batching_enabled () const |
Checks if the renderer has quad render batching enabled. | |
void | set_quad_batching_enabled (bool enabled) |
Enables/disables quad batching. | |
virtual std::size_t | get_texture_max_size () const =0 |
Returns the maximum texture width/height (in pixels). | |
virtual bool | is_texture_atlas_supported () const =0 |
Checks if the renderer supports texture atlases natively. | |
bool | is_texture_atlas_enabled () const |
Checks if the renderer has texture atlases enabled. | |
void | set_texture_atlas_enabled (bool enabled) |
Enables/disables texture atlases. | |
std::size_t | get_texture_atlas_page_size () const |
Returns the width/height of a texture atlas page (in pixels). | |
void | set_texture_atlas_page_size (std::size_t page_size) |
Set the width/height of a texture atlas page (in pixels). | |
std::size_t | get_texture_atlas_page_count () const |
Count the total number of texture atlas pages currently in use. | |
virtual bool | is_vertex_cache_supported () const =0 |
Checks if the renderer supports vertex caches. | |
bool | is_vertex_cache_enabled () const |
Checks if the renderer has enabled support for vertex caches. | |
void | set_vertex_cache_enabled (bool enabled) |
Enables/disables vertex caches. | |
void | auto_detect_settings () |
Automatically determines the best rendering settings for the current platform. | |
void | reset_counters () |
Resets the number of batches to zero (for analytics only). | |
std::size_t | get_batch_count () const |
Returns the number of batches of vertices sent to the GPU since the last call to reset_counters. | |
std::size_t | get_vertex_count () const |
Returns the number of vertices sent to the GPU since the last call to reset_counters. | |
void | begin (std::shared_ptr< render_target > target=nullptr) |
Begins rendering on a particular render target. | |
void | end () |
Ends rendering. | |
void | flush_quad_batch () |
Flushes any pending quad batch render operation. | |
void | set_view (const matrix4f &view_matrix) |
Sets the view matrix to use when rendering (viewport). | |
virtual matrix4f | get_view () const =0 |
Returns the current view matrix to use when rendering (viewport). | |
void | render_quad (const quad &q) |
Renders a quad. | |
void | render_quads (const material *mat, const std::vector< std::array< vertex, 4 > > &quad_list) |
Renders a set of quads. | |
void | render_cache (const material *mat, const vertex_cache &cache, const matrix4f &model_transform=matrix4f::identity) |
Renders a vertex cache. | |
std::shared_ptr< material > | create_material (const std::string &file_name, material::filter filt=material::filter::none) |
Creates a new material from a texture file. | |
std::shared_ptr< material > | create_atlas_material (const std::string &atlas_category, const std::string &file_name, material::filter filt=material::filter::none) |
Creates a new material from a texture file. | |
virtual std::shared_ptr< material > | create_material (std::shared_ptr< render_target > target, const bounds2f &location)=0 |
Creates a new material from a portion of a render target. | |
std::shared_ptr< material > | create_material (std::shared_ptr< render_target > target) |
Creates a new material from an entire render target. | |
virtual std::shared_ptr< material > | create_material (const vector2ui &dimensions, const color32 *pixel_data, material::filter filt=material::filter::none)=0 |
Creates a new material from arbitrary pixel data. | |
virtual std::shared_ptr< render_target > | create_render_target (const vector2ui &dimensions, material::filter filt=material::filter::none)=0 |
Creates a new render target. | |
std::shared_ptr< font > | create_font (const std::string &font_file, std::size_t size, std::size_t outline, const std::vector< code_point_range > &code_points, char32_t default_code_point) |
Creates a new font. | |
std::shared_ptr< font > | create_atlas_font (const std::string &atlas_category, const std::string &font_file, std::size_t size, std::size_t outline, const std::vector< code_point_range > &code_points, char32_t default_code_point) |
Creates a new font. | |
virtual std::shared_ptr< vertex_cache > | create_vertex_cache (gui::vertex_cache::type type)=0 |
Creates a new empty vertex cache. | |
virtual void | notify_window_resized (const vector2ui &dimensions) |
Notifies the renderer that the render window has been resized. | |
Protected Member Functions | |
virtual void | begin_ (std::shared_ptr< render_target > target)=0 |
Begins rendering on a particular render target. | |
virtual void | end_ ()=0 |
Ends rendering. | |
virtual void | set_view_ (const matrix4f &view_matrix)=0 |
Sets the view matrix to use when rendering (viewport). | |
virtual void | render_quads_ (const material *mat, const std::vector< std::array< vertex, 4 > > &quad_list)=0 |
Renders a set of quads. | |
virtual void | render_cache_ (const material *mat, const vertex_cache &cache, const matrix4f &model_transform)=0 |
Renders a vertex cache. | |
virtual std::shared_ptr< material > | create_material_ (const std::string &file_name, material::filter filt)=0 |
Creates a new material from a texture file. | |
virtual std::shared_ptr< atlas > | create_atlas_ (material::filter filt)=0 |
Creates a new atlas with a given texture filter mode. | |
virtual std::shared_ptr< font > | create_font_ (const std::string &font_file, std::size_t size, std::size_t outline, const std::vector< code_point_range > &code_points, char32_t default_code_point)=0 |
Creates a new font. | |
atlas & | get_atlas_ (const std::string &atlas_category, material::filter filt) |
Protected Attributes | |
std::unordered_map< std::string, std::weak_ptr< gui::material > > | texture_list_ |
std::unordered_map< std::string, std::shared_ptr< gui::atlas > > | atlas_list_ |
std::unordered_map< std::string, std::weak_ptr< gui::font > > | font_list_ |
Abstract type for implementation specific management.
Definition at line 26 of file gui_renderer.hpp.
|
default |
Constructor.
|
delete |
Non-copiable.
|
delete |
Non-movable.
|
virtualdefault |
Destructor.
void lxgui::gui::renderer::auto_detect_settings | ( | ) |
Automatically determines the best rendering settings for the current platform.
Definition at line 283 of file gui_renderer.cpp.
void lxgui::gui::renderer::begin | ( | std::shared_ptr< render_target > | target = nullptr | ) |
Begins rendering on a particular render target.
target | The render target (main screen if nullptr) |
Definition at line 11 of file gui_renderer.cpp.
|
protectedpure virtual |
Begins rendering on a particular render target.
target | The render target (main screen if nullptr) |
Implemented in lxgui::gui::gl::renderer, lxgui::gui::sdl::renderer, and lxgui::gui::sfml::renderer.
|
protectedpure virtual |
Creates a new atlas with a given texture filter mode.
filt | The filtering to apply to the texture |
Implemented in lxgui::gui::gl::renderer, lxgui::gui::sdl::renderer, and lxgui::gui::sfml::renderer.
std::shared_ptr< font > lxgui::gui::renderer::create_atlas_font | ( | const std::string & | atlas_category, |
const std::string & | font_file, | ||
std::size_t | size, | ||
std::size_t | outline, | ||
const std::vector< code_point_range > & | code_points, | ||
char32_t | default_code_point | ||
) |
Creates a new font.
atlas_category | The category of atlas in which to create the font texture |
font_file | The file from which to read the font |
size | The requested size of the characters (in points) |
outline | The thickness of the outline (in points) |
code_points | The list of Unicode characters to load |
default_code_point | The character to display as fallback |
Definition at line 329 of file gui_renderer.cpp.
std::shared_ptr< material > lxgui::gui::renderer::create_atlas_material | ( | const std::string & | atlas_category, |
const std::string & | file_name, | ||
material::filter | filt = material::filter::none |
||
) |
Creates a new material from a texture file.
atlas_category | The category of atlas in which to create the texture |
file_name | The name of the file |
filt | The filtering to apply to the texture |
Definition at line 307 of file gui_renderer.cpp.
std::shared_ptr< gui::font > lxgui::gui::renderer::create_font | ( | const std::string & | font_file, |
std::size_t | size, | ||
std::size_t | outline, | ||
const std::vector< code_point_range > & | code_points, | ||
char32_t | default_code_point | ||
) |
Creates a new font.
font_file | The file from which to read the font |
size | The requested size of the characters (in points) |
outline | The thickness of the outline (in points) |
code_points | The list of Unicode characters to load |
default_code_point | The character to display as fallback |
Definition at line 222 of file gui_renderer.cpp.
|
protectedpure virtual |
Creates a new font.
font_file | The file from which to read the font |
size | The requested size of the characters (in points) |
outline | The thickness of the outline (in points) |
code_points | The list of Unicode characters to load |
default_code_point | The character to display as fallback |
Implemented in lxgui::gui::gl::renderer, lxgui::gui::sdl::renderer, and lxgui::gui::sfml::renderer.
std::shared_ptr< gui::material > lxgui::gui::renderer::create_material | ( | const std::string & | file_name, |
material::filter | filt = material::filter::none |
||
) |
Creates a new material from a texture file.
file_name | The name of the file |
filt | The filtering to apply to the texture |
Definition at line 182 of file gui_renderer.cpp.
|
pure virtual |
Creates a new material from arbitrary pixel data.
dimensions | The dimensions of the material |
pixel_data | The color data for all the pixels in the material |
filt | The filtering to apply to the texture |
Implemented in lxgui::gui::gl::renderer, lxgui::gui::sdl::renderer, and lxgui::gui::sfml::renderer.
std::shared_ptr< material > lxgui::gui::renderer::create_material | ( | std::shared_ptr< render_target > | target | ) |
Creates a new material from an entire render target.
target | The render target from which to read the pixels |
Definition at line 359 of file gui_renderer.cpp.
|
pure virtual |
Creates a new material from a portion of a render target.
target | The render target from which to read the pixels |
location | The portion of the render target to use as material |
Implemented in lxgui::gui::gl::renderer, lxgui::gui::sdl::renderer, and lxgui::gui::sfml::renderer.
|
protectedpure virtual |
Creates a new material from a texture file.
file_name | The name of the file |
filt | The filtering to apply to the texture |
Implemented in lxgui::gui::gl::renderer, lxgui::gui::sdl::renderer, and lxgui::gui::sfml::renderer.
|
pure virtual |
Creates a new render target.
dimensions | The dimensions of the render target |
filt | The filtering to apply to the target texture when displayed |
Implemented in lxgui::gui::gl::renderer, lxgui::gui::sdl::renderer, and lxgui::gui::sfml::renderer.
|
pure virtual |
Creates a new empty vertex cache.
type | The type of data this cache will hold |
Implemented in lxgui::gui::gl::renderer, lxgui::gui::sdl::renderer, and lxgui::gui::sfml::renderer.
void lxgui::gui::renderer::end | ( | ) |
Ends rendering.
Definition at line 37 of file gui_renderer.cpp.
|
protectedpure virtual |
Ends rendering.
Implemented in lxgui::gui::gl::renderer, lxgui::gui::sdl::renderer, and lxgui::gui::sfml::renderer.
void lxgui::gui::renderer::flush_quad_batch | ( | ) |
Flushes any pending quad batch render operation.
Definition at line 136 of file gui_renderer.cpp.
|
protected |
Definition at line 289 of file gui_renderer.cpp.
std::size_t lxgui::gui::renderer::get_batch_count | ( | ) | const |
Returns the number of batches of vertices sent to the GPU since the last call to reset_counters.
Definition at line 52 of file gui_renderer.cpp.
|
pure virtual |
Returns a human-readable name for this renderer.
Implemented in lxgui::gui::gl::renderer, lxgui::gui::sdl::renderer, and lxgui::gui::sfml::renderer.
std::size_t lxgui::gui::renderer::get_texture_atlas_page_count | ( | ) | const |
Count the total number of texture atlas pages currently in use.
Definition at line 265 of file gui_renderer.cpp.
std::size_t lxgui::gui::renderer::get_texture_atlas_page_size | ( | ) | const |
Returns the width/height of a texture atlas page (in pixels).
Definition at line 254 of file gui_renderer.cpp.
|
pure virtual |
Returns the maximum texture width/height (in pixels).
Implemented in lxgui::gui::gl::renderer, lxgui::gui::sdl::renderer, and lxgui::gui::sfml::renderer.
std::size_t lxgui::gui::renderer::get_vertex_count | ( | ) | const |
Returns the number of vertices sent to the GPU since the last call to reset_counters.
Definition at line 56 of file gui_renderer.cpp.
|
pure virtual |
Returns the current view matrix to use when rendering (viewport).
Implemented in lxgui::gui::gl::renderer, lxgui::gui::sdl::renderer, and lxgui::gui::sfml::renderer.
bool lxgui::gui::renderer::is_quad_batching_enabled | ( | ) | const |
Checks if the renderer has quad render batching enabled.
Definition at line 173 of file gui_renderer.cpp.
bool lxgui::gui::renderer::is_texture_atlas_enabled | ( | ) | const |
Checks if the renderer has texture atlases enabled.
Definition at line 246 of file gui_renderer.cpp.
|
pure virtual |
Checks if the renderer supports texture atlases natively.
Implemented in lxgui::gui::gl::renderer, lxgui::gui::sdl::renderer, and lxgui::gui::sfml::renderer.
|
pure virtual |
Checks if the renderer supports setting colors for each vertex of a textured quad.
Implemented in lxgui::gui::gl::renderer, lxgui::gui::sdl::renderer, and lxgui::gui::sfml::renderer.
bool lxgui::gui::renderer::is_vertex_cache_enabled | ( | ) | const |
Checks if the renderer has enabled support for vertex caches.
Definition at line 275 of file gui_renderer.cpp.
|
pure virtual |
Checks if the renderer supports vertex caches.
Implemented in lxgui::gui::gl::renderer, lxgui::gui::sdl::renderer, and lxgui::gui::sfml::renderer.
|
virtual |
Notifies the renderer that the render window has been resized.
dimensions | The new window dimensions |
Reimplemented in lxgui::gui::gl::renderer, lxgui::gui::sdl::renderer, and lxgui::gui::sfml::renderer.
Definition at line 364 of file gui_renderer.cpp.
void lxgui::gui::renderer::render_cache | ( | const material * | mat, |
const vertex_cache & | cache, | ||
const matrix4f & | model_transform = matrix4f::identity |
||
) |
Renders a vertex cache.
mat | The material to use for rendering, or null if none |
cache | The vertex cache |
model_transform | The transformation matrix to apply to vertices |
Definition at line 160 of file gui_renderer.cpp.
|
protectedpure virtual |
Renders a vertex cache.
mat | The material to use for rendering, or null if none |
cache | The vertex cache |
model_transform | The transformation matrix to apply to vertices |
Implemented in lxgui::gui::gl::renderer, lxgui::gui::sdl::renderer, and lxgui::gui::sfml::renderer.
void lxgui::gui::renderer::render_quad | ( | const quad & | q | ) |
Renders a quad.
q | The quad to render on the current render target |
Definition at line 68 of file gui_renderer.cpp.
void lxgui::gui::renderer::render_quads | ( | const material * | mat, |
const std::vector< std::array< vertex, 4 > > & | quad_list | ||
) |
Renders a set of quads.
mat | The material to use for rendering, or null if none |
quad_list | The list of the quads you want to render |
Definition at line 89 of file gui_renderer.cpp.
|
protectedpure virtual |
Renders a set of quads.
mat | The material to use for rendering, or null if none |
quad_list | The list of the quads you want to render |
Implemented in lxgui::gui::gl::renderer, lxgui::gui::sdl::renderer, and lxgui::gui::sfml::renderer.
void lxgui::gui::renderer::reset_counters | ( | ) |
Resets the number of batches to zero (for analytics only).
Definition at line 45 of file gui_renderer.cpp.
void lxgui::gui::renderer::set_quad_batching_enabled | ( | bool | enabled | ) |
Enables/disables quad batching.
enabled | 'true' to enable quad batching, 'false' to disable it |
Definition at line 177 of file gui_renderer.cpp.
void lxgui::gui::renderer::set_texture_atlas_enabled | ( | bool | enabled | ) |
Enables/disables texture atlases.
enabled | 'true' to enable texture atlases, 'false' to disable them |
Definition at line 250 of file gui_renderer.cpp.
void lxgui::gui::renderer::set_texture_atlas_page_size | ( | std::size_t | page_size | ) |
Set the width/height of a texture atlas page (in pixels).
page_size | The texture width/height in pixels |
Definition at line 261 of file gui_renderer.cpp.
void lxgui::gui::renderer::set_vertex_cache_enabled | ( | bool | enabled | ) |
Enables/disables vertex caches.
enabled | 'true' to enable vertex caches, 'false' to disable them |
Definition at line 279 of file gui_renderer.cpp.
void lxgui::gui::renderer::set_view | ( | const matrix4f & | view_matrix | ) |
Sets the view matrix to use when rendering (viewport).
view_matrix | The view matrix |
Definition at line 60 of file gui_renderer.cpp.
|
protectedpure virtual |
Sets the view matrix to use when rendering (viewport).
view_matrix | The view matrix |
Implemented in lxgui::gui::gl::renderer, lxgui::gui::sdl::renderer, and lxgui::gui::sfml::renderer.
|
protected |
Definition at line 497 of file gui_renderer.hpp.
|
protected |
Definition at line 498 of file gui_renderer.hpp.
|
protected |
Definition at line 496 of file gui_renderer.hpp.