mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-14 22:50:08 -05:00
TextureTransformTest
This commit is contained in:
parent
07729d8f9c
commit
4ceafe62a4
|
|
@ -29,6 +29,7 @@ namespace UniGLTF
|
|||
|
||||
var materialExporter = new MaterialExporter();
|
||||
var gltfMaterial = materialExporter.ExportMaterial(srcMaterial, textureManager);
|
||||
gltfMaterial.pbrMetallicRoughness.baseColorTexture.extensions.Parse();
|
||||
|
||||
var shaderStore = new ShaderStore(null);
|
||||
var materialImporter = new MaterialImporter(shaderStore, (int index) => { return null; });
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace UniGLTF
|
|||
#endregion
|
||||
|
||||
#region for Import
|
||||
readonly ListTreeNode<JsonValue> m_json;
|
||||
ListTreeNode<JsonValue> m_json;
|
||||
public glTFExtension(ListTreeNode<JsonValue> json)
|
||||
{
|
||||
m_json = json;
|
||||
|
|
@ -45,6 +45,27 @@ namespace UniGLTF
|
|||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// for unit test
|
||||
///
|
||||
/// parse exported value
|
||||
/// </summary>
|
||||
public void Parse()
|
||||
{
|
||||
var f = new JsonFormatter();
|
||||
f.BeginMap();
|
||||
foreach (var kv in Serialized)
|
||||
{
|
||||
f.Key(kv.Key);
|
||||
f.Raw(kv.Value);
|
||||
}
|
||||
f.EndMap();
|
||||
|
||||
var b = f.GetStoreBytes();
|
||||
var json = Encoding.UTF8.GetString(b.Array, b.Offset, b.Count);
|
||||
m_json = json.ParseAsJson();
|
||||
}
|
||||
}
|
||||
|
||||
public static class GltfExtensionFormatterExtensions
|
||||
|
|
|
|||
|
|
@ -33,17 +33,20 @@ namespace UniGLTF
|
|||
|
||||
public static bool TryGet(glTFMesh mesh, out List<string> targetNames)
|
||||
{
|
||||
foreach (var kv in mesh.extras.ObjectItems())
|
||||
if (mesh.extras != null)
|
||||
{
|
||||
if (kv.Key.GetUtf8String() == ExtraNameUtf8)
|
||||
foreach (var kv in mesh.extras.ObjectItems())
|
||||
{
|
||||
targetNames = Deserialize(kv.Value);
|
||||
return true;
|
||||
if (kv.Key.GetUtf8String() == ExtraNameUtf8)
|
||||
{
|
||||
targetNames = Deserialize(kv.Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// use first primitive
|
||||
if (mesh.primitives.Count > 0)
|
||||
if (mesh.primitives.Count > 0 && mesh.primitives[0].extras != null)
|
||||
{
|
||||
foreach (var kv in mesh.primitives[0].extras.ObjectItems())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -268,20 +268,10 @@ namespace UniGLTF
|
|||
var primitive = mesh.primitives.FirstOrDefault();
|
||||
var targets = primitive.targets;
|
||||
|
||||
List<string> targetNames;
|
||||
throw new NotImplementedException();
|
||||
// if(primitive != null && primitive.extras != null && primitive.extras.targetNames != null && primitive.extras.targetNames.Count > 0)
|
||||
// {
|
||||
// targetNames = primitive.extras.targetNames;
|
||||
// }
|
||||
// else if(mesh.extras != null && mesh.extras.targetNames != null && mesh.extras.targetNames.Count > 0)
|
||||
// {
|
||||
// targetNames = mesh.extras.targetNames;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// throw new Exception("glTF BlendShape Animation. targetNames invalid.");
|
||||
// }
|
||||
if (!gltf_mesh_extras_targetNames.TryGet(mesh, out List<string> targetNames))
|
||||
{
|
||||
throw new Exception("glTF BlendShape Animation. targetNames invalid.");
|
||||
}
|
||||
|
||||
var keyNames = targetNames
|
||||
.Where(x => !string.IsNullOrEmpty(x))
|
||||
|
|
@ -307,7 +297,7 @@ namespace UniGLTF
|
|||
}
|
||||
return values;
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -59,35 +59,91 @@ namespace VRM
|
|||
}
|
||||
|
||||
public static string ToJson(this glTF_VRM_MaterialValueBind self)
|
||||
{ return ""; }
|
||||
{
|
||||
var f = new JsonFormatter();
|
||||
f.GenSerialize(self);
|
||||
return f.ToString();
|
||||
}
|
||||
public static string ToJson(this glTF_VRM_BlendShapeBind self)
|
||||
{ return ""; }
|
||||
{
|
||||
var f = new JsonFormatter();
|
||||
f.GenSerialize(self);
|
||||
return f.ToString();
|
||||
}
|
||||
public static string ToJson(this glTF_VRM_BlendShapeGroup self)
|
||||
{ return ""; }
|
||||
{
|
||||
var f = new JsonFormatter();
|
||||
f.GenSerialize(self);
|
||||
return f.ToString();
|
||||
}
|
||||
public static string ToJson(this glTF_VRM_DegreeMap self)
|
||||
{ return ""; }
|
||||
{
|
||||
var f = new JsonFormatter();
|
||||
f.GenSerialize(self);
|
||||
return f.ToString();
|
||||
}
|
||||
public static string ToJson(this glTF_VRM_MeshAnnotation self)
|
||||
{ return ""; }
|
||||
{
|
||||
var f = new JsonFormatter();
|
||||
f.GenSerialize(self);
|
||||
return f.ToString();
|
||||
}
|
||||
public static string ToJson(this glTF_VRM_Firstperson self)
|
||||
{ return ""; }
|
||||
{
|
||||
var f = new JsonFormatter();
|
||||
f.GenSerialize(self);
|
||||
return f.ToString();
|
||||
}
|
||||
public static string ToJson(this glTF_VRM_HumanoidBone self)
|
||||
{ return ""; }
|
||||
{
|
||||
var f = new JsonFormatter();
|
||||
f.GenSerialize(self);
|
||||
return f.ToString();
|
||||
}
|
||||
public static string ToJson(this glTF_VRM_Humanoid self)
|
||||
{ return ""; }
|
||||
{
|
||||
var f = new JsonFormatter();
|
||||
f.GenSerialize(self);
|
||||
return f.ToString();
|
||||
}
|
||||
public static string ToJson(this glTF_VRM_Material self)
|
||||
{ return ""; }
|
||||
{
|
||||
var f = new JsonFormatter();
|
||||
f.GenSerialize(self);
|
||||
return f.ToString();
|
||||
}
|
||||
public static string ToJson(this glTF_VRM_Meta self)
|
||||
{ return ""; }
|
||||
{
|
||||
var f = new JsonFormatter();
|
||||
f.GenSerialize(self);
|
||||
return f.ToString();
|
||||
}
|
||||
public static string ToJson(this glTF_VRM_SecondaryAnimationCollider self)
|
||||
{ return ""; }
|
||||
{
|
||||
var f = new JsonFormatter();
|
||||
f.GenSerialize(self);
|
||||
return f.ToString();
|
||||
}
|
||||
public static string ToJson(this glTF_VRM_SecondaryAnimationColliderGroup self)
|
||||
{ return ""; }
|
||||
{
|
||||
var f = new JsonFormatter();
|
||||
f.GenSerialize(self);
|
||||
return f.ToString();
|
||||
}
|
||||
|
||||
public static string ToJson(this glTF_VRM_SecondaryAnimationGroup self)
|
||||
{ return ""; }
|
||||
{
|
||||
var f = new JsonFormatter();
|
||||
f.GenSerialize(self);
|
||||
return f.ToString();
|
||||
}
|
||||
|
||||
public static string ToJson(this glTF_VRM_SecondaryAnimation self)
|
||||
{ return ""; }
|
||||
{
|
||||
var f = new JsonFormatter();
|
||||
f.GenSerialize(self);
|
||||
return f.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public class UniVRMSerializeTests
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user