11#include " Asteroid.h"
22#include " Constants.h"
33
4- glm::vec4 Asteroid::circlePoint = { 1 .0f , 0 .0f , 0 .f , 1 .f };
5- glm::vec4 Asteroid::circleCenter = { 0 .f , 0 .0f , 0 .f , 1 .f };
4+ glm::vec4 Asteroid::circlePoint = { 1 .0f , 0 .0f , 0 .0f , 1 .0f };
5+ glm::vec4 Asteroid::circleCenter = { 0 .0f , 0 .0f , 0 .0f , 1 .0f };
66
77Asteroid::Asteroid (float radius = 40 .0f , int nrOfVertices = 16 , glm::vec4 coordinates = glm::vec4(0 .0f ,0 .0f , 0 .0f , 0 .0f ),
88 glm::vec4 colors = glm::vec4(0 .0f , 0 .0f ,0 .0f ,0 .0f )) :
@@ -11,7 +11,9 @@ Asteroid::Asteroid(float radius = 40.0f, int nrOfVertices = 16, glm::vec4 coordi
1111 coordinates(coordinates),
1212 colors(colors),
1313 translatedDistance(0 ),
14- currentZone(Constants::SAFE) {
14+ currentZone(Constants::SAFE),
15+ asteroidMatrix(glm::mat4(1 .0f ))
16+ {
1517 textureIndex = rand () % Constants::nrOfTextures;
1618};
1719
@@ -27,7 +29,7 @@ bool Asteroid::inLowerHalf() {
2729 return !this ->belowViewport () && this ->isInViewport () && this ->getRealY () < Constants::height;
2830}
2931
30- string Asteroid::getCurrentZone () {
32+ string Asteroid::getCurrentZone () const {
3133 return this ->currentZone ;
3234}
3335
@@ -41,11 +43,11 @@ void Asteroid::updateState() {
4143 }
4244}
4345
44- float Asteroid::getX () {
46+ float Asteroid::getX () const {
4547 return this ->coordinates .x ;
4648}
4749
48- float Asteroid::getRealY () {
50+ float Asteroid::getRealY () const {
4951 return this ->coordinates .y - this ->translatedDistance ;
5052}
5153
@@ -56,10 +58,19 @@ void Asteroid::setX(float newXOffset) {
5658void Asteroid::setY (float newYOffset) {
5759 this ->coordinates .y = newYOffset;
5860}
59- int Asteroid::getTextureIndex () {
61+
62+ int Asteroid::getTextureIndex () const {
6063 return this ->textureIndex ;
6164}
62- float Asteroid::getTranslatedDistance () { return this ->translatedDistance ; }
65+
66+ void Asteroid::setAsteroidMatrix (glm::mat4 matrix) { asteroidMatrix = matrix; }
67+
68+ glm::mat4 Asteroid::getAsteroidMatrix () const { return asteroidMatrix; }
69+
70+ float Asteroid::getTranslatedDistance () const { return this ->translatedDistance ; }
71+
6372void Asteroid::setTranslatedDistance (float distance) { this ->translatedDistance = distance; }
64- float Asteroid::getRadius () { return this ->radius ; }
65- float Asteroid::getY () { return this ->coordinates .y ; }
73+
74+ float Asteroid::getRadius () const { return this ->radius ; }
75+
76+ float Asteroid::getY () const { return this ->coordinates .y ; }
0 commit comments