nngn
Loading...
Searching...
No Matches
anonymous_namespace{terminal.cpp}::TerminalBackend Class Referencefinal

Graphics back end for character terminals. More...

Inheritance diagram for anonymous_namespace{terminal.cpp}::TerminalBackend:
Collaboration diagram for anonymous_namespace{terminal.cpp}::TerminalBackend:

Classes

struct  RenderList
 

Public Member Functions

 TerminalBackend (int fd, Flag f, Mode m)
 Constructor.
 
 ~TerminalBackend (void) final
 Resets the terminal to its previous state and deallocates all data.
 
- Public Member Functions inherited from nngn::Pseudograph
bool init_backend () override
 
bool init_instance () override
 
bool init_device () override
 
bool init_device (std::size_t) override
 
std::size_t n_extensions () const override
 
std::size_t n_layers () const override
 
std::size_t n_devices () const override
 
std::size_t n_device_extensions (std::size_t) const override
 
std::size_t n_queue_families (std::size_t) const override
 
std::size_t n_present_modes () const override
 
std::size_t n_heaps (std::size_t) const override
 
std::size_t n_memory_types (std::size_t, std::size_t) const override
 
std::size_t selected_device () const override
 
void extensions (Extension *) const override
 
void layers (Layer *) const override
 
void device_infos (DeviceInfo *) const override
 
void device_extensions (std::size_t, Extension *) const override
 
void queue_families (std::size_t, QueueFamily *) const override
 
SurfaceInfo surface_info () const override
 
void present_modes (PresentMode *) const override
 
void heaps (std::size_t, MemoryHeap *) const override
 
void memory_types (std::size_t, std::size_t, MemoryType *) const override
 
bool error () override
 
bool window_closed () const override
 
GraphicsStats stats () override
 
void get_keys (size_t, int32_t *) const override
 
ivec2 mouse_pos (void) const override
 
bool set_n_frames (std::size_t) override
 
bool set_n_swap_chain_images (std::size_t) override
 
void set_window_title (const char *) override
 
void set_cursor_mode (CursorMode) override
 
void set_key_callback (void *, key_callback_f) override
 
void set_mouse_button_callback (void *, mouse_button_callback_f) override
 
void set_mouse_move_callback (void *, mouse_move_callback_f) override
 
void resize (int, int) override
 
void set_lighting (const Lighting &) override
 
void set_lighting_updated () override
 
bool set_shadow_map_size (uint32_t) override
 
bool set_shadow_cube_size (uint32_t) override
 
void set_automatic_exposure (bool) override
 
void set_exposure (float) override
 
void set_bloom_downscale (std::size_t) override
 
void set_bloom_threshold (float) override
 
void set_bloom_blur_size (float) override
 
void set_bloom_blur_passes (std::size_t) override
 
void set_bloom_amount (float) override
 
void set_blur_downscale (std::size_t) override
 
void set_blur_size (float) override
 
void set_blur_passes (std::size_t) override
 
void set_HDR_mix (float) override
 
bool set_buffer_capacity (u32, u64) override
 
bool set_buffer_size (u32, u64) override
 
bool write_to_buffer (u32 b, u64 offset, u64 n, u64 size, void *data, void f(void *, void *, u64, u64)) override
 
bool resize_textures (u32) override
 
bool load_textures (u32, u32, const std::byte *) override
 
bool resize_font (u32) override
 
bool load_font (unsigned char, u32, const nngn::uvec2 *, const std::byte *) override
 
void poll_events () const override
 
bool set_render_list (const RenderList &) override
 
bool vsync () override
 
- Public Member Functions inherited from nngn::Graphics
template<typename F >
bool write_to_buffer (u32 b, u64 offset, u64 n, u64 size, F &&f)
 
bool update_buffers (u32 vbo, u32 ebo, u64 voff, u64 eoff, u64 vn, u64 vsize, u64 en, u64 esize, void *data, auto &&vgen, auto &&egen)
 

Private Member Functions

auto version (void) const -> Version final
 
bool init (void) final
 Fully initialize the back end.
 
int swap_interval (void) const final
 
uvec2 window_size (void) const final
 
void set_swap_interval (int i) final
 
void set_size_callback (void *data, size_callback_f f) final
 
void set_camera (const Camera &c) final
 
void set_camera_updated (void) final
 
u32 create_pipeline (const PipelineConfiguration &conf) final
 
u32 create_buffer (const BufferConfiguration &conf) final
 
bool set_buffer_capacity (u32 b, u64 size) final
 
bool set_buffer_size (u32 b, u64 size) final
 
bool write_to_buffer (u32 b, u64 offset, u64 n, u64 size, void *data, void f(void *, void *, u64, u64)) final
 
bool resize_textures (u32 n) final
 
bool load_textures (u32 i, u32 n, const std::byte *v) final
 
bool resize_font (u32 n) final
 
bool load_font (unsigned char c, u32 n, const nngn::uvec2 *size, const std::byte *v) final
 
bool set_render_list (const Graphics::RenderList &l) final
 
bool render (void) final
 
std::vector< std::byte > & buffer (u32 i)
 
const std::vector< std::byte > & buffer (u32 i) const
 
std::span< const nngn::Vertexvbo (u32 i) const
 
std::span< const u32 > ebo (u32 i) const
 
nngn::term::Texturetexture (u32 i)
 

Private Attributes

std::vector< PipelineConfiguration::Type > pipelines = {{}}
 
std::vector< nngn::term::Texturetextures = {}
 
std::vector< nngn::term::Texturefonts = {}
 
std::vector< std::vector< std::byte > > buffers = {{}}
 
RenderList render_list = {}
 
nngn::Terminal term = {}
 
nngn::FrameLimiter frame_limiter = {}
 
nngn::term::FrameBuffer frame_buffer
 
nngn::term::Rasterizer rasterizer
 
int fd
 
Camera camera = {}
 
nngn::Flags< Flagflags
 
struct anonymous_namespace{terminal.cpp}::TerminalBackend:: { ... }  callback_data = {}
 

Additional Inherited Members

- Public Types inherited from nngn::Graphics
enum class  Backend : u8 {
  PSEUDOGRAPH , TERMINAL_BACKEND , OPENGL_BACKEND , OPENGL_ES_BACKEND ,
  VULKAN_BACKEND
}
 
enum class  LogLevel { DEBUG , WARNING , ERROR }
 
enum class  PresentMode { IMMEDIATE , MAILBOX , FIFO , FIFO_RELAXED }
 
enum class  TerminalFlag : u8 {
  CLEAR = 1u << 0 , REPOSITION = 1u << 1 , DEDUPLICATE = 1u << 2 , HIDE_CURSOR = 1u << 3 ,
  RESET_COLOR = 1u << 4
}
 
enum class  TerminalMode { ASCII , COLORED }
 
enum class  CursorMode { NORMAL , HIDDEN , DISABLED }
 
using size_callback_f = void (*)(void*, uvec2)
 
using key_callback_f = void (*)(void*, int, int, int, int)
 
using mouse_button_callback_f = void (*)(void*, int, int, int)
 
using mouse_move_callback_f = void (*)(void*, dvec2)
 
- Static Public Member Functions inherited from nngn::Graphics
static std::unique_ptr< Graphicscreate (Backend b, const void *params)
 
static const char * enum_str (DeviceInfo::Type t)
 
static const char * enum_str (QueueFamily::Flag f)
 
static const char * enum_str (PresentMode m)
 
static const char * enum_str (MemoryHeap::Flag m)
 
static const char * enum_str (MemoryType::Flag m)
 
static std::string flags_str (QueueFamily::Flag f)
 
static std::string flags_str (MemoryHeap::Flag f)
 
static std::string flags_str (MemoryType::Flag f)
 
- Static Public Attributes inherited from nngn::Graphics
static constexpr u32 TEXTURE_EXTENT = NNGN_TEXTURE_EXTENT
 
static constexpr u32 TEXTURE_EXTENT_LOG2 = std::countr_zero(TEXTURE_EXTENT)
 
static constexpr u32 TEXTURE_SIZE = NNGN_TEXTURE_SIZE
 
static constexpr u32 TEXTURE_MIP_LEVELS = Math::mip_levels(TEXTURE_EXTENT)
 
static constexpr u32 SHADOW_MAP_INITIAL_SIZE = 1024
 
static constexpr u32 SHADOW_CUBE_INITIAL_SIZE = 512
 
static constexpr float DEFAULT_EXPOSURE = 1.0f
 
static constexpr float DEFAULT_BLOOM_THRESHOLD = 0.75f
 
static constexpr float DEFAULT_BLOOM_BLUR_SIZE = 1.0f
 
static constexpr std::size_t DEFAULT_BLOOM_DOWNSCALE = 8
 
static constexpr std::size_t DEFAULT_BLUR_DOWNSCALE = 2
 
static constexpr std::size_t DEFAULT_BLOOM_BLUR_PASSES = 10
 

Detailed Description

Graphics back end for character terminals.

Implemented as a software rasterizer, either monochrome or colored. Currently only supports axis-aligned sprites (which includes text).

Constructor & Destructor Documentation

◆ TerminalBackend()

anonymous_namespace{terminal.cpp}::TerminalBackend::TerminalBackend ( int fd,
Flag f,
Mode m )

Constructor.

Parameters
fdNon-owning reference to the output file. Must remain valid while the object exists.

◆ ~TerminalBackend()

anonymous_namespace{terminal.cpp}::TerminalBackend::~TerminalBackend ( void )
final

Resets the terminal to its previous state and deallocates all data.

Here is the call graph for this function:

Member Function Documentation

◆ buffer() [1/2]

std::vector< std::byte > & anonymous_namespace{terminal.cpp}::TerminalBackend::buffer ( u32 i)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ buffer() [2/2]

const std::vector< std::byte > & anonymous_namespace{terminal.cpp}::TerminalBackend::buffer ( u32 i) const
private
Here is the call graph for this function:

◆ create_buffer()

u32 anonymous_namespace{terminal.cpp}::TerminalBackend::create_buffer ( const BufferConfiguration & conf)
finalprivatevirtual

Reimplemented from nngn::Pseudograph.

Here is the call graph for this function:

◆ create_pipeline()

u32 anonymous_namespace{terminal.cpp}::TerminalBackend::create_pipeline ( const PipelineConfiguration & conf)
finalprivatevirtual

Reimplemented from nngn::Pseudograph.

Here is the call graph for this function:

◆ ebo()

std::span< const u32 > anonymous_namespace{terminal.cpp}::TerminalBackend::ebo ( u32 i) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

bool anonymous_namespace{terminal.cpp}::TerminalBackend::init ( void )
finalprivatevirtual

Fully initialize the back end.

Calls the other initialization functions with default values.

Reimplemented from nngn::Graphics.

Here is the call graph for this function:

◆ load_font()

bool anonymous_namespace{terminal.cpp}::TerminalBackend::load_font ( unsigned char c,
u32 n,
const nngn::uvec2 * size,
const std::byte * v )
finalprivate
Here is the call graph for this function:

◆ load_textures()

bool anonymous_namespace{terminal.cpp}::TerminalBackend::load_textures ( u32 i,
u32 n,
const std::byte * v )
finalprivate
Here is the call graph for this function:

◆ render()

bool anonymous_namespace{terminal.cpp}::TerminalBackend::render ( void )
finalprivatevirtual

Reimplemented from nngn::Pseudograph.

Here is the call graph for this function:

◆ resize_font()

bool anonymous_namespace{terminal.cpp}::TerminalBackend::resize_font ( u32 n)
finalprivate

◆ resize_textures()

bool anonymous_namespace{terminal.cpp}::TerminalBackend::resize_textures ( u32 n)
finalprivate
Here is the call graph for this function:

◆ set_buffer_capacity()

bool anonymous_namespace{terminal.cpp}::TerminalBackend::set_buffer_capacity ( u32 b,
u64 size )
finalprivate
Here is the call graph for this function:

◆ set_buffer_size()

bool anonymous_namespace{terminal.cpp}::TerminalBackend::set_buffer_size ( u32 b,
u64 size )
finalprivate
Here is the call graph for this function:

◆ set_camera()

void anonymous_namespace{terminal.cpp}::TerminalBackend::set_camera ( const Camera & c)
finalprivatevirtual

