Aether3D Game Engine
Classes | Public Member Functions | List of all members
ae3d::Shader Class Reference

Shader program containing a vertex and pixel shader. More...

#include <Shader.hpp>

Classes

struct  IntDefaultedToMinusOne
 Wraps an int that is defaulted to -1. Needed for uniform handling. More...
 

Public Member Functions

void Load (const char *vertexSource, const char *fragmentSource)
 
void Load (const FileSystem::FileContentsData &vertexDataGLSL, const FileSystem::FileContentsData &fragmentDataGLSL, const char *metalVertexShaderName, const char *metalFragmentShaderName, const FileSystem::FileContentsData &vertexDataHLSL, const FileSystem::FileContentsData &fragmentDataHLSL, const FileSystem::FileContentsData &vertexDataSPIRV, const FileSystem::FileContentsData &fragmentDataSPIRV)
 
void Use ()
 Activates the shader to be used in a draw call.
 
void SetMatrix (const char *name, const float *matrix4x4)
 
void SetTexture (const char *name, class Texture2D *texture, int textureUnit)
 
void SetTexture (const char *name, class TextureCube *texture, int textureUnit)
 
void SetRenderTexture (const char *name, class RenderTexture *renderTexture, int textureUnit)
 
void SetInt (const char *name, int value)
 
void SetFloat (const char *name, float value)
 
void SetVector3 (const char *name, const float *vec3)
 
void SetVector4 (const char *name, const float *vec4)
 

Detailed Description

Shader program containing a vertex and pixel shader.

Member Function Documentation

void ae3d::Shader::Load ( const char *  vertexSource,
const char *  fragmentSource 
)

Loads a GLSL or HLSL shader from source code. For portability it's better to call the other load method that can take all shaders as input.

Parameters
vertexSourceVertex shader source. Language depends on the renderer.
fragmentSourceFragment shader source. Language depends on the renderer.
void ae3d::Shader::Load ( const FileSystem::FileContentsData vertexDataGLSL,
const FileSystem::FileContentsData fragmentDataGLSL,
const char *  metalVertexShaderName,
const char *  metalFragmentShaderName,
const FileSystem::FileContentsData vertexDataHLSL,
const FileSystem::FileContentsData fragmentDataHLSL,
const FileSystem::FileContentsData vertexDataSPIRV,
const FileSystem::FileContentsData fragmentDataSPIRV 
)
Parameters
vertexDataGLSLGLSL Vertex shader file contents.
fragmentDataGLSLGLSL Fragment shader file contents.
metalVertexShaderNameVertex shader name for Metal renderer. Must be referenced by the application's Xcode project.
metalFragmentShaderNameFragment shader name for Metal renderer. Must be referenced by the application's Xcode project.
vertexDataHLSLHLSL Vertex shader file contents.
fragmentDataHLSLHLSL Fragment shader file contents.
vertexDataSPIRVSPIR-V vertex shader file contents.
fragmentDataSPIRVSPIR-V fragment shader file contents.
void ae3d::Shader::SetFloat ( const char *  name,
float  value 
)
Parameters
nameFloat uniform name.
valueValue.
void ae3d::Shader::SetInt ( const char *  name,
int  value 
)
Parameters
nameInteger uniform name.
valueValue.
void ae3d::Shader::SetMatrix ( const char *  name,
const float *  matrix4x4 
)
Parameters
nameMatrix uniform name.
matrix4x4Contents of Matrix44.
void ae3d::Shader::SetRenderTexture ( const char *  name,
class RenderTexture renderTexture,
int  textureUnit 
)
Parameters
nameTexture uniform name.
renderTextureRenderTexture.
textureUnitTexture unit.
void ae3d::Shader::SetTexture ( const char *  name,
class Texture2D texture,
int  textureUnit 
)
Parameters
nameTexture uniform name.
textureTexture.
textureUnitTexture unit.
void ae3d::Shader::SetTexture ( const char *  name,
class TextureCube texture,
int  textureUnit 
)
Parameters
nameTexture uniform name.
textureTexture.
textureUnitTexture unit.
void ae3d::Shader::SetVector3 ( const char *  name,
const float *  vec3 
)
Parameters
nameVector uniform name.
vec3Vec3 contents.
void ae3d::Shader::SetVector4 ( const char *  name,
const float *  vec4 
)
Parameters
nameVector uniform name.
vec4Vec4 contents.

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