918c1c3d6146 — Leonard Ritter 2 years ago
* fixed triangle normals
1 files changed, 9 insertions(+), 7 deletions(-)

M testing/test_cascade_dmc_cc_vvf.sc
M testing/test_cascade_dmc_cc_vvf.sc +9 -7
@@ 52,7 52,7 @@ OCCLUSION_CULLING := false
 FOG := false
 USE_FLAT_SHADING := true
 BALANCE_QUADS := true
-USE_COMPLEX_SURFACE := false
+USE_COMPLEX_SURFACE := true
 HIGH_QUALITY_FEATURES := true
 SOFT_WORLD_SAMPLING := true
 USE_CATMULL_CLARK := false

          
@@ 322,7 322,7 @@ fn matmapf (p)
         elseif 0
             scale := 100.0
             (nine-spheres (p / scale)) * scale
-        elseif 0
+        elseif 1
             #p := p * 0.2
             let d =
                 static-if USE_COMPLEX_SURFACE

          
@@ 1144,8 1144,8 @@ fn generate-quad (v00 v01 v10 v11)
     let ofs = (atomicAdd vertex-out.count 6)
     entries := vertex-out.entries
     static-if USE_FLAT_SHADING
-        n0 := (triangle-normal v00.pos v10.pos v11.pos)
-        n1 := (triangle-normal v11.pos v01.pos v00.pos)
+        n0 := (triangle-normal v00.pos v11.pos v10.pos)
+        n1 := (triangle-normal v11.pos v00.pos v01.pos)
         #n1 := (normal v00.pos v11.pos v01.pos)
 
         entries @ (ofs + 0) = (swapnormal v00 n0)

          
@@ 1527,13 1527,15 @@ fn rasterize-vert ()
     normal.out =
         #(viridis (lod / MAX_WORLD_LOD)) * 2.0 - 1.0
         do
-            static-if VISUALIZE_IDS ((vec3hash (vertex-index as f32)) * 2.0 - 1.0)
+            static-if VISUALIZE_IDS
+                ((vec3hash (vertex-index as f32)) * 2.0 - 1.0)
+                hue ((vertex-index as f32) / 100000)
             else n
     depthval.out = coord.z
     albedo.out =
         do
             static-if VISUALIZE_LOD
-                vec4 (hue (lod / MAX_WORLD_LOD)) 1
+                vec4 (hue (clamp (lod / MAX_WORLD_LOD) 0.0 1.0)) 1
             else
                 vec4 1
     matdata.out =

          
@@ 1789,7 1791,7 @@ fn collect-sectors ()
                     ? (p.x >= c.x) 1:u32 0:u32
                     ? (p.y >= c.y) 2:u32 0:u32
                     ? (p.z >= c.z) 4:u32 0:u32
-            mask := mask ^ 7
+            #mask := mask ^ 7
             for index in (range 8:u32)
                 'append sector-queue
                     child-cell code (index ^ mask)