| 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 | *      remartin | 
|---|
| 24 | *   Co-authors: | 
|---|
| 25 | * | 
|---|
| 26 | */ | 
|---|
| 27 |  | 
|---|
| 28 | /** | 
|---|
| 29 |  | 
|---|
| 30 | @file | 
|---|
| 31 | @author remartin | 
|---|
| 32 | @brief Asteroid belt with lots of parameters. Derived from asteroidField.lua | 
|---|
| 33 |  | 
|---|
| 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). | 
|---|
| 39 |  | 
|---|
| 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 |  | 
|---|
| 43 | */ | 
|---|
| 44 |  | 
|---|
| 45 |  | 
|---|
| 46 | #ifndef _SpicedAsteroidBelt_H__ | 
|---|
| 47 | #define _SpicedAsteroidBelt_H__ | 
|---|
| 48 |  | 
|---|
| 49 | #include "AsteroidMiningPrereqs.h" | 
|---|
| 50 |  | 
|---|
| 51 | #include "core/BaseObject.h" | 
|---|
| 52 | #include "tools/interfaces/Tickable.h" | 
|---|
| 53 |  | 
|---|
| 54 | namespace orxonox // tolua_export | 
|---|
| 55 | { | 
|---|
| 56 |  | 
|---|
| 57 | // tolua_export | 
|---|
| 58 | class _AsteroidMiningExport SpicedAsteroidBelt : public BaseObject, public Tickable | 
|---|
| 59 | { // tolua_export | 
|---|
| 60 |  | 
|---|
| 61 | public: | 
|---|
| 62 | SpicedAsteroidBelt(Context* context);// This constructor is for XML access only! | 
|---|
| 63 | virtual ~SpicedAsteroidBelt(); | 
|---|
| 64 |  | 
|---|
| 65 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); | 
|---|
| 66 | virtual void tick(float dt) override; | 
|---|
| 67 |  | 
|---|
| 68 | inline void setCount(float s){this->count = s;} | 
|---|
| 69 | inline float getCount(){return this->count;} | 
|---|
| 70 |  | 
|---|
| 71 | inline void setMineralDensity(float d){this->mDensity = d;} | 
|---|
| 72 | inline float getMineralDensity(){return this->mDensity;} | 
|---|
| 73 |  | 
|---|
| 74 | inline void setPosition(const Vector3& v){this->position = v;} | 
|---|
| 75 | inline const Vector3& getPosition(){return this->position;} | 
|---|
| 76 |  | 
|---|
| 77 | inline void setSegments(int s){this->segments = s;} | 
|---|
| 78 | inline int getSegments(){return this->segments;} | 
|---|
| 79 |  | 
|---|
| 80 | inline void setMaxSize(float i){this->maxSize = i;} | 
|---|
| 81 | inline float getMaxSize(){return this->maxSize;} | 
|---|
| 82 |  | 
|---|
| 83 | inline void setMinSize(float i){this->minSize = i;} | 
|---|
| 84 | inline float getMinSize(){return this->minSize;} | 
|---|
| 85 |  | 
|---|
| 86 | inline void setRadius0(float r0){this->radius0 = r0;} | 
|---|
| 87 | inline float getRadius0(){return this->radius0;} | 
|---|
| 88 |  | 
|---|
| 89 | inline void setRadius1(float r1){this->radius1 = r1;} | 
|---|
| 90 | inline float getRadius1(){return this->radius1;} | 
|---|
| 91 |  | 
|---|
| 92 | inline void setFog(bool f){this->foggy = f;} | 
|---|
| 93 | inline bool isFoggy(){return this->foggy;} | 
|---|
| 94 |  | 
|---|
| 95 | inline void setFogDensity(float fd){this->fogDensity = fd;} | 
|---|
| 96 | inline float getFogDensity(){return this->fogDensity;} | 
|---|
| 97 |  | 
|---|
| 98 | inline void setTiltAt(float ta){this->tiltAt = ta;} | 
|---|
| 99 | inline void setTiltBy(float tb){this->tiltBy = tb;} | 
|---|
| 100 | inline float getTiltAt(){return this->tiltAt;} | 
|---|
| 101 | inline float getTiltBy(){return this->tiltBy;} | 
|---|
| 102 |  | 
|---|
| 103 |  | 
|---|
| 104 | protected: | 
|---|
| 105 |  | 
|---|
| 106 | float count; //!< Approximate number of asteroids | 
|---|
| 107 | float mDensity; //!< Approximate commonness of asteroids that yield stuff, value between 0 and 1; | 
|---|
| 108 |  | 
|---|
| 109 | Vector3 position; | 
|---|
| 110 |  | 
|---|
| 111 | int segments; //!< Number of asteroidFields that get generated. | 
|---|
| 112 |  | 
|---|
| 113 | float maxSize; //!< Most obese asteroid possible | 
|---|
| 114 | float minSize; //!< Most meagre asteroid possible | 
|---|
| 115 |  | 
|---|
| 116 | float radius0; //!< Inner radius | 
|---|
| 117 | float radius1; //!< Outer radius | 
|---|
| 118 |  | 
|---|
| 119 | bool foggy; //!< Whether there's fog arount the asteroids | 
|---|
| 120 | float fogDensity; | 
|---|
| 121 |  | 
|---|
| 122 | float tiltAt; //!< Orientation: Angle where it gets elevated/lowered the most | 
|---|
| 123 | float tiltBy; //!< angle at z-axis | 
|---|
| 124 |  | 
|---|
| 125 | private: | 
|---|
| 126 | virtual void create(); | 
|---|
| 127 |  | 
|---|
| 128 | }; // tolua_export | 
|---|
| 129 | } // tolua_export | 
|---|
| 130 |  | 
|---|
| 131 | #endif /* _SpicedAsteroidBelt_H__ */ | 
|---|