|
|
@@ -78,12 +78,47 @@ namespace SharpGLTF.Schema2.Authoring
|
|
|
, (new Vector3(-10, -10, 0), new Vector2(1, 1))
|
|
|
);
|
|
|
|
|
|
- var model = ModelRoot.CreateModel();
|
|
|
- var scene = model.UseScene("Default");
|
|
|
- var rnode = scene.CreateNode("RootNode").WithMesh(model.CreateMesh(mesh));
|
|
|
+ var scene = new Scenes.SceneBuilder();
|
|
|
+ scene.AddMesh(mesh, Matrix4x4.Identity);
|
|
|
+
|
|
|
+ scene.AttachToCurrentTest("result.glb");
|
|
|
+ scene.AttachToCurrentTest("result.gltf");
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test(Description = "Creates a quad mesh with a complex material")]
|
|
|
+ public void CreateSceneWithClearCoatExtension()
|
|
|
+ {
|
|
|
+ TestContext.CurrentContext.AttachShowDirLink();
|
|
|
+ TestContext.CurrentContext.AttachGltfValidatorLinks();
|
|
|
+
|
|
|
+ var basePath = System.IO.Path.Combine(TestFiles.RootDirectory, "glTF-Sample-Models", "2.0", "SpecGlossVsMetalRough", "glTF");
|
|
|
+
|
|
|
+ // first, create a default material
|
|
|
+ var material = new Materials.MaterialBuilder("material")
|
|
|
+ .WithMetallicRoughnessShader()
|
|
|
+ .WithChannelImage(Materials.KnownChannel.Normal, System.IO.Path.Combine(basePath, "WaterBottle_normal.png"))
|
|
|
+ .WithChannelImage(Materials.KnownChannel.Emissive, System.IO.Path.Combine(basePath, "WaterBottle_emissive.png"))
|
|
|
+ .WithChannelImage(Materials.KnownChannel.Occlusion, System.IO.Path.Combine(basePath, "WaterBottle_occlusion.png"))
|
|
|
+ .WithChannelImage(Materials.KnownChannel.BaseColor, System.IO.Path.Combine(basePath, "WaterBottle_baseColor.png"))
|
|
|
+ .WithChannelImage(Materials.KnownChannel.MetallicRoughness, System.IO.Path.Combine(basePath, "WaterBottle_roughnessMetallic.png"))
|
|
|
+ .WithChannelImage(Materials.KnownChannel.ClearCoat, System.IO.Path.Combine(basePath, "WaterBottle_emissive.png"))
|
|
|
+ .WithChannelParam(Materials.KnownChannel.ClearCoat, new Vector4(0.5f, 0, 0, 0))
|
|
|
+ .WithChannelImage(Materials.KnownChannel.ClearCoatRoughness, System.IO.Path.Combine(basePath, "WaterBottle_roughnessMetallic.png"))
|
|
|
+ .WithChannelImage(Materials.KnownChannel.ClearCoatNormal, System.IO.Path.Combine(basePath, "WaterBottle_normal.png"));
|
|
|
+
|
|
|
+ var mesh = new Geometry.MeshBuilder<VPOS, VTEX>("mesh1");
|
|
|
+ mesh.UsePrimitive(material).AddQuadrangle
|
|
|
+ ((new Vector3(-10, 10, 0), new Vector2(1, 0))
|
|
|
+ , (new Vector3(10, 10, 0), new Vector2(0, 0))
|
|
|
+ , (new Vector3(10, -10, 0), new Vector2(0, 1))
|
|
|
+ , (new Vector3(-10, -10, 0), new Vector2(1, 1))
|
|
|
+ );
|
|
|
+
|
|
|
+ var scene = new Scenes.SceneBuilder();
|
|
|
+ scene.AddMesh(mesh, Matrix4x4.Identity);
|
|
|
|
|
|
- model.AttachToCurrentTest("result.glb");
|
|
|
- model.AttachToCurrentTest("result.gltf");
|
|
|
+ scene.AttachToCurrentTest("result.glb");
|
|
|
+ scene.AttachToCurrentTest("result.gltf");
|
|
|
}
|
|
|
|
|
|
[TestCase("shannon-dxt5.dds")]
|