Oxygen Engine
Modern C++ 3D Engine using OpenGL
Loading...
Searching...
No Matches
oe::render::SurfaceShader Class Reference

Surface Shader class. More...

#include <OxygenEngine/render/surface_shader.h>

Inheritance diagram for oe::render::SurfaceShader:
[legend]
Collaboration diagram for oe::render::SurfaceShader:
[legend]

Public Member Functions

 SurfaceShader (const std::string &source_code, const std::string &name="")
 Create a new shader instance.
 
void setDepthFunctionName (const std::string &name)
 Set a custom function to use for getting alpha.
 
- Public Member Functions inherited from oe::render::ShaderBase
 ShaderBase (const std::string &name="")
 Create a new shader instance.
 
template<typename T >
void define (const std::string &name, const T &value)
 Define a shader constant.
 
void define (const std::string &name, const char *value)
 Define a shader constant.
 
void define (const std::string &name, const std::string &value)
 Define a shader constant.
 
void define (const std::string &name)
 Define a shader constant without value.
 
const std::string & getName () const
 Get shader name.
 
void compile (const GeometryPass vertex_pass, const RenderingPass fragment_pass)
 Compile / link the shader using the graphic API.
 
void bind (const GeometryPass vertex_pass, const RenderingPass fragment_pass)
 Use the shader in graphic API.
 
void fillFromCamera (const scene::Camera &camera) noexcept
 Fill uniforms from camera (mainly position + transform matrices)
 
void fillTextures (const std::map< std::string, std::pair< uint32_t, std::shared_ptr< oe::render::Texture > > > &textures)
 Fill textures uniforms + bind textures.
 
void fillCubemaps (const std::map< std::string, std::pair< uint32_t, std::shared_ptr< oe::render::Cubemap > > > &cubemaps)
 Fill cubemaps uniforms + bind cubemaps.
 
void fillFromMaterial (const scene::Material *material)
 Fill uniforms from material.
 
void unbind ()
 Tell the graphic API to release this shader.
 
void setInt (const std::string &name, const int32_t &value)
 Send an int uniform to the shader.
 
void setUInt (const std::string &name, const uint32_t &value)
 Send an unsigned int uniform to the shader.
 
void setFloat (const std::string &name, const float &value)
 Send a float uniform to the shader.
 
void setDouble (const std::string &name, const double &value)
 Send a double uniform to the shader.
 
void setMat3 (const std::string &name, const glm::mat3 &value)
 Send a 3x3 matrix uniform to the shader.
 
void setMat4 (const std::string &name, const glm::mat4 &value)
 Send a 4x4 matrix uniform to the shader.
 
void setVec2i (const std::string &name, const glm::ivec2 &value)
 Send an ivec2 uniform to the shader.
 
void setVec2 (const std::string &name, const glm::vec2 &value)
 Send a vec2 uniform to the shader.
 
void setVec3 (const std::string &name, const glm::vec3 &value)
 Send a vec3 uniform to the shader.
 
void setVec4 (const std::string &name, const glm::vec4 &value)
 Send a vec4 uniform to the shader.
 
void setIntArray (const std::string &name, const std::vector< int32_t > &values)
 Send an array of int uniforms to the shader.
 
void setUIntArray (const std::string &name, const std::vector< uint32_t > &values)
 Send a array of unsigned int uniforms to the shader.
 
void setFloatArray (const std::string &name, const std::vector< float > &values)
 Send an array of float uniforms to the shader.
 
void setDoubleArray (const std::string &name, const std::vector< double > &values)
 Send an array of double uniforms to the shader.
 
void setVec2iArray (const std::string &name, const std::vector< glm::ivec2 > &values)
 Send an array of ivec2 uniforms to the shader.
 
void setVec2Array (const std::string &name, const std::vector< glm::vec2 > &values)
 Send an array of vec2 uniforms to the shader.
 
void setVec3Array (const std::string &name, const std::vector< glm::vec3 > &values)
 Send an array of vec3 uniforms to the shader.
 
void setVec4Array (const std::string &name, const std::vector< glm::vec4 > &values)
 Send an array of vec4 uniforms to the shader.
 
void setMat4Array (const std::string &name, const std::vector< glm::mat4 > &values)
 Send an array of matrix uniforms to the shader.
 

Additional Inherited Members

- Protected Attributes inherited from oe::render::ShaderBase
std::unordered_map< GeometryPass, std::string > _vertex_shader_sources
 
std::unordered_map< RenderingPass, std::string > _fragment_shader_sources
 
std::string _header
 

Detailed Description

Surface Shader class.

You might want to take at look at the Surface shader chapter for usage instructions

Constructor & Destructor Documentation

◆ SurfaceShader()

oe::render::SurfaceShader::SurfaceShader ( const std::string &  source_code,
const std::string &  name = "" 
)

Create a new shader instance.

Parameters
source_codeSurface shader source code, check the documentation for the inputs/outputs
nameName of the shader (will be used in error messages)

Member Function Documentation

◆ setDepthFunctionName()

void oe::render::SurfaceShader::setDepthFunctionName ( const std::string &  name)
inline

Set a custom function to use for getting alpha.

Parameters
nameName of the function in your surface shader to run when in depth mode
Note
The function definition must be like void name_parameter_value(in SurfaceInput surface_input, inout float alpha)

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