mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-14 22:50:08 -05:00
fix glTFPbrMetallicRoughness init.
This commit is contained in:
parent
d864ba6d77
commit
446d5f0d58
|
|
@ -271,7 +271,7 @@ namespace UniGLTF
|
|||
};
|
||||
|
||||
var json = model.ToJson();
|
||||
Assert.AreEqual(@"{""name"":""a"",""emissiveFactor"":[0.5,0.5,0.5],""doubleSided"":false}", json);
|
||||
Assert.AreEqual(@"{""name"":""a"",""pbrMetallicRoughness"":{""baseColorFactor"":[1,1,1,1],""metallicFactor"":1,""roughnessFactor"":1},""emissiveFactor"":[0.5,0.5,0.5],""doubleSided"":false}", json);
|
||||
Debug.Log(json);
|
||||
|
||||
var c = new JsonSchemaValidationContext("")
|
||||
|
|
@ -279,7 +279,7 @@ namespace UniGLTF
|
|||
EnableDiagnosisForNotRequiredFields = true,
|
||||
};
|
||||
var json2 = JsonSchema.FromType<glTFMaterial>().Serialize(model, c);
|
||||
Assert.AreEqual(@"{""name"":""a"",""emissiveFactor"":[0.5,0.5,0.5],""doubleSided"":false}", json2);
|
||||
Assert.AreEqual(@"{""name"":""a"",""pbrMetallicRoughness"":{""baseColorFactor"":[1,1,1,1],""metallicFactor"":1,""roughnessFactor"":1},""emissiveFactor"":[0.5,0.5,0.5],""doubleSided"":false}", json2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -297,7 +297,7 @@ namespace UniGLTF
|
|||
EnableDiagnosisForNotRequiredFields = true,
|
||||
};
|
||||
var json = JsonSchema.FromType<glTFMaterial>().Serialize(model, c);
|
||||
Assert.AreEqual(@"{""name"":""a"",""emissiveFactor"":[0.5,0.5,0.5],""alphaMode"":""MASK"",""alphaCutoff"":0.5,""doubleSided"":false}", json);
|
||||
Assert.AreEqual(@"{""name"":""a"",""pbrMetallicRoughness"":{""baseColorFactor"":[1,1,1,1],""metallicFactor"":1,""roughnessFactor"":1},""emissiveFactor"":[0.5,0.5,0.5],""alphaMode"":""MASK"",""alphaCutoff"":0.5,""doubleSided"":false}", json);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
|||
|
|
@ -147,7 +147,10 @@ namespace UniGLTF
|
|||
public class glTFMaterial : JsonSerializableBase
|
||||
{
|
||||
public string name;
|
||||
public glTFPbrMetallicRoughness pbrMetallicRoughness;
|
||||
public glTFPbrMetallicRoughness pbrMetallicRoughness = new glTFPbrMetallicRoughness
|
||||
{
|
||||
baseColorFactor = new float[] { 1.0f, 1.0f, 1.0f, 1.0f },
|
||||
};
|
||||
public glTFMaterialNormalTextureInfo normalTexture = null;
|
||||
|
||||
public glTFMaterialOcclusionTextureInfo occlusionTexture = null;
|
||||
|
|
@ -214,8 +217,8 @@ namespace UniGLTF
|
|||
{
|
||||
return new glTFTextureInfo[]
|
||||
{
|
||||
pbrMetallicRoughness.baseColorTexture,
|
||||
pbrMetallicRoughness.metallicRoughnessTexture,
|
||||
(pbrMetallicRoughness != null)?pbrMetallicRoughness.baseColorTexture:null,
|
||||
(pbrMetallicRoughness != null)?pbrMetallicRoughness.metallicRoughnessTexture:null,
|
||||
normalTexture,
|
||||
occlusionTexture,
|
||||
emissiveTexture
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user