Similar to DecodePixelData() but it casts the results to float for all component types
| 320 | |
| 321 | // Similar to DecodePixelData() but it casts the results to float for all component types |
| 322 | FloatVector DecodeFormattedComponents(const ResourceFormat &fmt, const byte *data, bool *success) |
| 323 | { |
| 324 | PixelValue val; |
| 325 | DecodePixelData(fmt, data, val, success); |
| 326 | |
| 327 | FloatVector ret; |
| 328 | if(fmt.compType == CompType::UInt) |
| 329 | { |
| 330 | ret.x = (float)val.uintValue[0]; |
| 331 | ret.y = (float)val.uintValue[1]; |
| 332 | ret.z = (float)val.uintValue[2]; |
| 333 | ret.w = (float)val.uintValue[3]; |
| 334 | } |
| 335 | else if(fmt.compType == CompType::SInt) |
| 336 | { |
| 337 | ret.x = (float)val.intValue[0]; |
| 338 | ret.y = (float)val.intValue[1]; |
| 339 | ret.z = (float)val.intValue[2]; |
| 340 | ret.w = (float)val.intValue[3]; |
| 341 | } |
| 342 | else |
| 343 | { |
| 344 | ret.x = val.floatValue[0]; |
| 345 | ret.y = val.floatValue[1]; |
| 346 | ret.z = val.floatValue[2]; |
| 347 | ret.w = val.floatValue[3]; |
| 348 | } |
| 349 | |
| 350 | return ret; |
| 351 | } |
| 352 | |
| 353 | void EncodeFormattedComponents(const ResourceFormat &fmt, FloatVector v, byte *data, bool *success) |
| 354 | { |
no test coverage detected