From 5fe1132b1c7670cd9022fa9109c4833acbfb0115 Mon Sep 17 00:00:00 2001 From: bkaradzic Date: Sat, 23 Feb 2013 20:43:31 -0800 Subject: [PATCH] Cleanup. --- examples/06-bump/bump.cpp | 4 ++-- src/bgfx_p.h | 4 ++-- src/vertexdecl.cpp | 28 ++++++++++++++-------------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/examples/06-bump/bump.cpp b/examples/06-bump/bump.cpp index 4851ef7e..c75e05ea 100644 --- a/examples/06-bump/bump.cpp +++ b/examples/06-bump/bump.cpp @@ -22,8 +22,8 @@ struct PosNormalTangentTexcoordVertex float m_z; uint32_t m_normal; uint32_t m_tangent; - uint16_t m_u; - uint16_t m_v; + int16_t m_u; + int16_t m_v; }; static bgfx::VertexDecl s_PosNormalTangentTexcoordDecl; diff --git a/src/bgfx_p.h b/src/bgfx_p.h index 8e9d7bb0..76222bd4 100755 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -194,12 +194,12 @@ namespace bgfx const char* getAttribName(Attrib::Enum _attr); bool renderFrame(); - inline uint32_t uint16_min(uint16_t _a, uint16_t _b) + inline uint16_t uint16_min(uint16_t _a, uint16_t _b) { return _a > _b ? _b : _a; } - inline uint32_t uint16_max(uint16_t _a, uint16_t _b) + inline uint16_t uint16_max(uint16_t _a, uint16_t _b) { return _a < _b ? _b : _a; } diff --git a/src/vertexdecl.cpp b/src/vertexdecl.cpp index 99bc2377..6518520d 100644 --- a/src/vertexdecl.cpp +++ b/src/vertexdecl.cpp @@ -209,27 +209,27 @@ namespace bgfx case AttribType::Int16: { - uint16_t* packed = (uint16_t*)data; + int16_t* packed = (int16_t*)data; if (_inputNormalized) { if (asInt) { switch (num) { - default: *packed++ = uint16_t(*_input++ * 32767.0f); - case 3: *packed++ = uint16_t(*_input++ * 32767.0f); - case 2: *packed++ = uint16_t(*_input++ * 32767.0f); - case 1: *packed++ = uint16_t(*_input++ * 32767.0f); + default: *packed++ = int16_t(*_input++ * 32767.0f); + case 3: *packed++ = int16_t(*_input++ * 32767.0f); + case 2: *packed++ = int16_t(*_input++ * 32767.0f); + case 1: *packed++ = int16_t(*_input++ * 32767.0f); } } else { switch (num) { - default: *packed++ = uint16_t(*_input++ * 65535.0f - 32768.0f); - case 3: *packed++ = uint16_t(*_input++ * 65535.0f - 32768.0f); - case 2: *packed++ = uint16_t(*_input++ * 65535.0f - 32768.0f); - case 1: *packed++ = uint16_t(*_input++ * 65535.0f - 32768.0f); + default: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f); + case 3: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f); + case 2: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f); + case 1: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f); } } } @@ -237,10 +237,10 @@ namespace bgfx { switch (num) { - default: *packed++ = uint16_t(*_input++); - case 3: *packed++ = uint16_t(*_input++); - case 2: *packed++ = uint16_t(*_input++); - case 1: *packed++ = uint16_t(*_input++); + default: *packed++ = int16_t(*_input++); + case 3: *packed++ = int16_t(*_input++); + case 2: *packed++ = int16_t(*_input++); + case 1: *packed++ = int16_t(*_input++); } } } @@ -313,7 +313,7 @@ namespace bgfx case AttribType::Int16: { - uint16_t* packed = (uint16_t*)data; + int16_t* packed = (int16_t*)data; if (asInt) { switch (num)