| 1 | /* |
|---|
| 2 | ================================================================================= |
|---|
| 3 | This file is part of Cafu, the open-source game engine and graphics engine |
|---|
| 4 | for multiplayer, cross-platform, real-time 3D action. |
|---|
| 5 | Copyright (C) 2002-2012 Carsten Fuchs Software. |
|---|
| 6 | |
|---|
| 7 | Cafu is free software: you can redistribute it and/or modify it under the terms |
|---|
| 8 | of the GNU General Public License as published by the Free Software Foundation, |
|---|
| 9 | either version 3 of the License, or (at your option) any later version. |
|---|
| 10 | |
|---|
| 11 | Cafu is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
|---|
| 12 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|---|
| 13 | PURPOSE. See the GNU General Public License for more details. |
|---|
| 14 | |
|---|
| 15 | You should have received a copy of the GNU General Public License |
|---|
| 16 | along with Cafu. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 17 | |
|---|
| 18 | For support and more information about Cafu, visit us at <http://www.cafu.de>. |
|---|
| 19 | ================================================================================= |
|---|
| 20 | */ |
|---|
| 21 | |
|---|
| 22 | #ifndef CAFU_EDITOR_MATERIAL_HPP_INCLUDED |
|---|
| 23 | #define CAFU_EDITOR_MATERIAL_HPP_INCLUDED |
|---|
| 24 | |
|---|
| 25 | #include "wx/wx.h" |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | namespace MatSys { class RenderMaterialT; } |
|---|
| 29 | |
|---|
| 30 | class MaterialT; |
|---|
| 31 | class wxDC; |
|---|
| 32 | class wxImage; |
|---|
| 33 | class wxRect; |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | class EditorMaterialI |
|---|
| 37 | { |
|---|
| 38 | public: |
|---|
| 39 | |
|---|
| 40 | virtual ~EditorMaterialI() { } |
|---|
| 41 | |
|---|
| 42 | virtual int GetWidth() const=0; |
|---|
| 43 | virtual int GetHeight() const=0; |
|---|
| 44 | |
|---|
| 45 | virtual const wxString& GetName() const=0; |
|---|
| 46 | |
|---|
| 47 | // Called to draw this texture onto dc into DestRect. |
|---|
| 48 | // DestRect includes the NameBoxHeight, that is, the intended height of the texture is only DestRect.GetHeight()-NameBoxHeight. |
|---|
| 49 | // The drawing of the name box (background rectangle + font) is setup by the caller. |
|---|
| 50 | // On changes, make sure that the previous values for pens, brushes etc. are restored. |
|---|
| 51 | virtual void Draw(wxDC& dc, const wxRect& DestRect, int NameBoxHeight, bool DrawNameBox) const=0; |
|---|
| 52 | virtual const wxImage& GetImage() const=0; |
|---|
| 53 | |
|---|
| 54 | /// Returns the render material of this material. |
|---|
| 55 | /// @param PreviewMode If true, the render material for 3D preview mode is returned (as it would appear in Cafu). |
|---|
| 56 | /// If false, the render material for the 3D edit mode is returned (derived from the meta_editorImage, better for editing in CaWE). |
|---|
| 57 | virtual MatSys::RenderMaterialT* GetRenderMaterial(bool PreviewMode) const=0; |
|---|
| 58 | |
|---|
| 59 | /// Returns the material object. |
|---|
| 60 | virtual MaterialT* GetMaterial() const=0; |
|---|
| 61 | |
|---|
| 62 | /// Returns whether this material is rendered translucently. |
|---|
| 63 | /// Translucent materials are typically implemented with "alpha blending" and require rendering in back-to-front order. |
|---|
| 64 | /// Classes that derive from MapElementT typically use this to determine the return value for their MapElementT::IsTranslucent() method. |
|---|
| 65 | /// @see MapElementT::IsTranslucent() |
|---|
| 66 | virtual bool IsTranslucent() const=0; |
|---|
| 67 | |
|---|
| 68 | /// Returns whether the material should be shown for selection in the materials browser. |
|---|
| 69 | /// Useful for letting sprite and model materials out. |
|---|
| 70 | virtual bool ShowInMaterialBrowser() const=0; |
|---|
| 71 | }; |
|---|
| 72 | |
|---|
| 73 | #endif |
|---|