From fc9dc6a3cd75965eedfd7f1e6c6b325bea22c6e0 Mon Sep 17 00:00:00 2001 From: bkaradzic Date: Wed, 22 May 2013 23:06:13 -0700 Subject: [PATCH] Moved matrix functions to math.h --- examples/11-fontsdf/fontsdf.cpp | 18 ------------------ examples/common/math.h | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/examples/11-fontsdf/fontsdf.cpp b/examples/11-fontsdf/fontsdf.cpp index aeebc869..6028fd8b 100644 --- a/examples/11-fontsdf/fontsdf.cpp +++ b/examples/11-fontsdf/fontsdf.cpp @@ -19,24 +19,6 @@ #include #include -inline void mtxTranslate(float* _result, float x, float y, float z) -{ - memset(_result, 0, sizeof(float) * 16); - _result[0] = _result[5] = _result[10] = _result[15] = 1.0f; - _result[12] = x; - _result[13] = y; - _result[14] = z; -} - -inline void mtxScale(float* _result, float x, float y, float z) -{ - memset(_result, 0, sizeof(float) * 16); - _result[0] = x; - _result[5] = y; - _result[10] = z; - _result[15] = 1.0f; -} - long int fsize(FILE* _file) { long int pos = ftell(_file); diff --git a/examples/common/math.h b/examples/common/math.h index fdcd45b8..aaf9cacf 100644 --- a/examples/common/math.h +++ b/examples/common/math.h @@ -81,6 +81,23 @@ inline void mtxIdentity(float* _result) _result[0] = _result[5] = _result[10] = _result[15] = 1.0f; } +inline void mtxTranslate(float* _result, float _x, float _y, float _z) +{ + mtxIdentity(_result); + _result[12] = _x; + _result[13] = _y; + _result[14] = _z; +} + +inline void mtxScale(float* _result, float _x, float _y, float _z) +{ + memset(_result, 0, sizeof(float) * 16); + _result[0] = _x; + _result[5] = _y; + _result[10] = _z; + _result[15] = 1.0f; +} + inline void mtxLookAt(float* __restrict _result, const float* __restrict _eye, const float* __restrict _at) { float tmp[4];