add texture transform extensions format

This commit is contained in:
hiroj
2019-03-18 17:03:42 +09:00
parent ea8fd83352
commit b904f564c2
3 changed files with 70 additions and 1 deletions

View File

@@ -0,0 +1,54 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UniJSON;
namespace UniGLTF
{
[Serializable]
public class glTF_KHR_texture_transform : JsonSerializableBase
{
public static string ExtensionName
{
get
{
return "KHR_texture_transform";
}
}
[JsonSchema(MinItems = 2, MaxItems = 2)]
public float[] offset = new float[2] { 0.0f, 0.0f };
public float rotation;
[JsonSchema(MinItems = 2, MaxItems = 2)]
public float[] scale = new float[2] { 1.0f, 1.0f };
[ItemJsonSchema(Minimum = 0)]
public int texCoord;
protected override void SerializeMembers(GLTFJsonFormatter f)
{
f.KeyValue(() => offset);
f.KeyValue(() => rotation);
f.KeyValue(() => scale);
f.KeyValue(() => texCoord);
}
}
[Serializable]
public class glTFTextureInfo_extensions : ExtensionsBase<glTFTextureInfo_extensions>
{
[JsonSchema(Required = true)]
public glTF_KHR_texture_transform KHR_texture_transform;
[JsonSerializeMembers]
void SerializeMembers_unlit(GLTFJsonFormatter f)
{
if (KHR_texture_transform != null)
{
f.KeyValue(() => KHR_texture_transform);
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 04b631e1572e84d47b88aebc3631865b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -28,13 +28,17 @@ namespace UniGLTF
public int texCoord;
// empty schemas
public object extensions;
public glTFTextureInfo_extensions extensions;
public object extras;
protected override void SerializeMembers(GLTFJsonFormatter f)
{
f.KeyValue(() => index);
f.KeyValue(() => texCoord);
if (extensions != null)
{
f.KeyValue(() => extensions);
}
}
public abstract glTFTextureTypes TextreType { get; }