Cafu Engine
EditorMaterialDummy.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_DUMMY_HPP_INCLUDED
8 #define CAFU_EDITOR_MATERIAL_DUMMY_HPP_INCLUDED
9 
10 #include "wx/image.h"
11 #include "EditorMaterial.hpp"
12 
13 
14 /// The class implements the EditorMaterialI interface.
15 /// It is used whenever a map file contains a material name for which
16 /// we have no matching material in the MaterialSystems material manager.
18 {
19  public:
20 
21  DummyMaterialT(const wxString& Name);
22 
23  // Instead of 0, return reasonable numbers for the width and height, so that the dummy is properly displayed in the material browser.
24  int GetWidth () const { return 256; }
25  int GetHeight() const { return 64; }
26 
27  const wxString& GetName() const { return m_Name; }
28 
29  void Draw(wxDC& dc, const wxRect& DestRect, int NameBoxHeight, bool DrawNameBox) const;
30  const wxImage& GetImage() const { static wxImage DummyImage(2, 2); return DummyImage; }
31 
32  MatSys::RenderMaterialT* GetRenderMaterial(bool PreviewMode) const;
33  MaterialT* GetMaterial() const;
34  bool IsTranslucent() const { return false; }
35  bool ShowInMaterialBrowser() const { return true; }
36 
37 
38  protected:
39 
40  wxString m_Name;
41 };
42 
43 #endif
This class represents a surface render material.
Definition: RenderMaterial.hpp:25
MatSys::RenderMaterialT * GetRenderMaterial(bool PreviewMode) const
Returns the render material of this material.
Definition: EditorMaterialDummy.cpp:40
bool IsTranslucent() const
Returns whether this material is rendered translucently.
Definition: EditorMaterialDummy.hpp:34
bool ShowInMaterialBrowser() const
Returns whether the material should be shown for selection in the materials browser.
Definition: EditorMaterialDummy.hpp:35
This class represents a surface material ("A datastructural representation of a scripts material def...
Definition: Material.hpp:22
Definition: EditorMaterial.hpp:21
The class implements the EditorMaterialI interface.
Definition: EditorMaterialDummy.hpp:17
MaterialT * GetMaterial() const
Returns the material object.
Definition: EditorMaterialDummy.cpp:47