diff --git a/examples/common/bounds.cpp b/examples/common/bounds.cpp index 0f3d35c66..0b2ae4460 100644 --- a/examples/common/bounds.cpp +++ b/examples/common/bounds.cpp @@ -277,7 +277,7 @@ void calcMinBoundingSphere(Sphere& _sphere, const void* _vertices, uint32_t _num _sphere.m_radius = bx::fsqrt(maxDistSq); } -void calcPlaneUv(const Plane& _plane, float _step, float* _udir, float* _vdir) +void calcPlaneUv(const Plane& _plane, float* _udir, float* _vdir) { const uint8_t axis = bx::fabsolute(_plane.m_normal[0]) > 0.6f ? 0 @@ -287,29 +287,22 @@ void calcPlaneUv(const Plane& _plane, float _step, float* _udir, float* _vdir) const uint8_t* index = (uint8_t*)&"\x1\x2\x0\x2\x0\x1"[axis*2]; const uint8_t idx0 = *(index ); const uint8_t idx1 = *(index+1); - const float invStep = 1.0f/_step; _udir[0] = 0.0f; _udir[1] = 0.0f; _udir[2] = 0.0f; - _udir[idx0] = invStep; + _udir[idx0] = 1.0f; _vdir[0] = 0.0f; _vdir[1] = 0.0f; _vdir[2] = 0.0f; - _vdir[idx1] = invStep; + _vdir[idx1] = 1.0f; const float invPlaneAxis = 1.0f / _plane.m_normal[axis]; - float normal[3]; - float invLen; - invLen = 1.0f / bx::vec3Norm(normal, _udir); - bx::vec3Mul(_udir, normal, invLen); _udir[axis] -= bx::vec3Dot(_udir, _plane.m_normal) * invPlaneAxis; bx::vec3Norm(_udir, _udir); - invLen = 1.0f / bx::vec3Norm(normal, _vdir); - bx::vec3Mul(_vdir, normal, invLen); _vdir[axis] -= bx::vec3Dot(_vdir, _plane.m_normal) * invPlaneAxis; bx::vec3Norm(_vdir, _vdir); } diff --git a/examples/common/bounds.h b/examples/common/bounds.h index 55f937a3e..03cac67ca 100644 --- a/examples/common/bounds.h +++ b/examples/common/bounds.h @@ -95,7 +95,7 @@ void calcMaxBoundingSphere(Sphere& _sphere, const void* _vertices, uint32_t _num void calcMinBoundingSphere(Sphere& _sphere, const void* _vertices, uint32_t _numVertices, uint32_t _stride, float _step = 0.01f); /// Calculate coplanar U/V vectors. -void calcPlaneUv(const Plane& _plane, float _step, float* _udir, float* _vdir); +void calcPlaneUv(const Plane& _plane, float* _udir, float* _vdir); /// Returns 6 (near, far, left, right, top, bottom) planes representing frustum planes. void buildFrustumPlanes(Plane* _planes, const float* _viewProj); diff --git a/src/vertexdecl.cpp b/src/vertexdecl.cpp index 91ef865d0..be556e0f2 100644 --- a/src/vertexdecl.cpp +++ b/src/vertexdecl.cpp @@ -6,9 +6,10 @@ #include #include #include -#include -#include #include +#include +#include +#include #include "config.h" #include "vertexdecl.h" @@ -839,4 +840,5 @@ namespace bgfx return (uint16_t)numVertices; } + } // namespace bgfx