gdk-graphics  1b6d84e044c2c953fd7c9501e628a67e80f4da0d
Public Types | Public Member Functions | List of all members
gdk::webgl1es2_material Class Reference

#include <webgl1es2_material.h>

Inheritance diagram for gdk::webgl1es2_material:
gdk::material

Public Types

using shader_ptr_type = std::shared_ptr< gdk::webgl1es2_shader_program >
 shaders can be shared among many webgl1es2_materials
 
- Public Types inherited from gdk::material
enum  FaceCullingMode { FaceCullingMode::Front, FaceCullingMode::Back, FaceCullingMode::FrontAndBack, FaceCullingMode::None }
 specify whether front- or back-facing polygons can be culled More...
 
enum  render_mode { render_mode::opaque, render_mode::transparent }
 render mode decides transparency etc More...
 
using texture_ptr_type = std::shared_ptr< gdk::texture >
 textures can be shared among many webgl1es2_materials.
 

Public Member Functions

webgl1es2_materialoperator= (webgl1es2_material &&)=default
 support move semantics
 
 webgl1es2_material (webgl1es2_material &&)=default
 support move semantics
 
webgl1es2_materialoperator= (const webgl1es2_material &)=default
 support copy semantics
 
 webgl1es2_material (const webgl1es2_material &)=default
 support copy semantics
 
 webgl1es2_material (shader_ptr_type pShader, material::FaceCullingMode aFaceCullingMode, material::render_mode aRenderMode)
 
 ~webgl1es2_material ()=default
 trivial destructor
 
external interface
virtual void setTexture (const std::string &aName, texture_ptr_type aTexture) override
 assigns a texture to the material. More...
 
virtual void setFloat (const std::string &aName, float aValue) override
 assigns a float to the material.
 
virtual void setVector2 (const std::string &aName, graphics_vector2_type aValue) override
 assigns a 2 component vector
 
virtual void setVector3 (const std::string &aName, graphics_vector3_type aValue) override
 assigns a 3 component vector
 
virtual void setVector4 (const std::string &aName, graphics_vector4_type aValue) override
 assigns a 4 component vector
 
virtual void setInteger (const std::string &aName, int aValue) override
 assigns an integer to the material.
 
virtual void setInteger2 (const std::string &aName, int aValue1, int aValue2) override
 assigns a 2 integer array to the material.
 
virtual void setInteger3 (const std::string &aName, int aValue1, int aValue2, int aValue3) override
 assigns a 3 integer array to the material.
 
virtual void setInteger4 (const std::string &aName, int aValue1, int aValue2, int aValue3, int aValue4) override
 assigns a 4 integer array to the material.
 
internal interface
material::render_mode get_render_mode () const
 
shader_ptr_type getShaderProgram ()
 
void activate ()
 modifies the opengl state, assigning the program, assigning values to the program's uniforms etc.
 

Detailed Description

Todo:
think about how to model blend functionality. subclass that provides blend func related state , in opaque case force opaque options?

Constructor & Destructor Documentation

◆ webgl1es2_material()

gdk::webgl1es2_material::webgl1es2_material ( shader_ptr_type  pShader,
material::FaceCullingMode  aFaceCullingMode,
material::render_mode  aRenderMode 
)

constructs a webgl1es2_material. non-shader pipeline state and uniform values are 0 constructed, given default values specified by the opengl standard however a shader must be provided at ctor time, since the pipeline cannot be invoked without first using a shader logically, a webgl1es2_material without a shader_program implies a pipeline without a programmable vertex shader stage nor a programmable fragment shader stage, which is not a valid pipeline

Member Function Documentation

◆ setTexture()

virtual void gdk::webgl1es2_material::setTexture ( const std::string &  aName,
texture_ptr_type  aTexturePointer 
)
overridevirtual

assigns a texture to the material.

Note
note that this is passed by pointer, not value

Implements gdk::material.


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