Texture2DToArrUint8 void A::Texture2DToArrUint8(UTexture2D* Texture2D, TArray<uint8>& Pixels, int& SizeX, int& SizeY) { if (Texture2D == nullptr) { return; } FTexturePlatformData* TexturePlatformData = Texture2D->GetPlatformData(); if (TexturePlatformData == nullptr || TexturePlatformData->Mips.Num() == 0) { return; } Pixels.Empty(); SizeX = TexturePlatformData->SizeX; SizeY = TexturePlatformData->SizeY; FByteBulkData& BulkData = TexturePlatformData->Mips[0].BulkData; uint8* Data = (uint8*)BulkData.Lock(LOCK_READ_ONLY); Pixels.Append(Data, BulkData.GetBulkDataSize()); BulkData.Unlock(); } ArrUint8ToTexture2D if (Pixels.Num() == static_cast<int64>(SizeX) * static_cast<int64>(SizeY) * static_cast<int64>(GPixelFormats[PF_B8G8R8A8].BlockBytes)) { UTexture2D* NewTexture = UTexture2D::CreateTransient(SizeX, SizeY, PF_B8G8R8A8); uint8*
UTexture2D 和 uint8 转换
最新推荐文章于 2024-02-25 17:30:28 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)