Cafu Engine
MaterialManagerI Class Referenceabstract

This is an interface to the material manager. More...

#include "MaterialManager.hpp"

Inheritance diagram for MaterialManagerI:

Public Member Functions

virtual ArrayT< MaterialT * > RegisterMaterialScript (const std::string &FileName, const std::string &BaseDir)=0
 Registers a material script file. More...
 
virtual ArrayT< MaterialT * > RegisterMaterialScriptsInDir (const std::string &DirName, const std::string &BaseDir, const bool Recurse=true)=0
 Registers all ".cmat" files in a directory as material script files. More...
 
virtual const std::map
< std::string, MaterialT * > & 
GetAllMaterials () const =0
 Returns all the materials registered so far. More...
 
virtual bool HasMaterial (const std::string &MaterialName) const =0
 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...
 
virtual MaterialTGetMaterial (const std::string &MaterialName) const =0
 Returns a material by its name. More...
 
virtual ~MaterialManagerI ()
 Virtual destructor, so that nothing can go wrong and even g++ is happy. More...
 

Detailed Description

This is an interface to the material manager.

A material manager keeps a set of materials and their related script state, and finds materials by name.

The interface is specified as ABC in order to be able to share the material manager across exe/dll boundaries. (Note that sharing across exe/dll boundaries is probably not needed: The MaterialManagerI is just a helper for getting MaterialTs from script files. Thus we could also share (pointers to) arrays of MaterialTs directly. (MODs should not register their own materials, as the engine registeres anything in the Materials dir. anyway.) It is just the GetMaterial() "search" function that makes sharing the MatMan interesting.)

Constructor & Destructor Documentation

virtual MaterialManagerI::~MaterialManagerI ( )
inlinevirtual

Virtual destructor, so that nothing can go wrong and even g++ is happy.

Member Function Documentation

virtual const std::map<std::string, MaterialT*>& MaterialManagerI::GetAllMaterials ( ) const
pure virtual

Returns all the materials registered so far.

Implemented in MaterialManagerImplT.

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

Returns a material by its name.

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

Implemented in MaterialManagerImplT.

virtual bool MaterialManagerI::HasMaterial ( const std::string &  MaterialName) const
pure 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.

Implemented in MaterialManagerImplT.

virtual ArrayT<MaterialT*> MaterialManagerI::RegisterMaterialScript ( const std::string &  FileName,
const std::string &  BaseDir 
)
pure 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!

Implemented in MaterialManagerImplT.

virtual ArrayT<MaterialT*> MaterialManagerI::RegisterMaterialScriptsInDir ( const std::string &  DirName,
const std::string &  BaseDir,
const bool  Recurse = true 
)
pure 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!

Implemented in MaterialManagerImplT.


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