Euphoria
Classes | Typedefs | Enumerations | Functions | Variables
eu::render Namespace Reference

Classes

struct  BaseTexture
 Base class for all textures, but only exist due to code reuse and can easily be inlined. More...
 
struct  BoundFbo
 raii class to render to a FrameBuffer More...
 
struct  BoundUniformBuffer
 
struct  CompiledGeomVertexAttributes
 A list of CompiledVertexLayoutNoNameList (for geom) More...
 
struct  CompiledShaderVertexAttributes
 A list of CompiledVertexElement (for shader) More...
 
struct  CompiledUniformProp
 A compiled uniform buffer property that can be used in a shader. More...
 
struct  CompiledVertexElement
 A realized VertexElementDescription like vec3 position at gl shader position 3. More...
 
struct  CompiledVertexElementNoName
 A realized VertexElementDescription without name like vec3 at gl shader position 3. More...
 
struct  CompiledVertexTypeList
 A mapping of the vertex type (position...) to the actual shader id (for more than one shader) More...
 
struct  DrawableFont
 
struct  DrawableText
 
struct  FrameBuffer
 "render to texture" feature More...
 
struct  Glyph
 
struct  InputCommand
 
struct  InstanceProp
 A property for a shader used in instanced rendering. More...
 
struct  Layer
 
struct  LayoutData
 
struct  LerpData
 
struct  ListOfTextDrawCommands
 
struct  OpenglStates
 A "cache" for the current open gl state. More...
 
struct  Quad
 
struct  Render2
 
struct  RenderCommand
 
struct  RenderLayer2
 
struct  RenderLayer3
 
struct  RotateQuad
 
struct  ShaderProgram
 RAII representation of a open gl shader program. More...
 
struct  SpriteBatch
 
struct  StateChanger
 A helper class to change both the opengl state and the cache. More...
 
struct  TextDrawCommand
 
struct  Texture2d
 A 2d image texture. More...
 
struct  TextureCubemap
 A cubemap texture. More...
 
struct  Uniform
 Represents a found shader uniform and created via ShaderProgram::GetUniform() More...
 
struct  UniformBuffer
 
struct  UniformBufferCompiler
 
struct  UniformBufferSetup
 
struct  UniformProp
 internal More...
 
struct  Vertex2
 
struct  VertexElementDescription
 A not-yet-realised binding to a shader variable like vec3 position More...
 

Typedefs

using CharToGlyphMap = std::map< int, std::shared_ptr< Glyph > >
 
using BlendMode = std::tuple< Blend, Blend >
 Blend mode state consisting of src and dst blend functions.
 
using StencilFunc = std::tuple< Compare, i32, u32 >
 Stencil function state consisiting of the compare function, the ref and the state.
 
using StencilOp = std::tuple< StencilAction, StencilAction, StencilAction >
 Stencil operation state consisting of the stencil fail, depth fail and the pass action.
 
using ShaderVertexAttributes = std::vector< VertexElementDescription >
 Describes all vertex inputs a shader requires like [vec3 position, vec3 normal, vec2 uv]
 
using VertexTypes = std::vector< VertexType >
 

Enumerations

enum class  Blend {
  Blend::zero , Blend::one , Blend::src_color , Blend::one_minus_src_color ,
  Blend::dst_color , Blend::one_minus_dst_color , Blend::src_alpha , Blend::one_minus_src_alpha ,
  Blend::dst_alpha , Blend::one_minus_dst_alpha , Blend::constant_color , Blend::one_minus_constant_color ,
  Blend::constant_alpha , Blend::one_minus_constant_alpha , Blend::src_alpha_saturate , Blend::src1_color ,
  Blend::one_minus_src1_color , Blend::src1_alpha , Blend::one_minus_src1_alpha
}
 
enum class  ViewportStyle { black_bars , extended }
 
enum class  Compare {
  Compare::always , Compare::never , Compare::less , Compare::equal ,
  Compare::less_equal , Compare::greater , Compare::not_equal , Compare::greater_equal
}
 
enum class  CullFace { CullFace::front , CullFace::back , CullFace::front_and_back }
 
enum class  Align {
  top_left , top_center , top_right , baseline_left ,
  baseline_center , baseline_right , bottom_left , bottom_center ,
  bottom_right
}
 
enum class  RenderMode { RenderMode::fill , RenderMode::line , RenderMode::point }
 
enum class  StencilAction {
  StencilAction::keep , StencilAction::zero , StencilAction::replace , StencilAction::increase ,
  StencilAction::increase_wrap , StencilAction::decrease , StencilAction::decrease_wrap , StencilAction::invert
}
 
enum class  TextureEdge { TextureEdge::clamp , TextureEdge::repeat }
 
enum class  TextureRenderStyle { TextureRenderStyle::pixel , TextureRenderStyle::mipmap , TextureRenderStyle::linear }
 
enum class  Transparency { Transparency::include , Transparency::exclude }
 
enum class  ColorData { ColorData::color_data , ColorData::non_color_data , ColorData::dont_care }
 
enum class  SingleColor : std::uint32_t
 A single color in a format to load directly into open gl texture(ABGR on little endian). More...
 
enum class  DepthBits { DepthBits::use_none , DepthBits::use_16 , DepthBits::use_24 , DepthBits::use_32 }
 The number of bits to use for the depth buffer. More...
 
enum class  ColorBitsPerPixel { ColorBitsPerPixel::use_depth , ColorBitsPerPixel::use_8 , ColorBitsPerPixel::use_16 , ColorBitsPerPixel::use_32 }
 The number of bits/pixel to use for the color buffer. More...
 
enum class  UniformType {
  UniformType::invalid , UniformType::bool_type , UniformType::int_type , UniformType::float_type ,
  UniformType::vec2 , UniformType::vec3 , UniformType::vec4 , UniformType::mat4
}
 
enum class  VertexType {
  VertexType::position2xy , VertexType::position2xz , VertexType::position3 , VertexType::normal3 ,
  VertexType::color3 , VertexType::color4 , VertexType::texture2 , VertexType::instance_transform
}
 Vertex source type, position, normal etc. More...
 

Functions

RenderLayer2 with_layer2 (const RenderCommand &rc, const LayoutData &ld)
 
RenderLayer3 with_layer3 (const RenderCommand &rc, const LayoutData &ld)
 
Layer with_layer (const InputCommand &rc, const LayoutData &ld)
 
RenderLayer2 with_layer2 (const RenderCommand &rc, const LerpData &ld)
 
RenderLayer3 with_layer3 (const RenderCommand &rc, const LerpData &ld)
 
Layer with_layer (const InputCommand &rc, const LerpData &ld)
 
void setup_opengl_debug ()
 
GLenum glenum_from_int (int i)
 
GLuint gluint_from_int (int i)
 
GLsizeiptr glsizeiptr_from_sizet (std::size_t t)
 
GLsizei glsizei_from_sizet (std::size_t t)
 
u32 create_buffer ()
 
void destroy_buffer (u32 vbo)
 
u32 create_vertex_array ()
 
void destroy_vertex_array (u32 vao)
 
void set_gl_viewport (const Size &sz)
 
constexpr void opengl_nop ()
 
void setup_textures (ShaderProgram *shader, const std::vector< Uniform * > &uniform_list)
 Sets up textures for a shader program.
 
bool is_bound_for_shader (const std::unordered_set< VertexType > &debug_geom_shader_types)
 Verifies if the current shader matches the required vertex types.
 
bool is_shader_bound (unsigned int program)
 Checks if a specific shader program is currently active.
 
void clear_shader_program ()
 Clears the current open gl shader program binding.
 
void bind_texture_2d (OpenglStates *states, const Uniform &uniform, const Texture2d &texture)
 
void bind_texture_2d (OpenglStates *states, const Uniform &uniform, const FrameBuffer &texture)
 
void bind_texture_cubemap (OpenglStates *states, const Uniform &uniform, const TextureCubemap &texture)
 
constexpr SingleColor color_from_rgba (uint8_t r, uint8_t g, uint8_t b, uint8_t a)
 Constructs a SingleColor value from individual red, green, blue, and alpha components.
 
Texture2d load_image_from_color (DEBUG_LABEL_ARG_MANY SingleColor pixel, TextureEdge te, TextureRenderStyle trs, Transparency t, ColorData cd)
 
TextureCubemap load_cubemap_from_color (DEBUG_LABEL_ARG_MANY SingleColor pixel, ColorData cd)
 
std::shared_ptr< FrameBufferbuild_simple_framebuffer (DEBUG_LABEL_ARG_MANY const Size &size)
 Build a simple LDR frame buffer.
 
std::shared_ptr< FrameBufferbuild_msaa_framebuffer (DEBUG_LABEL_ARG_MANY const Size &size, int msaa_samples, ColorBitsPerPixel bits_per_pixel)
 Builds a multisample anti-aliasing (MSAA) framebuffer for high-quality rendering.
 
std::shared_ptr< FrameBufferbuild_hdr_floating_framebuffer (DEBUG_LABEL_ARG_MANY const Size &size, ColorBitsPerPixel bits_per_pixel)
 Build a HDR frame buffer.
 
std::shared_ptr< FrameBufferbuild_shadow_framebuffer (DEBUG_LABEL_ARG_MANY const Size &size)
 Create a depth-only framebuffer for shadow rendering.
 
void resolve_multisampled_buffer (const FrameBuffer &src, FrameBuffer *dst)
 
Texture2d load_image_from_embedded (DEBUG_LABEL_ARG_MANY const embedded_binary &image_binary, TextureEdge te, TextureRenderStyle trs, Transparency t, ColorData cd)
 
TextureCubemap load_cubemap_from_embedded (DEBUG_LABEL_ARG_MANY const std::array< embedded_binary, cubemap_size > &images, ColorData cd)
 
constexpr bool is_instance_based (VertexType v)
 
std::vector< VertexTypefind_duplicates (const ShaderVertexAttributes &items)
 
CompiledShaderVertexAttributes compile_shader_layout (const CompiledVertexTypeList &l, const ShaderVertexAttributes &elements, std::optional< InstanceProp > instance_prop, std::optional< int > start_index)
 
