| 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 | *      Gion-Andri Cantieni | 
|---|
| 24 | *   Co-authors: | 
|---|
| 25 | *      ... | 
|---|
| 26 | * | 
|---|
| 27 | */ | 
|---|
| 28 |  | 
|---|
| 29 | #include "DesignToolsPrereqs.h" | 
|---|
| 30 |  | 
|---|
| 31 | #include <string> | 
|---|
| 32 | #include "util/Math.h" | 
|---|
| 33 | #include "core/BaseObject.h" | 
|---|
| 34 |  | 
|---|
| 35 | namespace orxonox | 
|---|
| 36 | { | 
|---|
| 37 | class CreateStars : public BaseObject | 
|---|
| 38 | { | 
|---|
| 39 | public: | 
|---|
| 40 | CreateStars(Context* context); | 
|---|
| 41 | virtual ~CreateStars(); | 
|---|
| 42 |  | 
|---|
| 43 | void createBillboards(); | 
|---|
| 44 |  | 
|---|
| 45 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; | 
|---|
| 46 |  | 
|---|
| 47 | void setNumStars(int num) { | 
|---|
| 48 | this->numStars_ = num; | 
|---|
| 49 | } | 
|---|
| 50 |  | 
|---|
| 51 | int getNumStars() const { | 
|---|
| 52 | return this->numStars_; | 
|---|
| 53 | } | 
|---|
| 54 |  | 
|---|
| 55 | void setMaterial(const std::string& material) { | 
|---|
| 56 | this->material_ = material; | 
|---|
| 57 | } | 
|---|
| 58 |  | 
|---|
| 59 | const std::string& getMaterial() const { | 
|---|
| 60 | return this->material_; | 
|---|
| 61 | } | 
|---|
| 62 |  | 
|---|
| 63 | void setColour(const orxonox::ColourValue& colour) { | 
|---|
| 64 | this->colour_ = colour; | 
|---|
| 65 | } | 
|---|
| 66 |  | 
|---|
| 67 | const ColourValue& getColour() const { | 
|---|
| 68 | return this->colour_; | 
|---|
| 69 | } | 
|---|
| 70 |  | 
|---|
| 71 | void setAlpha(float alpha) { | 
|---|
| 72 | this->alpha_ = alpha; | 
|---|
| 73 | } | 
|---|
| 74 |  | 
|---|
| 75 | float getAlpha() const { | 
|---|
| 76 | return this->alpha_; | 
|---|
| 77 | } | 
|---|
| 78 |  | 
|---|
| 79 | void setColourDiff(float colourDiff) { | 
|---|
| 80 | this->colourDiff_ = colourDiff; | 
|---|
| 81 | } | 
|---|
| 82 |  | 
|---|
| 83 | float getColourDiff() const { | 
|---|
| 84 | return this->colourDiff_; | 
|---|
| 85 | } | 
|---|
| 86 |  | 
|---|
| 87 | void setAlphaDiff(float alphaDiff) { | 
|---|
| 88 | this->alphaDiff_ = alphaDiff; | 
|---|
| 89 | } | 
|---|
| 90 |  | 
|---|
| 91 | float getAlphaDiff() const { | 
|---|
| 92 | return this->alphaDiff_; | 
|---|
| 93 | } | 
|---|
| 94 |  | 
|---|
| 95 | void setRadiusDiff(float radiusDiff) { | 
|---|
| 96 | this->radiusDiff_ = radiusDiff; | 
|---|
| 97 | } | 
|---|
| 98 |  | 
|---|
| 99 | float getRadiusDiff() const { | 
|---|
| 100 | return this->radiusDiff_; | 
|---|
| 101 | } | 
|---|
| 102 |  | 
|---|
| 103 | void setRadius(unsigned int dist) { | 
|---|
| 104 | this->radius_ = dist; | 
|---|
| 105 | this->createBillboards(); | 
|---|
| 106 | } | 
|---|
| 107 |  | 
|---|
| 108 | unsigned int getRadius()const { | 
|---|
| 109 | return this->radius_; | 
|---|
| 110 | } | 
|---|
| 111 |  | 
|---|
| 112 | Vector3 PolarToCartesian(float alpha, float beta, float radius); | 
|---|
| 113 |  | 
|---|
| 114 | private: | 
|---|
| 115 | int numStars_; | 
|---|
| 116 | std::string material_; | 
|---|
| 117 | ColourValue colour_; | 
|---|
| 118 | std::vector<Billboard*> billboards_; | 
|---|
| 119 | unsigned int radius_; | 
|---|
| 120 | float alpha_; | 
|---|
| 121 | float colourDiff_; | 
|---|
| 122 | float alphaDiff_; | 
|---|
| 123 | float radiusDiff_; | 
|---|
| 124 |  | 
|---|
| 125 | }; | 
|---|
| 126 | } | 
|---|