Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
42 lines (30 sloc) 1.14 KB
(in-package :fraggle)
(defun-g fraggle-quad-vert ((pos :vec2))
(values (v! pos 0 1)
(* (+ pos (v2! 1f0)) 0.5)))
;; (blend (vec4 (11to01 (perlin-noise (v! (* uv 8) now))))
;; (graph (lambda ((x :float))
;; (perlin-noise (v! (* 8 x) 0 now)))
;; uv
;; (v! -1 1 -1 1)))
(defun-g fraggle-quad-frag ((uv :vec2)
&uniform (now :float)
(mouse :vec2)
(mouse-norm :vec2)
(mouse-buttons :vec2)
(screen-res :vec2))
(v! (x mouse-norm) (x mouse-buttons) (y mouse-norm) 1))
(defpipeline-g draw-fraggle ()
:vertex (fraggle-quad-vert :vec2)
:fragment (fraggle-quad-frag :vec2))
(defun step-fraggle ()
(as-frame
(map-g #'draw-fraggle (get-quad-stream-v2)
:now (* (now) 0.001)
:mouse (get-mouse)
:mouse-norm (get-mouse-norm)
:mouse-buttons (get-mouse-buttons)
:screen-res (viewport-resolution (current-viewport)))))
(def-simple-main-loop fraggle
(:on-start #'ensure-fraggle-initialized)
(step-fraggle))