Fix extension loading
This commit is contained in:
@@ -165,8 +165,14 @@ namespace ReFuel.Gltf
|
||||
this.material.Id = index;
|
||||
}
|
||||
|
||||
// TODO: materials.
|
||||
// TODO: morph targets.
|
||||
if (element.TryGetProperty("targets", out JsonElement targetsElement))
|
||||
{
|
||||
foreach (JsonProperty property in materialElement.EnumerateObject())
|
||||
{
|
||||
//TODO: targets
|
||||
//this.Targets.Add(weights);
|
||||
}
|
||||
}
|
||||
|
||||
if (element.TryGetProperty("mode", out JsonElement modeElement))
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace ReFuel.Gltf
|
||||
{
|
||||
public abstract GltfObjectKind Kind { get; }
|
||||
public GltfDocument Document { get; protected set; }
|
||||
public GltfCollection Extension { get; protected set; } = new GltfCollection();
|
||||
public GltfCollection Extension { get; protected set; } = new GltfCollection(true);
|
||||
public GltfCollection Extras { get; protected set; } = new GltfCollection();
|
||||
|
||||
protected GltfObject()
|
||||
@@ -49,7 +49,7 @@ namespace ReFuel.Gltf
|
||||
{
|
||||
Extras.Parse(extras);
|
||||
}
|
||||
if (element.TryGetProperty("extension", out JsonElement extension))
|
||||
if (element.TryGetProperty("extensions", out JsonElement extension))
|
||||
{
|
||||
Extension.Parse(extension);
|
||||
}
|
||||
|
||||
@@ -5,12 +5,10 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace ReFuel.Gltf
|
||||
{
|
||||
public class GltfSerializedExtensionProvider<T> : IGltfExtensionProvider<T>
|
||||
public class GltfSerializedExtensionProvider<T> : IGltfExtensionProvider
|
||||
{
|
||||
public string Name { get; }
|
||||
|
||||
public Type? DataType { get; } = typeof(T);
|
||||
|
||||
public GltfSerializedExtensionProvider(string name)
|
||||
{
|
||||
Name = name;
|
||||
|
||||
@@ -6,15 +6,8 @@ namespace ReFuel.Gltf
|
||||
public interface IGltfExtensionProvider
|
||||
{
|
||||
string Name { get; }
|
||||
Type? DataType { get; }
|
||||
|
||||
object ParseExtensionObject(JsonElement element);
|
||||
void WriteExtensionObject(object obj, Utf8JsonWriter writer);
|
||||
}
|
||||
|
||||
public interface IGltfExtensionProvider<T> : IGltfExtensionProvider
|
||||
{
|
||||
T ParseExtension(JsonElement element);
|
||||
void WriteExtension(T value, Utf8JsonWriter writer);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user