Fixed DX9 lack of non-normalized UINT16 vertex decl type.

This commit is contained in:
bkaradzic
2013-02-23 19:02:51 -08:00
parent 074bf5a232
commit e0eca362ad
5 changed files with 59 additions and 51 deletions

View File

@@ -207,7 +207,7 @@ namespace bgfx
}
break;
case AttribType::Uint16:
case AttribType::Int16:
{
uint16_t* packed = (uint16_t*)data;
if (_inputNormalized)
@@ -216,20 +216,20 @@ namespace bgfx
{
switch (num)
{
default: *packed++ = uint16_t(*_input++ * 32767.0f + 32768.0f);
case 3: *packed++ = uint16_t(*_input++ * 32767.0f + 32768.0f);
case 2: *packed++ = uint16_t(*_input++ * 32767.0f + 32768.0f);
case 1: *packed++ = uint16_t(*_input++ * 32767.0f + 32768.0f);
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);
}
}
else
{
switch (num)
{
default: *packed++ = uint16_t(*_input++ * 65535.0f);
case 3: *packed++ = uint16_t(*_input++ * 65535.0f);
case 2: *packed++ = uint16_t(*_input++ * 65535.0f);
case 1: *packed++ = uint16_t(*_input++ * 65535.0f);
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);
}
}
}
@@ -311,27 +311,27 @@ namespace bgfx
}
break;
case AttribType::Uint16:
case AttribType::Int16:
{
uint16_t* packed = (uint16_t*)data;
if (asInt)
{
switch (num)
{
default: *_output++ = (float(*packed++) - 32768.0f)*1.0f/32767.0f;
case 3: *_output++ = (float(*packed++) - 32768.0f)*1.0f/32767.0f;
case 2: *_output++ = (float(*packed++) - 32768.0f)*1.0f/32767.0f;
case 1: *_output++ = (float(*packed++) - 32768.0f)*1.0f/32767.0f;
default: *_output++ = float(*packed++)*1.0f/32767.0f;
case 3: *_output++ = float(*packed++)*1.0f/32767.0f;
case 2: *_output++ = float(*packed++)*1.0f/32767.0f;
case 1: *_output++ = float(*packed++)*1.0f/32767.0f;
}
}
else
{
switch (num)
{
default: *_output++ = float(*packed++)*1.0f/65535.0f;
case 3: *_output++ = float(*packed++)*1.0f/65535.0f;
case 2: *_output++ = float(*packed++)*1.0f/65535.0f;
case 1: *_output++ = float(*packed++)*1.0f/65535.0f;
default: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f;
case 3: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f;
case 2: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f;
case 1: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f;
}
}
}