| 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_PLANT_HPP_INCLUDED |
|---|
| 23 | #define CAFU_MAP_PLANT_HPP_INCLUDED |
|---|
| 24 | |
|---|
| 25 | #include "MapPrimitive.hpp" |
|---|
| 26 | #include "Plants/Tree.hpp" |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | class MapDocumentT; |
|---|
| 30 | struct PlantDescriptionT; |
|---|
| 31 | class PlantDescrManT; |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | class MapPlantT : public MapPrimitiveT |
|---|
| 35 | { |
|---|
| 36 | public: |
|---|
| 37 | |
|---|
| 38 | MapPlantT(); |
|---|
| 39 | MapPlantT(const PlantDescriptionT* PlantDescription, unsigned long RandomSeed, const Vector3fT& Position); |
|---|
| 40 | |
|---|
| 41 | /// The copy constructor for copying a plant. |
|---|
| 42 | /// @param Plant The plant to copy-construct this plant from. |
|---|
| 43 | MapPlantT(const MapPlantT& Plant); |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | // Implementations and overrides for base class methods. |
|---|
| 47 | MapPlantT* Clone() const; |
|---|
| 48 | void Assign(const MapElementT* Elem); |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | // MapElementT implementation. |
|---|
| 52 | BoundingBox3fT GetBB() const; |
|---|
| 53 | |
|---|
| 54 | void Render2D(Renderer2DT& Renderer) const; |
|---|
| 55 | void Render3D(Renderer3DT& Renderer) const; |
|---|
| 56 | |
|---|
| 57 | bool TracePixel(const wxPoint& Pixel, int Radius, const ViewWindow2DT& ViewWin) const; |
|---|
| 58 | wxString GetDescription() const { return "Plant"; } |
|---|
| 59 | bool IsTranslucent() const { return true; } |
|---|
| 60 | |
|---|
| 61 | // Implement the MapElementT transformation methods. |
|---|
| 62 | void TrafoMove(const Vector3fT& Delta); |
|---|
| 63 | void TrafoRotate(const Vector3fT& RefPoint, const cf::math::AnglesfT& Angles); |
|---|
| 64 | void TrafoScale(const Vector3fT& RefPoint, const Vector3fT& Scale); |
|---|
| 65 | void TrafoMirror(unsigned int NormalAxis, float Dist); |
|---|
| 66 | void Transform(const MatrixT& Matrix); |
|---|
| 67 | |
|---|
| 68 | void Load_cmap(TextParserT& TP, MapDocumentT& MapDoc); |
|---|
| 69 | void Save_cmap(std::ostream& OutFile, unsigned long PlantNr, const MapDocumentT& MapDoc) const; |
|---|
| 70 | |
|---|
| 71 | // The TypeSys related declarations for this class. |
|---|
| 72 | virtual const cf::TypeSys::TypeInfoT* GetType() const { return &TypeInfo; } |
|---|
| 73 | static void* CreateInstance(const cf::TypeSys::CreateParamsT& Params); |
|---|
| 74 | static const cf::TypeSys::TypeInfoT TypeInfo; |
|---|
| 75 | |
|---|
| 76 | |
|---|
| 77 | private: |
|---|
| 78 | |
|---|
| 79 | friend class InspDlgPrimitivePropsT; |
|---|
| 80 | friend class CommandChangePlantSeedT; |
|---|
| 81 | friend class CommandChangePlantDescrT; |
|---|
| 82 | |
|---|
| 83 | TreeT m_Tree; |
|---|
| 84 | unsigned long m_RandomSeed; |
|---|
| 85 | cf::math::AnglesfT m_Angles; |
|---|
| 86 | Vector3fT m_Position; |
|---|
| 87 | wxString m_DescrFileName; |
|---|
| 88 | }; |
|---|
| 89 | |
|---|
| 90 | #endif |
|---|