Cafu Engine
EditorMaterialManager.hpp
1 /*
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.
5 */
6 
7 #ifndef CAFU_EDITOR_MATERIAL_MANAGER_HPP_INCLUDED
8 #define CAFU_EDITOR_MATERIAL_MANAGER_HPP_INCLUDED
9 
10 #include "MaterialSystem/MaterialManagerImpl.hpp"
11 #include "Templates/Array.hpp"
12 #include "wx/wx.h"
13 
14 
15 class EditorMaterialI;
16 class GameConfigT;
17 
18 
19 /// This class manages the editor materials for a game configuration.
21 {
22  public:
23 
24  EditorMatManT(const GameConfigT& GameConfig);
25  ~EditorMatManT();
26 
27  const ArrayT<EditorMaterialI*>& GetMaterials() const { return m_Materials; }
28 
29  EditorMaterialI* GetDefaultMaterial();
30  void SetDefaultMaterial(EditorMaterialI* DefaultMat);
31 
32  /// This method finds an editor material by name.
33  ///
34  /// @param MatName Name of the material to find.
35  /// @param CreateDummy Creates and returns a dummy material when the requested material was not found.
36  ///
37  /// @returns a pointer to the requested editor material.
38  /// If the material was not found and CreateDummy is true, a dummy material is added and its pointer is returned.
39  /// If the material was not found and CreateDummy is false, NULL is returned.
40  EditorMaterialI* FindMaterial(const wxString& MatName, bool CreateDummy);
41 
42  // This loops through m_Materials, one per call, and calls the GetImage() method on the material,
43  // in order to make sure that the proxy is fully loaded.
44  void LazilyUpdateProxies();
45 
46 
47  private:
48 
49  EditorMatManT(const EditorMatManT&); ///< Use of the Copy Constructor is not allowed.
50  void operator = (const EditorMatManT&); ///< Use of the Assignment Operator is not allowed.
51 
52  MaterialManagerImplT m_MaterialMan; ///< The material manager for the materials that are used with this game config.
53  ArrayT<EditorMaterialI*> m_Materials; ///< Array of all materials in this game configuration.
54  EditorMaterialI* m_DefaultMaterial; ///< The currently used default material.
55  unsigned long m_LazyMatUpdateCount; ///< This counts up to where we already cached in the m_Materials.
56 };
57 
58 #endif
This class manages the editor materials for a game configuration.
Definition: EditorMaterialManager.hpp:20
EditorMaterialI * FindMaterial(const wxString &MatName, bool CreateDummy)
This method finds an editor material by name.
Definition: EditorMaterialManager.cpp:103
This class implements the MaterialManagerI interface.
Definition: MaterialManagerImpl.hpp:23
Definition: EditorMaterial.hpp:21
The class describes the settings for a game/MOD.
Definition: GameConfig.hpp:32