-
Notifications
You must be signed in to change notification settings - Fork 0
/
scene-defs.lisp
128 lines (125 loc) · 6.04 KB
/
scene-defs.lisp
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
;;;; -*- Mode: Lisp -*-
(in-package :raytracer)
(defun load-scene-foo ()
(list
:camera (make-instance 'camera)
:lights (list
(make-instance 'light
:position '(0 0 0 1)
:color '(1 1 1 1)))
:geometries (list
;; red
(make-instance 'sphere
:position '(1 0 -6)
:material '((.78 .04 .04 1)
(.78 .04 .04 1)
(.5 .5 .5 1) 0 0))
;; crystal
(make-instance 'sphere
:position '(-1 0 -6)
:material '((1 1 1 1)
(1 1 1 1)
(1 1 1 1) 10 1.6))
;; green
(make-instance 'triangle
:orientation '(0 0 0 0)
:vertices '((0 -1 -6) (-1 -2 -6) (1 -2 -6))
:normal '(0 0 0)
:material '((.08 .57 .09 1)
(.08 .57 .09 1)
(.25 .25 .25 1) 40 0)))))
(defun load-scene-cornell-box ()
(list
:camera (make-instance 'camera :position '(0 0 -6 0))
:lights (list
(make-instance 'light
:position '(0 4 0 1)
:color '(1 1 1 1)))
:geometries (list
;; red
(make-instance 'sphere
:position '(-1.5 2 1.5)
:material '((.78 .04 .04 1)
(.78 .04 .04 1)
(.5 .5 .5 1) 0 0))
;; crystal
(make-instance 'sphere
:position '(1.5 2 1.5)
:material '((1 1 1 1)
(1 1 1 1)
(1 1 1 1) 10 1.6))
;; back wall
(make-instance 'triangle
:orientation '(0 0 0 0)
:vertices '((-3 3 3) (-3 -3 3) (3 -3 3))
:normal '(0 0 0)
:material '((1 1 1 1)
(1 1 1 1)
(0 0 0 0) 0 0))
(make-instance 'triangle
:orientation '(0 0 0 0)
:vertices '((-3 3 3) (3 3 3) (3 -3 3))
:normal '(0 0 0)
:material '((1 1 1 1)
(1 1 1 1)
(0 0 0 0) 0 0))
;; left wall
(make-instance 'triangle
:orientation '(0 0 0 0)
:vertices '((-3 3 -3) (-3 -3 -3) (-3 -3 3))
:normal '(0 0 0)
:material '((.08 .57 .09 1)
(.08 .57 .09 1)
(.25 .25 .25 1) 0 0))
(make-instance 'triangle
:orientation '(0 0 0 0)
:vertices '((-3 3 -3) (-3 -3 3) (-3 3 3))
:normal '(0 0 0)
:material '((.08 .57 .09 1)
(.08 .57 .09 1)
(.25 .25 .25 1) 0 0))
;; right wall
(make-instance 'triangle
:orientation '(0 0 0 0)
:vertices '((3 3 -3) (3 -3 -3) (3 -3 3))
:normal '(0 0 0)
:material '((.78 .04 .04 1)
(.78 .04 .04 1)
(.25 .25 .25 1) 00 0))
(make-instance 'triangle
:orientation '(0 0 0 0)
:vertices '((3 3 -3) (3 -3 3) (3 3 3))
:normal '(0 0 0)
:material '((.78 .04 .04 1)
(.78 .04 .04 1)
(.25 .25 .25 1) 0 0))
;; top wall
(make-instance 'triangle
:orientation '(0 0 0 0)
:vertices '((-3 3 -3) (3 3 -3) (-3 3 3))
:normal '(0 0 0)
:material '((1 1 1 1)
(1 1 1 1)
(0 0 0 0) 0 0))
(make-instance 'triangle
:orientation '(0 0 0 0)
:vertices '((3 3 -3) (3 3 3) (-3 3 3))
:normal '(0 0 0)
:material '((1 1 1 1)
(1 1 1 1)
(0 0 0 0) 0 0))
;; bottom wall
(make-instance 'triangle
:orientation '(0 0 0 0)
:vertices '((-3 -3 -3) (3 -3 -3) (-3 -3 3))
:normal '(0 0 0)
:material '((1 1 1 1)
(1 1 1 1)
(0 0 0 0) 0 0))
(make-instance 'triangle
:orientation '(0 0 0 0)
:vertices '((3 -3 -3) (3 -3 3) (-3 -3 3))
:normal '(0 0 0)
:material '((1 1 1 1)
(1 1 1 1)
(0 0 0 0) 0 0)))))