/
workbench.lisp
43 lines (38 loc) · 1.71 KB
/
workbench.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
(in-package #:trial)
(define-pool workbench
:base 'trial)
(define-asset (workbench skybox) image
(list #p"masko-naive/posx.jpg"
#p"masko-naive/negx.jpg"
#p"masko-naive/posy.jpg"
#p"masko-naive/negy.jpg"
#p"masko-naive/posz.jpg"
#p"masko-naive/negz.jpg")
:target :texture-cube-map
:min-filter :linear)
(defmethod update :after ((main main) tt dt)
(let ((clipmap (unit :clipmap (scene main)))
(camera (unit :camera (scene main))))
(when clipmap
(let ((loc (case 3
(0 (vec 0 0))
(1 (vec 0 (- (- (mod (* 2 tt) 2048) 1024))))
(2 (vec (* 512 (sin (* 0.5 tt))) (* 512 (cos (* 0.5 tt)))))
(3 (vec (vx (location camera)) (vz (location camera))))
(4 (vec (vx (location clipmap)) (vz (location clipmap)))))))
(setf (vx (location clipmap)) (vx loc)
(vz (location clipmap)) (vy loc))
;;(setf (vy (location camera)) (+ 10 (current-height clipmap)))
))))
(progn
(defmethod setup-scene ((main main) scene)
(enter (make-instance 'skybox :texture (asset 'workbench 'skybox)) scene)
(enter (make-instance 'geometry-clipmap :name :clipmap
:map-scale (vec 1024 2048 1024)
:maps '("height" "splat")
:data-directory #p"~/simple-mountain/") scene)
(enter (make-instance 'editor-camera :name :camera
:move-speed 0.01
:location (vec -2048 2048 -2048)) scene)
(enter (make-instance 'render-pass) scene))
(maybe-reload-scene))