This commit is contained in:
Бранимир Караџић 2019-01-03 14:30:59 -08:00
parent 8a9ce83d47
commit fb8a82a5fd
2 changed files with 6 additions and 19 deletions

View File

@ -137,25 +137,15 @@ void toAabb(Aabb& _aabb, const float* _mtx, const void* _vertices, uint32_t _num
{ {
bx::Vec3 min, max; bx::Vec3 min, max;
uint8_t* vertex = (uint8_t*)_vertices; uint8_t* vertex = (uint8_t*)_vertices;
min = max = bx::mul(bx::load<bx::Vec3>(vertex), _mtx);
float position[3];
bx::vec3MulMtx(position, (float*)vertex, _mtx);
min.x = max.x = position[0];
min.y = max.y = position[1];
min.z = max.z = position[2];
vertex += _stride; vertex += _stride;
for (uint32_t ii = 1; ii < _numVertices; ++ii) for (uint32_t ii = 1; ii < _numVertices; ++ii)
{ {
bx::vec3MulMtx(position, (float*)vertex, _mtx); bx::Vec3 pos = bx::mul(bx::load<bx::Vec3>(vertex), _mtx);
vertex += _stride; vertex += _stride;
bx::Vec3 pos =
{
position[0],
position[1],
position[2],
};
min = bx::min(pos, min); min = bx::min(pos, min);
max = bx::max(pos, max); max = bx::max(pos, max);
} }

View File

@ -2054,14 +2054,11 @@ int _main_(int _argc, char** _argv)
if (view.m_fit) if (view.m_fit)
{ {
float wh[3] = { float(view.m_textureInfo.width), float(view.m_textureInfo.height), 0.0f }; const bx::Vec3 wh = { float(view.m_textureInfo.width), float(view.m_textureInfo.height), 0.0f };
float result[3]; const bx::Vec3 result = bx::round(bx::abs(bx::mul(wh, orientation) ) );
bx::vec3MulMtx(result, wh, orientation);
result[0] = bx::round(bx::abs(result[0]) );
result[1] = bx::round(bx::abs(result[1]) );
scale.set(bx::min(float(view.m_width) / result[0] scale.set(bx::min(float(view.m_width) / result.x
, float(view.m_height) / result[1]) , float(view.m_height) / result.y)
, 0.1f*view.m_transitionTime , 0.1f*view.m_transitionTime
); );
} }