Refactor asset import API and mesh streaming pipeline

- Standardize IImportableAssetHandler.ImportAsync to return sub-asset results
- Remove ISubAssetImportableAssetHandler, merge into main interface
- Update FBX/Texture handlers for new import contract
- Add StreamUtility for efficient (async) binary writes
- Refactor meshlet/LOD building to use ref structs and safe memory
- Use new streaming utilities in mesh import/export and tests
- AssetCatalog.Remove now recursively deletes sub-assets
- Improve asset registry file watcher for better change detection
- Log unhandled exceptions in App instead of breaking
- Add interpolated collection support to NativeMemoryManager
- Update project references and fix minor bugs
This commit is contained in:
2026-05-05 17:19:24 +09:00
parent 8d3e1c91d7
commit 5de480e231
15 changed files with 214 additions and 180 deletions

View File

@@ -14,6 +14,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Runtime\Ghost.Core\Ghost.Core.csproj" />
<ProjectReference Include="..\..\Test\Ghost.Test.Core\Ghost.Test.Core.csproj" />
<ProjectReference Include="..\..\ThridParty\Ghost.Nvtt\Ghost.Nvtt.csproj" />
<ProjectReference Include="..\..\ThridParty\Ghost.StbI\Ghost.StbI.csproj" />

View File

@@ -1,4 +1,5 @@
using Ghost.Core;
using Ghost.Core.Utilities;
using Ghost.Engine;
using Ghost.Graphics.Core;
using Ghost.Graphics.RHI;
@@ -143,18 +144,18 @@ internal class MockingContentProvider : IContentProvider
boundsMax = new float3(1, 1, 0),
};
WriteStruct(stream, in header);
header.vertexOffset = (ulong)stream.Position; WriteSpan(stream, vertices);
header.indexOffset = (ulong)stream.Position; WriteSpan(stream, indices);
header.materialPartOffset = (ulong)stream.Position; WriteSpan(stream, materialParts);
header.meshletOffset = (ulong)stream.Position; WriteSpan(stream, meshlets);
header.meshletGroupOffset = (ulong)stream.Position; WriteSpan(stream, groups);
header.meshletHierarchyNodeOffset = (ulong)stream.Position; WriteSpan(stream, hierarchy);
header.meshletVertexOffset = (ulong)stream.Position; WriteSpan(stream, meshletVertices);
header.meshletTriangleOffset = (ulong)stream.Position; WriteSpan(stream, meshletTriangles);
stream.Write(header);
header.vertexOffset = (ulong)stream.Position; stream.Write(vertices);
header.indexOffset = (ulong)stream.Position; stream.Write(indices);
header.materialPartOffset = (ulong)stream.Position; stream.Write(materialParts);
header.meshletOffset = (ulong)stream.Position; stream.Write(meshlets);
header.meshletGroupOffset = (ulong)stream.Position; stream.Write(groups);
header.meshletHierarchyNodeOffset = (ulong)stream.Position; stream.Write(hierarchy);
header.meshletVertexOffset = (ulong)stream.Position; stream.Write(meshletVertices);
header.meshletTriangleOffset = (ulong)stream.Position; stream.Write(meshletTriangles);
stream.Position = 0;
WriteStruct(stream, in header);
stream.Write(header);
AddMockAsset(guid, new MockAssetData
{
@@ -164,18 +165,6 @@ internal class MockingContentProvider : IContentProvider
});
}
private static void WriteStruct<T>(Stream stream, ref readonly T value)
where T : unmanaged
{
stream.Write(MemoryMarshal.AsBytes(MemoryMarshal.CreateReadOnlySpan(in value, 1)));
}
private static void WriteSpan<T>(Stream stream, ReadOnlySpan<T> value)
where T : unmanaged
{
stream.Write(MemoryMarshal.AsBytes(value));
}
public AssetType GetAssetType(Guid guid)
{
return _assets.TryGetValue(guid, out var asset) ? asset.type : AssetType.Unknown;