Add support for stripping texture resolution for target platform when cooking game

This commit is contained in:
Wojtek Figat
2021-06-17 16:01:01 +02:00
parent 4744fa05ef
commit 289515a78b
7 changed files with 234 additions and 88 deletions

View File

@@ -12,6 +12,51 @@
#include "Engine/Profiler/ProfilerCPU.h"
#include "Engine/Content/Factories/BinaryAssetFactory.h"
TextureMipData::TextureMipData()
: RowPitch(0)
, DepthPitch(0)
, Lines(0)
{
}
TextureMipData::TextureMipData(const TextureMipData& other)
: RowPitch(other.RowPitch)
, DepthPitch(other.DepthPitch)
, Lines(other.Lines)
, Data(other.Data)
{
}
TextureMipData::TextureMipData(TextureMipData&& other) noexcept
: RowPitch(other.RowPitch)
, DepthPitch(other.DepthPitch)
, Lines(other.Lines)
, Data(std::move(other.Data))
{
}
TextureMipData& TextureMipData::operator=(const TextureMipData& other)
{
if (this == &other)
return *this;
RowPitch = other.RowPitch;
DepthPitch = other.DepthPitch;
Lines = other.Lines;
Data = other.Data;
return *this;
}
TextureMipData& TextureMipData::operator=(TextureMipData&& other) noexcept
{
if (this == &other)
return *this;
RowPitch = other.RowPitch;
DepthPitch = other.DepthPitch;
Lines = other.Lines;
Data = MoveTemp(other.Data);
return *this;
}
REGISTER_BINARY_ASSET_ABSTRACT(TextureBase, "FlaxEngine.TextureBase");
TextureBase::TextureBase(const SpawnParams& params, const AssetInfo* info)

View File

@@ -19,6 +19,12 @@ public:
uint32 Lines;
BytesContainer Data;
TextureMipData();
TextureMipData(const TextureMipData& other);
TextureMipData(TextureMipData&& other) noexcept;
TextureMipData& operator=(const TextureMipData& other);
TextureMipData& operator=(TextureMipData&& other) noexcept;
template<typename T>
T& Get(int32 x, int32 y)
{
@@ -120,7 +126,6 @@ public:
/// <summary>
/// Gets amount of textures in the array
/// </summary>
/// <returns>Array size</returns>
int32 GetArraySize() const
{
return Items.Count();
@@ -129,7 +134,6 @@ public:
/// <summary>
/// Gets amount of mip maps in the textures
/// </summary>
/// <returns>Amount of mip levels</returns>
int32 GetMipLevels() const
{
return Items.HasItems() ? Items[0].Mips.Count() : 0;