2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
7 /***************************************/
8 /*** Material Manager Implementation ***/
9 /***************************************/
11 #ifndef CAFU_MATSYS_MATERIAL_MANAGER_IMPLEMENTATION_HPP_INCLUDED
12 #define CAFU_MATSYS_MATERIAL_MANAGER_IMPLEMENTATION_HPP_INCLUDED
14 #include "MaterialManager.hpp"
22 /// This class implements the MaterialManagerI interface.
23 class MaterialManagerImplT
: public MaterialManagerI
27 MaterialManagerImplT();
28 ~MaterialManagerImplT();
30 /// Registers a copy of the given material \c Mat and returns a pointer to the registered copy.
31 /// If a material with the same name \c Mat.Name is already registered with the material manager,
32 /// \c Mat is not registered, but a pointer to the already registered instance with the same name is returned
33 /// (use HasMaterial() in advance to unambigiously distingush between the two cases).
35 /// @param Mat The material of which a copy is to be registered with the material manager.
36 /// @returns A pointer to the registered material instance (or a previously existing instance with the same name).
37 MaterialT
* RegisterMaterial(const MaterialT
& Mat
);
40 // The MaterialManagerI interface.
41 ArrayT
<MaterialT
*> RegisterMaterialScript(const std::string
& FileName
, const std::string
& BaseDir
);
42 ArrayT
<MaterialT
*> RegisterMaterialScriptsInDir(const std::string
& DirName
, const std::string
& BaseDir
, const bool Recurse
=true);
43 const std::map
<std::string
, MaterialT
*>& GetAllMaterials() const { return Materials
; }
44 bool HasMaterial(const std::string
& MaterialName
) const;
45 MaterialT
* GetMaterial(const std::string
& MaterialName
) const;
46 // void ClearAllMaterials();
51 MaterialManagerImplT(const MaterialManagerImplT
&); // Use of the Copy Constructor is not allowed.
52 void operator = (const MaterialManagerImplT
&); // Use of the Assignment Operator is not allowed.
54 ArrayT
<std::string
> MaterialScriptFileNames
;
55 ArrayT
<TableT
*> Tables
;
56 std::map
<std::string
, MaterialT
*> Materials
;