void bgfx_ortho_view::setup_matrices() {
float proj[16];
float view[16];
const bgfx::Caps* caps = bgfx::getCaps();
static float rotation0 = 0.0;
rotation0 += 0.0005; // rotate at a slow speed
static float rotation1 = 3.14 / 2.0;
rotation1 += 0.0005;
static float rotation2 = 3.14 / 2.0;
rotation2 += 0.0005;
const bx::Vec3 at = { float(m_view_width / 2.0), float(m_view_height / 2.0), 0.0f };
// rotate in a horizontal circle
// const bx::Vec3 eye = { float(cos(rotation0)*1000 + m_view_width / 2.0f), float( m_view_height / 2.0f), float(sin(rotation0)*1000) };
// rotate in a vertical circle
const bx::Vec3 eye = { float(m_view_width / 2.0f), float(cos(rotation1)*1000 + m_view_height / 2.0f), float(sin(rotation1)*1000) };
// const bx::Vec3 up = { 0.0f, -1.0f, 0.0f }; // straight up
const bx::Vec3 up = { float(cos(rotation2)), float(-sin(rotation2)), 0.0f };
bx::mtxLookAt(view, eye, at, up);
bx::mtxProj(proj, 60.0f, float(m_view_width) / float(m_view_height), 0.0f, 100.0f, caps->homogeneousDepth);
bgfx::setViewTransform(m_index, view, proj);
}