CUGL 3.0
Cornell University Game Library
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
cugl::scene3::MaterialLib Class Reference

#include <CUMaterial.h>

Public Member Functions

 MaterialLib ()
 
std::shared_ptr< MaterialInfoacquireMaterial (const std::string key)
 
std::shared_ptr< MaterialInfocurrentMaterial () 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< MaterialInfoactive
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ MaterialLib()

cugl::scene3::MaterialLib::MaterialLib ( )
inline

Creates an empty MaterialLib.

Member Function Documentation

◆ acquireMaterial()

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

Parameters
keyThe material key
Returns
a new MaterialInfo allocated for this library and key

◆ currentMaterial()

std::shared_ptr< MaterialInfo > cugl::scene3::MaterialLib::currentMaterial ( ) const
inline

Returns the currently active MaterialInfo object.

This method is used during parsing to update the current material.

Returns
the currently active MaterialInfo object.

Member Data Documentation

◆ active

std::shared_ptr<MaterialInfo> cugl::scene3::MaterialLib::active

The current material for parsing (nullptr when parsing complete)

◆ complete

bool cugl::scene3::MaterialLib::complete

Whether the library has completed loading

◆ materials

std::unordered_map<std::string,std::shared_ptr<Material> > cugl::scene3::MaterialLib::materials

The completed materials for this library.

◆ matinfos

std::unordered_map<std::string,std::shared_ptr<MaterialInfo> > cugl::scene3::MaterialLib::matinfos

The material information for this library.

◆ name

std::string cugl::scene3::MaterialLib::name

The key for this MaterialLib in an AssetManager

◆ path

std::string cugl::scene3::MaterialLib::path

The path to the texture file


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