diff --git a/src/matrix.cpp b/src/matrix.cpp index e6d05117..204abde1 100644 --- a/src/matrix.cpp +++ b/src/matrix.cpp @@ -12,6 +12,10 @@ # include "config.h" #endif +#ifdef ANDROID_NDK +# include +#endif + #include #include /* free() */ #include /* strdup() */ @@ -65,6 +69,31 @@ template<> mat4 mat4::invert() const return ret; } +template<> void mat4::printf() const +{ + mat4 const &p = *this; + +#ifdef ANDROID_NDK + __android_log_print(ANDROID_LOG_INFO, "LOL", + "[ %6.6f %6.6f %6.6f %6.6f", p[0][0], p[1][0], p[2][0], p[3][0]); + __android_log_print(ANDROID_LOG_INFO, "LOL", + " %6.6f %6.6f %6.6f %6.6f", p[0][1], p[1][1], p[2][1], p[3][1]); + __android_log_print(ANDROID_LOG_INFO, "LOL", + " %6.6f %6.6f %6.6f %6.6f", p[0][2], p[1][2], p[2][2], p[3][2]); + __android_log_print(ANDROID_LOG_INFO, "LOL", + " %6.6f %6.6f %6.6f %6.6f ]", p[0][3], p[1][3], p[2][3], p[3][3]); +#else + fprintf(stderr, "[ %6.6f %6.6f %6.6f %6.6f\n", + p[0][0], p[1][0], p[2][0], p[3][0]); + fprintf(stderr, " %6.6f %6.6f %6.6f %6.6f\n", + p[0][1], p[1][1], p[2][1], p[3][1]); + fprintf(stderr, " %6.6f %6.6f %6.6f %6.6f\n", + p[0][2], p[1][2], p[2][2], p[3][2]); + fprintf(stderr, " %6.6f %6.6f %6.6f %6.6f ]\n", + p[0][3], p[1][3], p[2][3], p[3][3]); +#endif +} + template<> mat4 mat4::ortho(float left, float right, float bottom, float top, float near, float far) { diff --git a/src/matrix.h b/src/matrix.h index 51ce7663..69accb43 100644 --- a/src/matrix.h +++ b/src/matrix.h @@ -215,6 +215,8 @@ template struct Mat4 static Mat4 translate(T x, T y, T z); static Mat4 rotate(T theta, T x, T y, T z); + void printf() const; + inline Mat4 operator +(Mat4 const val) const { Mat4 ret;