Add ConvertComponent handling for double/uint64 data, albeit downcasted

This commit is contained in:
baldurk
2017-05-03 19:46:48 +01:00
parent 390e3c1bf4
commit 93cf884ad7
+20 -1
View File
@@ -39,7 +39,26 @@
float ConvertComponent(const ResourceFormat &fmt, byte *data)
{
if(fmt.compByteWidth == 4)
if(fmt.compByteWidth == 8)
{
// we just downcast
uint64_t *u64 = (uint64_t *)data;
int64_t *i64 = (int64_t *)data;
if(fmt.compType == CompType::Double || fmt.compType == CompType::Float)
{
return float(*(double *)u64);
}
else if(fmt.compType == CompType::UInt || fmt.compType == CompType::UScaled)
{
return float(*u64);
}
else if(fmt.compType == CompType::SInt || fmt.compType == CompType::SScaled)
{
return float(*i64);
}
}
else if(fmt.compByteWidth == 4)
{
uint32_t *u32 = (uint32_t *)data;
int32_t *i32 = (int32_t *)data;