Ignore:
Timestamp:
Feb 28, 2011, 7:02:24 PM (10 years ago)
Author:
sam
Message:

Basic utility function to display matrices.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/matrix.cpp

    r686 r708  
    1111#if defined HAVE_CONFIG_H
    1212#   include "config.h"
     13#endif
     14
     15#ifdef ANDROID_NDK
     16#   include <android/log.h>
    1317#endif
    1418
     
    6468    }
    6569    return ret;
     70}
     71
     72template<> void mat4::printf() const
     73{
     74    mat4 const &p = *this;
     75
     76#ifdef ANDROID_NDK
     77    __android_log_print(ANDROID_LOG_INFO, "LOL",
     78        "[ %6.6f %6.6f %6.6f %6.6f", p[0][0], p[1][0], p[2][0], p[3][0]);
     79    __android_log_print(ANDROID_LOG_INFO, "LOL",
     80        "  %6.6f %6.6f %6.6f %6.6f", p[0][1], p[1][1], p[2][1], p[3][1]);
     81    __android_log_print(ANDROID_LOG_INFO, "LOL",
     82        "  %6.6f %6.6f %6.6f %6.6f", p[0][2], p[1][2], p[2][2], p[3][2]);
     83    __android_log_print(ANDROID_LOG_INFO, "LOL",
     84        "  %6.6f %6.6f %6.6f %6.6f ]", p[0][3], p[1][3], p[2][3], p[3][3]);
     85#else
     86    fprintf(stderr, "[ %6.6f %6.6f %6.6f %6.6f\n",
     87            p[0][0], p[1][0], p[2][0], p[3][0]);
     88    fprintf(stderr, "  %6.6f %6.6f %6.6f %6.6f\n",
     89            p[0][1], p[1][1], p[2][1], p[3][1]);
     90    fprintf(stderr, "  %6.6f %6.6f %6.6f %6.6f\n",
     91            p[0][2], p[1][2], p[2][2], p[3][2]);
     92    fprintf(stderr, "  %6.6f %6.6f %6.6f %6.6f ]\n",
     93            p[0][3], p[1][3], p[2][3], p[3][3]);
     94#endif
    6695}
    6796
Note: See TracChangeset for help on using the changeset viewer.