Cafu Engine
EditorMaterial.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_HPP_INCLUDED
8 #define CAFU_EDITOR_MATERIAL_HPP_INCLUDED
9 
10 #include "wx/wx.h"
11 
12 
13 namespace MatSys { class RenderMaterialT; }
14 
15 class MaterialT;
16 class wxDC;
17 class wxImage;
18 class wxRect;
19 
20 
22 {
23  public:
24 
25  virtual ~EditorMaterialI() { }
26 
27  virtual int GetWidth() const=0;
28  virtual int GetHeight() const=0;
29 
30  virtual const wxString& GetName() const=0;
31 
32  // Called to draw this texture onto dc into DestRect.
33  // DestRect includes the NameBoxHeight, that is, the intended height of the texture is only DestRect.GetHeight()-NameBoxHeight.
34  // The drawing of the name box (background rectangle + font) is setup by the caller.
35  // On changes, make sure that the previous values for pens, brushes etc. are restored.
36  virtual void Draw(wxDC& dc, const wxRect& DestRect, int NameBoxHeight, bool DrawNameBox) const=0;
37  virtual const wxImage& GetImage() const=0;
38 
39  /// Returns the render material of this material.
40  /// @param PreviewMode If true, the render material for 3D preview mode is returned (as it would appear in Cafu).
41  /// If false, the render material for the 3D edit mode is returned (derived from the meta_editorImage, better for editing in CaWE).
42  virtual MatSys::RenderMaterialT* GetRenderMaterial(bool PreviewMode) const=0;
43 
44  /// Returns the material object.
45  virtual MaterialT* GetMaterial() const=0;
46 
47  /// Returns whether this material is rendered translucently.
48  /// Translucent materials are typically implemented with "alpha blending" and require rendering in back-to-front order.
49  /// Classes that derive from MapElementT typically use this to determine the return value for their MapElementT::IsTranslucent() method.
50  /// @see MapElementT::IsTranslucent()
51  virtual bool IsTranslucent() const=0;
52 
53  /// Returns whether the material should be shown for selection in the materials browser.
54  /// Useful for letting sprite and model materials out.
55  virtual bool ShowInMaterialBrowser() const=0;
56 };
57 
58 #endif
This class represents a surface render material.
Definition: RenderMaterial.hpp:25
virtual MatSys::RenderMaterialT * GetRenderMaterial(bool PreviewMode) const =0
Returns the render material of this material.
virtual bool IsTranslucent() const =0
Returns whether this material is rendered translucently.
virtual MaterialT * GetMaterial() const =0
Returns the material object.
This class represents a surface material ("A datastructural representation of a scripts material def...
Definition: Material.hpp:22
Definition: EditorMaterial.hpp:21
virtual bool ShowInMaterialBrowser() const =0
Returns whether the material should be shown for selection in the materials browser.