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 | |
---|
47 | static SpaceShip *getLocalShip(); |
---|
48 | |
---|
49 | SpaceShip(); |
---|
50 | ~SpaceShip(); |
---|
51 | bool create(); |
---|
52 | void registerAllVariables(); |
---|
53 | void init(); |
---|
54 | void setConfigValues(); |
---|
55 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
56 | virtual void tick(float dt); |
---|
57 | |
---|
58 | void setCamera(const std::string& camera = ""); |
---|
59 | void setMaxSpeed(float value); |
---|
60 | void setMaxSideAndBackSpeed(float value); |
---|
61 | void setMaxRotation(float value); |
---|
62 | void setTransAcc(float value); |
---|
63 | void setRotAcc(float value); |
---|
64 | void setTransDamp(float value); |
---|
65 | void setRotDamp(float value); |
---|
66 | void getFocus(); |
---|
67 | |
---|
68 | static SpaceShip* instance_s; |
---|
69 | static std::string whereAmI(); |
---|
70 | static void setMaxSpeedTest(float value) |
---|
71 | { SpaceShip::instance_s->setMaxSpeed(value); } |
---|
72 | |
---|
73 | void mouseButtonPressed (MouseButton::Enum id); |
---|
74 | void mouseButtonReleased(MouseButton::Enum id); |
---|
75 | void mouseButtonHeld (MouseButton::Enum id) { } |
---|
76 | void mouseMoved (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize); |
---|
77 | void mouseScrolled (int abs, int rel) { } |
---|
78 | |
---|
79 | float getMaxSpeed(); |
---|
80 | Vector3 getDir(); |
---|
81 | Vector3 getOrth(); |
---|
82 | Camera* getCamera(); |
---|
83 | |
---|
84 | private: |
---|
85 | void createCamera(); |
---|
86 | |
---|
87 | Vector3 testvector_; |
---|
88 | Vector3 initialDir_; |
---|
89 | Vector3 currentDir_; |
---|
90 | Vector3 initialOrth_; |
---|
91 | Vector3 currentOrth_; |
---|
92 | bool bInvertYAxis_; |
---|
93 | bool setMouseEventCallback_; |
---|
94 | bool bLMousePressed_; |
---|
95 | bool bRMousePressed_; |
---|
96 | |
---|
97 | Ogre::SceneNode* camNode_; |
---|
98 | Camera* cam_; |
---|
99 | std::string camName_; |
---|
100 | |
---|
101 | |
---|
102 | ParticleInterface* tt_; |
---|
103 | |
---|
104 | BillboardSet redBillboard_; |
---|
105 | BillboardSet greenBillboard_; |
---|
106 | Ogre::SceneNode* redNode_; |
---|
107 | Ogre::SceneNode* greenNode_; |
---|
108 | float blinkTime_; |
---|
109 | |
---|
110 | BillboardSet crosshairNear_; |
---|
111 | BillboardSet crosshairFar_; |
---|
112 | Ogre::SceneNode* chNearNode_; |
---|
113 | Ogre::SceneNode* chFarNode_; |
---|
114 | |
---|
115 | float timeToReload_; |
---|
116 | float reloadTime_; |
---|
117 | |
---|
118 | float maxSideAndBackSpeed_; |
---|
119 | float maxSpeed_; |
---|
120 | float maxRotation_; |
---|
121 | float translationAcceleration_; |
---|
122 | float rotationAcceleration_; |
---|
123 | float translationDamping_; |
---|
124 | float rotationDamping_; |
---|
125 | |
---|
126 | Radian maxRotationRadian_; |
---|
127 | Radian rotationAccelerationRadian_; |
---|
128 | Radian rotationDampingRadian_; |
---|
129 | Radian zeroRadian_; |
---|
130 | Radian mouseXRotation_; |
---|
131 | Radian mouseYRotation_; |
---|
132 | |
---|
133 | float mouseX_; |
---|
134 | float mouseY_; |
---|
135 | |
---|
136 | float emitterRate_; |
---|
137 | bool server_; |
---|
138 | }; |
---|
139 | } |
---|
140 | |
---|
141 | #endif /* _SpaceShip_H__ */ |
---|