[11665] | 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 | * |
---|
| 26 | */ |
---|
| 27 | |
---|
| 28 | /** |
---|
| 29 | |
---|
[11667] | 30 | @file |
---|
| 31 | @author remartin |
---|
[11665] | 32 | @brief Asteroid belt with lots of parameters. Derived from asteroidField.lua |
---|
| 33 | |
---|
[11667] | 34 | Generates a ring of asteroids by calling SpicedAsteroidField multiple times. |
---|
| 35 | It's in the xy-plane at default, orientation can be changed with tiltAt |
---|
| 36 | (angle where it gets elevated/lowered the most) and TiltBy (angle at z-axis). |
---|
| 37 | This doesn't work very well and could probably implemented differently with |
---|
| 38 | relative coordinates (attach etc, stuff in WorldEntity). |
---|
[11665] | 39 | |
---|
[11667] | 40 | It is required to wait until all XML-arguments are set. That's why the actual |
---|
| 41 | generation happens when tick() gets called for the first time. |
---|
| 42 | |
---|
[11665] | 43 | */ |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | #ifndef _SpicedAsteroidBelt_H__ |
---|
| 47 | #define _SpicedAsteroidBelt_H__ |
---|
| 48 | |
---|
[11731] | 49 | #include "AsteroidMiningPrereqs.h" |
---|
[11665] | 50 | |
---|
| 51 | #include <string> |
---|
| 52 | #include <vector> |
---|
| 53 | #include "worldentities/ControllableEntity.h" |
---|
| 54 | |
---|
| 55 | #include "../../orxonox/worldentities/pawns/Pawn.h" |
---|
| 56 | |
---|
| 57 | namespace orxonox // tolua_export |
---|
| 58 | { |
---|
| 59 | |
---|
| 60 | // tolua_export |
---|
[11731] | 61 | class _AsteroidMiningExport SpicedAsteroidBelt : public Pawn // need pawn to get tick for clean argument passing |
---|
[11665] | 62 | { // tolua_export |
---|
| 63 | |
---|
| 64 | public: |
---|
| 65 | SpicedAsteroidBelt(Context* context);// This constructor is for XML access only! |
---|
| 66 | |
---|
| 67 | virtual ~SpicedAsteroidBelt(); |
---|
| 68 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
| 69 | virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override; |
---|
| 70 | virtual void tick(float dt) override; |
---|
| 71 | |
---|
| 72 | |
---|
| 73 | inline void setCount(float s){this->count = s;} |
---|
| 74 | inline float getCount(){return this->count;} |
---|
| 75 | |
---|
| 76 | inline void setMineralDensity(float d){this->mDensity = d;} |
---|
| 77 | inline float getMineralDensity(){return this->mDensity;} |
---|
| 78 | |
---|
| 79 | inline void setPosition(Vector3 v){this->position = v;} |
---|
| 80 | inline Vector3 getPosition(){return this->position;} |
---|
| 81 | |
---|
| 82 | inline void setSegments(int s){this->segments = s;} |
---|
| 83 | inline int getSegments(){return this->segments;} |
---|
| 84 | |
---|
| 85 | inline void setMaxSize(int i){this->maxSize = i;} |
---|
| 86 | inline int getMaxSize(){return this->maxSize;} |
---|
| 87 | |
---|
| 88 | inline void setMinSize(int i){this->minSize = i;} |
---|
| 89 | inline int getMinSize(){return this->minSize;} |
---|
| 90 | |
---|
| 91 | inline void setRadius0(float r0){this->radius0 = r0;} |
---|
| 92 | inline int getRadius0(){return this->radius0;} |
---|
| 93 | |
---|
| 94 | inline void setRadius1(float r1){this->radius1 = r1;} |
---|
| 95 | inline int getRadius1(){return this->radius1;} |
---|
| 96 | |
---|
| 97 | inline void setFog(bool f){this->foggy = f;} |
---|
| 98 | inline bool isFoggy(){return this->foggy;} |
---|
| 99 | |
---|
| 100 | inline void setFogDensity(float fd){this->fogDensity = fd;} |
---|
| 101 | inline float getFogDensity(){return this->fogDensity;} |
---|
| 102 | |
---|
[11667] | 103 | inline void setTiltAt(float ta){this->tiltAt = ta;} |
---|
| 104 | inline void setTiltBy(float tb){this->tiltBy = tb;} |
---|
| 105 | inline float getTiltAt(){return this->tiltAt;} |
---|
| 106 | inline float getTiltBy(){return this->tiltBy;} |
---|
[11665] | 107 | |
---|
[11667] | 108 | |
---|
[11665] | 109 | protected: |
---|
| 110 | |
---|
| 111 | Context* context; |
---|
| 112 | |
---|
[11667] | 113 | float count; //!< Approximate number of asteroids |
---|
| 114 | float mDensity; //!< Approximate commonness of asteroids that yield stuff, value between 0 and 1; |
---|
[11665] | 115 | |
---|
| 116 | Vector3 position; |
---|
| 117 | |
---|
[11667] | 118 | int segments; //!< Number of asteroidFields that get generated. |
---|
[11665] | 119 | |
---|
[11667] | 120 | int maxSize; //!< Most obese asteroid possible |
---|
| 121 | int minSize; //!< Most meagre asteroid possible |
---|
[11665] | 122 | |
---|
[11667] | 123 | float radius0; //!< Inner radius |
---|
| 124 | float radius1; //!< Outer radius |
---|
[11665] | 125 | |
---|
[11667] | 126 | bool foggy; //!< Whether there's fog arount the asteroids |
---|
[11665] | 127 | float fogDensity; |
---|
| 128 | |
---|
[11667] | 129 | float tiltAt; //!< Orientation: Angle where it gets elevated/lowered the most |
---|
| 130 | float tiltBy; //!< angle at z-axis |
---|
[11665] | 131 | |
---|
| 132 | private: |
---|
| 133 | void registerVariables(); |
---|
[11667] | 134 | |
---|
| 135 | virtual void create(); |
---|
[11665] | 136 | |
---|
| 137 | }; // tolua_export |
---|
| 138 | } // tolua_export |
---|
| 139 | |
---|
| 140 | #endif /* _SpicedAsteroidBelt_H__ */ |
---|