Render agnostic material.
More...
#include <OxygenEngine/scene/material.h>
|
| void | setTexture (const std::string &name, std::shared_ptr< oe::render::Texture > texture, const int32_t layer=-1) |
| | Set Texture at specified layer.
|
| |
|
std::shared_ptr< oe::render::Texture > | getTexture (const uint32_t &layer) const noexcept |
| | Get Texture stored at specified layer.
|
| |
| uint32_t | getNextAvailableTextureLayer (const uint32_t start=0) const |
| | Get an available texture layer for this material.
|
| |
| const auto & | getTextures () const |
| | Get all material textures.
|
| |
| template<typename T > |
| Material * | setProperty (const std::string &name, const T &value)=delete |
| | Set a property on a material.
|
| |
| template<typename T > |
| Material * | setArray (const std::string &name, const std::vector< T > &value)=delete |
| | Set a array of properties on a material.
|
| |
|
template<> |
| Material * | setProperty (const std::string &name, const size_t &value) |
| |
|
template<> |
| Material * | setProperty (const std::string &name, const bool &value) |
| |
|
template<> |
| Material * | setArray (const std::string &name, const std::vector< bool > &values) |
| |
|
|
DrawMode | draw_mode = DrawMode::TRIANGLES |
| | Describe how the mesh should be drawn.
|
| |
| uint32_t | flags = 0 |
| | General purpose user flags, may be used for collisions / sounds / etc...
|
| |
|
std::shared_ptr< oe::render::ShaderBase > | shader = nullptr |
| | Shader to use to render this material.
|
| |
|
bool | double_sided = false |
| | Draws two sides of faces.
|
| |
|
bool | invert_faces = false |
| | If not double sided, draws back faces instead of front ones.
|
| |
| glm::vec2 | texture_tiling = glm::vec2(1.f) |
| | Apply a tiling to the texture UV.
|
| |
| glm::vec2 | texture_offset = glm::vec2(0.f) |
| | Apply an offset to the texture UV.
|
| |
|
bool | is_blend = false |
| | This material need blending (transparency, effects, ...)
|
| |
|
TransmissiveProperties | transmissive_properties |
| | Physically-based transmission properties.
|
| |
|
float | alpha_threshold = 0.5f |
| | Texture with alpha below this value will be considered completely transparent.
|
| |
|
Material * | parent = nullptr |
| | Material source where properties/textures should be inherited from.
|
| |
|
bool | inherit_properties = false |
| | Check if Material properties should be inherited from parent Material.
|
| |
|
bool | inherit_textures = false |
| | Check if Material textures should be inherited from parent Material.
|
| |
|
|
class | oe::render::ShaderBase |
| |
Render agnostic material.
- See also
- oe::render::ShaderBase::fillFromMaterial to understand which properties are automatically sent to shaders
◆ DrawMode
Specify how the mesh vertices will be rendered.
- Todo:
- in documentation, show one image demonstrating each mode
| Enumerator |
|---|
| TRIANGLES | The mesh will be drawn with filled triangles (default value)
|
| TRIANGLE_STRIP | Generate triangles where each vertice added will make a new triangle with the last 2 previous ones
|
| TRIANGLE_FAN | Generate triangles where they are build around the inital vertex
Can be used to build pyramids or any structure where all vertices are tied around one
|
| POINTS | The mesh will be drawn without connecting vertices (like a "scatter plot")
|
| LINES | The mesh will be drawn with lines between vertices (like the "wireframe meshes" for example)
|
◆ getNextAvailableTextureLayer()
| uint32_t oe::scene::Material::getNextAvailableTextureLayer |
( |
const uint32_t |
start = 0 | ) |
const |
Get an available texture layer for this material.
- Note
- Material being rendering agnostic, there is no limit on textures layers
- Parameters
-
| start | Do not search below this layer |
- Returns
- id of next available layer
- Exceptions
-
| runtime_error | If there are more than INT_MAX layers |
◆ getTextures()
| const auto & oe::scene::Material::getTextures |
( |
| ) |
const |
|
inline |
Get all material textures.
- Returns
- map where keys are textures names and values are std::pair<layer, std::shared_ptr<Texture>>
◆ setArray()
template<typename T >
| Material * oe::scene::Material::setArray |
( |
const std::string & |
name, |
|
|
const std::vector< T > & |
value |
|
) |
| |
|
delete |
Set a array of properties on a material.
- Parameters
-
| name | array name |
| value | vector of property values |
◆ setProperty()
template<typename T >
| Material * oe::scene::Material::setProperty |
( |
const std::string & |
name, |
|
|
const T & |
value |
|
) |
| |
|
delete |
Set a property on a material.
- Parameters
-
| name | property name |
| value | property value |
◆ setTexture()
| void oe::scene::Material::setTexture |
( |
const std::string & |
name, |
|
|
std::shared_ptr< oe::render::Texture > |
texture, |
|
|
const int32_t |
layer = -1 |
|
) |
| |
Set Texture at specified layer.
- Parameters
-
| name | Texture uniform name |
| texture | texture pointer |
| layer | layer (set to -1 to use the next available) |
◆ flags
| uint32_t oe::scene::Material::flags = 0 |
General purpose user flags, may be used for collisions / sounds / etc...
- Note
- OxygenEngine won't touch those
◆ texture_offset
| glm::vec2 oe::scene::Material::texture_offset = glm::vec2(0.f) |
Apply an offset to the texture UV.
- Note
- Example effect: if moved with time, conveyor or waterfall
- Todo:
- Make the property per texture
◆ texture_tiling
| glm::vec2 oe::scene::Material::texture_tiling = glm::vec2(1.f) |
Apply a tiling to the texture UV.
- Note
- Example effect: if moved with time, zoom-in / zoom-out texture
- Todo:
- Make the property per texture
The documentation for this class was generated from the following file: