Cafu Engine
MaterialManagerImplT Class Reference

This class implements the MaterialManagerI interface. More...

#include "MaterialManagerImpl.hpp"

Inheritance diagram for MaterialManagerImplT:

Public Member Functions

MaterialTRegisterMaterial (const MaterialT &Mat)
 Registers a copy of the given material Mat and returns a pointer to the registered copy. More...
 
ArrayT< MaterialT * > RegisterMaterialScript (const std::string &FileName, const std::string &BaseDir)
 Registers a material script file. More...
 
ArrayT< MaterialT * > RegisterMaterialScriptsInDir (const std::string &DirName, const std::string &BaseDir, const bool Recurse=true)
 Registers all ".cmat" files in a directory as material script files. More...
 
const std::map< std::string,
MaterialT * > & 
GetAllMaterials () const
 Returns all the materials registered so far. More...
 
bool HasMaterial (const std::string &MaterialName) const
 Returns whether the material with the given name is registered with the material manager, i.e. if a call to GetMaterial(MaterialName) will return successfully. More...
 
MaterialTGetMaterial (const std::string &MaterialName) const
 Returns a material by its name. More...
 
- Public Member Functions inherited from MaterialManagerI
virtual ~MaterialManagerI ()
 Virtual destructor, so that nothing can go wrong and even g++ is happy. More...
 

Detailed Description

This class implements the MaterialManagerI interface.

Member Function Documentation

const std::map<std::string, MaterialT*>& MaterialManagerImplT::GetAllMaterials ( ) const
inlinevirtual

Returns all the materials registered so far.

Implements MaterialManagerI.

MaterialT * MaterialManagerImplT::GetMaterial ( const std::string &  MaterialName) const
virtual

Returns a material by its name.

If the material is not found in the previously registered scripts, NULL is returned.

Implements MaterialManagerI.

bool MaterialManagerImplT::HasMaterial ( const std::string &  MaterialName) const
virtual

Returns whether the material with the given name is registered with the material manager, i.e. if a call to GetMaterial(MaterialName) will return successfully.

Use this to avoid warning messages to the console if the material is not registered.

Implements MaterialManagerI.

MaterialT * MaterialManagerImplT::RegisterMaterial ( const MaterialT Mat)

Registers a copy of the given material Mat and returns a pointer to the registered copy.

If a material with the same name Mat.Name is already registered with the material manager, Mat is not registered, but a pointer to the already registered instance with the same name is returned (use HasMaterial() in advance to unambigiously distingush between the two cases).

Parameters
MatThe material of which a copy is to be registered with the material manager.
Returns
A pointer to the registered material instance (or a previously existing instance with the same name).
ArrayT< MaterialT * > MaterialManagerImplT::RegisterMaterialScript ( const std::string &  FileName,
const std::string &  BaseDir 
)
virtual

Registers a material script file.

The GetMaterial() function will look into the files registered here when looking for a material.

Returns
an array of pointers to all the new materials found in the cmat file FileName. Note that only "new", not previously registered materials are considered here!

Implements MaterialManagerI.

ArrayT< MaterialT * > MaterialManagerImplT::RegisterMaterialScriptsInDir ( const std::string &  DirName,
const std::string &  BaseDir,
const bool  Recurse = true 
)
virtual

Registers all ".cmat" files in a directory as material script files.

Returns
an array of pointers to all the new materials found in cmat files in DirName. Note that only "new", not previously registered materials are considered here!

Implements MaterialManagerI.


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