| 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_MAP_HELPER_MODEL_HPP_INCLUDED |
|---|
| 23 | #define CAFU_MAP_HELPER_MODEL_HPP_INCLUDED |
|---|
| 24 | |
|---|
| 25 | #include "MapHelper.hpp" |
|---|
| 26 | #include "Models/AnimExpr.hpp" |
|---|
| 27 | #include "Util/Util.hpp" |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | class HelperInfoT; |
|---|
| 31 | class MapEntityT; |
|---|
| 32 | class Renderer2DT; |
|---|
| 33 | class Renderer3DT; |
|---|
| 34 | |
|---|
| 35 | class CafuModelT; |
|---|
| 36 | namespace cf { namespace GuiSys { class GuiImplT; } } |
|---|
| 37 | namespace cf { namespace TypeSys { class TypeInfoT; } } |
|---|
| 38 | namespace cf { namespace TypeSys { class TypeInfoManT; } } |
|---|
| 39 | namespace cf { namespace TypeSys { class CreateParamsT; } } |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | class MapHelperModelT : public MapHelperT |
|---|
| 43 | { |
|---|
| 44 | public: |
|---|
| 45 | |
|---|
| 46 | /// The constructor. |
|---|
| 47 | MapHelperModelT(const MapEntityT* ParentEntity, const HelperInfoT* HelperInfo); |
|---|
| 48 | |
|---|
| 49 | /// The copy constructor for copying a model. |
|---|
| 50 | /// @param Model The model to copy-construct this model from. |
|---|
| 51 | MapHelperModelT(const MapHelperModelT& Model); |
|---|
| 52 | |
|---|
| 53 | /// The destructor. |
|---|
| 54 | ~MapHelperModelT(); |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | // Implementations and overrides for base class methods. |
|---|
| 58 | MapHelperModelT* Clone() const; |
|---|
| 59 | void Assign(const MapElementT* Elem); |
|---|
| 60 | |
|---|
| 61 | wxString GetDescription() const { return "model"; } |
|---|
| 62 | BoundingBox3fT GetBB() const; |
|---|
| 63 | |
|---|
| 64 | void Render2D(Renderer2DT& Renderer) const; |
|---|
| 65 | void Render3D(Renderer3DT& Renderer) const; |
|---|
| 66 | |
|---|
| 67 | // The TypeSys related declarations for this class. |
|---|
| 68 | virtual const cf::TypeSys::TypeInfoT* GetType() const { return &TypeInfo; } |
|---|
| 69 | static void* CreateInstance(const cf::TypeSys::CreateParamsT& Params); |
|---|
| 70 | static const cf::TypeSys::TypeInfoT TypeInfo; |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | protected: |
|---|
| 74 | |
|---|
| 75 | void ClearGuis() const; |
|---|
| 76 | void UpdateModelCache() const; |
|---|
| 77 | int GetSequenceNr() const; |
|---|
| 78 | |
|---|
| 79 | const HelperInfoT* m_HelperInfo; ///< The HelperInfoT instance that caused the instantiation of this helper. |
|---|
| 80 | mutable const CafuModelT* m_Model; ///< Our model (obtained from the game config's model manager). |
|---|
| 81 | mutable IntrusivePtrT<AnimExpressionT> m_AnimExpr; ///< The current expression used for configuring the pose of the model. |
|---|
| 82 | mutable IntrusivePtrT<AnimExprStandardT> m_LastStdAE; ///< The most recent standard expression that we set (as a subexpression of m_AnimExpr). |
|---|
| 83 | mutable ArrayT<wxString> m_GuiNames; ///< The names of the GUIs in m_Guis. |
|---|
| 84 | mutable ArrayT<cf::GuiSys::GuiImplT*> m_Guis; ///< The GUIs that are rendered where the model has GUI fixtures. |
|---|
| 85 | mutable TimerT m_Timer; |
|---|
| 86 | }; |
|---|
| 87 | |
|---|
| 88 | #endif |
|---|