gdk-graphics 0a0aef92e917cfbac53dffbc32c295e4de914093
Loading...
Searching...
No Matches
gdk::graphics::context Class Referenceabstract

entry point for gdk-graphics More...

#include <context.h>

Inheritance diagram for gdk::graphics::context:

Public Member Functions

factory methods
virtual scene_ptr_type make_scene ()=0
 makes a scene
virtual screen_camera_ptr_type make_camera ()=0
 makes a camera that draws to the screen
virtual texture_camera_ptr_type make_texture_camera ()=0
 makes a texture_camera drawing into textures 1024 texels square
virtual texture_camera_ptr_type make_texture_camera (const intvector2_type &aSize)=0
 makes a texture_camera drawing into textures aSize texels across
virtual entity_ptr_type make_entity (const const_model_ptr_type pModel, const const_material_ptr_type pMaterial)=0
 make an entity
virtual model_ptr_type make_model (const gdk::graphics::model::usage_hint, const model_data &vertexData)=0
 make a model
virtual model_ptr_type make_model ()=0
 make an empty model
virtual material_ptr_type make_material (const const_shader_ptr_type pShader, const material::render_mode aRenderMode, const material::face_culling_mode aFaceCullingMode)=0
 make a material.
material_ptr_type make_material (const const_shader_ptr_type pShader, const material::render_mode aRenderMode)
 make a material that culls no faces
material_ptr_type make_material (const const_shader_ptr_type pShader)
 make an opaque material that culls no faces
virtual material_ptr_type make_material (const const_material_ptr_type &aPrototype)=0
 make a material that starts as a copy of another
virtual texture_ptr_type make_texture (const texture_data::view &aTextureDataView, const texture::wrap_mode aWrapModeU, const texture::wrap_mode aWrapModeV, const texture::filter_mode aFilterMode)=0
 make a texture
texture_ptr_type make_texture (const texture_data::view &aTextureDataView, const texture::wrap_mode aWrapModeU, const texture::wrap_mode aWrapModeV)
 make a sharp texture
texture_ptr_type make_texture (const texture_data::view &aTextureDataView)
 make a sharp texture that repeats
virtual texture_ptr_type make_texture ()=0
 make an empty texture
special resources provided by the implementation
virtual model_ptr_type make_cube_model () const =0
 a 1x1x1 cube model
virtual model_ptr_type make_sphere_model () const =0
virtual shader_ptr_type make_alpha_cutoff_shader () const =0
 Basic unlit forward renderer program: Attributes:
virtual shader_ptr_type make_alpha_blend_shader () const =0
 a shader that keeps the texel's alpha, for the blender to use.
virtual graphics::limits limits () const =0
 the limits of the device, narrowed to the context's profile when it was given one
virtual ~context ()=default
 virtual destructor

Detailed Description

entry point for gdk-graphics

Member Function Documentation

◆ limits()

virtual graphics::limits gdk::graphics::context::limits ( ) const
nodiscardpure virtual

the limits of the device, narrowed to the context's profile when it was given one

What an implementation offers beyond this interface, shaders made from source in its own language say, is on its own context type, which its make returns.

Implemented in gdk::graphics::null_context.

◆ make_alpha_blend_shader()

virtual shader_ptr_type gdk::graphics::context::make_alpha_blend_shader ( ) const
nodiscardpure virtual

a shader that keeps the texel's alpha, for the blender to use.

The sibling of the alpha cutoff shader: the two differ only in what the fragment does with alpha, one discarding anything not fully opaque and this one passing it through. Pair it with material::render_mode::transparent, which is what enables blending.

Implemented in gdk::graphics::null_context.

◆ make_alpha_cutoff_shader()

virtual shader_ptr_type gdk::graphics::context::make_alpha_cutoff_shader ( ) const
nodiscardpure virtual

Basic unlit forward renderer program: Attributes:

  • vec3 pos
  • vec2 uv Uniforms:
  • _MVP: model-view-projection matrix
  • _Texture: used to color frags Vertex shader behavior:
  • multiply position by mvp Fragment shader behavior:
  • sample _Texture, if alpha is 0, discard frag, otherwise write frag to color buffer

Both built-in shaders multiply the texel by _Color, a vec4 the material may set: a tint, a fade, a dim. A material starts with it white, so nothing changes until it is set.

Implemented in gdk::graphics::null_context.

◆ make_camera()

virtual screen_camera_ptr_type gdk::graphics::context::make_camera ( )
nodiscardpure virtual

makes a camera that draws to the screen

Implemented in gdk::graphics::null_context.

◆ make_cube_model()

virtual model_ptr_type gdk::graphics::context::make_cube_model ( ) const
nodiscardpure virtual

a 1x1x1 cube model

  • vertex attributes: vec3 pos, vec2 uv, vec3 normal

Implemented in gdk::graphics::null_context.

◆ make_entity()

virtual entity_ptr_type gdk::graphics::context::make_entity ( const const_model_ptr_type pModel,
const const_material_ptr_type pMaterial )
nodiscardpure virtual

make an entity

Implemented in gdk::graphics::null_context.

◆ make_material() [1/2]

virtual material_ptr_type gdk::graphics::context::make_material ( const const_material_ptr_type & aPrototype)
nodiscardpure virtual

make a material that starts as a copy of another

Implemented in gdk::graphics::null_context.

◆ make_material() [2/2]

virtual material_ptr_type gdk::graphics::context::make_material ( const const_shader_ptr_type pShader,
const material::render_mode aRenderMode,
const material::face_culling_mode aFaceCullingMode )
nodiscardpure virtual

make a material.

Implemented in gdk::graphics::null_context.

◆ make_model() [1/2]

virtual model_ptr_type gdk::graphics::context::make_model ( )
nodiscardpure virtual

make an empty model

Implemented in gdk::graphics::null_context.

◆ make_model() [2/2]

virtual model_ptr_type gdk::graphics::context::make_model ( const gdk::graphics::model::usage_hint ,
const model_data & vertexData )
nodiscardpure virtual

make a model

Implemented in gdk::graphics::null_context.

◆ make_scene()

virtual scene_ptr_type gdk::graphics::context::make_scene ( )
nodiscardpure virtual

makes a scene

Implemented in gdk::graphics::null_context.

◆ make_texture() [1/2]

virtual texture_ptr_type gdk::graphics::context::make_texture ( )
nodiscardpure virtual

make an empty texture

Implemented in gdk::graphics::null_context.

◆ make_texture() [2/2]

virtual texture_ptr_type gdk::graphics::context::make_texture ( const texture_data::view & aTextureDataView,
const texture::wrap_mode aWrapModeU,
const texture::wrap_mode aWrapModeV,
const texture::filter_mode aFilterMode )
nodiscardpure virtual

make a texture

Implemented in gdk::graphics::null_context.

◆ make_texture_camera() [1/2]

virtual texture_camera_ptr_type gdk::graphics::context::make_texture_camera ( )
nodiscardpure virtual

makes a texture_camera drawing into textures 1024 texels square

Implemented in gdk::graphics::null_context.

◆ make_texture_camera() [2/2]

virtual texture_camera_ptr_type gdk::graphics::context::make_texture_camera ( const intvector2_type & aSize)
nodiscardpure virtual

makes a texture_camera drawing into textures aSize texels across

Implemented in gdk::graphics::null_context.


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