This commit is contained in:
bkaradzic 2013-02-23 20:43:31 -08:00
parent e0eca362ad
commit 5fe1132b1c
3 changed files with 18 additions and 18 deletions

View file

@ -22,8 +22,8 @@ struct PosNormalTangentTexcoordVertex
float m_z; float m_z;
uint32_t m_normal; uint32_t m_normal;
uint32_t m_tangent; uint32_t m_tangent;
uint16_t m_u; int16_t m_u;
uint16_t m_v; int16_t m_v;
}; };
static bgfx::VertexDecl s_PosNormalTangentTexcoordDecl; static bgfx::VertexDecl s_PosNormalTangentTexcoordDecl;

View file

@ -194,12 +194,12 @@ namespace bgfx
const char* getAttribName(Attrib::Enum _attr); const char* getAttribName(Attrib::Enum _attr);
bool renderFrame(); 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; 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; return _a < _b ? _b : _a;
} }

View file

@ -209,27 +209,27 @@ namespace bgfx
case AttribType::Int16: case AttribType::Int16:
{ {
uint16_t* packed = (uint16_t*)data; int16_t* packed = (int16_t*)data;
if (_inputNormalized) if (_inputNormalized)
{ {
if (asInt) if (asInt)
{ {
switch (num) switch (num)
{ {
default: *packed++ = uint16_t(*_input++ * 32767.0f); default: *packed++ = int16_t(*_input++ * 32767.0f);
case 3: *packed++ = uint16_t(*_input++ * 32767.0f); case 3: *packed++ = int16_t(*_input++ * 32767.0f);
case 2: *packed++ = uint16_t(*_input++ * 32767.0f); case 2: *packed++ = int16_t(*_input++ * 32767.0f);
case 1: *packed++ = uint16_t(*_input++ * 32767.0f); case 1: *packed++ = int16_t(*_input++ * 32767.0f);
} }
} }
else else
{ {
switch (num) switch (num)
{ {
default: *packed++ = uint16_t(*_input++ * 65535.0f - 32768.0f); default: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f);
case 3: *packed++ = uint16_t(*_input++ * 65535.0f - 32768.0f); case 3: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f);
case 2: *packed++ = uint16_t(*_input++ * 65535.0f - 32768.0f); case 2: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f);
case 1: *packed++ = uint16_t(*_input++ * 65535.0f - 32768.0f); case 1: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f);
} }
} }
} }
@ -237,10 +237,10 @@ namespace bgfx
{ {
switch (num) switch (num)
{ {
default: *packed++ = uint16_t(*_input++); default: *packed++ = int16_t(*_input++);
case 3: *packed++ = uint16_t(*_input++); case 3: *packed++ = int16_t(*_input++);
case 2: *packed++ = uint16_t(*_input++); case 2: *packed++ = int16_t(*_input++);
case 1: *packed++ = uint16_t(*_input++); case 1: *packed++ = int16_t(*_input++);
} }
} }
} }
@ -313,7 +313,7 @@ namespace bgfx
case AttribType::Int16: case AttribType::Int16:
{ {
uint16_t* packed = (uint16_t*)data; int16_t* packed = (int16_t*)data;
if (asInt) if (asInt)
{ {
switch (num) switch (num)