-
Notifications
You must be signed in to change notification settings - Fork 0
/
material.rkt
42 lines (40 loc) · 1.44 KB
/
material.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#lang typed/racket
(provide (all-defined-out))
(require "color.rkt")
(require "matrix.rkt")
(require "patterns.rkt")
(struct material
([color : Color] [ambient : Float]
[diffuse : Float]
[specular : Float]
[shininess : Float]
[reflective : Float]
[transparency : Float]
[refractive : Float]
(pattern :
Pattern))
#:prefab
#:type-name Material)
(: make-material
(->* ()
(#:color Color
#:ambient Float
#:diffuse Float
#:specular Float
#:shininess Float
#:reflective Float
#:transparency Float
#:refractive Float
#:pattern Pattern)
Material))
(define (make-material #:color [color (color 1. 1. 1.)]
#:ambient [ambient 0.1]
#:diffuse [diffuse 0.9]
#:specular [specular 0.9]
#:shininess [shininess 200.]
#:reflective [reflective 0.]
#:transparency [transparency 0.]
#:refractive [refractive 1.]
#:pattern (pattern (pattern 'plain
(list color))))
(material color ambient diffuse specular shininess reflective transparency refractive pattern))