| 114 | } |
| 115 | |
| 116 | void GFXTextureArray::setTexture(const GFXTexHandle& texture, U32 slot) |
| 117 | { |
| 118 | PROFILE_SCOPE(GFXTextureArray_setTexture) |
| 119 | GFXTexHandle handle = texture; |
| 120 | if (texture->getPath().isNotEmpty()) |
| 121 | { |
| 122 | if (texture.getHeight() != mHeight || texture.getWidth() != mWidth || texture.getFormat() != mFormat || texture->getMipLevels() < mMipLevels) |
| 123 | { |
| 124 | if (texture.getHeight() != mHeight || texture.getWidth() != mWidth) |
| 125 | { |
| 126 | AssertWarn(true, avar("GFXTextureArray::setTexture all textures should be the same size: %i vs %i", texture.getHeight(), mHeight)); |
| 127 | Con::warnf(avar("GFXTextureArray::setTexture all textures should be the same size: %i vs %i", texture.getHeight(), mHeight)); |
| 128 | } |
| 129 | else if (texture->getMipLevels() < mMipLevels) |
| 130 | { |
| 131 | AssertWarn(true, avar("GFXTextureArray::setTexture all textures should have at least the same number of mips: %i vs %i", texture->getMipLevels(), mMipLevels)); |
| 132 | Con::warnf(avar("GFXTextureArray::setTexture all textures should have at least the same number of mips: %i vs %i", texture->getMipLevels(), mMipLevels)); |
| 133 | } |
| 134 | |
| 135 | GBitmap* inBitmap = TEXMGR->loadUncompressedTexture(texture->getPath(), &GFXTexturePersistentProfile, mWidth, mHeight); |
| 136 | if (!inBitmap->setFormat(mFormat)) |
| 137 | { |
| 138 | AssertFatal(true, "GFXTextureArray::setTexture all textures must be convertible to GFXFormat " + mFormat); |
| 139 | Con::errorf("GFXTextureArray::setTexture all textures must be convertible to GFXFormat" + mFormat); |
| 140 | handle = NULL; |
| 141 | delete inBitmap; |
| 142 | } |
| 143 | else |
| 144 | { |
| 145 | handle = TEXMGR->createTexture(inBitmap, "", &GFXStaticTextureProfile, true); |
| 146 | } |
| 147 | } |
| 148 | } |
| 149 | if (!handle.isValid()) |
| 150 | { |
| 151 | return; |
| 152 | } |
| 153 | |
| 154 | if (handle.getHeight() != mHeight || handle.getWidth() != mWidth || handle.getFormat() != mFormat || handle->getMipLevels() < mMipLevels) |
| 155 | { |
| 156 | AssertFatal(true, "GFXTextureArray::setTexture all textures must have the same size and format"); |
| 157 | Con::errorf("GFXTextureArray::setTexture all textures must have the same size and format"); |
| 158 | return; |
| 159 | } |
| 160 | |
| 161 | mTextures[slot] = handle; |
| 162 | |
| 163 | _setTexture(handle, slot); |
| 164 | } |
| 165 | |
| 166 | void GFXTextureArray::Release() |
| 167 | { |
nothing calls this directly
no test coverage detected