| 309 | } |
| 310 | |
| 311 | BytesContainer TextureBase::GetMipData(int32 mipIndex, int32& rowPitch, int32& slicePitch) |
| 312 | { |
| 313 | BytesContainer result; |
| 314 | if (IsVirtual()) |
| 315 | { |
| 316 | if (_customData == nullptr) |
| 317 | { |
| 318 | LOG(Error, "Missing virtual texture init data."); |
| 319 | return result; |
| 320 | } |
| 321 | |
| 322 | // Get description |
| 323 | rowPitch = _customData->Mips[mipIndex].RowPitch; |
| 324 | slicePitch = _customData->Mips[mipIndex].SlicePitch; |
| 325 | } |
| 326 | else |
| 327 | { |
| 328 | if (WaitForLoaded()) |
| 329 | return result; |
| 330 | |
| 331 | // Get description |
| 332 | uint32 rowPitch1, slicePitch1; |
| 333 | const int32 mipWidth = Math::Max(1, Width() >> mipIndex); |
| 334 | const int32 mipHeight = Math::Max(1, Height() >> mipIndex); |
| 335 | RenderTools::ComputePitch(Format(), mipWidth, mipHeight, rowPitch1, slicePitch1); |
| 336 | rowPitch = rowPitch1; |
| 337 | slicePitch = slicePitch1; |
| 338 | |
| 339 | // Ensure to have chunk loaded |
| 340 | if (LoadChunk(CalculateChunkIndex(mipIndex))) |
| 341 | return result; |
| 342 | } |
| 343 | |
| 344 | // Get data |
| 345 | GetMipData(mipIndex, result); |
| 346 | return result; |
| 347 | } |
| 348 | |
| 349 | bool TextureBase::GetTextureData(TextureData& result, bool copyData) |
| 350 | { |