MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / GetMipData

Method GetMipData

Source/Engine/Graphics/Textures/TextureBase.cpp:311–347  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

309}
310
311BytesContainer 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
349bool TextureBase::GetTextureData(TextureData& result, bool copyData)
350{

Callers 3

runMethod · 0.80
ExportTextureMethod · 0.80
ExportCubeTextureMethod · 0.80

Calls 7

IsVirtualFunction · 0.85
GetChunkDataMethod · 0.80
WidthFunction · 0.70
HeightFunction · 0.70
FormatFunction · 0.70
MaxFunction · 0.50
LinkMethod · 0.45

Tested by

no test coverage detected