| 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 field with lots of parameters. Derived from asteroidField.lua | 
|---|
| 33 |  | 
|---|
| 34 |     Generates a bunch of asteroids that may contain some stuff.  | 
|---|
| 35 |     It is required to wait until all XML-arguments are set. That's why the actual  | 
|---|
| 36 |     generation happens when tick() gets called for the first time.  | 
|---|
| 37 |      | 
|---|
| 38 | */ | 
|---|
| 39 |  | 
|---|
| 40 | #ifndef _SpicedAsteroidField_H__ | 
|---|
| 41 | #define _SpicedAsteroidField_H__ | 
|---|
| 42 |  | 
|---|
| 43 | #include "AsteroidMiningPrereqs.h" | 
|---|
| 44 |  | 
|---|
| 45 | #include "core/BaseObject.h" | 
|---|
| 46 | #include "tools/interfaces/Tickable.h" | 
|---|
| 47 |  | 
|---|
| 48 | namespace orxonox // tolua_export | 
|---|
| 49 | { | 
|---|
| 50 |  | 
|---|
| 51 |     // tolua_export | 
|---|
| 52 |     class _AsteroidMiningExport SpicedAsteroidField : public BaseObject, public Tickable | 
|---|
| 53 |     { // tolua_export | 
|---|
| 54 |  | 
|---|
| 55 |         public: | 
|---|
| 56 |             SpicedAsteroidField(Context* context); | 
|---|
| 57 |             virtual ~SpicedAsteroidField(); | 
|---|
| 58 |  | 
|---|
| 59 |             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); | 
|---|
| 60 |             virtual void tick(float dt) override; | 
|---|
| 61 |  | 
|---|
| 62 |             inline void setCount(int s){this->count = s;} | 
|---|
| 63 |             inline int getCount(){return this->count;} | 
|---|
| 64 |  | 
|---|
| 65 |             inline void setMineralDensity(float d){this->mDensity = d;} | 
|---|
| 66 |             inline float getMineralDensity(){return this->mDensity;} | 
|---|
| 67 |  | 
|---|
| 68 |             inline void setPosition(const Vector3& v){this->position = v;} | 
|---|
| 69 |             inline const Vector3& getPosition(){return this->position;} | 
|---|
| 70 |  | 
|---|
| 71 |             inline void setMaxSize(float i){this->maxSize = i;} | 
|---|
| 72 |             inline float getMaxSize(){return this->maxSize;} | 
|---|
| 73 |  | 
|---|
| 74 |             inline void setMinSize(float i){this->minSize = i;} | 
|---|
| 75 |             inline float getMinSize(){return this->minSize;} | 
|---|
| 76 |  | 
|---|
| 77 |             inline void setRadius(float r){this->radius = r;} | 
|---|
| 78 |             inline float getRadius(){return this->radius;} | 
|---|
| 79 |  | 
|---|
| 80 |             inline void setFog(bool f){this->foggy = f;} | 
|---|
| 81 |             inline bool isFoggy(){return this->foggy;} | 
|---|
| 82 |  | 
|---|
| 83 |             inline void setFogDensity(float fd){this->fogDensity = fd;} | 
|---|
| 84 |             inline float getFogDensity(){return this->fogDensity;} | 
|---|
| 85 |  | 
|---|
| 86 |         protected: | 
|---|
| 87 |  | 
|---|
| 88 |             int count; //!< Number of asteroids generated | 
|---|
| 89 |             float mDensity; //!< Mineral density, between 0 and 1; | 
|---|
| 90 |  | 
|---|
| 91 |             Vector3 position; //!< The center | 
|---|
| 92 |              | 
|---|
| 93 |             float maxSize; //!< Upper bound to asteroid size | 
|---|
| 94 |             float minSize; //!< Lower bound to asteroid size | 
|---|
| 95 |  | 
|---|
| 96 |             float radius; //!< Asteroids can appear within a sphere.  | 
|---|
| 97 |             bool foggy; //!< Whether there's fog | 
|---|
| 98 |             float fogDensity; | 
|---|
| 99 |  | 
|---|
| 100 |  | 
|---|
| 101 |         private: | 
|---|
| 102 |             virtual void create(); | 
|---|
| 103 |  | 
|---|
| 104 |  | 
|---|
| 105 |     }; // tolua_export | 
|---|
| 106 | } // tolua_export | 
|---|
| 107 |  | 
|---|
| 108 | #endif /* _SpicedAsteroidField_H__ */ | 
|---|