CompiledGeomVertexAttributes get_geom_layout (const CompiledVertexTypeList &l)
 
CompiledVertexTypeList compile_attribute_layouts (const std::vector< VertexType > &base_layout, const std::vector< ShaderVertexAttributes > &descriptions)
 
CompiledVertexTypeList compile_attribute_layouts (const std::vector< ShaderVertexAttributes > &descriptions)
 

Variables

constexpr std::size_t MAX_TEXTURES_SUPPORTED = 16
 
constexpr std::size_t cubemap_size = 6
 0=right(x+), 1=left(x-), 2=top(y+), 3=bottom(y-), 4=front(z+), 5=back(z-)
 

Typedef Documentation

◆ CharToGlyphMap

using eu::render::CharToGlyphMap = typedef std::map<int, std::shared_ptr<Glyph> >

Definition at line 40 of file font.h.

Enumeration Type Documentation

◆ Align

Enumerator
top_left 
top_center 
top_right 
baseline_left 
baseline_center 
baseline_right 
bottom_left 
bottom_center 
bottom_right 

Definition at line 44 of file font.h.

◆ ViewportStyle

Enumerator
black_bars 
extended 

Definition at line 27 of file canvas.h.

Function Documentation

◆ clear_shader_program()

void eu::render::clear_shader_program ( )

Clears the current open gl shader program binding.

◆ create_buffer()

u32 eu::render::create_buffer ( )

◆ create_vertex_array()

u32 eu::render::create_vertex_array ( )

◆ destroy_buffer()

void eu::render::destroy_buffer ( u32  vbo)

◆ destroy_vertex_array()

void eu::render::destroy_vertex_array ( u32  vao)

◆ glenum_from_int()

GLenum eu::render::glenum_from_int ( int  i)

◆ glsizei_from_sizet()

GLsizei eu::render::glsizei_from_sizet ( std::size_t  t)

◆ glsizeiptr_from_sizet()

GLsizeiptr eu::render::glsizeiptr_from_sizet ( std::size_t  t)

◆ gluint_from_int()

GLuint eu::render::gluint_from_int ( int  i)

◆ is_bound_for_shader()

bool eu::render::is_bound_for_shader ( const std::unordered_set< VertexType > &  debug_geom_shader_types)

Verifies if the current shader matches the required vertex types.

Parameters
debug_geom_shader_typesRequired set of vertex types
Returns
true if all required types are present; otherwise, false.
Note
The shader must be bound before calling this function.
Internal function, should only be available in debug builds

◆ is_shader_bound()

bool eu::render::is_shader_bound ( unsigned int  program)

Checks if a specific shader program is currently active.

Parameters
programthe id of the shader program to check
Returns
true if the program is active; otherwise, false.
Note
Internal function, should only be available in debug builds

◆ load_cubemap_from_embedded()

TextureCubemap eu::render::load_cubemap_from_embedded ( DEBUG_LABEL_ARG_MANY const std::array< embedded_binary, cubemap_size > &  images,
ColorData  cd 
)
Parameters
imagesimages in the following order: right, left, top, bottom, back and front
cdHow to load/interpret the color from the image

◆ load_image_from_embedded()

Texture2d eu::render::load_image_from_embedded ( DEBUG_LABEL_ARG_MANY const embedded_binary image_binary,
TextureEdge  te,
TextureRenderStyle  trs,
Transparency  t,
ColorData  cd 
)

◆ opengl_nop()

constexpr void eu::render::opengl_nop ( )
constexpr

Definition at line 67 of file opengl_utils.h.

◆ set_gl_viewport()

void eu::render::set_gl_viewport ( const Size sz)

◆ setup_opengl_debug()

void eu::render::setup_opengl_debug ( )

◆ setup_textures()

void eu::render::setup_textures ( ShaderProgram shader,
const std::vector< Uniform * > &  uniform_list 
)

Sets up textures for a shader program.

Parameters
shaderthe shader to use
uniform_listthe uniforms to associate with texture units
Note
The shader must be bound before calling this function.

◆ with_layer() [1/2]

Layer eu::render::with_layer ( const InputCommand rc,
const LayoutData ld 
)

◆ with_layer() [2/2]

Layer eu::render::with_layer ( const InputCommand rc,
const LerpData ld 
)

◆ with_layer2() [1/2]

RenderLayer2 eu::render::with_layer2 ( const RenderCommand rc,
const LayoutData ld 
)

◆ with_layer2() [2/2]

RenderLayer2 eu::render::with_layer2 ( const RenderCommand rc,
const LerpData ld 
)

◆ with_layer3() [1/2]

RenderLayer3 eu::render::with_layer3 ( const RenderCommand rc,
const LayoutData ld 
)

◆ with_layer3() [2/2]

RenderLayer3 eu::render::with_layer3 ( const RenderCommand rc,
const LerpData ld 
)

Variable Documentation

◆ MAX_TEXTURES_SUPPORTED

constexpr std::size_t eu::render::MAX_TEXTURES_SUPPORTED = 16
constexpr

Definition at line 7 of file constants.h.