| 1 | /* * ORXONOX - the hottest 3D action shooter ever to exist * > www.orxonox.net < * * * License notice: * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * |
|---|
| 2 | * Author: |
|---|
| 3 | * Yuning Chai |
|---|
| 4 | * Co-authors: |
|---|
| 5 | * Felix Schulthess |
|---|
| 6 | * |
|---|
| 7 | */ |
|---|
| 8 | |
|---|
| 9 | #ifndef _RadarOverlayElement_H__ |
|---|
| 10 | #define _RadarOverlayElement_H__ |
|---|
| 11 | |
|---|
| 12 | #include "OrxonoxPrereqs.h" |
|---|
| 13 | |
|---|
| 14 | #include <OgrePrerequisites.h> |
|---|
| 15 | #include <OgrePanelOverlayElement.h> |
|---|
| 16 | #include "util/Math.h" |
|---|
| 17 | |
|---|
| 18 | namespace orxonox |
|---|
| 19 | { |
|---|
| 20 | class _OrxonoxExport RadarOverlayElement : public Ogre::PanelOverlayElement |
|---|
| 21 | { |
|---|
| 22 | private: |
|---|
| 23 | Ogre::OverlayManager* om; // our one and only overlay manager |
|---|
| 24 | Ogre::OverlayContainer* container_; // pointer to the container we're in |
|---|
| 25 | Vector3 currentDir_; |
|---|
| 26 | Vector3 currentOrth_; |
|---|
| 27 | Vector3 shipPos_; // position of ship |
|---|
| 28 | |
|---|
| 29 | Ogre::Real leftRel_, topRel_, dimRel_; // relative position/dimension |
|---|
| 30 | int left_, top_, dim_; // absolute position/dimension |
|---|
| 31 | int windowW_, windowH_; // absolute window dimensions |
|---|
| 32 | |
|---|
| 33 | public: |
|---|
| 34 | RadarOverlayElement(const Ogre::String& name); |
|---|
| 35 | ~RadarOverlayElement(); |
|---|
| 36 | void init(Real leftRel, Real topRel, Real dimRel, Ogre::OverlayContainer* container); |
|---|
| 37 | void resize(); |
|---|
| 38 | void update(); |
|---|
| 39 | void listObjects(); |
|---|
| 40 | |
|---|
| 41 | static float calcRadius(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj); |
|---|
| 42 | static float calcPhi(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj); |
|---|
| 43 | static bool calcRight(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj); |
|---|
| 44 | }; |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | #endif /* _RadarOverlayElement_H__ */ |
|---|