Internal function used to save the Dds.
| 134 | |
| 135 | // Internal function used to save the Dds. |
| 136 | ILboolean iSaveDdsInternal() |
| 137 | { |
| 138 | ILenum DXTCFormat; |
| 139 | ILuint counter, numMipMaps, image, numFaces, i; |
| 140 | ILubyte *CurData = NULL; |
| 141 | ILint CubeTable[6] = { 0 }; |
| 142 | ILuint CubeFlags; |
| 143 | |
| 144 | CubeFlags = GetCubemapInfo(iCurImage, CubeTable); |
| 145 | |
| 146 | image = ilGetInteger(IL_CUR_IMAGE); |
| 147 | DXTCFormat = iGetInt(IL_DXTC_FORMAT); |
| 148 | WriteHeader(iCurImage, DXTCFormat, CubeFlags); |
| 149 | |
| 150 | if (CubeFlags != 0) |
| 151 | numFaces = ilGetInteger(IL_NUM_FACES); // Should always be 5 for now |
| 152 | else |
| 153 | numFaces = 0; |
| 154 | |
| 155 | numMipMaps = ilGetInteger(IL_NUM_MIPMAPS); //this assumes all faces have same # of mipmaps |
| 156 | |
| 157 | for (i = 0; i <= numFaces; ++i) { |
| 158 | for (counter = 0; counter <= numMipMaps; counter++) { |
| 159 | ilBindImage(image); |
| 160 | ilActiveImage(CubeTable[i]); |
| 161 | ilActiveMipmap(counter); |
| 162 | |
| 163 | if (iCurImage->Origin != IL_ORIGIN_UPPER_LEFT) { |
| 164 | CurData = iCurImage->Data; |
| 165 | iCurImage->Data = iGetFlipped(iCurImage); |
| 166 | if (iCurImage->Data == NULL) { |
| 167 | iCurImage->Data = CurData; |
| 168 | return IL_FALSE; |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | if (!Compress(iCurImage, DXTCFormat)) |
| 173 | return IL_FALSE; |
| 174 | |
| 175 | if (iCurImage->Origin != IL_ORIGIN_UPPER_LEFT) { |
| 176 | ifree(iCurImage->Data); |
| 177 | iCurImage->Data = CurData; |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | } |
| 182 | |
| 183 | return IL_TRUE; |
| 184 | } |
| 185 | |
| 186 | |
| 187 | // @TODO: Finish this, as it is incomplete. |
no test coverage detected