Added cast to double operator
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
diff --git a/include/FTPoint.h b/include/FTPoint.h
index bb1772c..d2d677c 100755
--- a/include/FTPoint.h
+++ b/include/FTPoint.h
@@ -73,10 +73,16 @@ class FTGL_EXPORT FTPoint
*/
friend bool operator != ( const FTPoint &a, const FTPoint &b);
+ operator FTGL_DOUBLE*()
+ {
+ return &x;
+ }
+
/**
* The point data
*/
FTGL_DOUBLE x, y, z; // FIXME make private
+// FTGL_FLOAT x, y, z; // FIXME make private
private:
};
diff --git a/src/FTPoint.cpp b/src/FTPoint.cpp
index e4678bc..365f4df 100755
--- a/src/FTPoint.cpp
+++ b/src/FTPoint.cpp
@@ -10,5 +10,3 @@ bool operator != ( const FTPoint &a, const FTPoint &b)
{
return((a.x != b.x) || (a.y != b.y) || (a.z != b.z));
}
-
-
diff --git a/test/FTPoint-Test.cpp b/test/FTPoint-Test.cpp
index 65be71a..aac49bd 100755
--- a/test/FTPoint-Test.cpp
+++ b/test/FTPoint-Test.cpp
@@ -84,11 +84,14 @@ class FTPointTest : public CppUnit::TestCase
}
- void testOperatorStar()
+ void testOperatorDouble()
{
FTPoint point1( 1.0f, 2.0f, 3.0f);
-// double* pointer = point1;
+ double* pointer = static_cast<double*>(point1);
+ CPPUNIT_ASSERT(pointer[0] == 1.0f);
+ CPPUNIT_ASSERT(pointer[1] == 2.0f);
+ CPPUNIT_ASSERT(pointer[2] == 3.0f);
}