nngn
Loading...
Searching...
No Matches
nngn::Renderers Class Reference

Rendering subsystem. More...

#include <render.h>

Collaboration diagram for nngn::Renderers:

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.
 
Rendererload (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)
 

Private Attributes

Flags< Flagflags = {}
 
Flags< Debugm_debug = {}
 
Texturestextures = nullptr
 
Graphicsgraphics = nullptr
 
const Fontsfonts = nullptr
 
const Textboxtextbox = nullptr
 
const Gridgrid = nullptr
 
const Colliderscolliders = nullptr
 
const Lightinglighting = nullptr
 
const Mapmap = nullptr
 
std::vector< SpriteRenderersprites = {}
 
std::vector< SpriteRendererscreen_sprites = {}
 
std::vector< SpriteRenderertranslucent = {}
 
std::vector< CubeRenderercubes = {}
 
std::vector< VoxelRenderervoxels = {}
 
std::unordered_set< const Renderer * > selections = {}
 
u32 translucent_vbo = {}
 
u32 translucent_ebo = {}
 
u32 sprite_vbo = {}
 
u32 sprite_ebo = {}
 
u32 sprite_debug_vbo = {}
 
u32 sprite_debug_ebo = {}
 
u32 screen_sprite_vbo = {}
 
u32 screen_sprite_ebo = {}
 
u32 screen_sprite_debug_vbo = {}
 
u32 screen_sprite_debug_ebo = {}
 
u32 cube_vbo = {}
 
u32 cube_ebo = {}
 
u32 cube_debug_vbo = {}
 
u32 cube_debug_ebo = {}
 
u32 voxel_vbo = {}
 
u32 voxel_ebo = {}
 
u32 voxel_debug_vbo = {}
 
u32 voxel_debug_ebo = {}
 
u32 text_vbo = {}
 
u32 text_ebo = {}
 
u32 textbox_vbo = {}
 
u32 textbox_ebo = {}
 
u32 selection_vbo = {}
 
u32 selection_ebo = {}
 
u32 aabb_vbo = {}
 
u32 aabb_ebo = {}
 
u32 aabb_circle_vbo = {}
 
u32 aabb_circle_ebo = {}
 
u32 bb_vbo = {}
 
u32 bb_ebo = {}
 
u32 bb_circle_vbo = {}
 
u32 bb_circle_ebo = {}
 
u32 sphere_vbo = {}
 
u32 sphere_ebo = {}
 
u32 lights_vbo = {}
 
u32 lights_ebo = {}
 
u32 range_vbo = {}
 
u32 range_ebo = {}
 
u32 depth_vbo = {}
 
u32 depth_ebo = {}
 
u32 depth_cube_vbo = {}
 
u32 depth_cube_ebo = {}
 

Detailed Description

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.

See also
Entity
Gen
Graphics

Member Enumeration Documentation

◆ Debug

Enabled debugging features.

Enumerator
DEBUG_RENDERERS 
DEBUG_CIRCLE 
DEBUG_BB 
DEBUG_LIGHT 
DEBUG_DEPTH 
DEBUG_ALL 

◆ Flag

enum nngn::Renderers::Flag : u16
private
Enumerator
SPRITES_UPDATED 
SCREEN_SPRITES_UPDATED 
TRANSLUCENT_UPDATED 
CUBES_UPDATED 
VOXELS_UPDATED 
DEBUG_UPDATED 
SELECTION_UPDATED 
PERSPECTIVE 
ZSPRITES 

Member Function Documentation

◆ add_selection()

void nngn::Renderers::add_selection ( const Renderer * p)

Processes changed renderers/configuration and updates graphics.

Here is the caller graph for this function:

◆ debug()

auto nngn::Renderers::debug ( void ) const
inline
Here is the caller graph for this function:

◆ init()

void nngn::Renderers::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.

See also
set_graphics
Here is the call graph for this function:

◆ load()

Renderer * nngn::Renderers::load ( nngn::lua::table_view t)

Adds a new renderer object according to a description in a Lua table.

Here is the caller graph for this function:

◆ max_cubes()

auto nngn::Renderers::max_cubes ( void ) const
inline

◆ max_screen_sprites()

auto nngn::Renderers::max_screen_sprites ( void ) const
inline

◆ max_sprites()

auto nngn::Renderers::max_sprites ( void ) const
inline

