lxgui
|
Open implementation of rendering. More...
#include <gui_gl_renderer.hpp>
Public Member Functions | |
renderer (const vector2ui &window_dimensions, bool init_glew=true) | |
Constructor. | |
std::string | get_name () const override |
Returns a human-readable name for this renderer. | |
matrix4f | get_view () const override |
Returns the current view matrix to use when rendering (viewport). | |
std::size_t | get_texture_max_size () const override |
Returns the maximum texture width/height (in pixels). | |
bool | is_texture_atlas_supported () const override |
Checks if the renderer supports texture atlases natively. | |
bool | is_texture_vertex_color_supported () const override |
Checks if the renderer supports setting colors for each vertex of a textured quad. | |
std::shared_ptr< gui::material > | create_material (const vector2ui &dimensions, const color32 *pixel_data, material::filter filt=material::filter::none) override |
Creates a new material from arbitrary pixel data. | |
std::shared_ptr< gui::material > | create_material (std::shared_ptr< gui::render_target > target, const bounds2f &location) override |
Creates a new material from a portion of a render target. | |
std::shared_ptr< gui::render_target > | create_render_target (const vector2ui &dimensions, material::filter filt=material::filter::none) override |
Creates a new render target. | |
bool | is_vertex_cache_supported () const override |
Checks if the renderer supports vertex caches. | |
std::shared_ptr< gui::vertex_cache > | create_vertex_cache (gui::vertex_cache::type type) override |
Creates a new empty vertex cache. | |
void | notify_window_resized (const vector2ui &new_dimensions) override |
Notifies the renderer that the render window has been resized. | |
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. | |
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. | |
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). | |
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_material (std::shared_ptr< render_target > target) |
Creates a new material from an entire render target. | |
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. | |
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. | |
Static Public Member Functions | |
static bool | is_gl_extension_supported (const std::string &extension) |
Checks if a given OpenGL extension is supported by the machine. | |
Protected Member Functions | |
std::shared_ptr< gui::material > | create_material_ (const std::string &file_name, material::filter filt) override |
Creates a new material from a texture file. | |
std::shared_ptr< gui::atlas > | create_atlas_ (material::filter filt) override |
Creates a new atlas with a given texture filter mode. | |
std::shared_ptr< gui::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) override |
Creates a new font. | |
void | begin_ (std::shared_ptr< gui::render_target > target) override |
Begins rendering on a particular render target. | |
void | end_ () override |
Ends rendering. | |
void | set_view_ (const matrix4f &view_matrix) override |
Sets the view matrix to use when rendering (viewport). | |
void | render_quads_ (const gui::material *mat, const std::vector< std::array< vertex, 4 > > &quad_list) override |
Renders a set of quads. | |
void | render_cache_ (const gui::material *mat, const gui::vertex_cache &cache, const matrix4f &model_transform) override |
Renders a vertex cache. | |
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_ |
Open implementation of rendering.
Definition at line 21 of file gui_gl_renderer.hpp.
|
explicit |
Constructor.
window_dimensions | The initial window dimensions (in pixels) |
init_glew | Set to 'true' to initialise GLEW |
|
inherited |
Automatically determines the best rendering settings for the current platform.
Definition at line 283 of file gui_renderer.cpp.
|
inherited |
Begins rendering on a particular render target.
target | The render target (main screen if nullptr) |
Definition at line 11 of file gui_renderer.cpp.
|
overrideprotectedvirtual |
Begins rendering on a particular render target.
target | The render target (main screen if nullptr) |
Implements lxgui::gui::renderer.
|
overrideprotectedvirtual |
Creates a new atlas with a given texture filter mode.
filt | The filtering to apply to the texture |
Implements lxgui::gui::renderer.
|
inherited |
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.
|
inherited |
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.
|
inherited |
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.
|
overrideprotectedvirtual |
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 |
Implements lxgui::gui::renderer.
|
inherited |
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.
|
overridevirtual |
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 |
Implements lxgui::gui::renderer.
|
overridevirtual |
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 |
Implements lxgui::gui::renderer.
|
inherited |
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.
|
overrideprotectedvirtual |
Creates a new material from a texture file.
file_name | The name of the file |
filt | The filtering to apply to the texture |
Implements lxgui::gui::renderer.
|
overridevirtual |
Creates a new render target.
dimensions | The dimensions of the render target |
filt | The filtering to apply to the target texture when displayed |
Implements lxgui::gui::renderer.
|
overridevirtual |
Creates a new empty vertex cache.
type | The type of data this cache will hold |
Implements lxgui::gui::renderer.
|
inherited |
Ends rendering.
Definition at line 37 of file gui_renderer.cpp.
|
overrideprotectedvirtual |
Ends rendering.
Implements lxgui::gui::renderer.
|
inherited |
Flushes any pending quad batch render operation.
Definition at line 136 of file gui_renderer.cpp.
|
protectedinherited |
Definition at line 289 of file gui_renderer.cpp.
|
inherited |
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.
|
overridevirtual |
Returns a human-readable name for this renderer.
Implements lxgui::gui::renderer.
|
inherited |
Count the total number of texture atlas pages currently in use.
Definition at line 265 of file gui_renderer.cpp.
|
inherited |
Returns the width/height of a texture atlas page (in pixels).
Definition at line 254 of file gui_renderer.cpp.
|
overridevirtual |
Returns the maximum texture width/height (in pixels).
Implements lxgui::gui::renderer.
|
inherited |
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.
|
overridevirtual |
Returns the current view matrix to use when rendering (viewport).
Implements lxgui::gui::renderer.
|
static |
Checks if a given OpenGL extension is supported by the machine.
|
inherited |
Checks if the renderer has quad render batching enabled.
Definition at line 173 of file gui_renderer.cpp.
|
inherited |
Checks if the renderer has texture atlases enabled.
Definition at line 246 of file gui_renderer.cpp.
|
overridevirtual |
Checks if the renderer supports texture atlases natively.
Implements lxgui::gui::renderer.
|
overridevirtual |
Checks if the renderer supports setting colors for each vertex of a textured quad.
Implements lxgui::gui::renderer.
|
inherited |
Checks if the renderer has enabled support for vertex caches.
Definition at line 275 of file gui_renderer.cpp.
|
overridevirtual |
Checks if the renderer supports vertex caches.
Implements lxgui::gui::renderer.
|
overridevirtual |
Notifies the renderer that the render window has been resized.
new_dimensions | The new window dimensions |
Reimplemented from lxgui::gui::renderer.
|
inherited |
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.
|
overrideprotectedvirtual |
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 |
Implements lxgui::gui::renderer.
|
inherited |
Renders a quad.
q | The quad to render on the current render target |
Definition at line 68 of file gui_renderer.cpp.
|
inherited |
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.
|
overrideprotectedvirtual |
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 |
Implements lxgui::gui::renderer.
|
inherited |
Resets the number of batches to zero (for analytics only).
Definition at line 45 of file gui_renderer.cpp.
|
inherited |
Enables/disables quad batching.
enabled | 'true' to enable quad batching, 'false' to disable it |
Definition at line 177 of file gui_renderer.cpp.
|
inherited |
Enables/disables texture atlases.
enabled | 'true' to enable texture atlases, 'false' to disable them |
Definition at line 250 of file gui_renderer.cpp.
|
inherited |
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.
|
inherited |
Enables/disables vertex caches.
enabled | 'true' to enable vertex caches, 'false' to disable them |
Definition at line 279 of file gui_renderer.cpp.
|
inherited |
Sets the view matrix to use when rendering (viewport).
view_matrix | The view matrix |
Definition at line 60 of file gui_renderer.cpp.
|
overrideprotectedvirtual |
Sets the view matrix to use when rendering (viewport).
view_matrix | The view matrix |
Implements lxgui::gui::renderer.
|
protectedinherited |
Definition at line 497 of file gui_renderer.hpp.
|
protectedinherited |
Definition at line 498 of file gui_renderer.hpp.
|
protectedinherited |
Definition at line 496 of file gui_renderer.hpp.