summaryrefslogtreecommitdiffstats
path: root/src/math
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-07-15 19:17:49 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-07-15 19:17:49 +0200
commit54f4da87923465a5387e2e854b58616647deb7af (patch)
treefc52b1866b29393be7d61a2341f04d430c078fdd /src/math
parenteca6d26459200d2956d64ccf8a2713d96a82c989 (diff)
downloadcolobot-54f4da87923465a5387e2e854b58616647deb7af.tar.gz
colobot-54f4da87923465a5387e2e854b58616647deb7af.tar.bz2
colobot-54f4da87923465a5387e2e854b58616647deb7af.zip
Fix in model loading; simple model viewer
- fixed model loading code - added simple model viewer (model_test) in src/graphics/opengl/test - added system time stamp code - split the code in app/system modules to separate headers - added debug messages in model loading - minor fixes in OpenGL engine
Diffstat (limited to 'src/math')
-rw-r--r--src/math/point.h10
-rw-r--r--src/math/vector.h11
2 files changed, 21 insertions, 0 deletions
diff --git a/src/math/point.h b/src/math/point.h
index d6768c8..80f80f4 100644
--- a/src/math/point.h
+++ b/src/math/point.h
@@ -24,6 +24,7 @@
#include "func.h"
#include <cmath>
+#include <sstream>
// Math module namespace
@@ -147,6 +148,15 @@ struct Point
return Point(left.x / right, left.y / right);
}
+
+ //! Returns a string "[x, y]"
+ inline std::string ToString() const
+ {
+ std::stringstream s;
+ s.precision(3);
+ s << "[" << x << ", " << y << "]";
+ return s.str();
+ }
}; // struct Point
diff --git a/src/math/vector.h b/src/math/vector.h
index 41f11a8..65fc2f9 100644
--- a/src/math/vector.h
+++ b/src/math/vector.h
@@ -24,6 +24,7 @@
#include "func.h"
#include <cmath>
+#include <sstream>
// Math module namespace
@@ -202,6 +203,16 @@ struct Vector
return Vector(left.x / right, left.y / right, left.z / right);
}
+
+ //! Returns a string "[x, y, z]"
+ inline std::string ToString() const
+ {
+ std::stringstream s;
+ s.precision(3);
+ s << "[" << x << ", " << y << ", " << z << "]";
+ return s.str();
+ }
+
}; // struct Point
//! Checks if two vectors are equal within given \a tolerance