◆ max_translucent()

auto nngn::Renderers::max_translucent ( void ) const
inline

◆ max_voxels()

auto nngn::Renderers::max_voxels ( void ) const
inline

◆ n()

std::size_t nngn::Renderers::n ( void ) const

Total number of active renderers.

Here is the caller graph for this function:

◆ n_cubes()

std::size_t nngn::Renderers::n_cubes ( void ) const
inline

Number of active cube renderers.

◆ n_screen_sprites()

std::size_t nngn::Renderers::n_screen_sprites ( void ) const
inline

Number of active screen sprite renderers.

◆ n_sprites()

std::size_t nngn::Renderers::n_sprites ( void ) const
inline

Number of active sprite renderers.

◆ n_translucent()

std::size_t nngn::Renderers::n_translucent ( void ) const
inline

Number of active translucent sprite renderers.

◆ n_voxels()

std::size_t nngn::Renderers::n_voxels ( void ) const
inline

Number of active voxel renderers.

◆ perspective()

bool nngn::Renderers::perspective ( void ) const
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove()

void nngn::Renderers::remove ( Renderer * p)

Removes a renderer.

The corresponding entity is not changed.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove_selection()

void nngn::Renderers::remove_selection ( const Renderer * p)
Here is the caller graph for this function:

◆ selected()

bool nngn::Renderers::selected ( const Renderer * p) const
inline
Here is the caller graph for this function:

◆ set_debug()

void nngn::Renderers::set_debug ( Debug d)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_graphics()

bool nngn::Renderers::set_graphics ( Graphics * g)

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.

Here is the call graph for this function:

◆ set_max_colliders()

bool nngn::Renderers::set_max_colliders ( std::size_t n)
Here is the call graph for this function:

◆ set_max_cubes()

bool nngn::Renderers::set_max_cubes ( std::size_t n)
Here is the call graph for this function:

◆ set_max_screen_sprites()

bool nngn::Renderers::set_max_screen_sprites ( std::size_t n)
Here is the call graph for this function:

◆ set_max_sprites()

bool nngn::Renderers::set_max_sprites ( std::size_t n)
Here is the call graph for this function:

◆ set_max_text()

bool nngn::Renderers::set_max_text ( std::size_t n)
Here is the call graph for this function:

◆ set_max_translucent()

bool nngn::Renderers::set_max_translucent ( std::size_t n)
Here is the call graph for this function:

◆ set_max_voxels()

bool nngn::Renderers::set_max_voxels ( std::size_t n)
Here is the call graph for this function:

◆ set_perspective()

void nngn::Renderers::set_perspective ( bool p)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_zsprites()

void nngn::Renderers::set_zsprites ( bool z)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update()

bool nngn::Renderers::update ( void )
Here is the call graph for this function:

◆ update_debug()

bool nngn::Renderers::update_debug ( bool sprites_updated,
bool screen_sprites_updated,
bool cubes_updated,
bool voxels_updated )
private
Here is the call graph for this function:

◆ update_renderers()

bool nngn::Renderers::update_renderers ( bool sprites_updated,
bool screen_sprites_updated,
bool translucent_updated,
bool cubes_updated,
bool voxels_updated )
private
Here is the call graph for this function:

◆ zsprites()

bool nngn::Renderers::zsprites ( void ) const
inline
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ aabb_circle_ebo

u32 nngn::Renderers::aabb_circle_ebo = {}
private

◆ aabb_circle_vbo

u32 nngn::Renderers::aabb_circle_vbo = {}
private

◆ aabb_ebo

u32 nngn::Renderers::aabb_ebo = {}
private

◆ aabb_vbo

u32 nngn::Renderers::aabb_vbo = {}
private

◆ bb_circle_ebo

u32 nngn::Renderers::bb_circle_ebo = {}
private

◆ bb_circle_vbo

u32 nngn::Renderers::bb_circle_vbo = {}
private

◆ bb_ebo

u32 nngn::Renderers::bb_ebo = {}
private

◆ bb_vbo

u32 nngn::Renderers::bb_vbo = {}
private

◆ colliders

const Colliders* nngn::Renderers::colliders = nullptr
private

◆ cube_debug_ebo

u32 nngn::Renderers::cube_debug_ebo = {}
private

◆ cube_debug_vbo

u32 nngn::Renderers::cube_debug_vbo = {}
private

