summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2021-05-11 09:09:20 -0400
committerDavid Thompson <dthompson2@worcester.edu>2021-05-11 09:09:20 -0400
commit685368435ca9962ca402f2bcf2f50c8dc850065a (patch)
tree618a3ea860e7d705f9ff8aaa57c98098d61462ce
parent954ba33eef634469f7e7c486bb26107ab8f62bf4 (diff)
graphics: pbr: Add metallic roughness texture back in.
-rw-r--r--chickadee/graphics/model.scm5
-rw-r--r--chickadee/graphics/pbr.scm16
2 files changed, 18 insertions, 3 deletions
diff --git a/chickadee/graphics/model.scm b/chickadee/graphics/model.scm
index e87e47f..3387de4 100644
--- a/chickadee/graphics/model.scm
+++ b/chickadee/graphics/model.scm
@@ -918,6 +918,8 @@
(not (eq? texture null-texture)))
(let-values (((base-color-texture base-color-texcoord)
(parse-texture pbrmr "baseColorTexture"))
+ ((metal-rough-texture metal-rough-texcoord)
+ (parse-texture pbrmr "metallicRoughnessTexture"))
((normal-texture normal-texcoord)
(parse-texture obj "normalTexture"))
((occlusion-texture occlusion-texcoord)
@@ -931,6 +933,9 @@
#:base-color-texcoord base-color-texcoord
#:metallic-factor metallic-factor
#:roughness-factor roughness-factor
+ #:metallic-roughness-texture metal-rough-texture
+ #:metallic-roughness-texture-enabled (non-null-texture? metal-rough-texture)
+ #:metallic-roughness-texcoord metal-rough-texcoord
#:normal-factor normal-factor
#:normal-texture normal-texture
#:normal-texture-enabled (non-null-texture? normal-texture)
diff --git a/chickadee/graphics/pbr.scm b/chickadee/graphics/pbr.scm
index 15b78b8..441c875 100644
--- a/chickadee/graphics/pbr.scm
+++ b/chickadee/graphics/pbr.scm
@@ -41,6 +41,9 @@
pbr-material-base-color-texcoord
pbr-material-metallic-factor
pbr-material-roughness-factor
+ pbr-material-metallic-roughness-texture
+ pbr-material-metallic-roughness-texture-enabled?
+ pbr-material-metallic-roughness-texcoord
pbr-material-normal-factor
pbr-material-normal-texture
pbr-material-normal-texture-enabled?
@@ -70,6 +73,9 @@
(int base-color-texcoord pbr-material-base-color-texcoord)
(float metallic-factor pbr-material-metallic-factor)
(float roughness-factor pbr-material-roughness-factor)
+ (local-field metallic-roughness-texture pbr-material-metallic-roughness-texture)
+ (bool metallic-roughness-texture-enabled pbr-material-metallic-roughness-texture-enabled?)
+ (int metallic-roughness-texcoord pbr-material-metallic-roughness-texcoord)
(float-vec3 normal-factor pbr-material-normal-factor)
(local-field normal-texture pbr-material-normal-texture)
(bool normal-texture-enabled pbr-material-normal-texture-enabled)
@@ -94,6 +100,9 @@
#:base-color-texcoord 0
#:metallic-factor 1.0
#:roughness-factor 1.0
+ #:metallic-roughness-texture null-texture
+ #:metallic-roughness-texture-enabled #f
+ #:metallic-roughness-texcoord 0
#:normal-factor #v(1.0 1.0 1.0)
#:normal-texture null-texture
#:normal-texture-enabled #f
@@ -125,9 +134,10 @@
no-cull-face-mode
back-cull-face-mode))
(g:texture-0 (pbr-material-base-color-texture material))
- (g:texture-1 (pbr-material-normal-texture material))
- (g:texture-2 (pbr-material-occlusion-texture material))
- (g:texture-3 (pbr-material-emissive-texture material)))
+ (g:texture-1 (pbr-material-metallic-roughness-texture material))
+ (g:texture-2 (pbr-material-normal-texture material))
+ (g:texture-3 (pbr-material-occlusion-texture material))
+ (g:texture-4 (pbr-material-emissive-texture material)))
(shader-apply shader vertex-array
#:model model-matrix
#:view view-matrix