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

Classes

struct  Assets
 
struct  BaseTexture
 Base class for all textures, but only exist due to code reuse and can easily be inlined. More...
 
struct  BloomRender
 
struct  BlurEffect
 A blur effect split into a vertical and horizontal blur step. More...
 
struct  BlurOptions
 Options for generating a blur shader source. More...
 
struct  BlurVerticalProvider
 A shader property for the vertical blur step. More...
 
struct  BoundFbo
 raii class to render to a FrameBuffer More...
 
struct  BoundUniformBuffer
 
struct  BuildArg
 Arguments for when building a effect stack. More...
 
struct  BurHorizontalProvider
 A shader property for the horizontal blur step. More...
 
struct  Camera
 The current perspective camera representation. More...
 
struct  CameraUniformBuffer
 "Global state" for the shaders describing the state of the camera. More...
 
struct  CameraVectors
 A temporary view of the local space of a camera. More...
 
struct  CompiledCamera
 A "compiled" camera for use in rendering. More...
 
struct  CompiledGeom
 Represents a Geom on the GPU. More...
 
struct  CompiledGeom_TransformInstance
 Represents a Geom on the GPU, instanced on a transform. More...
 
struct  CompiledMesh
 
struct  CompiledMeshGeom
 
struct  CompiledStack
 A compiled full-screen-effect. More...
 
struct  CompiledTransformedMesh
 
struct  DebugLine
 Line + color. More...
 
struct  DebugRender
 Just stores debug render requests and doesn't actually render anything. More...
 
struct  DefaultMaterial
 A material affected by light. More...
 
struct  DirectionalLight
 A directional light,. More...
 
struct  DirectionalLightUniforms
 Uniform for a directional light. More...
 
struct  DrawableFont
 
struct  DrawableText
 
struct  Effect
 A effect that can be toggled. More...
 
struct  EffectStack
 The facade of the post-proc framework. More...
 
struct  ExtractShader
 Extracts data for a bloom. More...
 
struct  FactorEffect
 A special effect where the effect can be eased into existence. More...
 
struct  FloatDragShaderProp
 A float shader property that is dragged with the mouse. More...
 
struct  FloatSliderShaderProp
 A float shader property that is a slider. More...
 
struct  FrameBuffer
 "render to texture" feature More...
 
struct  FrustumLight
 Like a spotlight but can be positioned with a transform, supports light cookies and can use a "view frustum" when culling. More...
 
struct  FrustumLightUniforms
 Uniforms for a frustum light. More...
 
struct  FullScreenGeom
 Store the information for how to render a full screen quad. More...
 
struct  Glyph
 
struct  InputCommand
 
struct  Layer
 
struct  LayoutData
 
struct  LerpData
 
struct  Lights
 All lights in a world. More...
 
struct  LineDrawer
 A utility to draw 3d lines. More...
 
struct  ListOfTextDrawCommands
 
struct  LoadedPostProcShader
 The "base class" for a loaded postproc shader. More...
 
struct  LoadedShader_Default
 Part of a loaded "default" shader. More...
 
struct  LoadedShader_Default_Container
 A default shader. More...
 
struct  LoadedShader_OnlyDepth
 Only writes depth. More...
 
struct  LoadedShader_SingleColor
 A single color shader. More...
 
struct  LoadedShader_Skybox
 A skybox shader. More...
 
struct  LoadedShader_Unlit
 Parts of a loaded unlit shader. More...
 
struct  LoadedShader_Unlit_Container
 A unlit shader. More...
 
struct  LocalAxis
 
struct  Material
 Base class for all materials. More...
 
struct  MeshInstance
 Stores Geom + Material (aka a mesh) and its current transform. More...
 
struct  MeshInstance_TransformInstanced
 Stores Geom + Material (aka a mesh) and its current transform but instanced for faster rendering. More...
 
struct  MeshInWorld
 
struct  OrthoCamera
 A orthographic camera representation. More...
 
struct  PingPongBlurShader
 
struct  PointLight
 A point light. More...
 
struct  PointLightUniforms
 Uniforms for a point light. More...
 
struct  PostProcArg
 Arguments for rendering a post-processing effect. More...
 
struct  Quad
 
struct  RealizeShader
 The shader data for composing a rendered image. More...
 
struct  Render2
 
struct  RenderCommand
 
struct  RenderContext
 Stores information that is useful when selecting a shader part from a shader container. More...
 
struct  Renderer
 The rendering engine. More...
 
struct  RendererPimpl
 Internal state of the renderer. More...
 
struct  RenderLayer2
 
struct  RenderLayer3
 
struct  RenderSettings
 Startup settings for the renderer. More...
 
struct  RenderSource
 A source that can be rendered to a framebuffer or a screen. More...
 
struct  RenderTextureWithShader
 Applies a shader to the output of another source. More...
 
