Internal function used to load the FTX.
| 60 | |
| 61 | // Internal function used to load the FTX. |
| 62 | ILboolean iLoadFtxInternal(void) |
| 63 | { |
| 64 | ILuint Width, Height, HasAlpha; |
| 65 | |
| 66 | if (iCurImage == NULL) { |
| 67 | ilSetError(IL_ILLEGAL_OPERATION); |
| 68 | return IL_FALSE; |
| 69 | } |
| 70 | |
| 71 | Width = GetLittleUInt(); |
| 72 | Height = GetLittleUInt(); |
| 73 | HasAlpha = GetLittleUInt(); // Kind of backwards from what I would think... |
| 74 | |
| 75 | //@TODO: Right now, it appears that all images are in RGBA format. See if I can find specs otherwise |
| 76 | // or images that load incorrectly like this. |
| 77 | //if (HasAlpha == 0) { // RGBA format |
| 78 | if (!ilTexImage(Width, Height, 1, 4, IL_RGBA, IL_UNSIGNED_BYTE, NULL)) |
| 79 | return IL_FALSE; |
| 80 | //} |
| 81 | //else if (HasAlpha == 1) { // RGB format |
| 82 | // if (!ilTexImage(Width, Height, 1, 3, IL_RGB, IL_UNSIGNED_BYTE, NULL)) |
| 83 | // return IL_FALSE; |
| 84 | //} |
| 85 | //else { // Unknown format |
| 86 | // ilSetError(IL_INVALID_FILE_HEADER); |
| 87 | // return IL_FALSE; |
| 88 | //} |
| 89 | |
| 90 | // The origin will always be in the upper left. |
| 91 | iCurImage->Origin = IL_ORIGIN_UPPER_LEFT; |
| 92 | |
| 93 | // All we have to do for this format is read the raw, uncompressed data. |
| 94 | if (iread(iCurImage->Data, 1, iCurImage->SizeOfData) != iCurImage->SizeOfData) |
| 95 | return IL_FALSE; |
| 96 | |
| 97 | return ilFixImage(); |
| 98 | } |
| 99 | |
| 100 | #endif//IL_NO_FTX |
| 101 |
no test coverage detected