Moved fpumath to bx.

This commit is contained in:
Branimir Karadžić
2014-05-26 19:31:37 -07:00
parent 92190fcbbf
commit 02e549bfec
27 changed files with 274 additions and 846 deletions

View File

@@ -7,7 +7,7 @@
#include <bgfx.h>
#include <bx/timer.h>
#include "fpumath.h"
#include <bx/fpumath.h>
#include "font/font_manager.h"
#include "font/text_metrics.h"
@@ -197,11 +197,11 @@ int _main_(int /*_argc*/, char** /*_argv*/)
float view[16];
float proj[16];
mtxLookAt(view, eye, at);
bx::mtxLookAt(view, eye, at);
float centering = 0.5f;
// Setup a top-left ortho matrix for screen space drawing.
mtxOrtho(proj, centering, width + centering, height + centering, centering, -1.0f, 1.0f);
bx::mtxOrtho(proj, centering, width + centering, height + centering, centering, -1.0f, 1.0f);
// Set view and projection matrix for view 0.
bgfx::setViewTransform(0, view, proj);
@@ -214,20 +214,20 @@ int _main_(int /*_argc*/, char** /*_argv*/)
float textScaleMat[16];
float screenCenterMat[16];
mtxRotateZ(textRotMat, textRotation);
mtxTranslate(textCenterMat, -(textAreaWidth * 0.5f), (-visibleLineCount)*metrics.getLineHeight()*0.5f, 0);
mtxScale(textScaleMat, textScale, textScale, 1.0f);
mtxTranslate(screenCenterMat, ( (width) * 0.5f), ( (height) * 0.5f), 0);
bx::mtxRotateZ(textRotMat, textRotation);
bx::mtxTranslate(textCenterMat, -(textAreaWidth * 0.5f), (-visibleLineCount)*metrics.getLineHeight()*0.5f, 0);
bx::mtxScale(textScaleMat, textScale, textScale, 1.0f);
bx::mtxTranslate(screenCenterMat, ( (width) * 0.5f), ( (height) * 0.5f), 0);
//first translate to text center, then scale, then rotate
float tmpMat[16];
mtxMul(tmpMat, textCenterMat, textRotMat);
bx::mtxMul(tmpMat, textCenterMat, textRotMat);
float tmpMat2[16];
mtxMul(tmpMat2, tmpMat, textScaleMat);
bx::mtxMul(tmpMat2, tmpMat, textScaleMat);
float tmpMat3[16];
mtxMul(tmpMat3, tmpMat2, screenCenterMat);
bx::mtxMul(tmpMat3, tmpMat2, screenCenterMat);
// Set model matrix for rendering.
bgfx::setTransform(tmpMat3);