Lysa  0.0
Lysa 3D Engine
Material Class Referenceabstract

Detailed Description

Base class for all materials of models surfaces

+ Inheritance diagram for Material:

Public Types

enum  Type { STANDARD, SHADER }
 

Public Member Functions

auto getCullMode () const
 
void setCullMode (const vireo::CullMode mode)
 
auto getDepthWrite () const
 
void setDepthWrite (const bool enable)
 
auto getDepthCompareOp () const
 
void setDepthCompareOp (const vireo::CompareOp op)
 
auto getTransparency () const
 
void setTransparency (const Transparency transparencyMode)
 
auto getAlphaScissor () const
 
void setAlphaScissor (const float scissor)
 
auto isUploaded () const
 
void upload () const
 
virtual MaterialData getMaterialData () const = 0
 
virtual pipeline_id getPipelineId () const = 0
 
const auto & getIndex () const
 
auto getType () const
 
 ~Material () override = default
 
- Public Member Functions inherited from ManagedResource
 ManagedResource () = default
 
 ManagedResource (UniqueResource &) = delete
 
ManagedResource & operator= (ManagedResource &) = delete
 
- Public Member Functions inherited from Resource
bool operator== (const Resource &other) const
 
 Resource () = default
 
 Resource (const unique_id id)
 
virtual ~Resource () = default
 

Protected Member Functions

 Material (Type type)
 

Additional Inherited Members

- Public Attributes inherited from ManagedResource
uint32 refCounter {0}
 
- Public Attributes inherited from Resource
unique_id id {INVALID_ID}
 

Member Enumeration Documentation

enum Type

Distinguishes between the built-in PBR material and custom shader materials.

Enum ValuesDocumentation
STANDARD 

Standard PBR material.

SHADER 

shader material with user-defined parameters and custome pipeline stages

Constructor & Destructor Documentation

~Material ( )
overridedefault
Material ( Type  type)
protected

Member Function Documentation

auto getAlphaScissor ( ) const
inline

Returns the alpha scissor threshold value

auto getCullMode ( ) const
inline

Returns the cull mode.

auto getDepthCompareOp ( ) const
inline
auto getDepthWrite ( ) const
inline
const auto& getIndex ( ) const
inline

Returns the index of this material in the global GPU materials array.

virtual MaterialData getMaterialData ( ) const
pure virtual

Returns the packed GPU-ready material data for this material.

Implemented in lysa::ShaderMaterial::getMaterialData(), lysa::StandardMaterial::getMaterialData()

virtual pipeline_id getPipelineId ( ) const
pure virtual

Returns the pipeline identifier used to select the correct render pipeline.

Implemented in lysa::ShaderMaterial::getPipelineId(), lysa::StandardMaterial::getPipelineId()

auto getTransparency ( ) const
inline

Returns the transparency mode

auto getType ( ) const
inline

Returns the material type (STANDARD or SHADER).

auto isUploaded ( ) const
inline

Returns true if the material has been uploaded to GPU memory.

void setAlphaScissor ( const float  scissor)
inline

Sets the alpha scissor threshold value Threshold at which the alpha scissors will discard values. Higher values will result in more pixels being discarded. If the material becomes too opaque at a distance, try increasing this value. If the material disappears at a distance, try decreasing this value.

void setCullMode ( const vireo::CullMode  mode)
inline

Sets the CullMode. Determines which side of the triangle to cull depending on whether the triangle faces towards or away from the camera.

void setDepthCompareOp ( const vireo::CompareOp  op)
inline
void setDepthWrite ( const bool  enable)
inline
void setTransparency ( const Transparency  transparencyMode)
inline

Sets the transparency mode

void upload ( ) const

Uploads the material data to the GPU memory block.

Friends And Related Function Documentation

friend class MaterialManager
friend