summaryrefslogtreecommitdiff
path: root/indra/llmath
diff options
context:
space:
mode:
authorSeth ProductEngine <slitovchuk@productengine.com>2012-02-23 21:02:46 +0200
committerSeth ProductEngine <slitovchuk@productengine.com>2012-02-23 21:02:46 +0200
commita5e4b15b7d29a64781eb32ef71e557a5bb8dc870 (patch)
tree8c25d883a4480b02148289a4bc9d3ecdc1805a64 /indra/llmath
parentc37b3dde541805afe29ce3297ec5416ba3609127 (diff)
Linux build fix.
Moved type casts from protected base classes to derived LLCoord.
Diffstat (limited to 'indra/llmath')
-rw-r--r--indra/llmath/llcoord.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/indra/llmath/llcoord.h b/indra/llmath/llcoord.h
index 756e23dbdf..9b76268afd 100644
--- a/indra/llmath/llcoord.h
+++ b/indra/llmath/llcoord.h
@@ -26,6 +26,15 @@
#ifndef LL_LLCOORD_H
#define LL_LLCOORD_H
+template<typename> class LLCoord;
+struct LL_COORD_TYPE_GL;
+struct LL_COORD_TYPE_WINDOW;
+struct LL_COORD_TYPE_SCREEN;
+
+typedef LLCoord<LL_COORD_TYPE_GL> LLCoordGL;
+typedef LLCoord<LL_COORD_TYPE_WINDOW> LLCoordWindow;
+typedef LLCoord<LL_COORD_TYPE_SCREEN> LLCoordScreen;
+
struct LLCoordCommon
{
LLCoordCommon(S32 x, S32 y) : mX(x), mY(y) {}
@@ -62,6 +71,8 @@ public:
bool operator==(const self_t& other) const { return mX == other.mX && mY == other.mY; }
bool operator!=(const self_t& other) const { return !(*this == other); }
+ static const self_t& getTypedCoords(const COORD_FRAME& self) { return static_cast<const self_t&>(self); }
+ static self_t& getTypedCoords(COORD_FRAME& self) { return static_cast<self_t&>(self); }
};
struct LL_COORD_TYPE_GL
@@ -70,13 +81,13 @@ struct LL_COORD_TYPE_GL
LLCoordCommon convertToCommon() const
{
- const LLCoord<LL_COORD_TYPE_GL>& self = static_cast<const LLCoord<LL_COORD_TYPE_GL>&>(*this);
+ const LLCoordGL& self = LLCoordGL::getTypedCoords(*this);
return LLCoordCommon(self.mX, self.mY);
}
void convertFromCommon(const LLCoordCommon& from)
{
- LLCoord<LL_COORD_TYPE_GL>& self = static_cast<LLCoord<LL_COORD_TYPE_GL>&>(*this);
+ LLCoordGL& self = LLCoordGL::getTypedCoords(*this);
self.mX = from.mX;
self.mY = from.mY;
}
@@ -98,8 +109,4 @@ struct LL_COORD_TYPE_SCREEN
void convertFromCommon(const LLCoordCommon& from);
};
-typedef LLCoord<LL_COORD_TYPE_GL> LLCoordGL;
-typedef LLCoord<LL_COORD_TYPE_WINDOW> LLCoordWindow;
-typedef LLCoord<LL_COORD_TYPE_SCREEN> LLCoordScreen;
-
#endif