From ea398a4ab1d8935e514f40ad3c2e824fe76ae947 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Fri, 7 Sep 2018 08:52:25 -0400 Subject: render: scene: Merge metallic roughness into material record type. * chickadee/render/scene.scm (): Delete. Merge all fields into . --- chickadee/render/scene.scm | 84 ++++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 44 deletions(-) diff --git a/chickadee/render/scene.scm b/chickadee/render/scene.scm index 434f301..60b34ce 100644 --- a/chickadee/render/scene.scm +++ b/chickadee/render/scene.scm @@ -33,23 +33,21 @@ #: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? @@ -82,55 +80,53 @@ scene-nodes draw-scene)) -(define-record-type - (%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 - (%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)) -- cgit v1.2.3