Fixed compilation errors;

Added MaterialPalette
This commit is contained in:
2026-03-14 12:27:49 +09:00
parent 8a3b40b4f8
commit 912b320d8f
27 changed files with 1870 additions and 483 deletions

View File

@@ -7,7 +7,7 @@ namespace Ghost.Entities.Test;
internal struct TestEntityQueryJob : IJobEntity<Transform>
{
public readonly void Execute(Entity entity, ref Transform transform, int threadIndex)
public readonly void Execute(Entity entity, ref Transform transform, ref readonly JobExecutionContext ctx)
{
transform.position += new float3(5, 5, 5);
}
@@ -15,9 +15,9 @@ internal struct TestEntityQueryJob : IJobEntity<Transform>
internal struct TestChunkQueryJob : IJobChunk
{
public readonly void Execute(ChunkView view, int threadIndex)
public readonly void Execute(ChunkView view, ref readonly JobExecutionContext ctx)
{
var random = new random((uint)threadIndex + 1u);
var random = new random((uint)ctx.ThreadIndex + 1u);
var transforms = view.GetComponentDataRW<Transform>();
for (var i = 0; i < view.Count; i++)
@@ -54,7 +54,7 @@ public partial class EntityQueryTest : ITest
var testJob = new TestChunkQueryJob();
var handle = query.ScheduleChunkParallel(testJob, 1, JobHandle.Invalid);
_jobScheduler.WaitComplete(handle);
_jobScheduler.Wait(handle);
query.ForEach<Transform>((e, ref t) =>
{

View File

@@ -19,8 +19,7 @@ internal class SystemTest : ITest
group.SortSystems();
var api = new SystemAPI();
_world.SystemManager.InitializeAll(in api);
_world.SystemManager.InitializeAll(new TimeData());
}
public void Cleanup()

View File

@@ -1,7 +1,8 @@
using Ghost.DSL.Generator;
using Misaki.HighPerformance.Mathematics;
using System.Numerics;
//ShaderStructGenerator.GenerateHLSL([typeof(TestStruct), typeof(TestEnum), typeof(TestEnumFlags)], PackingRules.Exact, "C:/Users/Misaki/Downloads/Archive/Test.cs.hlsl");
ShaderStructGenerator.GenerateHLSL([typeof(TestStruct), typeof(TestEnum), typeof(TestEnumFlags)], PackingRules.Exact, "C:/Users/Misaki/Downloads/Archive/Test.cs.hlsl");
//return;
#if false

View File

@@ -1,3 +1,4 @@
#if false
using Ghost.Core;
namespace Ghost.UnitTest;
@@ -432,3 +433,4 @@ public class AssetDatabaseIntegrationTest
CheckInternalErrors();
}
}
#endif

View File

@@ -1,92 +0,0 @@
using System.Text.Json;
namespace Ghost.UnitTest;
[TestClass]
public class AssetMetaTest
{
[TestMethod]
public void TestMetaSerialization()
{
var meta = new AssetMeta
{
Guid = Guid.NewGuid(),
Version = 1,
Tags = new List<string> { "Test", "Asset" }
};
var json = JsonSerializer.Serialize(meta, new JsonSerializerOptions { WriteIndented = true });
Assert.IsNotNull(json);
Assert.Contains("Guid", json);
Assert.Contains("Version", json);
Assert.Contains("Tags", json);
}
[TestMethod]
public void TestMetaDeserialization()
{
var guid = Guid.NewGuid();
var json = $@"{{
""Guid"": ""{guid}"",
""Version"": 1,
""Tags"": [""Test"", ""Asset""]
}}";
var meta = JsonSerializer.Deserialize<AssetMeta>(json);
Assert.IsNotNull(meta);
Assert.AreEqual(guid, meta.Guid);
Assert.AreEqual(1, meta.Version);
Assert.HasCount(2, meta.Tags);
Assert.Contains("Test", meta.Tags);
}
[TestMethod]
public void TestMetaWithSettings()
{
var meta = new AssetMeta
{
Guid = Guid.NewGuid(),
Version = 1
};
// Add importer settings using the new API
var settings = new TextImporterSettings
{
Encoding = "UTF-8",
TrimWhitespace = true
};
meta.SetImporterSettings("TextImporter", settings);
var json = JsonSerializer.Serialize(meta, new JsonSerializerOptions { WriteIndented = true });
var deserialized = JsonSerializer.Deserialize<AssetMeta>(json);
Assert.IsNotNull(deserialized);
Assert.Contains("TextImporter", deserialized.ImporterSettings.Keys);
// Test retrieving the settings
var retrievedSettings = deserialized.GetImporterSettings<TextImporterSettings>("TextImporter");
Assert.IsNotNull(retrievedSettings);
Assert.AreEqual("UTF-8", retrievedSettings.Encoding);
Assert.IsTrue(retrievedSettings.TrimWhitespace);
}
[TestMethod]
public void TestFileHashAndDependenciesNotSerialized()
{
var meta = new AssetMeta
{
Guid = Guid.NewGuid(),
Version = 1
};
var json = JsonSerializer.Serialize(meta, new JsonSerializerOptions { WriteIndented = true });
// FileHash and Dependencies should NOT be in the serialized JSON
Assert.DoesNotContain("FileHash", json);
Assert.DoesNotContain("Dependencies", json);
}
}