gdk-graphics 0a0aef92e917cfbac53dffbc32c295e4de914093
Loading...
Searching...
No Matches
gdk::graphics::null_context Class Referencefinal
Inheritance diagram for gdk::graphics::null_context:
Collaboration diagram for gdk::graphics::null_context:

Public Types

using shader_check_type

Public Member Functions

virtual scene_ptr_type make_scene () override
 makes a scene
virtual screen_camera_ptr_type make_camera () override
 makes a camera that draws to the screen
virtual texture_camera_ptr_type make_texture_camera () override
 makes a texture_camera drawing into textures 1024 texels square
virtual texture_camera_ptr_type make_texture_camera (const intvector2_type &aSize) override
 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) override
 make an entity
virtual model_ptr_type make_model () override
 make an empty model
virtual model_ptr_type make_model (const gdk::graphics::model::usage_hint, const model_data &aModelData) override
 make a model
virtual material_ptr_type make_material (const const_shader_ptr_type pShader, const material::render_mode aRenderMode, const material::face_culling_mode aFaceCullingMode) override
 make a material.
virtual material_ptr_type make_material (const const_material_ptr_type &aPrototype) override
 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) override
 make a texture
virtual texture_ptr_type make_texture () override
 make an empty texture
std::size_t texture_count () const
virtual model_ptr_type make_cube_model () const override
 a 1x1x1 cube model
virtual model_ptr_type make_sphere_model () const override
virtual shader_ptr_type make_alpha_cutoff_shader () const override
 Basic unlit forward renderer program: Attributes:
virtual shader_ptr_type make_alpha_blend_shader () const override
 a shader that keeps the texel's alpha, for the blender to use.
virtual graphics::limits limits () const override
 the limits of the device, narrowed to the context's profile when it was given one
shader_ptr_type make_shader (const std::string_view aVertexSource, const std::string_view aFragmentSource)
std::size_t resources_made () const
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
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
Public Member Functions inherited from gdk::graphics::context
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
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 ~context ()=default
 virtual destructor

Static Public Member Functions

static std::shared_ptr< null_context > make (std::optional< graphics::profile > aProfile={}, shader_check_type aShaderCheck={})

Member Typedef Documentation

◆ shader_check_type

using gdk::graphics::null_context::shader_check_type
Initial value:
std::function<void(const graphics::profile &aProfile,
std::string_view aVertexSource, std::string_view aFragmentSource)>
a target's limits
Definition profile.h:18

Member Function Documentation

◆ limits()

virtual graphics::limits gdk::graphics::null_context::limits ( ) const
nodiscardoverridevirtual

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.

Implements gdk::graphics::context.

◆ make_alpha_blend_shader()

virtual shader_ptr_type gdk::graphics::null_context::make_alpha_blend_shader ( ) const
nodiscardoverridevirtual

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.

Implements gdk::graphics::context.

◆ make_alpha_cutoff_shader()

virtual shader_ptr_type gdk::graphics::null_context::make_alpha_cutoff_shader ( ) const
nodiscardoverridevirtual

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.

Implements gdk::graphics::context.

◆ make_camera()

virtual screen_camera_ptr_type gdk::graphics::null_context::make_camera ( )
nodiscardoverridevirtual

makes a camera that draws to the screen

Implements gdk::graphics::context.

◆ make_cube_model()

virtual model_ptr_type gdk::graphics::null_context::make_cube_model ( ) const
nodiscardoverridevirtual

a 1x1x1 cube model

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

Implements gdk::graphics::context.

◆ make_entity()

virtual entity_ptr_type gdk::graphics::null_context::make_entity ( const const_model_ptr_type pModel,
const const_material_ptr_type pMaterial )
nodiscardoverridevirtual

make an entity

Implements gdk::graphics::context.

◆ make_material() [1/2]

virtual material_ptr_type gdk::graphics::null_context::make_material ( const const_material_ptr_type & aPrototype)
nodiscardoverridevirtual

make a material that starts as a copy of another

Implements gdk::graphics::context.

◆ make_material() [2/2]

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

make a material.

Implements gdk::graphics::context.

◆ make_model() [1/2]

virtual model_ptr_type gdk::graphics::null_context::make_model ( )
nodiscardoverridevirtual

make an empty model

Implements gdk::graphics::context.

◆ make_model() [2/2]

virtual model_ptr_type gdk::graphics::null_context::make_model ( const gdk::graphics::model::usage_hint ,
const model_data & vertexData )
nodiscardoverridevirtual

make a model

Implements gdk::graphics::context.

◆ make_scene()

virtual scene_ptr_type gdk::graphics::null_context::make_scene ( )
nodiscardoverridevirtual

makes a scene

Implements gdk::graphics::context.

◆ make_sphere_model()

virtual model_ptr_type gdk::graphics::null_context::make_sphere_model ( ) const
nodiscardoverridevirtual

◆ make_texture() [1/2]

virtual texture_ptr_type gdk::graphics::null_context::make_texture ( )
nodiscardoverridevirtual

make an empty texture

Implements gdk::graphics::context.

◆ make_texture() [2/2]

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

make a texture

Implements gdk::graphics::context.

◆ make_texture_camera() [1/2]

virtual texture_camera_ptr_type gdk::graphics::null_context::make_texture_camera ( )
nodiscardoverridevirtual

makes a texture_camera drawing into textures 1024 texels square

Implements gdk::graphics::context.

◆ make_texture_camera() [2/2]

virtual texture_camera_ptr_type gdk::graphics::null_context::make_texture_camera ( const intvector2_type & aSize)
nodiscardoverridevirtual

makes a texture_camera drawing into textures aSize texels across

Implements gdk::graphics::context.


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