[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: |
---|
[11741] | 23 | * remartin |
---|
[11665] | 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 | |
---|
[11736] | 51 | #include "core/BaseObject.h" |
---|
| 52 | #include "tools/interfaces/Tickable.h" |
---|
[11665] | 53 | |
---|
| 54 | namespace orxonox // tolua_export |
---|
| 55 | { |
---|
| 56 | |
---|
| 57 | // tolua_export |
---|
[11736] | 58 | class _AsteroidMiningExport SpicedAsteroidBelt : public BaseObject, public Tickable |
---|
[11665] | 59 | { // tolua_export |
---|
| 60 | |
---|
| 61 | public: |
---|
| 62 | SpicedAsteroidBelt(Context* context);// This constructor is for XML access only! |
---|
[11736] | 63 | virtual ~SpicedAsteroidBelt(); |
---|
[11665] | 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 | |
---|
[11739] | 74 | inline void setPosition(const Vector3& v){this->position = v;} |
---|
| 75 | inline const Vector3& getPosition(){return this->position;} |
---|
[11665] | 76 | |
---|
| 77 | inline void setSegments(int s){this->segments = s;} |
---|
| 78 | inline int getSegments(){return this->segments;} |
---|
| 79 | |
---|
[11739] | 80 | inline void setMaxSize(float i){this->maxSize = i;} |
---|
| 81 | inline float getMaxSize(){return this->maxSize;} |
---|
[11665] | 82 | |
---|
[11739] | 83 | inline void setMinSize(float i){this->minSize = i;} |
---|
| 84 | inline float getMinSize(){return this->minSize;} |
---|
[11665] | 85 | |
---|
| 86 | inline void setRadius0(float r0){this->radius0 = r0;} |
---|
[11739] | 87 | inline float getRadius0(){return this->radius0;} |
---|
[11665] | 88 | |
---|
| 89 | inline void setRadius1(float r1){this->radius1 = r1;} |
---|
[11739] | 90 | inline float getRadius1(){return this->radius1;} |
---|
[11665] | 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 | |
---|
[11667] | 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;} |
---|
[11665] | 102 | |
---|
[11667] | 103 | |
---|
[11665] | 104 | protected: |
---|
| 105 | |
---|
[11667] | 106 | float count; //!< Approximate number of asteroids |
---|
| 107 | float mDensity; //!< Approximate commonness of asteroids that yield stuff, value between 0 and 1; |
---|
[11665] | 108 | |
---|
| 109 | Vector3 position; |
---|
| 110 | |
---|
[11667] | 111 | int segments; //!< Number of asteroidFields that get generated. |
---|
[11665] | 112 | |
---|
[11739] | 113 | float maxSize; //!< Most obese asteroid possible |
---|
| 114 | float minSize; //!< Most meagre asteroid possible |
---|
[11665] | 115 | |
---|
[11667] | 116 | float radius0; //!< Inner radius |
---|
| 117 | float radius1; //!< Outer radius |
---|
[11665] | 118 | |
---|
[11667] | 119 | bool foggy; //!< Whether there's fog arount the asteroids |
---|
[11665] | 120 | float fogDensity; |
---|
| 121 | |
---|
[11667] | 122 | float tiltAt; //!< Orientation: Angle where it gets elevated/lowered the most |
---|
| 123 | float tiltBy; //!< angle at z-axis |
---|
[11665] | 124 | |
---|
| 125 | private: |
---|
[11667] | 126 | virtual void create(); |
---|
[11665] | 127 | |
---|
| 128 | }; // tolua_export |
---|
| 129 | } // tolua_export |
---|
| 130 | |
---|
| 131 | #endif /* _SpicedAsteroidBelt_H__ */ |
---|