![]() |
CUGL 3.0
Cornell University Game Library
|
#include <CUMaterial.h>
Public Member Functions | |
MaterialLib () | |
std::shared_ptr< MaterialInfo > | acquireMaterial (const std::string key) |
std::shared_ptr< MaterialInfo > | currentMaterial () const |
Public Attributes | |
std::string | name |
std::string | path |
std::unordered_map< std::string, std::shared_ptr< MaterialInfo > > | matinfos |
std::unordered_map< std::string, std::shared_ptr< Material > > | materials |
bool | complete |
std::shared_ptr< MaterialInfo > | active |
This class represents an MTL file
An MTL is a collection of one or more materials. An OBJ file can reference more than one MTL file.
As MaterialLib objects are processed using a state machine, they will have an active material at all times during parsing. However, this active texture will be set to nullptr once the library is fully parsed.
|
inline |
Creates an empty MaterialLib.
std::shared_ptr< MaterialInfo > cugl::scene3::MaterialLib::acquireMaterial | ( | const std::string | key | ) |
Returns a new MaterialInfo allocated for this library and key
This method is used during parsing to add new material data
key | The material key |
|
inline |
Returns the currently active MaterialInfo object.
This method is used during parsing to update the current material.
std::shared_ptr<MaterialInfo> cugl::scene3::MaterialLib::active |
The current material for parsing (nullptr when parsing complete)
bool cugl::scene3::MaterialLib::complete |
Whether the library has completed loading
std::unordered_map<std::string,std::shared_ptr<Material> > cugl::scene3::MaterialLib::materials |
The completed materials for this library.
std::unordered_map<std::string,std::shared_ptr<MaterialInfo> > cugl::scene3::MaterialLib::matinfos |
The material information for this library.
std::string cugl::scene3::MaterialLib::name |
The key for this MaterialLib in an AssetManager
std::string cugl::scene3::MaterialLib::path |
The path to the texture file