summaryrefslogtreecommitdiff
path: root/chickadee/graphics/phong.scm
diff options
context:
space:
mode:
Diffstat (limited to 'chickadee/graphics/phong.scm')
-rw-r--r--chickadee/graphics/phong.scm29
1 files changed, 6 insertions, 23 deletions
diff --git a/chickadee/graphics/phong.scm b/chickadee/graphics/phong.scm
index 372cdb6..f52f10b 100644
--- a/chickadee/graphics/phong.scm
+++ b/chickadee/graphics/phong.scm
@@ -26,6 +26,7 @@
#:use-module (chickadee math vector)
#:use-module (chickadee graphics color)
#:use-module (chickadee graphics engine)
+ #:use-module (chickadee graphics light)
#:use-module (chickadee graphics shader)
#:use-module (chickadee graphics texture)
#:use-module (srfi srfi-9)
@@ -87,27 +88,6 @@
;;;
-;;; Lights
-;;;
-
-(define-shader-type <directional-light>
- make-directional-light
- directional-light?
- (float-vec3 direction directional-light-direction)
- (float-vec3 ambient directional-light-ambient)
- (float-vec3 diffuse directional-light-diffuse)
- (float-vec3 specular directional-light-specular)
- (float shininess directional-light-shininess))
-
-(define default-directional-light
- (make-directional-light #:direction (vec3 0.0 0.0 -1.0)
- #:ambient (vec3 0.1 0.1 0.1)
- #:diffuse (vec3 1.0 1.0 1.0)
- #:specular (vec3 0.5 0.5 0.5)
- #:shininess 32.0))
-
-
-;;;
;;; Phong Shader
;;;
@@ -115,7 +95,8 @@
(load-shader (scope-datadir "shaders/phong-vert.glsl")
(scope-datadir "shaders/phong-frag.glsl")))
-(define (shader-apply/phong vertex-array material model-matrix view-matrix)
+(define (shader-apply/phong vertex-array material model-matrix view-matrix
+ camera-position lights ambient-light-color)
(let ((shader (graphics-variable-ref phong-shader)))
(with-graphics-state ((g:texture-0 (phong-material-ambient-map material))
(g:texture-1 (phong-material-diffuse-map material))
@@ -126,4 +107,6 @@
#:view view-matrix
#:projection (current-projection)
#:material material
- #:directional-light default-directional-light))))
+ ;; #:camera-position camera-position
+ #:ambient-light-color ambient-light-color
+ #:lights lights))))