Commit 4be9417d authored by Dave Griffiths's avatar Dave Griffiths
Browse files

getting there...

parent 23047999
assets/thread.png

1.41 KB | W: | H:

assets/thread.png

2.4 KB | W: | H:

assets/thread.png
assets/thread.png
assets/thread.png
assets/thread.png
  • 2-up
  • Swipe
  • Onion skin
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; weavecoding raspberry pi installation
(rotate (vector 00 45 0))
(define weft (build-jellyfish 4096))
(define warp (build-jellyfish 4096))
(define weave-scale (vector 0.1 -0.1 0.1))
(define weave-scale (vector 0.2 -0.2 0.2))
(with-primitive
weft
(program-jelly
50 prim-triangles
30 prim-triangles
'(let ((vertex positions-start)
(t 0)
(v 0)
(weft-direction (vector 2 0 0))
(weft-position (vector 0 0 0))
(weft-position (vector -20 0 0))
(weft-t 0)
(draft-pos 0)
(draft-size 4)
......@@ -96,18 +97,14 @@
(set! vertex positions-start)
(loop (< vertex positions-end)
(calc-weft-z)
(set! weft-position (+ weft-position weft-direction))
;; selvedge time?
(cond
((> (mag (*v weft-position (vector 1 0 0))) 22)
((> weft-count 21)
(set! weft-count 0)
(set! draft-pos (+ draft-pos 1))
(cond ((> draft-pos draft-size)
(set! draft-pos 0)))
(trace draft-pos)
(set! weft-position (- (+ weft-position (vector 0 1.5 0))
weft-direction))
(set! weft-direction (* weft-direction -1))
......@@ -115,6 +112,7 @@
((> 0 weft-direction) (right-selvedge (vector 0 1.5 0)))
((< 0 weft-direction) (left-selvedge (vector 0 1.5 0))))))
(set! weft-t (/ weft-count 21))
(write! vertex
(+ weft-z weft-position)
......@@ -150,18 +148,19 @@
(with-primitive
warp
(program-jelly
3000 prim-triangles
800 prim-triangles
'(let ((vertex positions-start)
(warp-end 0)
(warp-position (vector 0 0 0))
(shed 0)
(v 0)
(weft-t 0)
(draft-pos 0)
(draft-size 4)
(draft 1) (d-b 1) (d-c 0) (d-d 0)
(d-e 0) (d-f 1) (d-g 1) (d-h 0)
(d-i 0) (d-j 0) (d-k 1) (d-l 1)
(d-m 1) (d-n 0) (d-o 0) (d-p 1))
(draft 1) (d-b 0) (d-c 0) (d-d 1)
(d-e 1) (d-f 1) (d-g 0) (d-h 0)
(d-i 0) (d-j 1) (d-k 1) (d-l 0)
(d-m 0) (d-n 0) (d-o 1) (d-p 1)
(last-t 0))
(define build-quad
(lambda (tl size)
......@@ -179,12 +178,13 @@
(+ (* draft-pos draft-size)
(modulo warp-end (+ draft-size (vector 0 1 1)) ))))))
(define animate-shed
(lambda (i v)
(set! v (if (< v 0.5)
(vector 0 0 1)
(vector 0 0 -1)))
(lambda (i)
(set! v (if (< weft-t 0.2)
(vector 0 0 2)
(if (> weft-t 0.8)
(vector 0 0 -2)
(vector 0 0 0))))
(set! warp-end 0)
(loop (< warp-end 20)
(if (> (read-draft) 0.5)
......@@ -192,34 +192,32 @@
v 0 v v)
(write-add! (- i 6) 0 v 0 0 v v
v 0 v v))
(set! i (+ i 24))
(set! warp-end (+ warp-end 1)))))
(set! vertex positions-start)
; build 4 segments X warp-ends
(loop (< warp-end 20)
(set! warp-position (+ (vector -19 -35 0)
(* (vector 2 0 0) warp-end)))
(build-quad warp-position (vector 1 35 0))
(build-quad (+ warp-position (vector 0 35 0)) (vector 1 15 0))
(build-quad (+ warp-position (vector 0 50 0)) (vector 1 15 0))
(build-quad (+ warp-position (vector 0 65 0)) (vector 1 25 0))
(set! warp-end (+ warp-end 1)))
(define build-warp
(lambda ()
(set! vertex positions-start)
;; build 4 segments X warp-ends
(set! warp-end 0)
(loop (< warp-end 20)
(set! warp-position (+ (vector -19 -35.5 0)
(* (vector 2 0 0) warp-end)))
(build-quad warp-position (vector 1 35 0))
(build-quad (+ warp-position (vector 0 35 0)) (vector 1 10 0))
(build-quad (+ warp-position (vector 0 45 0)) (vector 1 15 0))
(build-quad (+ warp-position (vector 0 60 0)) (vector 1 25 0))
(set! warp-end (+ warp-end 1)))))
(build-warp)
(forever
;; todo control externally
(set! weft-t (+ weft-t 0.02))
(cond ((> weft-t 1)
(set! draft-pos (+ draft-pos 1))
(cond ((> draft-pos draft-size)
(set! draft-pos 0)))
(set! weft-t 0)))
(set! vertex (+ positions-start 12))
(animate-shed vertex weft-t)
(set! shed (+ shed 5))
(animate-shed vertex)
(cond ((> (- last-t weft-t) 0.5)
(build-warp)))
(set! last-t weft-t)
)))
(hint-unlit)
......@@ -228,10 +226,10 @@
(pdata-index-map! (lambda (i t)
(cond
((eqv? (modulo i 6) 0) (vector 0 0 0))
((eqv? (modulo i 6) 1) (vector 1 10 0))
((eqv? (modulo i 6) 1) (vector 10 1 0))
((eqv? (modulo i 6) 2) (vector 0 1 0))
((eqv? (modulo i 6) 3) (vector 0 0 0))
((eqv? (modulo i 6) 4) (vector 1 10 0))
((eqv? (modulo i 6) 4) (vector 10 1 0))
((eqv? (modulo i 6) 5) (vector 10 0 0))
)) "t")
(pdata-map! (lambda (c) (vector 1 0.5 0.2)) "c")
......@@ -242,6 +240,19 @@
(every-frame
(with-primitive
warp
(pdata-set!
"x" 11 (with-primitive
weft
(pdata-ref "x" 12))))
(with-primitive
warp
(pdata-set!
"x" 12 (with-primitive
weft
(pdata-ref "x" 13))))
(with-primitive
weft
(when
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment