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