소스 검색

small code improvements
Added flat scale test

Vicente Penades 6 년 전
부모
커밋
f0715042a1
2개의 변경된 파일12개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/SharpGLTF.Core/Schema2/khr.lights.cs
  2. 11 0
      tests/SharpGLTF.Tests/Schema2/Authoring/MeshBuilderCreationTests.cs

+ 1 - 1
src/SharpGLTF.Core/Schema2/khr.lights.cs

@@ -199,7 +199,7 @@ namespace SharpGLTF.Schema2
             get
             get
             {
             {
                 var ext = this.GetExtension<KHR_lights_punctualglTFextension>();
                 var ext = this.GetExtension<KHR_lights_punctualglTFextension>();
-                if (ext == null) return new PunctualLight[0];
+                if (ext == null) return Array.Empty<PunctualLight>();
 
 
                 return ext.Lights;
                 return ext.Lights;
             }
             }

+ 11 - 0
tests/SharpGLTF.Tests/Schema2/Authoring/MeshBuilderCreationTests.cs

@@ -378,6 +378,10 @@ namespace SharpGLTF.Schema2.Authoring
             // add all meshes (just one in this case) to the model
             // add all meshes (just one in this case) to the model
             model.CreateMeshes(cube);
             model.CreateMeshes(cube);
 
 
+            var flatx = new Vector3(0, 1, 1);
+            var flaty = new Vector3(1, 0, 1);
+            var flatz = new Vector3(1, 1, 0);
+
             // create a scene, a node, and assign the first mesh (the terrain)
             // create a scene, a node, and assign the first mesh (the terrain)
             model.UseScene("Default")
             model.UseScene("Default")
                 .CreateNode()
                 .CreateNode()
@@ -392,6 +396,13 @@ namespace SharpGLTF.Schema2.Authoring
                     , (4, -Vector3.One)
                     , (4, -Vector3.One)
                     , (5, -Vector3.One)
                     , (5, -Vector3.One)
                     , (6, Vector3.One)
                     , (6, Vector3.One)
+                    , (7, flatx)
+                    , (8, flatx)
+                    , (9, flaty)
+                    , (10, flaty)
+                    , (11, flatz)
+                    , (12, flatz)
+                    , (13, Vector3.One)
                 );
                 );
 
 
             // save the model as GLB
             // save the model as GLB