Permalink
Browse files

minor

  • Loading branch information...
Shinmera committed Sep 2, 2018
1 parent 85e6e42 commit 5846a159d02852157d96bfd1cc5271fe28b5d8a3
Showing with 11 additions and 14 deletions.
  1. +4 −1 geometry-clipmap.lisp
  2. +7 −13 workbench.lisp
View
@@ -245,12 +245,15 @@ in CLIPMAP_DATA{
out vec4 color;
void main(){
vec3 fog = vec3(1,1,1);
vec3 sky = vec3(112.0/255,175.0/255,224.0/255);
vec3 light = vec3(0.8, 0.45, 0.9);
vec3 light_dir = normalize(light);
float diff = max(dot(clipmap.normal, light_dir)*10-2.7, 0.0);
vec4 splat = mix(texture(splat_map, clipmap.tex_i), texture(splat_map, clipmap.tex_o), clipmap.a);
vec3 diffuse = (splat.g*vec3(1,1,1)+(1-splat.g)*vec3(0.30,0.27,0.27)*0.7) * diff;
color = vec4(diffuse, 1.0);
float d = clamp(pow(1.0/((1-gl_FragCoord.z)*8000), 2), 0, 1);
color = vec4(mix(diffuse, sky, d), 1);
}")
(defun make-clipmap-block (n levels)
View
@@ -16,27 +16,21 @@
(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)))))))
(setf (vx (location clipmap)) (vx (location camera))
(vz (location clipmap)) (vz (location camera)))
;; (setf (vy (location camera)) (+ 10 (current-height clipmap)))
))
(progn
(defmethod setup-scene ((main main) scene)
(enter (make-instance 'skybox :texture (asset 'workbench 'skybox)) scene)
(setf (clear-color main) (vec 112/255 175/255 224/255))
;; (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
:move-speed 0.1
:location (vec -2048 2048 -2048)) scene)
(enter (make-instance 'render-pass) scene))
(maybe-reload-scene))

0 comments on commit 5846a15

Please sign in to comment.