| 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_ENTITY_HPP_INCLUDED |
|---|
| 23 | #define CAFU_MAP_ENTITY_HPP_INCLUDED |
|---|
| 24 | |
|---|
| 25 | #include "MapEntityBase.hpp" |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | class MapHelperT; |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | class MapEntityT : public MapEntityBaseT |
|---|
| 32 | { |
|---|
| 33 | public: |
|---|
| 34 | |
|---|
| 35 | /// The default constructor. |
|---|
| 36 | MapEntityT(); |
|---|
| 37 | |
|---|
| 38 | /// The copy constructor for copying an entity. |
|---|
| 39 | /// @param Entity The entity to copy-construct this entity from. |
|---|
| 40 | MapEntityT(const MapEntityT& Entity); |
|---|
| 41 | |
|---|
| 42 | /// The destructor. |
|---|
| 43 | ~MapEntityT(); |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | // Implementations and overrides for base class methods. |
|---|
| 47 | MapEntityT* Clone() const; |
|---|
| 48 | void Assign(const MapElementT* Elem); |
|---|
| 49 | |
|---|
| 50 | wxColour GetColor(bool ConsiderGroup=true) const; |
|---|
| 51 | wxString GetDescription() const; |
|---|
| 52 | |
|---|
| 53 | void Render2D(Renderer2DT& Renderer) const; |
|---|
| 54 | void Render3D(Renderer3DT& Renderer) const; |
|---|
| 55 | BoundingBox3fT GetBB() const; |
|---|
| 56 | |
|---|
| 57 | bool TraceRay(const Vector3fT& RayOrigin, const Vector3fT& RayDir, float& Fraction, unsigned long& FaceNr) const; |
|---|
| 58 | bool TracePixel(const wxPoint& Pixel, int Radius, const ViewWindow2DT& ViewWin) const; |
|---|
| 59 | void TrafoMove(const Vector3fT& Delta); |
|---|
| 60 | void TrafoRotate(const Vector3fT& RefPoint, const cf::math::AnglesfT& Angles); |
|---|
| 61 | void TrafoScale(const Vector3fT& RefPoint, const Vector3fT& Scale); |
|---|
| 62 | void TrafoMirror(unsigned int NormalAxis, float Dist); |
|---|
| 63 | void Transform(const MatrixT& Matrix); |
|---|
| 64 | |
|---|
| 65 | void SetClass(const EntityClassT* NewClass); |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | /// Checks if unique values are set and unique inside the world and changes/sets them if bool Repair is true (default). |
|---|
| 69 | /// @return Properties that are flagged as unique, but haven't (or hadn't, if repaired) unique values. |
|---|
| 70 | ArrayT<EntPropertyT> CheckUniqueValues(MapDocumentT& MapDoc, bool Repair=true); |
|---|
| 71 | |
|---|
| 72 | Vector3fT GetOrigin() const; |
|---|
| 73 | void SetOrigin(const Vector3fT& Origin); |
|---|
| 74 | |
|---|
| 75 | |
|---|
| 76 | // The TypeSys related declarations for this class. |
|---|
| 77 | virtual const cf::TypeSys::TypeInfoT* GetType() const { return &TypeInfo; } |
|---|
| 78 | static void* CreateInstance(const cf::TypeSys::CreateParamsT& Params); |
|---|
| 79 | static const cf::TypeSys::TypeInfoT TypeInfo; |
|---|
| 80 | |
|---|
| 81 | |
|---|
| 82 | private: |
|---|
| 83 | |
|---|
| 84 | void UpdateHelpers(); |
|---|
| 85 | |
|---|
| 86 | Vector3fT m_Origin; |
|---|
| 87 | ArrayT<MapHelperT*> m_Helpers; |
|---|
| 88 | }; |
|---|
| 89 | |
|---|
| 90 | #endif |
|---|