brutal/Brutal.Gltf/GltfApi/GltfJsonContext.cs
BRUTAL release 4ac91e105e Update Slang, Vulkan, Gltf and ImGui. Offload natives to sub-packages.
Public-PR: https://github.com/ahwootech/BRUTAL/pull/9
Public-PR: https://github.com/ahwootech/BRUTAL/pull/15
Public-PR: https://github.com/ahwootech/BRUTAL/pull/21
Fixes: ahwootech/BRUTAL#8
Fixes: ahwootech/BRUTAL#22
Co-authored-by: Laurens de Voogd <laurens@devoogd.be>
Co-authored-by: sGo7-Dev <goulax16@gmail.com>
Co-authored-by: Capsup <capsup@live.dk>
2026-10-23 15:07:17 +13:00

27 lines
1.2 KiB
C#

using System.Text.Json;
using System.Text.Json.Serialization;
namespace Brutal.GltfApi;
/// <summary>
/// Source-generated System.Text.Json metadata for the glTF schema, so that loading and saving
/// works without reflection (trimming and Native AOT).
/// </summary>
/// <remarks>
/// The generator emits the other half of this class (<c>GeneratedSchema/GltfJsonContext.gen.cs</c>) with every
/// <see cref="JsonSerializableAttribute"/>: the document root, every extension root type, the nested enums and
/// <see cref="JsonElement"/>. Don't add <see cref="JsonSerializableAttribute"/> here; the System.Text.Json source
/// generator fails when more than one partial declaration carries it.
/// </remarks>
[JsonSourceGenerationOptions(
// glTF has no concept of an explicit JSON null; absent optional properties must be
// omitted entirely or strict validators reject the asset (e.g. "uri": null in GLB).
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
Converters = [
typeof(JsonHelpers.Float3JsonConverter),
typeof(JsonHelpers.Float4JsonConverter),
typeof(JsonHelpers.FloatQuatJsonConverter),
typeof(JsonHelpers.Float4X4JsonConverter),
]
)]
internal partial class GltfJsonContext : JsonSerializerContext;