nngn
|
Rendering subsystem. More...
#include <render.h>
Public Types | |
enum | Debug : u8 { DEBUG_RENDERERS = 1u << 0 , DEBUG_CIRCLE = 1u << 1 , DEBUG_BB = 1u << 2 , DEBUG_LIGHT = 1u << 3 , DEBUG_DEPTH = 1u << 4 , DEBUG_ALL = (1u << 5) - 1 } |
Enabled debugging features. More... | |
Public Member Functions | |
void | init (Textures *t, const Fonts *f, const Textbox *tb, const Grid *g, const Colliders *c, const Lighting *l, const Map *map) |
Partially initializes this system. | |
auto | debug (void) const |
bool | perspective (void) const |
bool | zsprites (void) const |
auto | max_sprites (void) const |
auto | max_screen_sprites (void) const |
auto | max_translucent (void) const |
auto | max_cubes (void) const |
auto | max_voxels (void) const |
std::size_t | n (void) const |
Total number of active renderers. | |
std::size_t | n_sprites (void) const |
Number of active sprite renderers. | |
std::size_t | n_screen_sprites (void) const |
Number of active screen sprite renderers. | |
std::size_t | n_translucent (void) const |
Number of active translucent sprite renderers. | |
std::size_t | n_cubes (void) const |
Number of active cube renderers. | |
std::size_t | n_voxels (void) const |
Number of active voxel renderers. | |
bool | selected (const Renderer *p) const |
void | set_debug (Debug d) |
void | set_perspective (bool p) |
void | set_zsprites (bool z) |
bool | set_max_sprites (std::size_t n) |
bool | set_max_screen_sprites (std::size_t n) |
bool | set_max_translucent (std::size_t n) |
bool | set_max_cubes (std::size_t n) |
bool | set_max_voxels (std::size_t n) |
bool | set_max_text (std::size_t n) |
bool | set_max_colliders (std::size_t n) |
bool | set_graphics (Graphics *g) |
Associates this system with a graphics back end. | |
Renderer * | load (nngn::lua::table_view t) |
Adds a new renderer object according to a description in a Lua table. | |
void | remove (Renderer *p) |
Removes a renderer. | |
void | add_selection (const Renderer *p) |
Processes changed renderers/configuration and updates graphics. | |
void | remove_selection (const Renderer *p) |
bool | update (void) |
Private Types | |
enum | Flag : u16 { SPRITES_UPDATED = 1u << 0 , SCREEN_SPRITES_UPDATED = 1u << 1 , TRANSLUCENT_UPDATED = 1u << 2 , CUBES_UPDATED = 1u << 3 , VOXELS_UPDATED = 1u << 4 , DEBUG_UPDATED = 1u << 5 , SELECTION_UPDATED = 1u << 6 , PERSPECTIVE = 1u << 7 , ZSPRITES = 1u << 8 } |
Private Member Functions | |
bool | update_renderers (bool sprites_updated, bool screen_sprites_updated, bool translucent_updated, bool cubes_updated, bool voxels_updated) |
bool | update_debug (bool sprites_updated, bool screen_sprites_updated, bool cubes_updated, bool voxels_updated) |
Rendering subsystem.
Renders to the screen via the graphics subsystem. This system stores all renderers and rendering configuration. Renderers are added via the Lua interface and always have an associated entity. At every frame, changes are processed and new rendering data are sent to the graphics system to be displayed.
enum nngn::Renderers::Debug : u8 |
|
private |
Processes changed renderers/configuration and updates graphics.
|
inline |
Renderer * nngn::Renderers::load | ( | nngn::lua::table_view | t | ) |
Adds a new renderer object according to a description in a Lua table.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
std::size_t nngn::Renderers::n | ( | void | ) | const |
Total number of active renderers.
|
inline |
Number of active cube renderers.
|
inline |
Number of active screen sprite renderers.
|
inline |
Number of active sprite renderers.
|
inline |
Number of active translucent sprite renderers.
|
inline |
Number of active voxel renderers.
|
inline |
void nngn::Renderers::remove | ( | Renderer * | p | ) |
Removes a renderer.
The corresponding entity is not changed.
void nngn::Renderers::set_debug | ( | Debug | d | ) |
Associates this system with a graphics back end.
Must be called before update
. It is assumed that the current associated back end, if it exists, will be destroyed shortly, so previous resources are not released.
bool nngn::Renderers::set_max_colliders | ( | std::size_t | n | ) |
bool nngn::Renderers::set_max_cubes | ( | std::size_t | n | ) |
bool nngn::Renderers::set_max_screen_sprites | ( | std::size_t | n | ) |
bool nngn::Renderers::set_max_sprites | ( | std::size_t | n | ) |
bool nngn::Renderers::set_max_text | ( | std::size_t | n | ) |
bool nngn::Renderers::set_max_translucent | ( | std::size_t | n | ) |
bool nngn::Renderers::set_max_voxels | ( | std::size_t | n | ) |
void nngn::Renderers::set_perspective | ( | bool | p | ) |
void nngn::Renderers::set_zsprites | ( | bool | z | ) |
bool nngn::Renderers::update | ( | void | ) |
|
private |
|
private |
|
inline |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |