diff --git a/ss/LightBounce.cc b/ss/LightBounce.cc index 26e4e6b..c6071d4 100644 --- a/ss/LightBounce.cc +++ b/ss/LightBounce.cc @@ -44,6 +44,14 @@ LightBounceBox::~LightBounceBox() glDeleteLists(m_dl, 1); } +void LightBounceBox::updateDist(float x, float y, float z) +{ + float dx = x - this->x; + float dy = y - this->y; + float dz = z - this->z; + this->dist = (dx*dx) + (dy*dy) + (dz*dz); +} + /* construct screensaver mode and do some basic OpenGL setup */ LightBounce::LightBounce(SSMain * _SSMain) : SSMode(_SSMain) { diff --git a/ss/LightBounce.h b/ss/LightBounce.h index 664dbdf..35dd995 100644 --- a/ss/LightBounce.h +++ b/ss/LightBounce.h @@ -20,7 +20,7 @@ public: float xr, float yr, float zr); ~LightBounceBox(); void draw() { glCallList(m_dl); } - float dist; + void updateDist(float x, float y, float z); private: float x; @@ -29,6 +29,7 @@ private: float xr; float yr; float zr; + float dist; GLuint m_dl; };