API Documentation
Public Member Functions | List of all members
nkAstraeus::Material Class Referenceabstract

Base class for all materials in the component. More...

Inheritance diagram for nkAstraeus::Material:
nkExport::Exportable nkAstraeus::PbsMaterial

Public Member Functions

 Material (MATERIAL_TYPE type) noexcept
 
virtual ~Material ()
 
nkMemory::StringView getName () const
 
nkGraphics::ShadergetShader () const
 
MATERIAL_TYPE getType () const
 
void setName (nkMemory::StringView value)
 
virtual bool load ()=0
 
virtual void unload ()=0
 
virtual void exportClassToTree (nkExport::Node *rootNode) override
 
virtual void importClassFromTree (nkExport::Node *rootNode) override
 
- Public Member Functions inherited from nkExport::Exportable
 Exportable () noexcept
 
virtual ~Exportable ()
 

Detailed Description

Base class for all materials in the component.

This class offers basic information and the general interface to access them. Materials are designed to be inter-operable with the nkGraphics::Entity class. As such, the shader created by a material is usable directly on an entity.

Constructor & Destructor Documentation

◆ Material()

nkAstraeus::Material::Material ( MATERIAL_TYPE  type)
noexcept

Constructor.

Parameters
typeThe material type, usually given by the underlying implementation.

◆ ~Material()

virtual nkAstraeus::Material::~Material ( )
virtual

Destructor.

Member Function Documentation

◆ getName()

nkMemory::StringView nkAstraeus::Material::getName ( ) const
Returns
The material's name.

◆ getShader()

nkGraphics::Shader* nkAstraeus::Material::getShader ( ) const
Returns
The final shader prepared by the material, once a successful load() has been called.

◆ getType()

MATERIAL_TYPE nkAstraeus::Material::getType ( ) const
Returns
The material real type. Allows to know which derived class this material truly is.

◆ setName()

void nkAstraeus::Material::setName ( nkMemory::StringView  value)

Sets the name of the material.

Parameters
valueThe name to set.
Remarks
This function is called by the MaterialManager to keep it in sync with its internal memory. If you need to alter this, please call MaterialManager::rename.

◆ load()

virtual bool nkAstraeus::Material::load ( )
pure virtual

Loads the material and make it ready for rendering.

Returns
Whether the loading went well (true) or not (false).

Implemented in nkAstraeus::PbsMaterial.

◆ unload()

virtual void nkAstraeus::Material::unload ( )
pure virtual

Unloads the material and its internal memory. After that, the material is unusable for rendering.

Implemented in nkAstraeus::PbsMaterial.

◆ exportClassToTree()

virtual void nkAstraeus::Material::exportClassToTree ( nkExport::Node rootNode)
overridevirtual

Exports an item into a tree describing its structure and its data.

Parameters
rootNodeThe node into which the object has to write its related information.

Implements nkExport::Exportable.

Reimplemented in nkAstraeus::PbsMaterial.

◆ importClassFromTree()

virtual void nkAstraeus::Material::importClassFromTree ( nkExport::Node rootNode)
overridevirtual

Imports information from a tree which is supposed to describe its structure and data.

Parameters
rootNodeThe root node of the tree holding the information.

Implements nkExport::Exportable.

Reimplemented in nkAstraeus::PbsMaterial.


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