struct  RenderWorld
 A source that "just" renders the world. More...
 
struct  RotateQuad
 
struct  ShaderOptions
 Shader compilation options. More...
 
struct  ShaderProgram
 RAII representation of a open gl shader program. More...
 
struct  ShaderProp
 A tweakable shader property. More...
 
struct  ShaderPropertyProvider
 A functor that sends properties/uniforms to the shader. More...
 
struct  ShaderResource
 All loaded shaders. More...
 
struct  ShaderSource
 
struct  ShaderSource_withLayout
 Shader source with the layout that is expected. More...
 
struct  ShadowContext
 
struct  SimpleEffect
 A effect that only performs a single step. More...
 
struct  Skybox
 A skybox model with a cubemap texture. More...
 
struct  SpriteBatch
 
struct  State
 A "cache" for the current open gl state. More...
 
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  TransformedMeshInWorld
 
struct  Uniform
 Represents a found shader uniform and created via ShaderProgram::GetUniform() More...
 
struct  UniformBuffer
 
struct  UnlitMaterial
 A unlit (or fully lit) material, not affected by light. More...
 
struct  Vertex2
 
struct  World
 A list of objects to render. 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.
 

Enumerations

enum class  ViewportStyle { black_bars , extended }
 
enum class  Align {
  top_left , top_center , top_right , baseline_left ,
  baseline_center , baseline_right , bottom_left , bottom_center ,
  bottom_right
}
 
enum class  BlurType { horizontal , vertical }
 
enum class  IsGauss { no , yes }
 
enum class  TransformSource { TransformSource::Uniform , TransformSource::Instanced_mat4 }
 Enum describing on how the model transform is provided. More...
 
enum class  PostProcSetup { PostProcSetup::none = 0 , PostProcSetup::factor = 1 << 1 , PostProcSetup::resolution = 1 << 2 , PostProcSetup::time = 1 << 3 }
 Bitmask for what features each postproc shader wants. More...
 
enum class  UseTransparency { UseTransparency::yes , UseTransparency::no }
 A "named boolean". More...
 
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  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  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  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  Billboarding {
  Billboarding::none , Billboarding::screen , Billboarding::screen_fast , Billboarding::axial_y ,
  Billboarding::axial_y_fast
}
 Defines the billboarding algorithm to use. More...
 

Functions

CameraVectors create_vectors (const Camera &camera)
 Capture the current local space of the camera.
 
m4 create_view_from_world_mat (const v3 &pos, const CameraVectors &cv)
 
CompiledCamera compile (const Camera &, const Size &window_size)
 "Compile" a camera to a perspective so it can be used in rendering.
 
CompiledCamera compile (const OrthoCamera &, const Size &window_size)
 "Compile" a camera to an orthographic view so it can be used in rendering.
 
v2 screen_from_world (const CompiledCamera &cam, const v3 &world_pos, const v2 &resolution)
 Calculate the screen coordinate of a 3d world position.
 
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)
 
CompiledMesh compile_mesh (DEBUG_LABEL_ARG_MANY const core::Mesh &mesh, const core::CompiledGeomVertexAttributes &geom_layout)
 
void draw_frustum (DebugRender *debug, const CompiledCamera &camera, const Rgb &color)
 
v3 vec_from_lin (const Lin_rgb &lin)
 
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)
 
void set_gl_viewport (const Rect &r)
 
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< core::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.
 
std::string generate_blur (std::string_view src, const BlurOptions &options)
 
ShaderSource_withLayout load_shader_source (const ShaderSource &source, const ShaderOptions &options, const std::string &uniform_buffer_source)
 
ShaderSource load_skybox_source (const ShaderSource &source, const std::string &uniform_buffer_source)
 
PostProcSetup operator| (PostProcSetup lhs, PostProcSetup rhs)
 
const LoadedShader_Unlitshader_from_container (const LoadedShader_Unlit_Container &container, const RenderContext &rc)
 Select the correct sub shader from a container.
 
const LoadedShader_Defaultshader_from_container (const LoadedShader_Default_Container &container, const RenderContext &rc)
 Select the correct sub shader from a container.
 
ShaderResource load_shaders (const Assets &assets, const CameraUniformBuffer &desc, const RenderSettings &settings, const FullScreenGeom &full_screen)
 
CompiledCamera compile_the_shadow_camera (const Camera &camera, const Size &window_size, const DirectionalLight &light, const RenderSettings &settings, const World &world)
 
CameraVectors create_vectors (const Ypr &rotation)
 Capture the local space of a "camera" us ing only the rotation.
 
void bind_texture_2d (State *states, const Uniform &uniform, const Texture2d &texture)
 
void bind_texture_2d (State *states, const Uniform &uniform, const FrameBuffer &texture)
 
