From 0336c7ba34432e4e9e6408688bd6f2a1260ffb1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Thu, 6 Dec 2018 22:25:47 -0800 Subject: [PATCH] Removing old vector math. --- src/topology.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/topology.cpp b/src/topology.cpp index 1a3e8b6f6..02221800e 100644 --- a/src/topology.cpp +++ b/src/topology.cpp @@ -277,22 +277,21 @@ namespace bgfx return (_a + _b + _c) * 1.0f/3.0f; } - const float* vertexPos(const void* _vertices, uint32_t _stride, uint32_t _index) + const bx::Vec3 vertexPos(const void* _vertices, uint32_t _stride, uint32_t _index) { const uint8_t* vertices = (const uint8_t*)_vertices; - return (const float*)&vertices[_index*_stride]; + return bx::load(&vertices[_index*_stride]); } inline float distanceDir(const float* __restrict _dir, const void* __restrict _vertices, uint32_t _stride, uint32_t _index) { - return bx::vec3Dot(vertexPos(_vertices, _stride, _index), _dir); + return bx::dot(vertexPos(_vertices, _stride, _index), bx::load(_dir) ); } inline float distancePos(const float* __restrict _pos, const void* __restrict _vertices, uint32_t _stride, uint32_t _index) { - float tmp[3]; - bx::vec3Sub(tmp, _pos, vertexPos(_vertices, _stride, _index) ); - return bx::sqrt(bx::vec3Dot(tmp, tmp) ); + const bx::Vec3 tmp = bx::sub(bx::load(_pos), vertexPos(_vertices, _stride, _index) ); + return bx::sqrt(bx::dot(tmp, tmp) ); } typedef float (*KeyFn)(float, float, float);