# HG changeset patch # User Steve Losh # Date 1560094061 14400 # Node ID 4f1a10f252451df85602e425f51bb672f2b1975d # Parent 91c04aa41ac5c5cc3c173d6dd72354621fe05acc Update to latest cl-losh diff -r 91c04aa41ac5 -r 4f1a10f25245 flax.asd --- a/flax.asd Wed Mar 27 19:59:02 2019 -0400 +++ b/flax.asd Sun Jun 09 11:27:41 2019 -0400 @@ -26,10 +26,10 @@ (:file "quickutils") (:module "lofi-tri" :components ((:file "lofi.tri"))))) - (:file "package") (:module "src" :serial t :components - ((:file "base") + ((:file "package") + (:file "base") (:file "colors") (:file "transform") (:module "drawing" :serial t diff -r 91c04aa41ac5 -r 4f1a10f25245 package.lisp --- a/package.lisp Wed Mar 27 19:59:02 2019 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -(defpackage :flax.base - (:use :cl :iterate :losh :flax.quickutils - :3d-vectors - :3d-matrices) - (:export - :rand - :with-seed - :random-or - :randomly-initialize - :round-to)) - -(defpackage :flax.colors - (:use :cl :iterate :losh :flax.base :flax.quickutils) - (:export - :color - :with-color - :hsv - :rgb)) - -(defpackage :flax.transform - (:use :cl :iterate :losh :flax.base :flax.quickutils - :3d-vectors - :3d-matrices) - (:export - :transformation - :scale - :rotate - :translate - :ntransform)) - -(defpackage :flax.drawing - (:use :cl :iterate :losh :flax.base :flax.quickutils - :flax.colors - :flax.transform - :3d-vectors - :3d-matrices) - (:export - :with-rendering - :render - :fade - :triangle - :path - :points - :rectangle - :point - :circle - :text)) - - -(defpackage :flax.looms.001-triangles - (:use :cl :iterate :losh :flax.base :flax.quickutils - :3d-vectors) - (:export :loom)) - -(defpackage :flax.looms.002-wobbly-lines - (:use :cl :iterate :losh :flax.base :flax.quickutils - :flax.colors - :3d-vectors) - (:export :loom)) - -(defpackage :flax.looms.003-basic-l-systems - (:use :cl :iterate :losh :flax.base :flax.quickutils - :flax.colors - :3d-vectors) - (:export :loom)) - -(defpackage :flax.looms.004-turtle-curves - (:use :cl :iterate :losh :flax.base :flax.quickutils - :flax.colors - :flax.transform - :3d-vectors) - (:export :loom)) - -(defpackage :flax.looms.005-simple-triangulations - (:use :cl :iterate :losh :flax.base :flax.quickutils - :flax.colors - :3d-vectors) - (:export :loom)) - -(defpackage :flax.looms.006-tracing-lines - (:use :cl :iterate :losh :flax.base :flax.quickutils - :flax.colors - :3d-vectors) - (:export :loom)) - -(defpackage :flax.looms.007-stipple - (:use :cl :iterate :losh :flax.base :flax.quickutils - :flax.colors - :3d-vectors) - (:export :loom)) - - diff -r 91c04aa41ac5 -r 4f1a10f25245 src/colors.lisp --- a/src/colors.lisp Wed Mar 27 19:59:02 2019 -0400 +++ b/src/colors.lisp Sun Jun 09 11:27:41 2019 -0400 @@ -11,7 +11,7 @@ (g 0.0d0 :type color-float) (b 0.0d0 :type color-float)) -(define-with-macro (color :conc-name "") r g b) +(define-with-macro color r g b) (defun rgb (r g b) (make-color (coerce r 'double-float) diff -r 91c04aa41ac5 -r 4f1a10f25245 src/drawing/api.lisp --- a/src/drawing/api.lisp Wed Mar 27 19:59:02 2019 -0400 +++ b/src/drawing/api.lisp Sun Jun 09 11:27:41 2019 -0400 @@ -6,7 +6,7 @@ ;;;; Canvas ------------------------------------------------------------------- -(defclass* (canvas :conc-name "") () +(defclass* canvas () ((width :type (integer 0)) (height :type (integer 0)) (padding :type (single-float 0.0 0.5) :initform 0.03) @@ -28,7 +28,7 @@ (defmethod initialize-instance :after ((canvas canvas) &key) (recompute-output-transformation canvas)) -(define-with-macro (canvas :conc-name "") width height) +(define-with-macro canvas width height) (defgeneric make-canvas (type &key &allow-other-keys)) @@ -73,7 +73,7 @@ ;;;; Drawables ---------------------------------------------------------------- -(defclass* (drawable :conc-name "") () +(defclass* drawable () ((opacity :type (double-float 0.0d0 1.0d0)) (color :type color))) @@ -81,7 +81,7 @@ ;;;; Paths -------------------------------------------------------------------- -(defclass* (path :conc-name "") (drawable) +(defclass* path (drawable) ((points :type list))) (defun path (points &key (opacity 1.0d0) (color *black*)) @@ -102,7 +102,7 @@ ;;;; Triangles ---------------------------------------------------------------- -(defclass* (triangle :conc-name "") (drawable) +(defclass* triangle (drawable) ((a :type vec3) (b :type vec3) (c :type vec3))) @@ -130,7 +130,7 @@ ;;;; Rectangles --------------------------------------------------------------- -(defclass* (rectangle :conc-name "") (drawable) +(defclass* rectangle (drawable) ((a :type vec3) (b :type vec3) (round-corners :type float :initform 0.0))) @@ -165,7 +165,7 @@ ;;;; Circles ------------------------------------------------------------------ -(defclass* (circle :conc-name "") (drawable) +(defclass* circle (drawable) ((center :type vec3) (radius :type single-float))) @@ -188,7 +188,7 @@ ;;;; Points ------------------------------------------------------------------- -(defclass* (point :conc-name "") (drawable) +(defclass* point (drawable) ((location :type vec3))) (defun point (location &key (opacity 1.0d0) (color *black*)) @@ -208,7 +208,7 @@ ;;;; Text --------------------------------------------------------------------- -(defclass* (text :conc-name "") (drawable) +(defclass* text (drawable) ((pos :type vec3) (font :type string) (size :type single-float) diff -r 91c04aa41ac5 -r 4f1a10f25245 src/drawing/plot.lisp --- a/src/drawing/plot.lisp Wed Mar 27 19:59:02 2019 -0400 +++ b/src/drawing/plot.lisp Sun Jun 09 11:27:41 2019 -0400 @@ -4,7 +4,7 @@ ;;; TODO: shell out to svgsort automatically? -(defclass* (plot-canvas :conc-name "") (svg-canvas) ()) +(defclass* plot-canvas (svg-canvas) ()) (defmethod make-canvas ((type (eql :plot)) &key height width) (let ((scene (svg:make-svg-toplevel 'svg:svg-1.1-toplevel diff -r 91c04aa41ac5 -r 4f1a10f25245 src/drawing/png.lisp --- a/src/drawing/png.lisp Wed Mar 27 19:59:02 2019 -0400 +++ b/src/drawing/png.lisp Sun Jun 09 11:27:41 2019 -0400 @@ -43,7 +43,7 @@ ;;;; Canvas ------------------------------------------------------------------- -(defclass* (png-canvas :conc-name "") (canvas) +(defclass* png-canvas (canvas) (image state)) (defmethod make-canvas ((type (eql :png)) &key height width background) diff -r 91c04aa41ac5 -r 4f1a10f25245 src/drawing/svg.lisp --- a/src/drawing/svg.lisp Wed Mar 27 19:59:02 2019 -0400 +++ b/src/drawing/svg.lisp Sun Jun 09 11:27:41 2019 -0400 @@ -10,7 +10,7 @@ ;;;; Canvas ------------------------------------------------------------------- -(defclass* (svg-canvas :conc-name "") (canvas) +(defclass* svg-canvas (canvas) (scene)) (defmethod make-canvas ((type (eql :svg)) &key height width background) diff -r 91c04aa41ac5 -r 4f1a10f25245 src/looms/001-triangles.lisp --- a/src/looms/001-triangles.lisp Wed Mar 27 19:59:02 2019 -0400 +++ b/src/looms/001-triangles.lisp Sun Jun 09 11:27:41 2019 -0400 @@ -11,12 +11,12 @@ ;;;; Elements ----------------------------------------------------------------- -(defstruct (triangle (:conc-name "")) +(defstruct (triangle (:conc-name nil)) (a (vec 0 0) :type vec2) (b (vec 0 0) :type vec2) (c (vec 0 0) :type vec2)) -(define-with-macro (triangle :conc-name "") a b c) +(define-with-macro triangle a b c) (defun triangle (a b c) (make-triangle :a a :b b :c c)) diff -r 91c04aa41ac5 -r 4f1a10f25245 src/looms/002-wobbly-lines.lisp --- a/src/looms/002-wobbly-lines.lisp Wed Mar 27 19:59:02 2019 -0400 +++ b/src/looms/002-wobbly-lines.lisp Sun Jun 09 11:27:41 2019 -0400 @@ -9,12 +9,11 @@ ;;;; Elements ----------------------------------------------------------------- -(defstruct (line (:conc-name "") +(defstruct (line (:conc-name nil) (:constructor line (points))) (points (error "Required") :type vector)) -(define-with-macro (line :conc-name "") points) - +(define-with-macro line points) ;;;; Element Conversion ------------------------------------------------------- (defun convert (line opacity) diff -r 91c04aa41ac5 -r 4f1a10f25245 src/looms/004-turtle-curves.lisp --- a/src/looms/004-turtle-curves.lisp Wed Mar 27 19:59:02 2019 -0400 +++ b/src/looms/004-turtle-curves.lisp Sun Jun 09 11:27:41 2019 -0400 @@ -12,7 +12,7 @@ (angle *starting-angle*) (state nil)) -(define-with-macro turtle x y angle state) +(define-with-macro (turtle :conc-name turtle-) x y angle state) (defun rot (angle amount) @@ -132,8 +132,8 @@ (finally (return word)))) (defun run-named-l-system (l-system iterations) - (run-l-system (l-system-axiom l-system) - (l-system-productions l-system) + (run-l-system (axiom l-system) + (productions l-system) iterations)) @@ -389,12 +389,12 @@ (*color* (hsv (rand 1.0) (random-range 0.5 0.8 #'rand) (random-range 0.9 1.0 #'rand))) - (axiom (l-system-axiom l-system)) - (*angle* (l-system-recommended-angle l-system)))) + (axiom (axiom l-system)) + (*angle* (recommended-angle l-system)))) (multiple-value-bind (productions mutagen) (if pure - (values (l-system-productions l-system) nil) - (maybe-mutate-productions (l-system-productions l-system)))) + (values (productions l-system) nil) + (maybe-mutate-productions (productions l-system)))) (flax.drawing:with-rendering (canvas filetype filename width height :background bg :padding 0.05)) (progn @@ -402,7 +402,7 @@ turtle-draw transform-to-fit (flax.drawing:render canvas <>)) - (values (l-system-name l-system) + (values (name l-system) iterations mutagen)))) diff -r 91c04aa41ac5 -r 4f1a10f25245 src/looms/007-stippling.lisp --- a/src/looms/007-stippling.lisp Wed Mar 27 19:59:02 2019 -0400 +++ b/src/looms/007-stippling.lisp Sun Jun 09 11:27:41 2019 -0400 @@ -11,8 +11,8 @@ (defstruct (circle (:conc-name nil)) center radius) -(define-with-macro (rectangle :conc-name "") a b) -(define-with-macro (circle :conc-name "") center radius) +(define-with-macro rectangle a b) +(define-with-macro circle center radius) (defun random-coord () diff -r 91c04aa41ac5 -r 4f1a10f25245 src/package.lisp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/package.lisp Sun Jun 09 11:27:41 2019 -0400 @@ -0,0 +1,92 @@ +(defpackage :flax.base + (:use :cl :iterate :losh :flax.quickutils + :3d-vectors + :3d-matrices) + (:export + :rand + :with-seed + :random-or + :randomly-initialize + :round-to)) + +(defpackage :flax.colors + (:use :cl :iterate :losh :flax.base :flax.quickutils) + (:export + :color + :with-color + :hsv + :rgb)) + +(defpackage :flax.transform + (:use :cl :iterate :losh :flax.base :flax.quickutils + :3d-vectors + :3d-matrices) + (:export + :transformation + :scale + :rotate + :translate + :ntransform)) + +(defpackage :flax.drawing + (:use :cl :iterate :losh :flax.base :flax.quickutils + :flax.colors + :flax.transform + :3d-vectors + :3d-matrices) + (:export + :with-rendering + :render + :fade + :triangle + :path + :points + :rectangle + :point + :circle + :text)) + + +(defpackage :flax.looms.001-triangles + (:use :cl :iterate :losh :flax.base :flax.quickutils + :3d-vectors) + (:export :loom)) + +(defpackage :flax.looms.002-wobbly-lines + (:use :cl :iterate :losh :flax.base :flax.quickutils + :flax.colors + :3d-vectors) + (:export :loom)) + +(defpackage :flax.looms.003-basic-l-systems + (:use :cl :iterate :losh :flax.base :flax.quickutils + :flax.colors + :3d-vectors) + (:export :loom)) + +(defpackage :flax.looms.004-turtle-curves + (:use :cl :iterate :losh :flax.base :flax.quickutils + :flax.colors + :flax.transform + :3d-vectors) + (:export :loom)) + +(defpackage :flax.looms.005-simple-triangulations + (:use :cl :iterate :losh :flax.base :flax.quickutils + :flax.colors + :3d-vectors) + (:export :loom)) + +(defpackage :flax.looms.006-tracing-lines + (:use :cl :iterate :losh :flax.base :flax.quickutils + :flax.colors + :3d-vectors) + (:export :loom)) + +(defpackage :flax.looms.007-stipple + (:use :cl :iterate :losh :flax.base :flax.quickutils + :flax.colors + :3d-vectors) + (:export :loom)) + +