void bind_texture_cubemap (State *states, const Uniform &uniform, const TextureCubemap &texture)
 
Texture2d load_image_from_color (DEBUG_LABEL_ARG_MANY core::SingleColor pixel, TextureEdge te, TextureRenderStyle trs, Transparency t, ColorData cd)
 
TextureCubemap load_cubemap_from_color (DEBUG_LABEL_ARG_MANY core::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)
 
std::shared_ptr< CompiledGeomcompile_geom (DEBUG_LABEL_ARG_MANY const core::Geom &, const core::CompiledGeomVertexAttributes &layout)
 
std::shared_ptr< CompiledGeom_TransformInstancecompile_geom_with_transform_instance (DEBUG_LABEL_ARG_MANY const core::Geom &, const core::CompiledGeomVertexAttributes &layout, std::size_t max_instances)
 
m4 transform_from_rotation (const v3 &position, const Ypr &ypr)
 
m4 transform_from_billboard (const v3 &position, Billboarding billboarding, const CompiledCamera &cc)
 
std::shared_ptr< MeshInstancemake_mesh_instance (std::shared_ptr< CompiledGeom > geom, std::shared_ptr< Material > mat)
 
std::shared_ptr< MeshInstance_TransformInstancedmake_mesh_instance (std::shared_ptr< CompiledGeom_TransformInstance > geom, std::shared_ptr< Material > mat)
 
void render_geom (const CompiledGeom &geom)
 
void render_geom_instanced (const MeshInstance_TransformInstanced &instanced)
 
CameraVectors create_vectors (const DirectionalLight &p)
 

Variables

constexpr std::size_t MAX_TEXTURES_SUPPORTED = 16
 
constexpr float ALMOST_ZERO = 0.01f
 
constexpr float ALPHA_TRANSPARENCY_LIMIT = 1.0f - ALMOST_ZERO
 if alpha goes above this limit, it is no longer considered transparent
 
constexpr float OUTLINE_SCALE = 1.1f
 
constexpr int BLUR_SAMPLES = 10
 
constexpr auto UP = v3(0.0f, 1.0f, 0.0f)
 
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.

◆ BlurType

See also
generate_blur
Enumerator
horizontal 
vertical 

Definition at line 47 of file shader.source.h.

◆ IsGauss

See also
generate_blur
Enumerator
no 
yes 

Definition at line 54 of file shader.source.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.

◆ compile_mesh()

CompiledMesh eu::render::compile_mesh ( DEBUG_LABEL_ARG_MANY const core::Mesh mesh,
const core::CompiledGeomVertexAttributes geom_layout 
)

◆ compile_the_shadow_camera()

CompiledCamera eu::render::compile_the_shadow_camera ( const Camera camera,
const Size window_size,
const DirectionalLight light,
const RenderSettings settings,
const World world 
)

◆ create_buffer()

u32 eu::render::create_buffer ( )

◆ create_vectors()

CameraVectors eu::render::create_vectors ( const Ypr rotation)

Capture the local space of a "camera" us ing only the rotation.

◆ 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)

◆ generate_blur()

std::string eu::render::generate_blur ( std::string_view  src,
const BlurOptions options 
)

◆ 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< core::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 
)

◆ load_shader_source()

ShaderSource_withLayout eu::render::load_shader_source ( const ShaderSource source,
const ShaderOptions options,
const std::string &  uniform_buffer_source 
)

◆ load_skybox_source()

ShaderSource eu::render::load_skybox_source ( const ShaderSource source,
const std::string &  uniform_buffer_source 
)

◆ opengl_nop()

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

Definition at line 68 of file opengl_utils.h.

◆ set_gl_viewport() [1/2]

void eu::render::set_gl_viewport ( const Rect r)

◆ set_gl_viewport() [2/2]

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

◆ ALMOST_ZERO

constexpr float eu::render::ALMOST_ZERO = 0.01f
constexpr

Definition at line 11 of file constants.h.

◆ ALPHA_TRANSPARENCY_LIMIT

constexpr float eu::render::ALPHA_TRANSPARENCY_LIMIT = 1.0f - ALMOST_ZERO
constexpr

if alpha goes above this limit, it is no longer considered transparent

Definition at line 13 of file constants.h.

◆ BLUR_SAMPLES

constexpr int eu::render::BLUR_SAMPLES = 10
constexpr

Definition at line 17 of file constants.h.

◆ MAX_TEXTURES_SUPPORTED

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

Definition at line 7 of file constants.h.

◆ OUTLINE_SCALE

constexpr float eu::render::OUTLINE_SCALE = 1.1f
constexpr

Definition at line 15 of file constants.h.

◆ UP

constexpr auto eu::render::UP = v3(0.0f, 1.0f, 0.0f)
constexpr

Definition at line 6 of file space.h.