Renamed pss to PowerScaledScalar

This commit is contained in:
Alexander Bock
2014-05-11 18:34:57 +02:00
parent 37e5e63b70
commit 3520bd121e
21 changed files with 165 additions and 240 deletions

View File

@@ -18,7 +18,7 @@ public:
void rotate(const glm::quat &rotation);
void orbit(const glm::quat &rotation);
void distance(const pss &distance);
void distance(const PowerScaledScalar &distance);
protected:

View File

@@ -43,7 +43,7 @@ public:
void orbit(const glm::quat &rotation);
void rotate(const glm::quat &rotation);
void distance(const pss &distance);
void distance(const PowerScaledScalar &distance);
void lookAt(const glm::quat &rotation);
void setRotation(const glm::quat &rotation);

View File

@@ -45,8 +45,8 @@ public:
virtual bool initialize() = 0;
virtual bool deinitialize() = 0;
void setBoundingSphere(const pss& boundingSphere);
const pss& getBoundingSphere();
void setBoundingSphere(const PowerScaledScalar& boundingSphere);
const PowerScaledScalar& getBoundingSphere();
virtual void render(const Camera* camera, const psc& thisPosition) = 0;
virtual void update();
@@ -54,7 +54,7 @@ public:
protected:
// Renderable();
private:
pss boundingSphere_;
PowerScaledScalar boundingSphere_;
};
} // namespace openspace

View File

@@ -69,7 +69,7 @@ public:
const std::vector<SceneGraphNode*>& children() const;
// bounding sphere
pss calculateBoundingSphere();
PowerScaledScalar calculateBoundingSphere();
SceneGraphNode* get(const std::string& name);
@@ -92,10 +92,10 @@ private:
// bounding sphere
bool _boundingSphereVisible;
pss _boundingSphere;
PowerScaledScalar _boundingSphere;
// private helper methods
bool sphereInsideFrustum(const psc s_pos, const pss& s_rad, const Camera* camera);
bool sphereInsideFrustum(const psc s_pos, const PowerScaledScalar& s_rad, const Camera* camera);
};
} // namespace openspace

View File

@@ -32,7 +32,7 @@ class Planet
{
public:
//initializers
Planet(pss radius, int levels = 4);
Planet(PowerScaledScalar radius, int levels = 4);
~Planet();
void setHeightMap(const std::string &path);

View File

@@ -36,7 +36,7 @@ namespace openspace
{
// forward declare the power scaled scalars
class pss;
class PowerScaledScalar;
class PowerScaledCoordinate {
public:
@@ -60,7 +60,7 @@ public:
// returns the rescaled, "normal" coordinates
glm::vec3 vec3() const;
// length of the vector as a pss
pss length() const;
PowerScaledScalar length() const;
glm::vec3 direction() const;
// operator overloading
@@ -78,8 +78,8 @@ public:
// scalar operators
PowerScaledCoordinate operator*(const double& rhs) const;
PowerScaledCoordinate operator*(const float& rhs) const;
PowerScaledCoordinate& operator*=(const pss& rhs);
PowerScaledCoordinate operator*(const pss& rhs) const;
PowerScaledCoordinate& operator*=(const PowerScaledScalar& rhs);
PowerScaledCoordinate operator*(const PowerScaledScalar& rhs) const;
PowerScaledCoordinate operator*(const glm::mat4& matrix) const;
@@ -100,7 +100,7 @@ public:
friend std::ostream& operator<<(std::ostream& os, const PowerScaledCoordinate& rhs);
// allow the power scaled scalars to access private members
friend class pss;
friend class PowerScaledScalar;
private:
// internal glm vector

View File

@@ -34,76 +34,59 @@
namespace openspace {
class pss {
class PowerScaledScalar {
public:
// constructors
pss();
pss(const glm::vec2 &v);
pss(const glm::dvec2 &v);
pss(const float &f1,const float &f2);
pss(const double &d1,const double &d2);
static pss CreatePSS(double d1);
PowerScaledScalar();
PowerScaledScalar(const glm::vec2 &v);
PowerScaledScalar(float f1, float f2);
static PowerScaledScalar CreatePSS(double d1);
// print n' debug
void print() const;
void print(const char *name) const;
// get functions
const double * value_ptr();
const float * value_ptrf();
glm::dvec2 getVec2() const;
glm::vec2 getVec2f() const;
double length() const;
const glm::vec2& vec2() const;
float lengthf() const;
// operator overloading
pss & operator=(const pss &rhs);
pss & operator+=(const pss &rhs);
const pss operator+(const pss &rhs) const;
pss & operator-=(const pss &rhs);
const pss operator-(const pss &rhs) const;
pss & operator*=(const pss &rhs);
const pss operator*(const pss &rhs) const;
pss & operator*=(const double &rhs);
const pss operator*(const double &rhs) const;
pss & operator*=(const float &rhs);
const pss operator*(const float &rhs) const;
double& operator[](unsigned int idx);
const double& operator[](unsigned int idx) const;
PowerScaledScalar& operator=(const PowerScaledScalar& rhs);
PowerScaledScalar& operator+=(const PowerScaledScalar& rhs);
const PowerScaledScalar operator+(const PowerScaledScalar& rhs) const;
PowerScaledScalar& operator-=(const PowerScaledScalar& rhs);
const PowerScaledScalar operator-(const PowerScaledScalar& rhs) const;
PowerScaledScalar& operator*=(const PowerScaledScalar& rhs);
const PowerScaledScalar operator*(const PowerScaledScalar& rhs) const;
PowerScaledScalar& operator*=(const float& rhs);
const PowerScaledScalar operator*(const float& rhs) const;
float& operator[](unsigned int idx);
float operator[](unsigned int idx) const;
// comparasion
bool operator==(const pss &other) const;
bool operator<(const pss &other) const;
bool operator>(const pss &other) const;
bool operator<=(const pss &other) const;
bool operator>=(const pss &other) const;
// comparison
bool operator==(const PowerScaledScalar& other) const;
bool operator<(const PowerScaledScalar& other) const;
bool operator>(const PowerScaledScalar& other) const;
bool operator<=(const PowerScaledScalar& other) const;
bool operator>=(const PowerScaledScalar& other) const;
bool operator==(const double &other) const;
bool operator<(const double &other) const;
bool operator>(const double &other) const;
bool operator<=(const double &other) const;
bool operator>=(const double &other) const;
bool operator==(double other) const;
bool operator<(double other) const;
bool operator>(double other) const;
bool operator<=(double other) const;
bool operator>=(double other) const;
// glm integration
pss & operator=(const glm::vec2 &rhs);
pss & operator=(const float &rhs);
pss & operator=(const glm::dvec2 &rhs);
pss & operator=(const double &rhs);
PowerScaledScalar& operator=(const glm::vec2& rhs);
PowerScaledScalar& operator=(float rhs);
friend std::ostream& operator<<(::std::ostream& os, const pss& rhs);
friend std::ostream& operator<<(std::ostream& os, const PowerScaledScalar& rhs);
// allow the power scaled coordinates to acces private members
// allow the power scaled coordinates to access private members
friend class PowerScaledCoordinate;
private:
// internal glm vector
glm::dvec2 vec_;
// float vector used when returning float values
mutable glm::vec2 vecf_;
glm::vec2 _data;
};
typedef PowerScaledScalar pss;
} // namespace openspace

View File

@@ -36,7 +36,7 @@ namespace openspace {
class PowerScaledSphere {
public:
// initializers
PowerScaledSphere(const pss& radius, int segments = 8);
PowerScaledSphere(const PowerScaledScalar& radius, int segments = 8);
~PowerScaledSphere();
bool initialize();