Another compilation fix

This commit is contained in:
Wojtek Figat
2025-01-14 23:26:26 +01:00
parent be8686bbb2
commit d0a6edbb2c
5 changed files with 28 additions and 30 deletions

View File

@@ -404,7 +404,7 @@ bool Model::SaveHeader(WriteStream& stream)
{
if (ModelBase::SaveHeader(stream))
return true;
static_assert(HeaderVersion == 2, "Update code");
static_assert(MODEL_HEADER_VERSION == 2, "Update code");
// LODs
stream.Write((byte)LODs.Count());
@@ -431,7 +431,7 @@ bool Model::SaveHeader(WriteStream& stream, const ModelData& modelData)
{
if (ModelBase::SaveHeader(stream, modelData))
return true;
static_assert(HeaderVersion == 2, "Update code");
static_assert(MODEL_HEADER_VERSION == 2, "Update code");
// LODs
stream.Write((byte)modelData.LODs.Count());

View File

@@ -66,7 +66,7 @@ public:
Array<MeshBase*> meshes;
model->GetMeshes(meshes, _lodIndex);
byte meshVersion = stream.ReadByte();
if (meshVersion < 2 || meshVersion > ModelBase::MeshVersion)
if (meshVersion < 2 || meshVersion > MODEL_MESH_VERSION)
{
LOG(Warning, "Unsupported mesh version {}", meshVersion);
return true;
@@ -315,12 +315,12 @@ bool ModelBase::LoadHeader(ReadStream& stream, byte& headerVersion)
{
// Basic info
stream.Read(headerVersion);
if (headerVersion < 2 || headerVersion > HeaderVersion)
if (headerVersion < 2 || headerVersion > MODEL_HEADER_VERSION)
{
LOG(Warning, "Unsupported model asset header version {}", headerVersion);
return true;
}
static_assert(HeaderVersion == 2, "Update code");
static_assert(MODEL_HEADER_VERSION == 2, "Update code");
stream.Read(MinScreenSize);
// Materials
@@ -344,7 +344,7 @@ bool ModelBase::LoadHeader(ReadStream& stream, byte& headerVersion)
bool ModelBase::LoadMesh(MemoryReadStream& stream, byte meshVersion, MeshBase* mesh, MeshData* dataIfReadOnly)
{
// Load descriptor
static_assert(MeshVersion == 2, "Update code");
static_assert(MODEL_MESH_VERSION == 2, "Update code");
uint32 vertices, triangles;
stream.Read(vertices);
stream.Read(triangles);
@@ -402,8 +402,8 @@ bool ModelBase::LoadMesh(MemoryReadStream& stream, byte meshVersion, MeshBase* m
bool ModelBase::SaveHeader(WriteStream& stream)
{
// Basic info
static_assert(HeaderVersion == 2, "Update code");
stream.Write(HeaderVersion);
static_assert(MODEL_HEADER_VERSION == 2, "Update code");
stream.Write(MODEL_HEADER_VERSION);
stream.Write(MinScreenSize);
// Materials
@@ -446,8 +446,8 @@ bool ModelBase::SaveHeader(WriteStream& stream, const ModelData& modelData)
}
// Basic info
static_assert(HeaderVersion == 2, "Update code");
stream.Write(HeaderVersion);
static_assert(MODEL_HEADER_VERSION == 2, "Update code");
stream.Write(MODEL_HEADER_VERSION);
stream.Write(modelData.MinScreenSize);
// Materials
@@ -518,8 +518,8 @@ bool ModelBase::SaveLOD(WriteStream& stream, int32 lodIndex) const
return true;
// Create meshes data
static_assert(MeshVersion == 2, "Update code");
stream.Write(MeshVersion);
static_assert(MODEL_MESH_VERSION == 2, "Update code");
stream.Write(MODEL_MESH_VERSION);
for (int32 meshIndex = 0; meshIndex < meshesCount; meshIndex++)
{
const auto& mesh = *meshes[meshIndex];
@@ -609,8 +609,8 @@ bool ModelBase::SaveLOD(WriteStream& stream, int32 lodIndex) const
bool ModelBase::SaveLOD(WriteStream& stream, const ModelData& modelData, int32 lodIndex, bool saveMesh(WriteStream& stream, const ModelData& modelData, int32 lodIndex, int32 meshIndex))
{
// Create meshes data
static_assert(MeshVersion == 2, "Update code");
stream.Write(MeshVersion);
static_assert(MODEL_MESH_VERSION == 2, "Update code");
stream.Write(MODEL_MESH_VERSION);
const auto& lod = modelData.LODs[lodIndex];
for (int32 meshIndex = 0; meshIndex < lod.Meshes.Count(); meshIndex++)
{

View File

@@ -18,6 +18,9 @@
// Chunk 15: SDF
#define MODEL_LOD_TO_CHUNK_INDEX(lod) (lod + 1)
#define MODEL_HEADER_VERSION (byte)2
#define MODEL_MESH_VERSION (byte)2
class MeshBase;
class StreamModelLODTask;
struct RenderContextBatch;
@@ -114,9 +117,6 @@ API_CLASS(Abstract, NoSpawn) class FLAXENGINE_API ModelBase : public BinaryAsset
friend StreamModelLODTask;
protected:
static constexpr byte HeaderVersion = 2;
static constexpr byte MeshVersion = 2;
bool _initialized = false;
int32 _loadedLODs = 0;
StreamModelLODTask* _streamingTask = nullptr;

View File

@@ -533,7 +533,7 @@ bool SkinnedModel::LoadMesh(MemoryReadStream& stream, byte meshVersion, MeshBase
{
if (ModelBase::LoadMesh(stream, meshVersion, mesh, dataIfReadOnly))
return true;
static_assert(MeshVersion == 2, "Update code");
static_assert(MODEL_MESH_VERSION == 2, "Update code");
auto skinnedMesh = (SkinnedMesh*)mesh;
// Blend Shapes
@@ -562,7 +562,7 @@ bool SkinnedModel::LoadHeader(ReadStream& stream, byte& headerVersion)
{
if (ModelBase::LoadHeader(stream, headerVersion))
return true;
static_assert(HeaderVersion == 2, "Update code");
static_assert(MODEL_HEADER_VERSION == 2, "Update code");
// LODs
byte lods = stream.ReadByte();
@@ -665,7 +665,7 @@ bool SkinnedModel::SaveHeader(WriteStream& stream)
{
if (ModelBase::SaveHeader(stream))
return true;
static_assert(HeaderVersion == 2, "Update code");
static_assert(MODEL_HEADER_VERSION == 2, "Update code");
// LODs
stream.Write((byte)LODs.Count());
@@ -727,7 +727,7 @@ bool SkinnedModel::SaveHeader(WriteStream& stream, const ModelData& modelData)
{
if (ModelBase::SaveHeader(stream, modelData))
return true;
static_assert(HeaderVersion == 2, "Update code");
static_assert(MODEL_HEADER_VERSION == 2, "Update code");
// LODs
stream.Write((byte)modelData.LODs.Count());
@@ -788,7 +788,7 @@ bool SkinnedModel::SaveMesh(WriteStream& stream, const MeshBase* mesh) const
{
if (ModelBase::SaveMesh(stream, mesh))
return true;
static_assert(MeshVersion == 2, "Update code");
static_assert(MODEL_MESH_VERSION == 2, "Update code");
auto skinnedMesh = (const SkinnedMesh*)mesh;
// Blend Shapes
@@ -802,7 +802,7 @@ bool SkinnedModel::SaveMesh(WriteStream& stream, const MeshBase* mesh) const
bool SkinnedModel::SaveMesh(WriteStream& stream, const ModelData& modelData, int32 lodIndex, int32 meshIndex)
{
static_assert(MeshVersion == 2, "Update code");
static_assert(MODEL_MESH_VERSION == 2, "Update code");
auto& mesh = modelData.LODs[lodIndex].Meshes[meshIndex];
// Blend Shapes

View File

@@ -14,10 +14,8 @@
#include "Engine/Core/Collections/Dictionary.h"
#include "Engine/Utilities/StringConverter.h"
#include "Engine/Graphics/RenderTask.h"
#include "Engine/Graphics/PixelFormatSampler.h"
#include "Engine/Graphics/Textures/TextureData.h"
// hack using TextureTool in Platform module -> TODO: move texture data sampling to texture data itself
#define COMPILE_WITH_TEXTURE_TOOL 1
#include "Engine/Tools/TextureTool/TextureTool.h"
#include "IncludeX11.h"
// ICCCM
@@ -888,13 +886,13 @@ void LinuxWindow::SetIcon(TextureData& icon)
const auto mipData = mip.Data.Get<Color32>();
const auto iconData = icon.GetData(0, 0);
const Int2 iconSize(icon.Width, icon.Height);
const auto sampler = TextureTool::GetSampler(icon.Format);
const auto sampler = PixelFormatSampler::GetSampler(icon.Format);
for (int32 y = 0; y < icon.Height; y++)
{
for (int32 x = 0; x < icon.Width; x++)
{
const Float2 uv((float)x / icon.Width, (float)y / icon.Height);
Color color = TextureTool::SampleLinear(sampler, uv, iconData->Data.Get(), iconSize, iconData->RowPitch);
Color color = sampler->SampleLinear(iconData->Data.Get(), uv, iconSize, iconData->RowPitch);
*(mipData + y * icon.Width + x) = Color32(color);
}
}
@@ -932,13 +930,13 @@ void LinuxWindow::SetIcon(TextureData& icon)
const auto mipData = mip.Data.Get<Color32>();
const auto iconData = icon.GetData(0, 0);
const Int2 iconSize(icon.Width, icon.Height);
const auto sampler = TextureTool::GetSampler(img.Format);
const auto sampler = PixelFormatSampler::GetSampler(img.Format);
for (int32 y = 0; y < newHeight; y++)
{
for (int32 x = 0; x < newWidth; x++)
{
const Float2 uv((float)x / newWidth, (float)y / newHeight);
Color color = TextureTool::SampleLinear(sampler, uv, iconData->Data.Get(), iconSize, iconData->RowPitch);
Color color = sampler->SampleLinear(iconData->Data.Get(), uv, iconSize, iconData->RowPitch);
*(mipData + y * newWidth + x) = Color32(color);
}
}