diff options
author | Porteries Tristan <republicthunderbolt9@gmail.com> | 2015-10-31 12:24:38 +0300 |
---|---|---|
committer | Porteries Tristan <republicthunderbolt9@gmail.com> | 2015-10-31 21:45:17 +0300 |
commit | d54e71c8bf1b0ea5651f9b44282f367c5d4e0906 (patch) | |
tree | 8bfcfb11a0271ae0ee5f5e0a94525fd5d164c316 /intern/moto/include/MT_CmMatrix4x4.h | |
parent | df61c50ffae9463eafb30b7a3e23b4fcaaca7dbf (diff) |
BGE: Moto: use templates to avoid duplicated code to convert in double or float arrays.
Diffstat (limited to 'intern/moto/include/MT_CmMatrix4x4.h')
-rw-r--r-- | intern/moto/include/MT_CmMatrix4x4.h | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/intern/moto/include/MT_CmMatrix4x4.h b/intern/moto/include/MT_CmMatrix4x4.h index 2b710c66888..962451cf456 100644 --- a/intern/moto/include/MT_CmMatrix4x4.h +++ b/intern/moto/include/MT_CmMatrix4x4.h @@ -54,16 +54,17 @@ class MT_CmMatrix4x4 public : - MT_CmMatrix4x4( - const float value[4][4] - ); - - MT_CmMatrix4x4( - ); - + template <typename T> + MT_CmMatrix4x4(const T value[4][4]) + { + for (int i=0;i<4;i++) + { + for (int j=0;j<4;j++) + m_V[i][j] = (double)value[i][j]; + } + } MT_CmMatrix4x4( - const double value[16] ); MT_CmMatrix4x4( @@ -94,11 +95,11 @@ public : getPointer( ) const; - void - setElem( - int pos, - double newvalue - ); + template <typename T> + void setElem(int pos, T newvalue) + { + m_Vflat[pos] = (double)newvalue; + } MT_Vector3 GetRight( |