mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-29 06:28:25 +01:00
SOURCE DUMP v1
This commit is contained in:
parent
bd62d51ec9
commit
fb20299e9d
1 changed files with 768360 additions and 0 deletions
21
brutal.gltf/Brutal.Gltf/GltfApi/IExtensionGltfObject.cs
Normal file
21
brutal.gltf/Brutal.Gltf/GltfApi/IExtensionGltfObject.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
using System.Text.Json;
|
||||
|
||||
namespace Brutal.GltfApi;
|
||||
|
||||
public interface IExtensionGltfObject
|
||||
{
|
||||
public Dictionary<string, object>? Extensions { get; }
|
||||
}
|
||||
|
||||
public static class GltfExtensions
|
||||
{
|
||||
public static T? GetExtension<T>(this IExtensionGltfObject obj, string extensionName)
|
||||
where T : class
|
||||
{
|
||||
var extensionMap = obj.Extensions;
|
||||
if (extensionMap == null || !extensionMap.TryGetValue(extensionName, out var extObj))
|
||||
return null;
|
||||
JsonElement je = (JsonElement)extObj;
|
||||
return je.Deserialize<T>();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue