mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-10 12:59:17 -05:00
@@ -191,6 +191,11 @@ namespace UniGLTF
|
||||
var gltf = new glTF
|
||||
{
|
||||
materials = new System.Collections.Generic.List<glTFMaterial> { material },
|
||||
textures = new List<glTFTexture>{
|
||||
new glTFTexture{
|
||||
name = "texture_0"
|
||||
}
|
||||
},
|
||||
};
|
||||
var task = DefaultCreateMaterialAsync(default(ImmediateCaller), gltf, i, null);
|
||||
return task.Result;
|
||||
|
||||
@@ -111,7 +111,10 @@ namespace UniGLTF
|
||||
alphaMode = "OPAQUE",
|
||||
pbrMetallicRoughness = new glTFPbrMetallicRoughness
|
||||
{
|
||||
baseColorTexture = new glTFMaterialBaseColorTextureInfo(),
|
||||
baseColorTexture = new glTFMaterialBaseColorTextureInfo
|
||||
{
|
||||
index = 0,
|
||||
},
|
||||
},
|
||||
extensions = glTF_KHR_materials_unlit.Serialize().Deserialize(),
|
||||
};
|
||||
@@ -127,7 +130,10 @@ namespace UniGLTF
|
||||
pbrMetallicRoughness = new glTFPbrMetallicRoughness
|
||||
{
|
||||
baseColorFactor = new float[] { 1, 0, 0, 1 },
|
||||
baseColorTexture = new glTFMaterialBaseColorTextureInfo(),
|
||||
baseColorTexture = new glTFMaterialBaseColorTextureInfo
|
||||
{
|
||||
index = 0
|
||||
},
|
||||
},
|
||||
extensions = glTF_KHR_materials_unlit.Serialize().Deserialize(),
|
||||
};
|
||||
@@ -157,7 +163,10 @@ namespace UniGLTF
|
||||
alphaMode = "BLEND",
|
||||
pbrMetallicRoughness = new glTFPbrMetallicRoughness
|
||||
{
|
||||
baseColorTexture = new glTFMaterialBaseColorTextureInfo(),
|
||||
baseColorTexture = new glTFMaterialBaseColorTextureInfo
|
||||
{
|
||||
index = 0,
|
||||
},
|
||||
},
|
||||
extensions = glTF_KHR_materials_unlit.Serialize().Deserialize(),
|
||||
};
|
||||
@@ -173,7 +182,10 @@ namespace UniGLTF
|
||||
pbrMetallicRoughness = new glTFPbrMetallicRoughness
|
||||
{
|
||||
baseColorFactor = new float[] { 1, 0, 0, 1 },
|
||||
baseColorTexture = new glTFMaterialBaseColorTextureInfo(),
|
||||
baseColorTexture = new glTFMaterialBaseColorTextureInfo
|
||||
{
|
||||
index = 0,
|
||||
},
|
||||
},
|
||||
extensions = glTF_KHR_materials_unlit.Serialize().Deserialize(),
|
||||
};
|
||||
@@ -188,7 +200,10 @@ namespace UniGLTF
|
||||
alphaMode = "MASK",
|
||||
pbrMetallicRoughness = new glTFPbrMetallicRoughness
|
||||
{
|
||||
baseColorTexture = new glTFMaterialBaseColorTextureInfo(),
|
||||
baseColorTexture = new glTFMaterialBaseColorTextureInfo
|
||||
{
|
||||
index = 0,
|
||||
},
|
||||
},
|
||||
extensions = glTF_KHR_materials_unlit.Serialize().Deserialize(),
|
||||
};
|
||||
@@ -204,7 +219,10 @@ namespace UniGLTF
|
||||
pbrMetallicRoughness = new glTFPbrMetallicRoughness
|
||||
{
|
||||
baseColorFactor = new float[] { 1, 0, 0, 1 },
|
||||
baseColorTexture = new glTFMaterialBaseColorTextureInfo(),
|
||||
baseColorTexture = new glTFMaterialBaseColorTextureInfo
|
||||
{
|
||||
index = 0,
|
||||
},
|
||||
},
|
||||
extensions = glTF_KHR_materials_unlit.Serialize().Deserialize(),
|
||||
};
|
||||
|
||||
@@ -26,7 +26,14 @@ namespace UniVRM10
|
||||
}
|
||||
if (node.rotation != null && node.rotation.Length == 4)
|
||||
{
|
||||
// throw new NotImplementedException("not normalized !");
|
||||
if (node.rotation[0] == 0 && node.rotation[1] == 0 && node.rotation[2] == 0 && node.rotation[3] == 1)
|
||||
{
|
||||
// indentity
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotImplementedException("not normalized !");
|
||||
}
|
||||
}
|
||||
if (node.scale != null && node.scale.Length == 3)
|
||||
{
|
||||
|
||||
@@ -75,27 +75,27 @@ namespace UniVRM10
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RotateTest()
|
||||
public void RotateY180Test()
|
||||
{
|
||||
var euler = new Vector3(0, 10, 20);
|
||||
var r = Quaternion.Euler(euler);
|
||||
var node = new glTFNode
|
||||
{
|
||||
translation = new float[] { 1, 2, 3 },
|
||||
rotation = new float[] { r.x, r.y, r.z, r.w },
|
||||
// rotation = new float[] { r.x, r.y, r.z, r.w },
|
||||
scale = new float[] { 1, 2, 3 },
|
||||
};
|
||||
RotateY180.Rotate(node);
|
||||
|
||||
Assert.AreEqual(new Vector3(-1, 2, 3), node.translation.ToVector3().ToUnityVector3());
|
||||
Assert.AreEqual(new Vector3(-1, 2, -3), node.translation.ToVector3().ToUnityVector3());
|
||||
Assert.AreEqual(new Vector3(1, 2, 3), node.scale.ToVector3().ToUnityVector3());
|
||||
|
||||
var result = node.rotation.ToQuaternion().ToUnityQuaternion().eulerAngles;
|
||||
Debug.LogFormat($"{result}");
|
||||
// var result = node.rotation.ToQuaternion().ToUnityQuaternion().eulerAngles;
|
||||
// Debug.LogFormat($"{result}");
|
||||
|
||||
Assert.True(Nearly(0, result.x));
|
||||
Assert.True(Nearly(360 - 10, result.y));
|
||||
Assert.True(Nearly(360 - 20, result.z));
|
||||
// Assert.True(Nearly(0, result.x));
|
||||
// Assert.True(Nearly(10, result.y));
|
||||
// Assert.True(Nearly(20, result.z));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in New Issue
Block a user