You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Added the option to allow the import of non-power of two textures in the interchange generic texture pipeline. Added some static assert to the interchange texture factory to help the long term maintenance. Added some functions to the interchange texture 2d factory node to help the manipulation of udims source blocks. Removed some texture translators since they can share their implementation. That also fixed the difference between interchange and the legacy factory. Removed a copy of the raw source data for most of the image that are imported by the image wrappers (Tiff was already able to avoid the copy before that). This will greatly reduce the peak memory usage during the imports. Fixed some other minor issues. #jira UE-146448, UE-146450, UE-146715, UE-146718 #rb Alexis.Mate #preflight 6269899ff97c319beba3575c [CL 19944368 by Julien StJean in ue5-main branch]
44 lines
924 B
C++
44 lines
924 B
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "TextureImportUtils.h"
|
|
|
|
#include "ImageCore.h"
|
|
|
|
namespace UE
|
|
{
|
|
namespace TextureUtilitiesCommon
|
|
{
|
|
/**
|
|
* Detect the existence of gray scale image in some formats and convert those to a gray scale equivalent image
|
|
*
|
|
* @return true if the image was converted
|
|
*/
|
|
bool AutoDetectAndChangeGrayScale(FImage& Image)
|
|
{
|
|
if (Image.Format != ERawImageFormat::BGRA8)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
// auto-detect gray BGRA8 and change to G8
|
|
|
|
const FColor* Colors = (const FColor*)Image.RawData.GetData();
|
|
int64 NumPixels = Image.GetNumPixels();
|
|
|
|
for (int64 i = 0; i < NumPixels; i++)
|
|
{
|
|
if (Colors[i].A != 255 ||
|
|
Colors[i].R != Colors[i].B ||
|
|
Colors[i].G != Colors[i].B)
|
|
{
|
|
return false ;
|
|
}
|
|
}
|
|
|
|
// yes, it's gray, do it :
|
|
Image.ChangeFormat(ERawImageFormat::G8, Image.GammaSpace);
|
|
|
|
return true;
|
|
}
|
|
}
|
|
} |