TeaPacket v0.0.1
Multiplatform Game Engine
Loading...
Searching...
No Matches
TeaPacket::Graphics::Shader Class Reference

A combined shader (or program) in the rendering pipeline. Used to interpret and render Model data. More...

#include <Shader.hpp>

Public Member Functions

void Initialize (const std::string &vertexShaderCode, const std::string &fragmentShaderCode, const std::vector< ShaderVariableType > &inputAttributes, const std::vector< ShaderVariableType > &uniforms)
 
void UseShader ()
 Bind the shader for rendering. Every Model drawn after this call to UseShader() will use this shader until a new shader is bound.
 
void SetParameter (unsigned char index, ShaderVariableValue value)
 

Static Public Member Functions

static Shader CreateShader (const std::string &vertexShaderCode, const std::string &fragmentShaderCode, const std::vector< ShaderVariableType > &inputAttributes, const std::vector< ShaderVariableType > &uniforms)
 
static Shader CreateShaderFromFiles (const std::string &vertexShaderPath, const std::string &fragmentShaderPath, const std::vector< ShaderVariableType > &inputAttributes, const std::vector< ShaderVariableType > &uniforms)
 

Public Attributes

PlatformShader platformShader
 Platform data.
 

Detailed Description

A combined shader (or program) in the rendering pipeline. Used to interpret and render Model data.

Member Function Documentation

◆ CreateShader()

static Shader TeaPacket::Graphics::Shader::CreateShader ( const std::string & vertexShaderCode,
const std::string & fragmentShaderCode,
const std::vector< ShaderVariableType > & inputAttributes,
const std::vector< ShaderVariableType > & uniforms )
static

Creates a shader. See Initialize() for parameter info.

Returns
The shader created.

◆ CreateShaderFromFiles()

static Shader TeaPacket::Graphics::Shader::CreateShaderFromFiles ( const std::string & vertexShaderPath,
const std::string & fragmentShaderPath,
const std::vector< ShaderVariableType > & inputAttributes,
const std::vector< ShaderVariableType > & uniforms )
static

Load a shader from the Asset Registry

Parameters
vertexShaderPathThe path to the .vert file to load vertex shader code from.
fragmentShaderPathThe path to the .frag file to load fragment shader code from.
inputAttributesThe VertexAttributes that the vertexShader expects. Should be the same as whatever Models you use.
Returns
The shader created.

◆ Initialize()

void TeaPacket::Graphics::Shader::Initialize ( const std::string & vertexShaderCode,
const std::string & fragmentShaderCode,
const std::vector< ShaderVariableType > & inputAttributes,
const std::vector< ShaderVariableType > & uniforms )

Initialize a shader

Parameters
vertexShaderCodeThe code for the vertex shader to be used.
fragmentShaderCodeThe code for the fragment (pixel) shader to be used.
inputAttributesThe VertexAttributes that the vertexShader expects. Should be the same as whatever Models you use.

◆ SetParameter()

void TeaPacket::Graphics::Shader::SetParameter ( unsigned char index,
ShaderVariableValue value )

Set a uniform within a shader

Parameters
indexThe index of the parameter
valueThe value you want to set it to.

◆ UseShader()

void TeaPacket::Graphics::Shader::UseShader ( )

Bind the shader for rendering. Every Model drawn after this call to UseShader() will use this shader until a new shader is bound.

Member Data Documentation

◆ platformShader

PlatformShader TeaPacket::Graphics::Shader::platformShader

Platform data.


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