◆ cube_ebo

u32 nngn::Renderers::cube_ebo = {}
private

◆ cube_vbo

u32 nngn::Renderers::cube_vbo = {}
private

◆ cubes

std::vector<CubeRenderer> nngn::Renderers::cubes = {}
private

◆ depth_cube_ebo

u32 nngn::Renderers::depth_cube_ebo = {}
private

◆ depth_cube_vbo

u32 nngn::Renderers::depth_cube_vbo = {}
private

◆ depth_ebo

u32 nngn::Renderers::depth_ebo = {}
private

◆ depth_vbo

u32 nngn::Renderers::depth_vbo = {}
private

◆ flags

Flags<Flag> nngn::Renderers::flags = {}
private

◆ fonts

const Fonts* nngn::Renderers::fonts = nullptr
private

◆ graphics

Graphics* nngn::Renderers::graphics = nullptr
private

◆ grid

const Grid* nngn::Renderers::grid = nullptr
private

◆ lighting

const Lighting* nngn::Renderers::lighting = nullptr
private

◆ lights_ebo

u32 nngn::Renderers::lights_ebo = {}
private

◆ lights_vbo

u32 nngn::Renderers::lights_vbo = {}
private

◆ m_debug

Flags<Debug> nngn::Renderers::m_debug = {}
private

◆ map

const Map* nngn::Renderers::map = nullptr
private

◆ range_ebo

u32 nngn::Renderers::range_ebo = {}
private

◆ range_vbo

u32 nngn::Renderers::range_vbo = {}
private

◆ screen_sprite_debug_ebo

u32 nngn::Renderers::screen_sprite_debug_ebo = {}
private

◆ screen_sprite_debug_vbo

u32 nngn::Renderers::screen_sprite_debug_vbo = {}
private

◆ screen_sprite_ebo

u32 nngn::Renderers::screen_sprite_ebo = {}
private

◆ screen_sprite_vbo

u32 nngn::Renderers::screen_sprite_vbo = {}
private

◆ screen_sprites

std::vector<SpriteRenderer> nngn::Renderers::screen_sprites = {}
private

◆ selection_ebo

u32 nngn::Renderers::selection_ebo = {}
private

◆ selection_vbo

u32 nngn::Renderers::selection_vbo = {}
private

◆ selections

std::unordered_set<const Renderer*> nngn::Renderers::selections = {}
private

◆ sphere_ebo

u32 nngn::Renderers::sphere_ebo = {}
private

◆ sphere_vbo

u32 nngn::Renderers::sphere_vbo = {}
private

◆ sprite_debug_ebo

u32 nngn::Renderers::sprite_debug_ebo = {}
private

◆ sprite_debug_vbo

u32 nngn::Renderers::sprite_debug_vbo = {}
private

◆ sprite_ebo

u32 nngn::Renderers::sprite_ebo = {}
private

◆ sprite_vbo

u32 nngn::Renderers::sprite_vbo = {}
private

◆ sprites

std::vector<SpriteRenderer> nngn::Renderers::sprites = {}
private

◆ text_ebo

u32 nngn::Renderers::text_ebo = {}
private

◆ text_vbo

u32 nngn::Renderers::text_vbo = {}
private

◆ textbox

const Textbox* nngn::Renderers::textbox = nullptr
private

◆ textbox_ebo

u32 nngn::Renderers::textbox_ebo = {}
private

◆ textbox_vbo

u32 nngn::Renderers::textbox_vbo = {}
private

◆ textures

Textures* nngn::Renderers::textures = nullptr
private

◆ translucent

std::vector<SpriteRenderer> nngn::Renderers::translucent = {}
private

◆ translucent_ebo

u32 nngn::Renderers::translucent_ebo = {}
private

◆ translucent_vbo

u32 nngn::Renderers::translucent_vbo = {}
private

◆ voxel_debug_ebo

u32 nngn::Renderers::voxel_debug_ebo = {}
private

◆ voxel_debug_vbo

u32 nngn::Renderers::voxel_debug_vbo = {}
private

◆ voxel_ebo

u32 nngn::Renderers::voxel_ebo = {}
private

◆ voxel_vbo

u32 nngn::Renderers::voxel_vbo = {}
private

◆ voxels

std::vector<VoxelRenderer> nngn::Renderers::voxels = {}
private

The documentation for this class was generated from the following files: