luna engine
software engine
Loading...
Searching...
No Matches
luna::renderer::renderer2D Class Reference

2D renderer api runs onTop of the renderer api. More...

#include <renderer2D.h>

Classes

struct  statistics
 struct containing renderer2D statistics. More...
 

Static Public Member Functions

static void init ()
 initializes the 2D renderer. More...
 
static void shutdown ()
 shutsdown the 2D renderer and destroys the appropriate resources. More...
 
static void BeginScene ()
 starts a 2D renderer scene. More...
 
static void endScene ()
 ends the 2D renderer scene. More...
 
static bool drawLabel (const glm::vec3 &position, const glm::vec2 &size, const ref< font > &font, const std::string labelText)
 
static bool drawCharQuad (const glm::vec3 &position, const glm::vec2 &size, const ref< texture > &texture, uint64_t handleIndex)
 draws a texture quad. More...
 
static bool drawQuad (const glm::vec3 &position, const glm::vec2 &size, const ref< texture > &texture)
 draws a texture quad. More...
 
static bool drawQuad (const glm::mat4 transform, const glm::vec4 color, const ref< texture > &texture)
 draws a texture quad. More...
 
static bool drawQuad (const glm::vec3 &position, const glm::vec2 &size, const glm::vec4 &color)
 draws a quad. More...
 
static bool drawQuad (const glm::vec3 &position, const glm::vec2 &size)
 draws a quad. More...
 
static bool drawQuad (const glm::mat4 &transform, const glm::vec4 &color)
 draws a quad. More...
 
static void flush ()
 flushes all the draw commands to the base renderer. More...
 
static statistics getStats ()
 returns renderer2D stats. More...
 

Static Private Member Functions

static uint64_t textureInBatch (const uint64_t &handle)
 

Static Private Attributes

static ref< textureblankImage
 

Detailed Description

2D renderer api runs onTop of the renderer api.

See also
renderer::renderer

Member Function Documentation

◆ BeginScene()

void luna::renderer::renderer2D::BeginScene ( )
static

starts a 2D renderer scene.

◆ drawCharQuad()

bool luna::renderer::renderer2D::drawCharQuad ( const glm::vec3 &  position,
const glm::vec2 &  size,
const ref< texture > &  texture,
uint64_t  handleIndex 
)
static

draws a texture quad.

Parameters
constglm::vec3& position starting position
constglm::vec2& size starting size;
constglm::vec3& color rgb color value

◆ drawLabel()

bool luna::renderer::renderer2D::drawLabel ( const glm::vec3 &  position,
const glm::vec2 &  size,
const ref< font > &  font,
const std::string  labelText 
)
static

Parameters
position
size
font
labelText

font rendering: quad origin is at top left. 1) xadvance += glyph advance.x 2) draw glyph (+ y advance) 3) xadvance += relative glyph width.

◆ drawQuad() [1/5]

bool luna::renderer::renderer2D::drawQuad ( const glm::mat4 &  transform,
const glm::vec4 &  color 
)
static

draws a quad.

Parameters
constglm::mat4& transform starting transformation.

◆ drawQuad() [2/5]

bool luna::renderer::renderer2D::drawQuad ( const glm::mat4  transform,
const glm::vec4  color,
const ref< texture > &  texture 
)
static

draws a texture quad.

Parameters
constglm::mat4 transform
constglm::vec4 color
constref<texture>& texture

◆ drawQuad() [3/5]

bool luna::renderer::renderer2D::drawQuad ( const glm::vec3 &  position,
const glm::vec2 &  size 
)
static

draws a quad.

Parameters
constglm::vec3& position starting position
constglm::vec2& size starting size;

◆ drawQuad() [4/5]

bool luna::renderer::renderer2D::drawQuad ( const glm::vec3 &  position,
const glm::vec2 &  size,
const glm::vec4 &  color 
)
static

draws a quad.

Parameters
constglm::vec3& position starting position
constglm::vec2& size starting size;
constglm::vec3& color rgb color value

◆ drawQuad() [5/5]

bool luna::renderer::renderer2D::drawQuad ( const glm::vec3 &  position,
const glm::vec2 &  size,
const ref< texture > &  texture 
)
static

draws a texture quad.

Parameters
constglm::vec3& position starting position
constglm::vec2& size starting size;
constglm::vec3& color rgb color value

◆ endScene()

void luna::renderer::renderer2D::endScene ( )
static

ends the 2D renderer scene.

◆ flush()

void luna::renderer::renderer2D::flush ( )
static

flushes all the draw commands to the base renderer.

See also
renderer::renderer

◆ getStats()

renderer2D::statistics luna::renderer::renderer2D::getStats ( )
static

returns renderer2D stats.

◆ init()

void luna::renderer::renderer2D::init ( )
static

initializes the 2D renderer.

◆ shutdown()

void luna::renderer::renderer2D::shutdown ( )
static

shutsdown the 2D renderer and destroys the appropriate resources.

◆ textureInBatch()

uint64_t luna::renderer::renderer2D::textureInBatch ( const uint64_t &  handle)
staticprivate

Member Data Documentation

◆ blankImage

ref<texture> luna::renderer::renderer2D::blankImage
inlinestaticprivate

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