Reimplemented from nngn::Pseudograph.

Here is the call graph for this function:

◆ set_camera_updated()

void anonymous_namespace{terminal.cpp}::TerminalBackend::set_camera_updated ( void )
finalprivatevirtual

Reimplemented from nngn::Pseudograph.

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

◆ set_render_list()

bool anonymous_namespace{terminal.cpp}::TerminalBackend::set_render_list ( const Graphics::RenderList & l)
finalprivate
Here is the call graph for this function:

◆ set_size_callback()

void anonymous_namespace{terminal.cpp}::TerminalBackend::set_size_callback ( void * data,
size_callback_f f )
finalprivatevirtual

Reimplemented from nngn::Pseudograph.

Here is the call graph for this function:

◆ set_swap_interval()

void anonymous_namespace{terminal.cpp}::TerminalBackend::set_swap_interval ( int i)
inlinefinalprivatevirtual

Reimplemented from nngn::Pseudograph.

◆ swap_interval()

int anonymous_namespace{terminal.cpp}::TerminalBackend::swap_interval ( void ) const
finalprivatevirtual

Reimplemented from nngn::Pseudograph.

Here is the call graph for this function:

◆ texture()

nngn::term::Texture & anonymous_namespace{terminal.cpp}::TerminalBackend::texture ( u32 i)
private
Here is the call graph for this function:

◆ vbo()

std::span< const nngn::Vertex > anonymous_namespace{terminal.cpp}::TerminalBackend::vbo ( u32 i) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ version()

auto anonymous_namespace{terminal.cpp}::TerminalBackend::version ( void ) const -> Version
inlinefinalprivatevirtual

Reimplemented from nngn::Pseudograph.

◆ window_size()

uvec2 anonymous_namespace{terminal.cpp}::TerminalBackend::window_size ( void ) const
inlinefinalprivatevirtual

Reimplemented from nngn::Pseudograph.

◆ write_to_buffer()

bool anonymous_namespace{terminal.cpp}::TerminalBackend::write_to_buffer ( u32 b,
u64 offset,
u64 n,
u64 size,
void * data,
void fvoid *, void *, u64, u64 )
finalprivate
Here is the call graph for this function:

Member Data Documentation

◆ buffers

std::vector<std::vector<std::byte> > anonymous_namespace{terminal.cpp}::TerminalBackend::buffers = {{}}
private

◆ []

struct anonymous_namespace{terminal.cpp} { ... } anonymous_namespace{terminal.cpp}::TerminalBackend::callback_data

◆ camera

Camera anonymous_namespace{terminal.cpp}::TerminalBackend::camera = {}
private

◆ fd

int anonymous_namespace{terminal.cpp}::TerminalBackend::fd
private

◆ flags

nngn::Flags<Flag> anonymous_namespace{terminal.cpp}::TerminalBackend::flags
private

◆ fonts

std::vector<nngn::term::Texture> anonymous_namespace{terminal.cpp}::TerminalBackend::fonts = {}
private

◆ frame_buffer

nngn::term::FrameBuffer anonymous_namespace{terminal.cpp}::TerminalBackend::frame_buffer
private

◆ frame_limiter

nngn::FrameLimiter anonymous_namespace{terminal.cpp}::TerminalBackend::frame_limiter = {}
private

◆ pipelines

std::vector<PipelineConfiguration::Type> anonymous_namespace{terminal.cpp}::TerminalBackend::pipelines = {{}}
private

◆ rasterizer

nngn::term::Rasterizer anonymous_namespace{terminal.cpp}::TerminalBackend::rasterizer
private

◆ render_list

RenderList anonymous_namespace{terminal.cpp}::TerminalBackend::render_list = {}
private

◆ size_cb

size_callback_f anonymous_namespace{terminal.cpp}::TerminalBackend::size_cb

◆ size_p

void* anonymous_namespace{terminal.cpp}::TerminalBackend::size_p

◆ term

nngn::Terminal anonymous_namespace{terminal.cpp}::TerminalBackend::term = {}
private

◆ textures

std::vector<nngn::term::Texture> anonymous_namespace{terminal.cpp}::TerminalBackend::textures = {}
private

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