| 362 | } |
| 363 | |
| 364 | void GLES2Texture::prepareImpl() |
| 365 | { |
| 366 | if (mUsage & TU_RENDERTARGET) return; |
| 367 | |
| 368 | String baseName, ext; |
| 369 | size_t pos = mName.find_last_of("."); |
| 370 | baseName = mName.substr(0, pos); |
| 371 | |
| 372 | if (pos != String::npos) |
| 373 | { |
| 374 | ext = mName.substr(pos+1); |
| 375 | } |
| 376 | |
| 377 | LoadedImages loadedImages = LoadedImages(new vector<Image>::type()); |
| 378 | |
| 379 | if (mTextureType == TEX_TYPE_1D || mTextureType == TEX_TYPE_2D || |
| 380 | mTextureType == TEX_TYPE_2D_ARRAY || mTextureType == TEX_TYPE_3D) |
| 381 | |
| 382 | { |
| 383 | doImageIO(mName, mGroup, ext, *loadedImages, this); |
| 384 | |
| 385 | // If this is a volumetric texture set the texture type flag accordingly. |
| 386 | // If this is a cube map, set the texture type flag accordingly. |
| 387 | if ((*loadedImages)[0].hasFlag(IF_CUBEMAP)) |
| 388 | mTextureType = TEX_TYPE_CUBE_MAP; |
| 389 | |
| 390 | // If this is a volumetric texture set the texture type flag accordingly. |
| 391 | if((*loadedImages)[0].getDepth() > 1 && mTextureType != TEX_TYPE_2D_ARRAY) |
| 392 | mTextureType = TEX_TYPE_3D; |
| 393 | |
| 394 | // If PVRTC and 0 custom mipmap disable auto mip generation and disable software mipmap creation |
| 395 | if (PixelUtil::isCompressed((*loadedImages)[0].getFormat())) |
| 396 | { |
| 397 | size_t imageMips = (*loadedImages)[0].getNumMipmaps(); |
| 398 | if (imageMips == 0) |
| 399 | { |
| 400 | mNumMipmaps = mNumRequestedMipmaps = imageMips; |
| 401 | // Disable flag for auto mip generation |
| 402 | mUsage &= ~TU_AUTOMIPMAP; |
| 403 | } |
| 404 | } |
| 405 | } |
| 406 | else if (mTextureType == TEX_TYPE_CUBE_MAP) |
| 407 | { |
| 408 | if(getSourceFileType() == "dds" || getSourceFileType() == "oitd") |
| 409 | { |
| 410 | // XX HACK there should be a better way to specify whether |
| 411 | // all faces are in the same file or not |
| 412 | doImageIO(mName, mGroup, ext, *loadedImages, this); |
| 413 | } |
| 414 | else |
| 415 | { |
| 416 | vector<Image>::type images(6); |
| 417 | ConstImagePtrList imagePtrs; |
| 418 | static const String suffixes[6] = {"_rt", "_lf", "_up", "_dn", "_fr", "_bk"}; |
| 419 | |
| 420 | for(size_t i = 0; i < 6; i++) |
| 421 | { |
nothing calls this directly
no test coverage detected