1 | /* |
---|
2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
3 | * > www.orxonox.net < |
---|
4 | * |
---|
5 | * |
---|
6 | * License notice: |
---|
7 | * |
---|
8 | * This program is free software; you can redistribute it and/or |
---|
9 | * modify it under the terms of the GNU General Public License |
---|
10 | * as published by the Free Software Foundation; either version 2 |
---|
11 | * of the License, or (at your option) any later version. |
---|
12 | * |
---|
13 | * This program is distributed in the hope that it will be useful, |
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | * GNU General Public License for more details. |
---|
17 | * |
---|
18 | * You should have received a copy of the GNU General Public License |
---|
19 | * along with this program; if not, write to the Free Software |
---|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
21 | * |
---|
22 | * Author: |
---|
23 | * Fabian 'x3n' Landau |
---|
24 | * Co-authors: |
---|
25 | * Benjamin Knecht |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | #ifndef _SpaceShip_H__ |
---|
30 | #define _SpaceShip_H__ |
---|
31 | #include <string> |
---|
32 | #include "OrxonoxPrereqs.h" |
---|
33 | #include <OgrePrerequisites.h> |
---|
34 | |
---|
35 | #include "util/Math.h" |
---|
36 | #include "core/InputInterfaces.h" |
---|
37 | #include "Camera.h" |
---|
38 | #include "Model.h" |
---|
39 | #include "../tools/BillboardSet.h" |
---|
40 | |
---|
41 | namespace orxonox |
---|
42 | { |
---|
43 | class _OrxonoxExport SpaceShip : public Model, public MouseHandler |
---|
44 | { |
---|
45 | public: |
---|
46 | SpaceShip(); |
---|
47 | ~SpaceShip(); |
---|
48 | bool create(); |
---|
49 | void registerAllVariables(); |
---|
50 | void init(); |
---|
51 | void setConfigValues(); |
---|
52 | virtual void loadParams(TiXmlElement* xmlElem); |
---|
53 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
54 | virtual void tick(float dt); |
---|
55 | |
---|
56 | void setCamera(const std::string& camera = ""); |
---|
57 | void setMaxSpeed(float value); |
---|
58 | void setMaxSideAndBackSpeed(float value); |
---|
59 | void setMaxRotation(float value); |
---|
60 | void setTransAcc(float value); |
---|
61 | void setRotAcc(float value); |
---|
62 | void setTransDamp(float value); |
---|
63 | void setRotDamp(float value); |
---|
64 | |
---|
65 | void getFocus(); |
---|
66 | static SpaceShip* instance_s; |
---|
67 | static Vector3 getSPosition(); |
---|
68 | static Quaternion getSOrientation(); |
---|
69 | static std::string whereAmI(); |
---|
70 | static void setMaxSpeedTest(float value) |
---|
71 | { SpaceShip::instance_s->setMaxSpeed(value); } |
---|
72 | |
---|
73 | bool mouseButtonPressed (const MouseState& state, MouseButton::Enum id); |
---|
74 | bool mouseButtonReleased(const MouseState& state, MouseButton::Enum id); |
---|
75 | bool mouseButtonHeld (const MouseState& state, MouseButton::Enum id) { return true; } |
---|
76 | bool mouseMoved (const MouseState& state); |
---|
77 | bool mouseScrolled (const MouseState& state) { return true; } |
---|
78 | |
---|
79 | float getMaxSpeed(); |
---|
80 | |
---|
81 | private: |
---|
82 | void createCamera(); |
---|
83 | |
---|
84 | Vector3 testvector_; |
---|
85 | bool bInvertYAxis_; |
---|
86 | bool setMouseEventCallback_; |
---|
87 | bool bLMousePressed_; |
---|
88 | bool bRMousePressed_; |
---|
89 | |
---|
90 | Ogre::SceneNode* camNode_; |
---|
91 | Camera* cam_; |
---|
92 | std::string camName_; |
---|
93 | |
---|
94 | |
---|
95 | ParticleInterface* tt_; |
---|
96 | |
---|
97 | BillboardSet redBillboard_; |
---|
98 | BillboardSet greenBillboard_; |
---|
99 | Ogre::SceneNode* redNode_; |
---|
100 | Ogre::SceneNode* greenNode_; |
---|
101 | float blinkTime_; |
---|
102 | |
---|
103 | BillboardSet crosshairNear_; |
---|
104 | BillboardSet crosshairFar_; |
---|
105 | Ogre::SceneNode* chNearNode_; |
---|
106 | Ogre::SceneNode* chFarNode_; |
---|
107 | |
---|
108 | float timeToReload_; |
---|
109 | float reloadTime_; |
---|
110 | |
---|
111 | float maxSideAndBackSpeed_; |
---|
112 | float maxSpeed_; |
---|
113 | float maxRotation_; |
---|
114 | float translationAcceleration_; |
---|
115 | float rotationAcceleration_; |
---|
116 | float translationDamping_; |
---|
117 | float rotationDamping_; |
---|
118 | |
---|
119 | Radian maxRotationRadian_; |
---|
120 | Radian rotationAccelerationRadian_; |
---|
121 | Radian rotationDampingRadian_; |
---|
122 | Radian zeroRadian_; |
---|
123 | Radian mouseXRotation_; |
---|
124 | Radian mouseYRotation_; |
---|
125 | |
---|
126 | float mouseX_; |
---|
127 | float mouseY_; |
---|
128 | |
---|
129 | float emitterRate_; |
---|
130 | bool server_; |
---|
131 | }; |
---|
132 | } |
---|
133 | |
---|
134 | #endif /* _SpaceShip_H__ */ |
---|