Stores material properties for Mesh. Their names/values are directly mapped into shader uniforms.
More...
#include <Material.hpp>
|
virtual void | LoadFromFile (const char *path)=0 |
|
virtual const char * | Name () const =0 |
|
virtual bool | Opaque () const =0 |
|
virtual void | SetOpaque (bool opaque)=0 |
|
virtual Error::Enum | SetShaders (const std::string &vertexShaderPath, const std::string &fragmentShaderPath, const std::string &geometryShaderPath, const std::string &defines)=0 |
|
virtual void | SetFloat (const std::string &name, float value)=0 |
|
virtual void | SetMatrix (const std::string &name, const Matrix44 &matrix)=0 |
|
virtual void | SetName (const char *name)=0 |
|
virtual void | SetTexture (const std::string &name, const Texture *texture)=0 |
|
virtual void | SetVector (const std::string &name, const Vec3 &value)=0 |
|
virtual void | SetVector (const std::string &name, const Vec4 &value)=0 |
|
Stores material properties for Mesh. Their names/values are directly mapped into shader uniforms.
◆ LoadFromFile()
virtual void Material::LoadFromFile |
( |
const char * |
path | ) |
|
|
pure virtual |
Loads parameters and shader names from an ASCII file. File is not hot-reloaded. If parsing fails, parameters parsed before failure are kept.
Example file contents:
texture checker checker.png texture checkerNormal checker_n.png shaders cook_torrance cook_torrance param_float roughness 0.2 param_vec3 materialSpecular 0.2 0.2 0.2 param_texture diffuseMap checker param_texture normalMap checkerNormal
- Parameters
-
◆ Name()
virtual const char* Material::Name |
( |
| ) |
const |
|
pure virtual |
◆ Opaque()
virtual bool Material::Opaque |
( |
| ) |
const |
|
pure virtual |
◆ SetFloat()
virtual void Material::SetFloat |
( |
const std::string & |
name, |
|
|
float |
value |
|
) |
| |
|
pure virtual |
Sets a float.
- Parameters
-
name | Shader uniform name. |
value | Value. |
◆ SetMatrix()
virtual void Material::SetMatrix |
( |
const std::string & |
name, |
|
|
const Matrix44 & |
matrix |
|
) |
| |
|
pure virtual |
Sets a Matrix.
- Parameters
-
name | Shader uniform name. |
matrix | Matrix. |
◆ SetName()
virtual void Material::SetName |
( |
const char * |
name | ) |
|
|
pure virtual |
◆ SetOpaque()
virtual void Material::SetOpaque |
( |
bool |
opaque | ) |
|
|
pure virtual |
Sets opacity on/off. Default is opaque.
If it's off, the mesh using this material will have its textures's alpha channel applied.
- Parameters
-
◆ SetShaders()
virtual Error::Enum Material::SetShaders |
( |
const std::string & |
vertexShaderPath, |
|
|
const std::string & |
fragmentShaderPath, |
|
|
const std::string & |
geometryShaderPath, |
|
|
const std::string & |
defines |
|
) |
| |
|
pure virtual |
Sets shaders. Source language must match renderer API, eg. you can't use HLSL shaders if you're using OpenGL renderer. HLSL shaders are compiled in HLSL version 5.
- Parameters
-
vertexShaderPath | Vertex shader path or shader's file name without path or extension to use search paths. |
fragmentShaderPath | Fragment (Pixel) shader path or shader's file name without path or extension to use search paths. |
geometryShaderPath | Geometry shader path, can be an empty string if not used. Alternatively shader's file name without path or extension to use search paths. Ignored on unsupported renderers. |
defines | Space separated shader source defines. |
- See also
- Renderer.SetShaderSearchPaths.
- Returns
- Error::NO_ERRORS on success, error otherwise.
◆ SetTexture()
virtual void Material::SetTexture |
( |
const std::string & |
name, |
|
|
const Texture * |
texture |
|
) |
| |
|
pure virtual |
Sets a texture. If the texture name is "textureMap", its UV scale and offset are in 4-dimensional vector "textureMap_ST".
- Parameters
-
name | Shader uniform name. |
texture | Texture. |
◆ SetVector() [1/2]
virtual void Material::SetVector |
( |
const std::string & |
name, |
|
|
const Vec3 & |
value |
|
) |
| |
|
pure virtual |
Sets a vector.
- Parameters
-
name | Shader uniform name. |
value | Value. |
◆ SetVector() [2/2]
virtual void Material::SetVector |
( |
const std::string & |
name, |
|
|
const Vec4 & |
value |
|
) |
| |
|
pure virtual |
Sets a vector.
- Parameters
-
name | Shader uniform name. |
value | Value. |
The documentation for this class was generated from the following file:
- /home/glaze/Documents/src/Aether3D_2013/Include/Material.hpp