Removing old vector math.
This commit is contained in:
Родитель
b1752bc630
Коммит
66a7d6ab05
|
@ -273,8 +273,8 @@ public:
|
|||
|
||||
float time = (float)( (bx::getHPCounter()-m_timeOffset)/double(bx::getHPFrequency() ) );
|
||||
|
||||
float at[3] = { 0.0f, 0.0f, 0.0f };
|
||||
float eye[3] = { 0.0f, 0.0f, -35.0f };
|
||||
const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
|
||||
const bx::Vec3 eye = { 0.0f, 0.0f, -35.0f };
|
||||
|
||||
// Set view and projection matrix for view 0.
|
||||
{
|
||||
|
|
|
@ -579,8 +579,8 @@ public:
|
|||
const double toMs = 1000.0/freq;
|
||||
float time = (float)( (now - m_timeOffset)/double(bx::getHPFrequency() ) );
|
||||
|
||||
float at[3] = { 0.0f, 0.0f, 0.0f };
|
||||
float eye[3] = { 0.0f, 0.0f, -50.0f };
|
||||
const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
|
||||
const bx::Vec3 eye = { 0.0f, 0.0f, -50.0f };
|
||||
|
||||
// Set view and projection matrix for view 0.
|
||||
{
|
||||
|
|
|
@ -192,8 +192,8 @@ public:
|
|||
// if no other draw calls are submitted to viewZ 0.
|
||||
bgfx::touch(0);
|
||||
|
||||
float at[3] = { 0.0f, 0.0f, 0.0f };
|
||||
float eye[3] = { 0.0f, 0.0f, -15.0f };
|
||||
const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
|
||||
const bx::Vec3 eye = { 0.0f, 0.0f, -15.0f };
|
||||
|
||||
float view[16];
|
||||
float proj[16];
|
||||
|
|
|
@ -103,8 +103,8 @@ public:
|
|||
float time = (float)( (bx::getHPCounter()-m_timeOffset)/double(bx::getHPFrequency() ) );
|
||||
bgfx::setUniform(u_time, &time);
|
||||
|
||||
float at[3] = { 0.0f, 1.0f, 0.0f };
|
||||
float eye[3] = { 0.0f, 1.0f, -2.5f };
|
||||
const bx::Vec3 at = { 0.0f, 1.0f, 0.0f };
|
||||
const bx::Vec3 eye = { 0.0f, 1.0f, -2.5f };
|
||||
|
||||
// Set view and projection matrix for view 0.
|
||||
{
|
||||
|
|
|
@ -172,8 +172,8 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
float at[3] = { 0.0f, 0.0f, 0.0f };
|
||||
float eye[3] = { 0.0f, 0.0f, -35.0f };
|
||||
const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
|
||||
const bx::Vec3 eye = { 0.0f, 0.0f, -35.0f };
|
||||
|
||||
// Set view and projection matrix for view 0.
|
||||
{
|
||||
|
|
|
@ -211,8 +211,8 @@ public:
|
|||
|
||||
float time = (float)( (bx::getHPCounter()-m_timeOffset)/double(bx::getHPFrequency() ));
|
||||
|
||||
float at[3] = { 0.0f, 0.0f, 0.0f };
|
||||
float eye[3] = { 0.0f, 0.0f, -7.0f };
|
||||
const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
|
||||
const bx::Vec3 eye = { 0.0f, 0.0f, -7.0f };
|
||||
|
||||
// Set view and projection matrix for view 0.
|
||||
{
|
||||
|
|
|
@ -423,8 +423,8 @@ public:
|
|||
// if no other draw calls are submitted to view 0.
|
||||
bgfx::touch(0);
|
||||
|
||||
float at[3] = { 0.0f, 0.0f, 0.0f };
|
||||
float eye[3] = { 0.0f, 0.0f, -35.0f };
|
||||
const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
|
||||
const bx::Vec3 eye = { 0.0f, 0.0f, -35.0f };
|
||||
|
||||
float view[16];
|
||||
float proj[16];
|
||||
|
|
|
@ -484,8 +484,8 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
float at[3] = { 0.0f, 0.0f, 0.0f };
|
||||
float eye[3] = { 0.0f, 0.0f, -5.0f };
|
||||
const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
|
||||
const bx::Vec3 eye = { 0.0f, 0.0f, -5.0f };
|
||||
|
||||
float view[16];
|
||||
bx::mtxLookAt(view, eye, at);
|
||||
|
|
|
@ -469,8 +469,8 @@ public:
|
|||
bgfx::setViewTransform(ii, NULL, proj);
|
||||
}
|
||||
|
||||
float at[3] = { 0.0f, 1.0f, 0.0f };
|
||||
float eye[3] = { 0.0f, 1.0f, -2.5f };
|
||||
const bx::Vec3 at = { 0.0f, 1.0f, 0.0f };
|
||||
const bx::Vec3 eye = { 0.0f, 1.0f, -2.5f };
|
||||
|
||||
float mtx[16];
|
||||
bx::mtxRotateXY(mtx
|
||||
|
@ -478,11 +478,10 @@ public:
|
|||
, m_time
|
||||
);
|
||||
|
||||
float temp[4];
|
||||
bx::vec3MulMtx(temp, eye, mtx);
|
||||
const bx::Vec3 tmp = bx::mul(eye, mtx);
|
||||
|
||||
float view[16];
|
||||
bx::mtxLookAt(view, temp, at);
|
||||
bx::mtxLookAt(view, tmp, at);
|
||||
bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f, caps->homogeneousDepth);
|
||||
|
||||
// Set view and projection matrix for view hdrMesh.
|
||||
|
|
|
@ -258,8 +258,8 @@ public:
|
|||
m_textBufferManager->appendText(m_transientText, m_visitor10, "text buffer\n");
|
||||
m_textBufferManager->appendText(m_transientText, m_visitor10, fpsText);
|
||||
|
||||
float at[3] = { 0, 0, 0.0f };
|
||||
float eye[3] = { 0, 0, -1.0f };
|
||||
const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
|
||||
const bx::Vec3 eye = { 0.0f, 0.0f, -1.0f };
|
||||
|
||||
float view[16];
|
||||
bx::mtxLookAt(view, eye, at);
|
||||
|
|
|
@ -191,8 +191,8 @@ public:
|
|||
// if no other draw calls are submitted to view 0.
|
||||
bgfx::touch(0);
|
||||
|
||||
float at[3] = { 0.0f, 0.0f, 0.0f };
|
||||
float eye[3] = { 0.0f, 0.0f, -1.0f };
|
||||
const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
|
||||
const bx::Vec3 eye = { 0.0f, 0.0f, -1.0f };
|
||||
|
||||
float view[16];
|
||||
bx::mtxLookAt(view, eye, at);
|
||||
|
|
|
@ -176,8 +176,8 @@ public:
|
|||
// if no other draw calls are submitted to view 0.
|
||||
bgfx::touch(0);
|
||||
|
||||
float at[3] = { 0.0f, 1.0f, 0.0f };
|
||||
float eye[3] = { 0.0f, 2.0f, -distance };
|
||||
const bx::Vec3 at = { 0.0f, 1.0f, 0.0f };
|
||||
const bx::Vec3 eye = { 0.0f, 2.0f, -distance };
|
||||
|
||||
// Set view and projection matrix for view 0.
|
||||
{
|
||||
|
@ -245,12 +245,12 @@ public:
|
|||
}
|
||||
|
||||
int lod = 0;
|
||||
if (eye[2] < -2.5f)
|
||||
if (eye.z < -2.5f)
|
||||
{
|
||||
lod = 1;
|
||||
}
|
||||
|
||||
if (eye[2] < -5.0f)
|
||||
if (eye.z < -5.0f)
|
||||
{
|
||||
lod = 2;
|
||||
}
|
||||
|
|
|
@ -213,8 +213,8 @@ public:
|
|||
|
||||
// Set view and projection matrices.
|
||||
|
||||
float eye[3] = { 0.0f, 30.0f, -60.0f };
|
||||
float at[3] = { 0.0f, 5.0f, 0.0f };
|
||||
const bx::Vec3 at = { 0.0f, 5.0f, 0.0f };
|
||||
const bx::Vec3 eye = { 0.0f, 30.0f, -60.0f };
|
||||
bx::mtxLookAt(m_view, eye, at);
|
||||
|
||||
const float aspect = float(int32_t(m_width) ) / float(int32_t(m_height) );
|
||||
|
@ -319,9 +319,8 @@ public:
|
|||
float lightView[16];
|
||||
float lightProj[16];
|
||||
|
||||
float eye[3] = { -lightPos[0], -lightPos[1], -lightPos[2] };
|
||||
float at[3] = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
|
||||
const bx::Vec3 eye = { -lightPos[0], -lightPos[1], -lightPos[2] };
|
||||
bx::mtxLookAt(lightView, eye, at);
|
||||
|
||||
const bgfx::Caps* caps = bgfx::getCaps();
|
||||
|
|
|
@ -2335,7 +2335,7 @@ public:
|
|||
|
||||
float at[3];
|
||||
bx::vec3Add(at, m_pointLight.m_position.m_v, m_pointLight.m_spotDirectionInner.m_v);
|
||||
bx::mtxLookAt(lightView[TetrahedronFaces::Green], m_pointLight.m_position.m_v, at);
|
||||
bx::mtxLookAt(lightView[TetrahedronFaces::Green], bx::load(m_pointLight.m_position.m_v), bx::load(at) );
|
||||
}
|
||||
else if (LightType::PointLight == m_settings.m_lightType)
|
||||
{
|
||||
|
@ -2421,13 +2421,13 @@ public:
|
|||
else // LightType::DirectionalLight == settings.m_lightType
|
||||
{
|
||||
// Setup light view mtx.
|
||||
float eye[3] =
|
||||
const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
|
||||
const bx::Vec3 eye =
|
||||
{
|
||||
-m_directionalLight.m_position.m_x
|
||||
, -m_directionalLight.m_position.m_y
|
||||
, -m_directionalLight.m_position.m_z
|
||||
-m_directionalLight.m_position.m_x,
|
||||
-m_directionalLight.m_position.m_y,
|
||||
-m_directionalLight.m_position.m_z,
|
||||
};
|
||||
float at[3] = { 0.0f, 0.0f, 0.0f };
|
||||
bx::mtxLookAt(lightView[0], eye, at);
|
||||
|
||||
// Compute camera inverse view mtx.
|
||||
|
|
|
@ -375,8 +375,8 @@ public:
|
|||
|
||||
imguiEndFrame();
|
||||
|
||||
float at[3] = { 0.0f, 0.0f, 0.0f };
|
||||
float eye[3] = { 0.0f, 0.0f, -35.0f };
|
||||
const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
|
||||
const bx::Vec3 eye = { 0.0f, 0.0f, -35.0f };
|
||||
|
||||
float view[16];
|
||||
bx::mtxLookAt(view, eye, at);
|
||||
|
|
|
@ -205,7 +205,7 @@ struct Camera
|
|||
|
||||
void mtxLookAt(float* _outViewMtx)
|
||||
{
|
||||
bx::mtxLookAt(_outViewMtx, m_pos.curr, m_target.curr);
|
||||
bx::mtxLookAt(_outViewMtx, bx::load(m_pos.curr), bx::load(m_target.curr) );
|
||||
}
|
||||
|
||||
void orbit(float _dx, float _dy)
|
||||
|
|
|
@ -351,8 +351,8 @@ public:
|
|||
// http://jcgt.org/published/0002/02/09/
|
||||
// http://casual-effects.blogspot.com/2014/03/weighted-blended-order-independent.html
|
||||
|
||||
float at[3] = { 0.0f, 0.0f, 0.0f };
|
||||
float eye[3] = { 0.0f, 0.0f, -7.0f };
|
||||
const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
|
||||
const bx::Vec3 eye = { 0.0f, 0.0f, -7.0f };
|
||||
|
||||
float view[16];
|
||||
float proj[16];
|
||||
|
|
|
@ -230,8 +230,8 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
float at[3] = { 0.0f, 0.0f, 0.0f };
|
||||
float eye[3] = { 0.0f, 0.0f, -35.0f };
|
||||
const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
|
||||
const bx::Vec3 eye = { 0.0f, 0.0f, -35.0f };
|
||||
|
||||
float view[16];
|
||||
bx::mtxLookAt(view, eye, at);
|
||||
|
|
|
@ -119,8 +119,8 @@ public:
|
|||
m_vd.resize(uint16_t(m_width), uint16_t(m_height) );
|
||||
}
|
||||
|
||||
const float at[3] = { 0.0f, 0.0f, 0.0f };
|
||||
const float eye[3] = { 0.0f, 0.0f, -35.0f };
|
||||
const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
|
||||
const bx::Vec3 eye = { 0.0f, 0.0f, -35.0f };
|
||||
|
||||
float view[16];
|
||||
float proj[16];
|
||||
|
|
|
@ -219,8 +219,8 @@ public:
|
|||
bgfx::setViewTransform(1, view, proj);
|
||||
bgfx::setViewRect(1, 0, 0, uint16_t(m_width), uint16_t(m_height) );
|
||||
|
||||
float at[3] = { 0.0f, 0.0f, 0.0f };
|
||||
float eye[3] = { 17.5f, 10.0f, -17.5f };
|
||||
const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
|
||||
const bx::Vec3 eye = { 17.5f, 10.0f, -17.5f };
|
||||
bx::mtxLookAt(view, eye, at);
|
||||
|
||||
bgfx::setViewTransform(2, view, proj);
|
||||
|
|
|
@ -49,7 +49,7 @@ struct Camera
|
|||
|
||||
void mtxLookAt(float* _outViewMtx)
|
||||
{
|
||||
bx::mtxLookAt(_outViewMtx, m_pos.curr, m_target.curr);
|
||||
bx::mtxLookAt(_outViewMtx, bx::load(m_pos.curr), bx::load(m_target.curr) );
|
||||
}
|
||||
|
||||
void orbit(float _dx, float _dy)
|
||||
|
|
|
@ -627,9 +627,9 @@ public:
|
|||
float mtxInvVp[16];
|
||||
bx::mtxInverse(mtxInvVp, mtxVp);
|
||||
|
||||
float zero[3] = {};
|
||||
float eye[] = { 5.0f, 10.0f, 5.0f };
|
||||
bx::mtxLookAt(view, eye, zero);
|
||||
const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
|
||||
const bx::Vec3 eye = { 5.0f, 10.0f, 5.0f };
|
||||
bx::mtxLookAt(view, eye, at);
|
||||
bx::mtxProj(proj, 45.0f, float(m_width)/float(m_height), 1.0f, 15.0f, bgfx::getCaps()->homogeneousDepth);
|
||||
bx::mtxMul(mtxVp, view, proj);
|
||||
|
||||
|
|
|
@ -238,13 +238,14 @@ public:
|
|||
const float camSpeed = 0.25;
|
||||
float cameraSpin = (float)m_cameraSpin;
|
||||
float eyeDist = 2.5f;
|
||||
float eye[3] =
|
||||
|
||||
const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
|
||||
const bx::Vec3 eye =
|
||||
{
|
||||
-eyeDist * bx::sin(time*cameraSpin*camSpeed),
|
||||
0.0f,
|
||||
-eyeDist * bx::cos(time*cameraSpin*camSpeed),
|
||||
};
|
||||
float at[3] = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
float view[16];
|
||||
bx::mtxLookAt(view, eye, at);
|
||||
|
@ -277,7 +278,7 @@ public:
|
|||
|
||||
// Look at our unprojected point
|
||||
float pickView[16];
|
||||
bx::mtxLookAt(pickView, pickEye, pickAt);
|
||||
bx::mtxLookAt(pickView, bx::load(pickEye), bx::load(pickAt) );
|
||||
|
||||
// Tight FOV is best for picking
|
||||
float pickProj[16];
|
||||
|
|
|
@ -476,7 +476,7 @@ public:
|
|||
lightAt[1] = 0.0f;
|
||||
lightAt[2] = 0.0f;
|
||||
|
||||
bx::mtxLookAt(smView, lightEye, lightAt);
|
||||
bx::mtxLookAt(smView, bx::load(lightEye), bx::load(lightAt) );
|
||||
const float area = 10.0f;
|
||||
const bgfx::Caps* caps = bgfx::getCaps();
|
||||
bx::mtxOrtho(smProj, -area, area, -area, area, -100.0f, 100.0f, 0.0f, caps->homogeneousDepth);
|
||||
|
|
|
@ -225,8 +225,8 @@ public:
|
|||
|
||||
float time = (float)( (now-m_timeOffset)/freq);
|
||||
|
||||
float at[3] = { 0.0f, 0.0f, 1.0f };
|
||||
float eye[3] = { 0.0f, 0.0f, 0.0f };
|
||||
const bx::Vec3 at = { 0.0f, 0.0f, 1.0f };
|
||||
const bx::Vec3 eye = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
// Set view and projection matrix for view 0.
|
||||
{
|
||||
|
|
|
@ -207,8 +207,8 @@ public:
|
|||
|
||||
float time = (float)( (bx::getHPCounter()-m_timeOffset)/double(bx::getHPFrequency() ) );
|
||||
|
||||
float at[3] = { 0.0f, 0.0f, 0.0f };
|
||||
float eye[3] = { 0.0f, 0.0f, -35.0f };
|
||||
const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
|
||||
const bx::Vec3 eye = { 0.0f, 0.0f, -35.0f };
|
||||
|
||||
// Set view and projection matrix for view 0.
|
||||
{
|
||||
|
|
|
@ -190,8 +190,8 @@ public:
|
|||
|
||||
float time = (float)( (bx::getHPCounter()-m_timeOffset)/double(bx::getHPFrequency() ) );
|
||||
|
||||
float at[3] = { 0.0f, 0.0f, 0.0f };
|
||||
float eye[3] = { 0.0f, 0.0f, -35.0f };
|
||||
const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
|
||||
const bx::Vec3 eye = { 0.0f, 0.0f, -35.0f };
|
||||
|
||||
// Set view and projection matrix for view 0.
|
||||
{
|
||||
|
|
|
@ -55,7 +55,7 @@ struct Camera
|
|||
|
||||
void mtxLookAt(float* _outViewMtx)
|
||||
{
|
||||
bx::mtxLookAt(_outViewMtx, m_pos.curr, m_target.curr);
|
||||
bx::mtxLookAt(_outViewMtx, bx::load(m_pos.curr), bx::load(m_target.curr) );
|
||||
}
|
||||
|
||||
void orbit(float _dx, float _dy)
|
||||
|
|
|
@ -240,7 +240,7 @@ struct Camera
|
|||
|
||||
void getViewMtx(float* _viewMtx)
|
||||
{
|
||||
bx::mtxLookAt(_viewMtx, &m_eye.x, &m_at.x, &m_up.x);
|
||||
bx::mtxLookAt(_viewMtx, bx::load(&m_eye.x), bx::load(&m_at.x), bx::load(&m_up.x) );
|
||||
}
|
||||
|
||||
void setPosition(const float* _pos)
|
||||
|
|
Загрузка…
Ссылка в новой задаче