Implement DownloadDataCPU for Mesh and add result entries count

This commit is contained in:
Wojtek Figat
2021-08-05 16:40:28 +02:00
parent c5b9654547
commit fae682e406
10 changed files with 170 additions and 173 deletions

View File

@@ -5,16 +5,6 @@
#include "ModelBase.h"
#include "Engine/Graphics/Models/ModelLOD.h"
// Note: we use the first chunk as a header, next is the highest quality lod and then lower ones
//
// Example:
// Chunk 0: Header
// Chunk 1: LOD0
// Chunk 2: LOD1
// ..
//
#define MODEL_LOD_TO_CHUNK_INDEX(lod) (lod + 1)
class Mesh;
class StreamModelLODTask;

View File

@@ -7,6 +7,16 @@
#include "Engine/Graphics/Models/MaterialSlot.h"
#include "Engine/Streaming/StreamableResource.h"
// Note: we use the first chunk as a header, next is the highest quality lod and then lower ones
//
// Example:
// Chunk 0: Header
// Chunk 1: LOD0
// Chunk 2: LOD1
// ..
//
#define MODEL_LOD_TO_CHUNK_INDEX(lod) (lod + 1)
class MeshBase;
/// <summary>
@@ -58,7 +68,6 @@ public:
/// <summary>
/// Gets amount of the level of details in the model.
/// </summary>
/// <returns>Amount of the level of details in the model.</returns>
virtual int32 GetLODsCount() const = 0;
/// <summary>

View File

@@ -147,13 +147,13 @@ Array<String> SkinnedModel::GetBlendShapes()
ContentLoadTask* SkinnedModel::RequestLODDataAsync(int32 lodIndex)
{
const int32 chunkIndex = SKINNED_MODEL_LOD_TO_CHUNK_INDEX(lodIndex);
const int32 chunkIndex = MODEL_LOD_TO_CHUNK_INDEX(lodIndex);
return RequestChunkDataAsync(chunkIndex);
}
void SkinnedModel::GetLODData(int32 lodIndex, BytesContainer& data) const
{
const int32 chunkIndex = SKINNED_MODEL_LOD_TO_CHUNK_INDEX(lodIndex);
const int32 chunkIndex = MODEL_LOD_TO_CHUNK_INDEX(lodIndex);
GetChunkData(chunkIndex, data);
}
@@ -617,7 +617,7 @@ bool SkinnedModel::Save(bool withMeshDataFromGpu, const StringView& path)
}
// Override meshes data chunk with the fetched GPU meshes memory
auto lodChunk = GET_CHUNK(SKINNED_MODEL_LOD_TO_CHUNK_INDEX(lodIndex));
auto lodChunk = GET_CHUNK(MODEL_LOD_TO_CHUNK_INDEX(lodIndex));
if (lodChunk == nullptr)
return true;
lodChunk->Data.Copy(meshesStream.GetHandle(), meshesStream.GetPosition());
@@ -631,7 +631,7 @@ bool SkinnedModel::Save(bool withMeshDataFromGpu, const StringView& path)
// Load all chunks with a mesh data
for (int32 lodIndex = 0; lodIndex < LODs.Count(); lodIndex++)
{
if (LoadChunk(SKINNED_MODEL_LOD_TO_CHUNK_INDEX(lodIndex)))
if (LoadChunk(MODEL_LOD_TO_CHUNK_INDEX(lodIndex)))
return true;
}
}

View File

@@ -9,16 +9,6 @@
class StreamSkinnedModelLODTask;
// Note: we use the first chunk as a header, next is the highest quality lod and then lower ones
//
// Example:
// Chunk 0: Header
// Chunk 1: LOD0
// Chunk 2: LOD1
// ..
//
#define SKINNED_MODEL_LOD_TO_CHUNK_INDEX(lod) (lod + 1)
/// <summary>
/// Skinned model asset that contains model object made of meshes that can be rendered on the GPU using skeleton bones skinning.
/// </summary>