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

Render agnostic material. More...

#include <OxygenEngine/scene/material.h>

+ Collaboration diagram for oe::scene::Material:

Public Member Functions

void setTexture (const std::string &name, render::Texture *texture)
 
uint32_t getNextAvailableTextureLayer (const uint32_t start=0) const
 Get an available texture layer for this material.
 
template<typename T >
MaterialsetProperty (const std::string &name, const T &value)=delete
 Get all material textures.
 
template<typename T >
MaterialsetArray (const std::string &name, const std::vector< T > &value)=delete
 Set a array of properties on a material.
 
template<>
MaterialsetProperty (const std::string &name, const size_t &value)
 
template<>
MaterialsetProperty (const std::string &name, const bool &value)
 
template<>
MaterialsetArray (const std::string &name, const std::vector< bool > &values)
 

Public Attributes

std::vector< TexturePropertytextures
 
TextureCoordinatesTransform texture_coordinates_0
 First texture coordinates transformation set.
 
TextureCoordinatesTransform texture_coordinates_1
 Second texture coordinates transformation set.
 
uint32_t flags = 0
 General purpose user flags, may be used for collisions / sounds / etc...
 
oe::render::ShaderBaseshader = 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.
 
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.
 
Materialparent = 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.
 

Friends

class oe::render::ShaderBase
 

Detailed Description

Render agnostic material.

See also
oe::render::ShaderBase::fillFromMaterial to understand which properties are automatically sent to shaders

Member Function Documentation

◆ 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
startDo not search below this layer
Returns
id of next available layer
Exceptions
runtime_errorIf there are no more than INT_MAX layers

◆ 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
namearray name
valuevector of property values

◆ setProperty()

template<typename T >
Material * oe::scene::Material::setProperty ( const std::string &  name,
const T &  value 
)
delete

Get all material textures.

Returns
map where keys are textures names and values are std::pair<layer, std::shared_ptr<Texture>>

Set a property on a material

Parameters
nameproperty name
valueproperty value

Member Data Documentation

◆ 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

◆ is_blend

bool oe::scene::Material::is_blend = false

This material need blending (transparency, effects, ...)

If blending is enabled, this material will only be drawn on Forward pass


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