render: scene: Merge metallic roughness into material record type.
authorDavid Thompson <dthompson2@worcester.edu>
Fri, 7 Sep 2018 12:52:25 +0000 (08:52 -0400)
committerDavid Thompson <dthompson2@worcester.edu>
Fri, 7 Sep 2018 12:52:25 +0000 (08:52 -0400)
* chickadee/render/scene.scm (<metallic-roughness>): Delete. Merge all
  fields into <material>.

chickadee/render/scene.scm

index 434f301..60b34ce 100644 (file)
   #:use-module (chickadee render shader)
   #:use-module (srfi srfi-9)
   #:use-module (srfi srfi-9 gnu)
-  #:export (make-metallic-roughness
-            default-metallic-roughness
-            metallic-roughness?
-            metallic-roughness-base-color
-            metallic-roughness-base-color-texture
-            metallic-roughness-metallic-factor
-            metallic-roughness-roughness-factor
-            metallic-roughness-texture
-            make-material
+  #:export (make-material
             default-material
             material?
             material-name
-            material-metallic-roughness
+            material-base-color-factor
+            material-base-color-texture
+            material-metallic-factor
+            material-roughness-factor
+            material-metallic-roughness-texture
+            material-normal-factor
             material-normal-texture
+            material-occlusion-facgor
             material-occlusion-texture
-            material-emissive-texture
             material-emissive-factor
+            material-emissive-texture
             material-alpha-mode
             material-alpha-cutoff
             material-double-sided?
             scene-nodes
             draw-scene))
 
-(define-record-type <metallic-roughness>
-  (%make-metallic-roughness base-color base-color-texture metallic-factor
-                            roughness-factor texture)
-  metallic-roughness?
-  (base-color metallic-roughness-base-color)
-  (base-color-texture metallic-roughness-base-color-texture)
-  (metallic-factor metallic-roughness-metallic-factor)
-  (roughness-factor metallic-roughness-roughness-factor)
-  (texture metallic-roughness-texture))
-
-(define* (make-metallic-roughness #:key
-                                  (base-color white)
-                                  base-color-texture
-                                  (metallic-factor 1.0)
-                                  (roughness-factor 1.0)
-                                  texture)
-  (%make-metallic-roughness base-color base-color-texture metallic-factor
-                            roughness-factor texture))
-
-(define default-metallic-roughness (make-metallic-roughness))
-
 (define-record-type <material>
-  (%make-material name metallic-roughness normal-texture occlusion-texture
-                  emissive-texture emissive-factor alpha-mode alpha-cutoff
+  (%make-material name base-color-factor base-color-texture
+                  metallic-factor roughness-factor metallic-roughness-texture
+                  normal-factor normal-texture
+                  occlusion-factor occlusion-texture
+                  emissive-texture emissive-factor
+                  alpha-mode alpha-cutoff
                   double-sided?)
   material?
   (name material-name)
-  (metallic-roughness material-metallic-roughness)
+  (base-color-factor material-base-color-factor)
+  (base-color-texture material-base-color-texture)
+  (metallic-factor material-metallic-factor)
+  (roughness-factor material-roughness-factor)
+  (metallic-roughness-texture material-metallic-roughness-texture)
+  (normal-factor material-normal-factor)
   (normal-texture material-normal-texture)
+  (occlusion-factor material-occlusion-factor)
   (occlusion-texture material-occlusion-texture)
-  (emissive-texture material-emissive-texture)
   (emissive-factor material-emissive-factor)
+  (emissive-texture material-emissive-texture)
   (alpha-mode material-alpha-mode)
   (alpha-cutoff material-alpha-cutoff)
   (double-sided? material-double-sided?))
 
 (define* (make-material #:key
                         (name "anonymous")
-                        (metallic-roughness default-metallic-roughness)
-                        normal-texture
-                        occlusion-texture
-                        emissive-texture
-                        (emissive-factor (vec3 0.0 0.0 0.0))
+                        (base-color-factor #v(0.0 0.0 0.0))
+                        (base-color-texture null-texture)
+                        (metallic-factor 1.0)
+                        (roughness-factor 1.0)
+                        (metallic-roughness-texture null-texture)
+                        (normal-factor #v(0.0 0.0 0.0))
+                        (normal-texture null-texture)
+                        (occlusion-factor #v(0.0 0.0 0.0))
+                        (occlusion-texture null-texture)
+                        (emissive-factor #v(0.0 0.0 0.0))
+                        (emissive-texture null-texture)
                         (alpha-mode 'opaque)
                         (alpha-cutoff 0.5)
                         double-sided?)
-  (%make-material name metallic-roughness normal-texture occlusion-texture
-                  emissive-texture emissive-factor alpha-mode alpha-cutoff
-                  double-sided?))
+  (%make-material name base-color-factor base-color-texture
+                  metallic-factor roughness-factor metallic-roughness-texture
+                  normal-factor normal-texture
+                  occlusion-factor occlusion-texture
+                  emissive-texture emissive-factor
+                  alpha-mode alpha-cutoff double-sided?))
 
 (define default-material (make-material))