From 5ed62d23b4bbbf7717de4adfa0eaf2af19365408 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Mon, 12 Nov 2018 16:18:45 -0500 Subject: add viz 2 post --- .../viz/2/quil/middlewares/deprecated_options.cljc | 26 ++ .../middlewares/deprecated_options.cljc.cache.edn | 1 + .../viz/2/quil/middlewares/deprecated_options.js | 95 ++++++++ .../2/quil/middlewares/deprecated_options.js.map | 1 + assets/viz/2/quil/middlewares/fun_mode.cljc | 78 ++++++ .../viz/2/quil/middlewares/fun_mode.cljc.cache.edn | 1 + assets/viz/2/quil/middlewares/fun_mode.js | 155 ++++++++++++ assets/viz/2/quil/middlewares/fun_mode.js.map | 1 + assets/viz/2/quil/middlewares/navigation_2d.cljc | 89 +++++++ .../quil/middlewares/navigation_2d.cljc.cache.edn | 1 + assets/viz/2/quil/middlewares/navigation_2d.js | 116 +++++++++ assets/viz/2/quil/middlewares/navigation_2d.js.map | 1 + assets/viz/2/quil/middlewares/navigation_3d.cljc | 188 +++++++++++++++ .../quil/middlewares/navigation_3d.cljc.cache.edn | 1 + assets/viz/2/quil/middlewares/navigation_3d.js | 261 +++++++++++++++++++++ assets/viz/2/quil/middlewares/navigation_3d.js.map | 1 + 16 files changed, 1016 insertions(+) create mode 100644 assets/viz/2/quil/middlewares/deprecated_options.cljc create mode 100644 assets/viz/2/quil/middlewares/deprecated_options.cljc.cache.edn create mode 100644 assets/viz/2/quil/middlewares/deprecated_options.js create mode 100644 assets/viz/2/quil/middlewares/deprecated_options.js.map create mode 100644 assets/viz/2/quil/middlewares/fun_mode.cljc create mode 100644 assets/viz/2/quil/middlewares/fun_mode.cljc.cache.edn create mode 100644 assets/viz/2/quil/middlewares/fun_mode.js create mode 100644 assets/viz/2/quil/middlewares/fun_mode.js.map create mode 100644 assets/viz/2/quil/middlewares/navigation_2d.cljc create mode 100644 assets/viz/2/quil/middlewares/navigation_2d.cljc.cache.edn create mode 100644 assets/viz/2/quil/middlewares/navigation_2d.js create mode 100644 assets/viz/2/quil/middlewares/navigation_2d.js.map create mode 100644 assets/viz/2/quil/middlewares/navigation_3d.cljc create mode 100644 assets/viz/2/quil/middlewares/navigation_3d.cljc.cache.edn create mode 100644 assets/viz/2/quil/middlewares/navigation_3d.js create mode 100644 assets/viz/2/quil/middlewares/navigation_3d.js.map (limited to 'assets/viz/2/quil/middlewares') diff --git a/assets/viz/2/quil/middlewares/deprecated_options.cljc b/assets/viz/2/quil/middlewares/deprecated_options.cljc new file mode 100644 index 0000000..6ed40d2 --- /dev/null +++ b/assets/viz/2/quil/middlewares/deprecated_options.cljc @@ -0,0 +1,26 @@ +(ns quil.middlewares.deprecated-options) + +(def ^:private deprecated + {:decor ["2.0" "Try :features [:present] for similar effect"] + :target ["2.0" "Use :features [:keep-on-top] instead."] + :safe-draw-fn ["2.0" "Use :features [:no-safe-fns] instead."]}) + +(defn- check-features-vector [features] + (let [features (set features)] + (when (features :no-safe-draw) + (println "Feature :no-safe-draw was renamed to :no-safe-fns in Quil 2.1." + "Use :feature [:no-safe-fns] now.")) + (disj features :no-safe-draw))) + +(defn deprecated-options + "Checks if options map contains deprected options and removes them. + Prints messages how to fix deprecated functions." + [options] + (let [options (update-in options [:features] check-features-vector)] + (->> (for [[name value] options] + (if-let [[version message] (deprecated name)] + (do (println name "option was removed in Quil" version "." message) + nil) + [name value])) + (remove nil?) + (into {})))) diff --git a/assets/viz/2/quil/middlewares/deprecated_options.cljc.cache.edn b/assets/viz/2/quil/middlewares/deprecated_options.cljc.cache.edn new file mode 100644 index 0000000..0af4bd9 --- /dev/null +++ b/assets/viz/2/quil/middlewares/deprecated_options.cljc.cache.edn @@ -0,0 +1 @@ +{:rename-macros {}, :renames {}, :use-macros {}, :excludes #{}, :name quil.middlewares.deprecated-options, :imports nil, :requires nil, :uses nil, :defs {deprecated {:name quil.middlewares.deprecated-options/deprecated, :file "out/quil/middlewares/deprecated_options.cljc", :line 3, :column 1, :end-line 3, :end-column 26, :private true, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/deprecated_options.cljc", :line 3, :column 16, :end-line 3, :end-column 26, :private true}, :tag cljs.core/IMap}, check-features-vector {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/deprecated_options.cljc", :line 8, :column 8, :end-line 8, :end-column 29, :private true, :arglists (quote ([features]))}, :private true, :name quil.middlewares.deprecated-options/check-features-vector, :variadic false, :file "out/quil/middlewares/deprecated_options.cljc", :end-column 29, :method-params ([features]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 8, :end-line 8, :max-fixed-arity 1, :fn-var true, :arglists (quote ([features]))}, deprecated-options {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/deprecated_options.cljc", :line 15, :column 7, :end-line 15, :end-column 25, :arglists (quote ([options])), :doc "Checks if options map contains deprected options and removes them.\n Prints messages how to fix deprecated functions."}, :name quil.middlewares.deprecated-options/deprecated-options, :variadic false, :file "out/quil/middlewares/deprecated_options.cljc", :end-column 25, :method-params ([options]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 15, :end-line 15, :max-fixed-arity 1, :fn-var true, :arglists (quote ([options])), :doc "Checks if options map contains deprected options and removes them.\n Prints messages how to fix deprecated functions."}}, :require-macros nil, :cljs.analyzer/constants {:seen #{:features :decor :safe-draw-fn :no-safe-draw :target}, :order [:decor :target :safe-draw-fn :no-safe-draw :features]}, :doc nil} \ No newline at end of file diff --git a/assets/viz/2/quil/middlewares/deprecated_options.js b/assets/viz/2/quil/middlewares/deprecated_options.js new file mode 100644 index 0000000..2ac66e3 --- /dev/null +++ b/assets/viz/2/quil/middlewares/deprecated_options.js @@ -0,0 +1,95 @@ +// Compiled by ClojureScript 1.9.473 {} +goog.provide('quil.middlewares.deprecated_options'); +goog.require('cljs.core'); +quil.middlewares.deprecated_options.deprecated = new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"decor","decor",-1730969431),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, ["2.0","Try :features [:present] for similar effect"], null),new cljs.core.Keyword(null,"target","target",253001721),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, ["2.0","Use :features [:keep-on-top] instead."], null),new cljs.core.Keyword(null,"safe-draw-fn","safe-draw-fn",1454900202),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, ["2.0","Use :features [:no-safe-fns] instead."], null)], null); +quil.middlewares.deprecated_options.check_features_vector = (function quil$middlewares$deprecated_options$check_features_vector(features){ +var features__$1 = cljs.core.set.call(null,features); +if(cljs.core.truth_(features__$1.call(null,new cljs.core.Keyword(null,"no-safe-draw","no-safe-draw",-1157778157)))){ +cljs.core.println.call(null,"Feature :no-safe-draw was renamed to :no-safe-fns in Quil 2.1.","Use :feature [:no-safe-fns] now."); +} else { +} + +return cljs.core.disj.call(null,features__$1,new cljs.core.Keyword(null,"no-safe-draw","no-safe-draw",-1157778157)); +}); +/** + * Checks if options map contains deprected options and removes them. + * Prints messages how to fix deprecated functions. + */ +quil.middlewares.deprecated_options.deprecated_options = (function quil$middlewares$deprecated_options$deprecated_options(options){ +var options__$1 = cljs.core.update_in.call(null,options,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"features","features",-1146962336)], null),quil.middlewares.deprecated_options.check_features_vector); +return cljs.core.into.call(null,cljs.core.PersistentArrayMap.EMPTY,cljs.core.remove.call(null,cljs.core.nil_QMARK_,(function (){var iter__7602__auto__ = ((function (options__$1){ +return (function quil$middlewares$deprecated_options$deprecated_options_$_iter__8043(s__8044){ +return (new cljs.core.LazySeq(null,((function (options__$1){ +return (function (){ +var s__8044__$1 = s__8044; +while(true){ +var temp__4657__auto__ = cljs.core.seq.call(null,s__8044__$1); +if(temp__4657__auto__){ +var s__8044__$2 = temp__4657__auto__; +if(cljs.core.chunked_seq_QMARK_.call(null,s__8044__$2)){ +var c__7600__auto__ = cljs.core.chunk_first.call(null,s__8044__$2); +var size__7601__auto__ = cljs.core.count.call(null,c__7600__auto__); +var b__8046 = cljs.core.chunk_buffer.call(null,size__7601__auto__); +if((function (){var i__8045 = (0); +while(true){ +if((i__8045 < size__7601__auto__)){ +var vec__8059 = cljs.core._nth.call(null,c__7600__auto__,i__8045); +var name = cljs.core.nth.call(null,vec__8059,(0),null); +var value = cljs.core.nth.call(null,vec__8059,(1),null); +cljs.core.chunk_append.call(null,b__8046,(function (){var temp__4655__auto__ = quil.middlewares.deprecated_options.deprecated.call(null,name); +if(cljs.core.truth_(temp__4655__auto__)){ +var vec__8062 = temp__4655__auto__; +var version = cljs.core.nth.call(null,vec__8062,(0),null); +var message = cljs.core.nth.call(null,vec__8062,(1),null); +cljs.core.println.call(null,name,"option was removed in Quil",version,".",message); + +return null; +} else { +return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [name,value], null); +} +})()); + +var G__8071 = (i__8045 + (1)); +i__8045 = G__8071; +continue; +} else { +return true; +} +break; +} +})()){ +return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__8046),quil$middlewares$deprecated_options$deprecated_options_$_iter__8043.call(null,cljs.core.chunk_rest.call(null,s__8044__$2))); +} else { +return cljs.core.chunk_cons.call(null,cljs.core.chunk.call(null,b__8046),null); +} +} else { +var vec__8065 = cljs.core.first.call(null,s__8044__$2); +var name = cljs.core.nth.call(null,vec__8065,(0),null); +var value = cljs.core.nth.call(null,vec__8065,(1),null); +return cljs.core.cons.call(null,(function (){var temp__4655__auto__ = quil.middlewares.deprecated_options.deprecated.call(null,name); +if(cljs.core.truth_(temp__4655__auto__)){ +var vec__8068 = temp__4655__auto__; +var version = cljs.core.nth.call(null,vec__8068,(0),null); +var message = cljs.core.nth.call(null,vec__8068,(1),null); +cljs.core.println.call(null,name,"option was removed in Quil",version,".",message); + +return null; +} else { +return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [name,value], null); +} +})(),quil$middlewares$deprecated_options$deprecated_options_$_iter__8043.call(null,cljs.core.rest.call(null,s__8044__$2))); +} +} else { +return null; +} +break; +} +});})(options__$1)) +,null,null)); +});})(options__$1)) +; +return iter__7602__auto__.call(null,options__$1); +})())); +}); + +//# sourceMappingURL=deprecated_options.js.map \ No newline at end of file diff --git a/assets/viz/2/quil/middlewares/deprecated_options.js.map b/assets/viz/2/quil/middlewares/deprecated_options.js.map new file mode 100644 index 0000000..90fab0a --- /dev/null +++ b/assets/viz/2/quil/middlewares/deprecated_options.js.map @@ -0,0 +1 @@ +{"version":3,"file":"\/home\/mediocregopher\/src\/viz\/out\/quil\/middlewares\/deprecated_options.js","sources":["deprecated_options.cljc"],"lineCount":95,"mappings":";AAAA;;AAEA,iDAAA,2CAAA,wDAAA,mFAAA,MAAA,sDAAA,wDAAA,mFAAA,MAAA,gDAAA,qEAAA,mFAAA,MAAA,loBAAeA;AAKf,4DAAA,5DAAOC,gIAAuBC;AAA9B,AACE,IAAMA,eAAS,AAACC,wBAAID;AAApB,AACE,oBAAM,uBAAA,vBAACA;AAAP,AACE,4BAAA,iEAAA,7FAACE;;AADH;;AAGA,6CAAA,tCAACC,yBAAKH;;AAEV;;;;yDAAA,zDAAMI,0HAGHC;AAHH,AAIE,IAAMA,cAAQ,sCAAA,mFAAA,zHAACC,8BAAUD,iKAAoBN;AAA7C,mHACO,iBAAAQ,qBAAA,tFAKA,AAAC+B,2BAAOC,9FACR,gCAAA,zBAACC;qFANDhC;AAAA,AAAA,YAAAC,kBAAA,KAAA;;AAAA,AAAA,IAAAD,cAAAA;;AAAA,AAAA,IAAAE,qBAAA,AAAAC,wBAAAH;AAAA,AAAA,GAAAE;AAAA,AAAA,IAAAF,cAAAE;AAAA,AAAA,GAAA,AAAAE,uCAAAJ;AAAA,IAAAK,kBAqwE0C,AAAA4B,gCAAAjC;IArwE1CM,qBAAA,AAAAC,0BAAAF;IAAAG,UAAA,AAAAC,iCAAAH;AAAA,AAAA,GAAA,AAAA,iBAAAI,UAAA;;AAAA,AAAA,GAAA,CAAAA,UAAAJ;AAAA,IAAAK,YAAA,AAAAC,yBAAAP,gBAAAK;WAAA,AAAAG,wBAAAF,UAAA,IAAA,7CAAOY;YAAP,AAAAV,wBAAAF,UAAA,IAAA,9CAAYa;AAAZ,AAAA,AAAA,AAAAV,iCAAAN,QACE,iBAAAiB,qBAA2B,AAACnC,yDAAWiC;AAAvC,AAAA,oBAAAE;AAAA,IAAAC,YAAAD;cAAA,AAAAZ,wBAAAa,UAAA,IAAA,hDAAUE;cAAV,AAAAf,wBAAAa,UAAA,IAAA,hDAAkBG;AAAlB,AACE,AAAI,iCAAA,qCAAA,tEAACnC,4BAAQ6B,kCAAkCK,YAAYC;;AAA3D;;AADF,0FAGGN,KAAKC;;;;AAJV,cAAA,CAAAd,UAAA;;;;AAAA;;;;;AAAA,OAAAK,+BAAA,AAAAC,0BAAAR,SAAA,AAAAS,8EAAA,AAAAC,+BAAAlB;;AAAA,OAAAe,+BAAA,AAAAC,0BAAAR,SAAA;;;AAAA,IAAAW,YAAA,AAAAC,0BAAApB;WAAA,AAAAa,wBAAAM,UAAA,IAAA,7CAAOI;YAAP,AAAAV,wBAAAM,UAAA,IAAA,9CAAYK;AAAZ,AAAA,OAAAH,yBACE,iBAAAI,qBAA2B,AAACnC,yDAAWiC;AAAvC,AAAA,oBAAAE;AAAA,IAAAE,YAAAF;cAAA,AAAAZ,wBAAAc,UAAA,IAAA,hDAAUC;cAAV,AAAAf,wBAAAc,UAAA,IAAA,hDAAkBE;AAAlB,AACE,AAAI,iCAAA,qCAAA,tEAACnC,4BAAQ6B,kCAAkCK,YAAYC;;AAA3D;;AADF,0FAGGN,KAAKC;;KAJV,AAAAP,8EAAA,AAAAK,yBAAAtB;;;AAAA;;;;;CAAA,KAAA;;;AAAA,AAAA,OAAAD,6BAAmBF","names":["quil.middlewares.deprecated-options\/deprecated","quil.middlewares.deprecated-options\/check-features-vector","features","cljs.core\/set","cljs.core\/println","cljs.core\/disj","quil.middlewares.deprecated-options\/deprecated-options","options","cljs.core\/update-in","iter__7602__auto__","s__8044","cljs.core\/LazySeq","temp__4657__auto__","cljs.core\/seq","cljs.core\/chunked-seq?","c__7600__auto__","size__7601__auto__","cljs.core\/count","b__8046","cljs.core\/chunk-buffer","i__8045","vec__8059","cljs.core\/-nth","cljs.core\/nth","cljs.core\/chunk-append","cljs.core\/chunk-cons","cljs.core\/chunk","iter__8043","cljs.core\/chunk-rest","vec__8065","cljs.core\/first","cljs.core\/cons","cljs.core\/rest","name","value","temp__4655__auto__","vec__8062","vec__8068","version","message","cljs.core\/remove","cljs.core\/nil?","cljs.core\/into","cljs.core\/chunk-first"]} \ No newline at end of file diff --git a/assets/viz/2/quil/middlewares/fun_mode.cljc b/assets/viz/2/quil/middlewares/fun_mode.cljc new file mode 100644 index 0000000..14330c7 --- /dev/null +++ b/assets/viz/2/quil/middlewares/fun_mode.cljc @@ -0,0 +1,78 @@ +(ns quil.middlewares.fun-mode + (:require [quil.core :as q])) + +(defn- wrap-setup [options] + (let [setup (:setup options (fn [] nil))] + (assoc options + :setup #(reset! (q/state-atom) (setup))))) + +(defn- wrap-draw-update [options] + (let [draw (:draw options (fn [_])) + update (:update options identity) + quil-draw #(-> (q/state-atom) + (swap! (if (= (q/frame-count) 1) + identity + update)) + (draw))] + (-> options + (dissoc :update) + (assoc :draw quil-draw)))) + +(defn- mouse-event [] + {:x (q/mouse-x) + :y (q/mouse-y)}) + +(defn- mouse-event-full [] + {:x (q/mouse-x) + :y (q/mouse-y) + :button (q/mouse-button)}) + +(defn- key-event [] + {:key (q/key-as-keyword) + :key-code (q/key-code) + :raw-key (q/raw-key) + #?@(:clj [:modifiers (q/key-modifiers)])}) + +(defn- wrap-handler + ([options handler-key] + (wrap-handler options handler-key nil)) + ([options handler-key event-fn] + (if-let [handler (options handler-key)] + (assoc options handler-key + (if event-fn + #(swap! (q/state-atom) handler (event-fn)) + #(swap! (q/state-atom) handler))) + options))) + +(defn- wrap-handlers [options & handlers] + (reduce (fn [options handler] + (if (keyword? handler) + (wrap-handler options handler) + (apply wrap-handler options handler))) + options handlers)) + +(defn- wrap-mouse-wheel [options] + (if-let [handler (:mouse-wheel options)] + (assoc options :mouse-wheel + (fn [rotation] + (swap! (q/state-atom) handler rotation))) + options)) + +(defn fun-mode + "Introduces function mode making all handlers (setup, draw, mouse-click, etc) + state-aware. Adds support for 'update' function." + [options] + (-> options + wrap-setup + wrap-draw-update + (wrap-handlers :focus-gained :focus-lost [:mouse-entered mouse-event] + [:mouse-exited mouse-event] [:mouse-pressed mouse-event-full] + [:mouse-released mouse-event] [:mouse-clicked mouse-event-full] + [:mouse-moved (fn [] {:x (q/mouse-x) :y (q/mouse-y) + :p-x (q/pmouse-x) :p-y (q/pmouse-y)})] + [:mouse-dragged (fn [] {:x (q/mouse-x) :y (q/mouse-y) + :p-x (q/pmouse-x) :p-y (q/pmouse-y) + :button (q/mouse-button)})] + [:key-pressed key-event] :key-released [:key-typed key-event] + :on-close) + wrap-mouse-wheel)) diff --git a/assets/viz/2/quil/middlewares/fun_mode.cljc.cache.edn b/assets/viz/2/quil/middlewares/fun_mode.cljc.cache.edn new file mode 100644 index 0000000..bde2282 --- /dev/null +++ b/assets/viz/2/quil/middlewares/fun_mode.cljc.cache.edn @@ -0,0 +1 @@ +{:rename-macros {}, :renames {}, :externs {Error {}}, :use-macros {}, :excludes #{}, :name quil.middlewares.fun-mode, :imports nil, :requires {q quil.core, quil.core quil.core}, :uses nil, :defs {wrap-setup {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/fun_mode.cljc", :line 4, :column 8, :end-line 4, :end-column 18, :private true, :arglists (quote ([options]))}, :private true, :name quil.middlewares.fun-mode/wrap-setup, :variadic false, :file "out/quil/middlewares/fun_mode.cljc", :end-column 18, :method-params ([options]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 4, :end-line 4, :max-fixed-arity 1, :fn-var true, :arglists (quote ([options]))}, wrap-draw-update {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/fun_mode.cljc", :line 9, :column 8, :end-line 9, :end-column 24, :private true, :arglists (quote ([options]))}, :private true, :name quil.middlewares.fun-mode/wrap-draw-update, :variadic false, :file "out/quil/middlewares/fun_mode.cljc", :end-column 24, :method-params ([options]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 9, :end-line 9, :max-fixed-arity 1, :fn-var true, :arglists (quote ([options]))}, mouse-event {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/fun_mode.cljc", :line 21, :column 8, :end-line 21, :end-column 19, :private true, :arglists (quote ([]))}, :private true, :name quil.middlewares.fun-mode/mouse-event, :variadic false, :file "out/quil/middlewares/fun_mode.cljc", :end-column 19, :method-params ([]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 21, :end-line 21, :max-fixed-arity 0, :fn-var true, :arglists (quote ([]))}, mouse-event-full {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/fun_mode.cljc", :line 25, :column 8, :end-line 25, :end-column 24, :private true, :arglists (quote ([]))}, :private true, :name quil.middlewares.fun-mode/mouse-event-full, :variadic false, :file "out/quil/middlewares/fun_mode.cljc", :end-column 24, :method-params ([]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 25, :end-line 25, :max-fixed-arity 0, :fn-var true, :arglists (quote ([]))}, key-event {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/fun_mode.cljc", :line 30, :column 8, :end-line 30, :end-column 17, :private true, :arglists (quote ([]))}, :private true, :name quil.middlewares.fun-mode/key-event, :variadic false, :file "out/quil/middlewares/fun_mode.cljc", :end-column 17, :method-params ([]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 30, :end-line 30, :max-fixed-arity 0, :fn-var true, :arglists (quote ([]))}, wrap-handler {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/fun_mode.cljc", :line 36, :column 8, :end-line 36, :end-column 20, :private true, :arglists (quote ([options handler-key] [options handler-key event-fn])), :top-fn {:variadic false, :max-fixed-arity 3, :method-params ([options handler-key] [options handler-key event-fn]), :arglists ([options handler-key] [options handler-key event-fn]), :arglists-meta (nil nil)}}, :private true, :name quil.middlewares.fun-mode/wrap-handler, :variadic false, :file "out/quil/middlewares/fun_mode.cljc", :end-column 20, :top-fn {:variadic false, :max-fixed-arity 3, :method-params ([options handler-key] [options handler-key event-fn]), :arglists ([options handler-key] [options handler-key event-fn]), :arglists-meta (nil nil)}, :method-params ([options handler-key] [options handler-key event-fn]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 36, :end-line 36, :max-fixed-arity 3, :fn-var true, :arglists ([options handler-key] [options handler-key event-fn])}, wrap-handlers {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/fun_mode.cljc", :line 47, :column 8, :end-line 47, :end-column 21, :private true, :arglists (quote ([options & handlers])), :top-fn {:variadic true, :max-fixed-arity 1, :method-params [(options handlers)], :arglists ([options & handlers]), :arglists-meta (nil)}}, :private true, :name quil.middlewares.fun-mode/wrap-handlers, :variadic true, :file "out/quil/middlewares/fun_mode.cljc", :end-column 21, :top-fn {:variadic true, :max-fixed-arity 1, :method-params [(options handlers)], :arglists ([options & handlers]), :arglists-meta (nil)}, :method-params [(options handlers)], :protocol-impl nil, :arglists-meta (nil), :column 1, :line 47, :end-line 47, :max-fixed-arity 1, :fn-var true, :arglists ([options & handlers])}, wrap-mouse-wheel {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/fun_mode.cljc", :line 54, :column 8, :end-line 54, :end-column 24, :private true, :arglists (quote ([options]))}, :private true, :name quil.middlewares.fun-mode/wrap-mouse-wheel, :variadic false, :file "out/quil/middlewares/fun_mode.cljc", :end-column 24, :method-params ([options]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 54, :end-line 54, :max-fixed-arity 1, :fn-var true, :arglists (quote ([options]))}, fun-mode {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/fun_mode.cljc", :line 61, :column 7, :end-line 61, :end-column 15, :arglists (quote ([options])), :doc "Introduces function mode making all handlers (setup, draw, mouse-click, etc)\n state-aware. Adds support for 'update' function."}, :name quil.middlewares.fun-mode/fun-mode, :variadic false, :file "out/quil/middlewares/fun_mode.cljc", :end-column 15, :method-params ([options]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 61, :end-line 61, :max-fixed-arity 1, :fn-var true, :arglists (quote ([options])), :doc "Introduces function mode making all handlers (setup, draw, mouse-click, etc)\n state-aware. Adds support for 'update' function."}}, :require-macros nil, :cljs.analyzer/constants {:seen #{:y :key-code :p-y :key-typed :mouse-clicked :mouse-released :mouse-exited :key :on-close :button :mouse-wheel :mouse-moved :update :setup :mouse-pressed :focus-gained :mouse-entered :focus-lost :key-pressed :key-released :p-x :x :raw-key :draw :mouse-dragged}, :order [:setup :draw :update :x :y :button :key :key-code :raw-key :mouse-wheel :focus-gained :focus-lost :mouse-entered :mouse-exited :mouse-pressed :mouse-released :mouse-clicked :mouse-moved :p-x :p-y :mouse-dragged :key-pressed :key-released :key-typed :on-close]}, :doc nil} \ No newline at end of file diff --git a/assets/viz/2/quil/middlewares/fun_mode.js b/assets/viz/2/quil/middlewares/fun_mode.js new file mode 100644 index 0000000..73285ea --- /dev/null +++ b/assets/viz/2/quil/middlewares/fun_mode.js @@ -0,0 +1,155 @@ +// Compiled by ClojureScript 1.9.473 {} +goog.provide('quil.middlewares.fun_mode'); +goog.require('cljs.core'); +goog.require('quil.core'); +quil.middlewares.fun_mode.wrap_setup = (function quil$middlewares$fun_mode$wrap_setup(options){ +var setup = new cljs.core.Keyword(null,"setup","setup",1987730512).cljs$core$IFn$_invoke$arity$2(options,(function (){ +return null; +})); +return cljs.core.assoc.call(null,options,new cljs.core.Keyword(null,"setup","setup",1987730512),((function (setup){ +return (function (){ +return cljs.core.reset_BANG_.call(null,quil.core.state_atom.call(null),setup.call(null)); +});})(setup)) +); +}); +quil.middlewares.fun_mode.wrap_draw_update = (function quil$middlewares$fun_mode$wrap_draw_update(options){ +var draw = new cljs.core.Keyword(null,"draw","draw",1358331674).cljs$core$IFn$_invoke$arity$2(options,(function (_){ +return null; +})); +var update = new cljs.core.Keyword(null,"update","update",1045576396).cljs$core$IFn$_invoke$arity$2(options,cljs.core.identity); +var quil_draw = ((function (draw,update){ +return (function (){ +return draw.call(null,cljs.core.swap_BANG_.call(null,quil.core.state_atom.call(null),((cljs.core._EQ_.call(null,quil.core.frame_count.call(null),(1)))?cljs.core.identity:update))); +});})(draw,update)) +; +return cljs.core.assoc.call(null,cljs.core.dissoc.call(null,options,new cljs.core.Keyword(null,"update","update",1045576396)),new cljs.core.Keyword(null,"draw","draw",1358331674),quil_draw); +}); +quil.middlewares.fun_mode.mouse_event = (function quil$middlewares$fun_mode$mouse_event(){ +return new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"x","x",2099068185),quil.core.mouse_x.call(null),new cljs.core.Keyword(null,"y","y",-1757859776),quil.core.mouse_y.call(null)], null); +}); +quil.middlewares.fun_mode.mouse_event_full = (function quil$middlewares$fun_mode$mouse_event_full(){ +return new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"x","x",2099068185),quil.core.mouse_x.call(null),new cljs.core.Keyword(null,"y","y",-1757859776),quil.core.mouse_y.call(null),new cljs.core.Keyword(null,"button","button",1456579943),quil.core.mouse_button.call(null)], null); +}); +quil.middlewares.fun_mode.key_event = (function quil$middlewares$fun_mode$key_event(){ +return new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"key","key",-1516042587),quil.core.key_as_keyword.call(null),new cljs.core.Keyword(null,"key-code","key-code",-1732114304),quil.core.key_code.call(null),new cljs.core.Keyword(null,"raw-key","raw-key",-162482279),quil.core.raw_key.call(null)], null); +}); +quil.middlewares.fun_mode.wrap_handler = (function quil$middlewares$fun_mode$wrap_handler(var_args){ +var args9436 = []; +var len__7927__auto___9439 = arguments.length; +var i__7928__auto___9440 = (0); +while(true){ +if((i__7928__auto___9440 < len__7927__auto___9439)){ +args9436.push((arguments[i__7928__auto___9440])); + +var G__9441 = (i__7928__auto___9440 + (1)); +i__7928__auto___9440 = G__9441; +continue; +} else { +} +break; +} + +var G__9438 = args9436.length; +switch (G__9438) { +case 2: +return quil.middlewares.fun_mode.wrap_handler.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)])); + +break; +case 3: +return quil.middlewares.fun_mode.wrap_handler.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)])); + +break; +default: +throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Invalid arity: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(args9436.length)].join(''))); + +} +}); + +quil.middlewares.fun_mode.wrap_handler.cljs$core$IFn$_invoke$arity$2 = (function (options,handler_key){ +return quil.middlewares.fun_mode.wrap_handler.call(null,options,handler_key,null); +}); + +quil.middlewares.fun_mode.wrap_handler.cljs$core$IFn$_invoke$arity$3 = (function (options,handler_key,event_fn){ +var temp__4655__auto__ = options.call(null,handler_key); +if(cljs.core.truth_(temp__4655__auto__)){ +var handler = temp__4655__auto__; +return cljs.core.assoc.call(null,options,handler_key,(cljs.core.truth_(event_fn)?((function (handler,temp__4655__auto__){ +return (function (){ +return cljs.core.swap_BANG_.call(null,quil.core.state_atom.call(null),handler,event_fn.call(null)); +});})(handler,temp__4655__auto__)) +:((function (handler,temp__4655__auto__){ +return (function (){ +return cljs.core.swap_BANG_.call(null,quil.core.state_atom.call(null),handler); +});})(handler,temp__4655__auto__)) +)); +} else { +return options; +} +}); + +quil.middlewares.fun_mode.wrap_handler.cljs$lang$maxFixedArity = 3; + +quil.middlewares.fun_mode.wrap_handlers = (function quil$middlewares$fun_mode$wrap_handlers(var_args){ +var args__7934__auto__ = []; +var len__7927__auto___9445 = arguments.length; +var i__7928__auto___9446 = (0); +while(true){ +if((i__7928__auto___9446 < len__7927__auto___9445)){ +args__7934__auto__.push((arguments[i__7928__auto___9446])); + +var G__9447 = (i__7928__auto___9446 + (1)); +i__7928__auto___9446 = G__9447; +continue; +} else { +} +break; +} + +var argseq__7935__auto__ = ((((1) < args__7934__auto__.length))?(new cljs.core.IndexedSeq(args__7934__auto__.slice((1)),(0),null)):null); +return quil.middlewares.fun_mode.wrap_handlers.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__7935__auto__); +}); + +quil.middlewares.fun_mode.wrap_handlers.cljs$core$IFn$_invoke$arity$variadic = (function (options,handlers){ +return cljs.core.reduce.call(null,(function (options__$1,handler){ +if((handler instanceof cljs.core.Keyword)){ +return quil.middlewares.fun_mode.wrap_handler.call(null,options__$1,handler); +} else { +return cljs.core.apply.call(null,quil.middlewares.fun_mode.wrap_handler,options__$1,handler); +} +}),options,handlers); +}); + +quil.middlewares.fun_mode.wrap_handlers.cljs$lang$maxFixedArity = (1); + +quil.middlewares.fun_mode.wrap_handlers.cljs$lang$applyTo = (function (seq9443){ +var G__9444 = cljs.core.first.call(null,seq9443); +var seq9443__$1 = cljs.core.next.call(null,seq9443); +return quil.middlewares.fun_mode.wrap_handlers.cljs$core$IFn$_invoke$arity$variadic(G__9444,seq9443__$1); +}); + +quil.middlewares.fun_mode.wrap_mouse_wheel = (function quil$middlewares$fun_mode$wrap_mouse_wheel(options){ +var temp__4655__auto__ = new cljs.core.Keyword(null,"mouse-wheel","mouse-wheel",1811662439).cljs$core$IFn$_invoke$arity$1(options); +if(cljs.core.truth_(temp__4655__auto__)){ +var handler = temp__4655__auto__; +return cljs.core.assoc.call(null,options,new cljs.core.Keyword(null,"mouse-wheel","mouse-wheel",1811662439),((function (handler,temp__4655__auto__){ +return (function (rotation){ +return cljs.core.swap_BANG_.call(null,quil.core.state_atom.call(null),handler,rotation); +});})(handler,temp__4655__auto__)) +); +} else { +return options; +} +}); +/** + * Introduces function mode making all handlers (setup, draw, mouse-click, etc) + * state-aware. Adds support for 'update' function. + */ +quil.middlewares.fun_mode.fun_mode = (function quil$middlewares$fun_mode$fun_mode(options){ +return quil.middlewares.fun_mode.wrap_mouse_wheel.call(null,quil.middlewares.fun_mode.wrap_handlers.call(null,quil.middlewares.fun_mode.wrap_draw_update.call(null,quil.middlewares.fun_mode.wrap_setup.call(null,options)),new cljs.core.Keyword(null,"focus-gained","focus-gained",-857086384),new cljs.core.Keyword(null,"focus-lost","focus-lost",-554849613),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"mouse-entered","mouse-entered",811350322),quil.middlewares.fun_mode.mouse_event], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"mouse-exited","mouse-exited",-483205244),quil.middlewares.fun_mode.mouse_event], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"mouse-pressed","mouse-pressed",736955536),quil.middlewares.fun_mode.mouse_event_full], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"mouse-released","mouse-released",-664480061),quil.middlewares.fun_mode.mouse_event], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"mouse-clicked","mouse-clicked",-199339421),quil.middlewares.fun_mode.mouse_event_full], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"mouse-moved","mouse-moved",-1918152310),(function (){ +return new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"x","x",2099068185),quil.core.mouse_x.call(null),new cljs.core.Keyword(null,"y","y",-1757859776),quil.core.mouse_y.call(null),new cljs.core.Keyword(null,"p-x","p-x",-1721211211),quil.core.pmouse_x.call(null),new cljs.core.Keyword(null,"p-y","p-y",-530704830),quil.core.pmouse_y.call(null)], null); +})], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"mouse-dragged","mouse-dragged",-1220073441),(function (){ +return new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"x","x",2099068185),quil.core.mouse_x.call(null),new cljs.core.Keyword(null,"y","y",-1757859776),quil.core.mouse_y.call(null),new cljs.core.Keyword(null,"p-x","p-x",-1721211211),quil.core.pmouse_x.call(null),new cljs.core.Keyword(null,"p-y","p-y",-530704830),quil.core.pmouse_y.call(null),new cljs.core.Keyword(null,"button","button",1456579943),quil.core.mouse_button.call(null)], null); +})], null),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"key-pressed","key-pressed",-757100364),quil.middlewares.fun_mode.key_event], null),new cljs.core.Keyword(null,"key-released","key-released",215919828),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"key-typed","key-typed",-876037597),quil.middlewares.fun_mode.key_event], null),new cljs.core.Keyword(null,"on-close","on-close",-761178394))); +}); + +//# sourceMappingURL=fun_mode.js.map \ No newline at end of file diff --git a/assets/viz/2/quil/middlewares/fun_mode.js.map b/assets/viz/2/quil/middlewares/fun_mode.js.map new file mode 100644 index 0000000..ee748fd --- /dev/null +++ b/assets/viz/2/quil/middlewares/fun_mode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"\/home\/mediocregopher\/src\/viz\/out\/quil\/middlewares\/fun_mode.js","sources":["fun_mode.cljc"],"lineCount":155,"mappings":";AAAA;;;AAGA,uCAAA,vCAAOA,sFAAYC;AAAnB,AACE,IAAMC,QAAM,AAAA,qFAAQD,QAAQ;AAAA,AAAA;;AAA5B,AACE,yCAAA,uDAAA,zFAACE,0BAAMF;;AAAP,AACU,OAACG,gCAAO,AAACC,gCAAc,AAACH;;;;AAEtC,6CAAA,7C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AM,AAACP,gCAAc8B,QAAQc;;;;AACvChD;;;AAEJ;;;;qCAAA,rCAAMiD,kFAGHjD;AAHH,AAIE,kNAAIA,\/CACAD,rDACAM,lDACA,kDAAA,qDAAA,yDAAA,qEAAA,iEAAA,mFAAA,oHAAA,mFAAA,mHAAA,mFAAA,yHAAA,mFAAA,uHAAA,mFAAA,0HAAA,mFAAA,z2CAACiC,+bAAwDvB,sMAC3BA,uMAA6BG,+MAC3BH,wMAA6BG,0MAChC,l+CAO7B6B;AAP6B,AAAA,kDAAA,4EAAA,6EAAA,kFAAA,5LAAW,AAAC\/B,6EAAc,AAACC,iFACd,AAACiC,iFAAiB,AAACC;WAJ7D,mFAAA,wEAK+B;AAAA,AAAA,kDAAA,4EAAA,6EAAA,kFAAA,iFAAA,7QAAW,AAACnC,6EAAc,AAACC,iFACd,AAACiC,iFAAiB,AAACC,uFAChB,AAAChC;WAPhD,mFAAA,+GAAA,oEAAA,mFAAA,2GAAA,9SAQ6BC,kQAAqCA","names":["quil.middlewares.fun-mode\/wrap-setup","options","setup","cljs.core\/assoc","cljs.core\/reset!","quil.core\/state-atom","quil.middlewares.fun-mode\/wrap-draw-update","draw","_","update","cljs.core\/identity","quil-draw","cljs.core\/swap!","cljs.core\/=","quil.core\/frame-count","cljs.core\/dissoc","quil.middlewares.fun-mode\/mouse-event","quil.core\/mouse-x","quil.core\/mouse-y","quil.middlewares.fun-mode\/mouse-event-full","quil.core\/mouse-button","quil.middlewares.fun-mode\/key-event","quil.core\/key-as-keyword","quil.core\/key-code","quil.core\/raw-key","var_args","args9436","len__7927__auto__","i__7928__auto__","G__9438","quil.middlewares.fun-mode\/wrap-handler","js\/Error","handler-key","event-fn","temp__4655__auto__","handler","args__7934__auto__","argseq__7935__auto__","cljs.core\/IndexedSeq","quil.middlewares.fun-mode\/wrap-handlers","seq9443","G__9444","cljs.core\/first","cljs.core\/next","handlers","cljs.core\/reduce","cljs.core\/Keyword","cljs.core\/apply","quil.middlewares.fun-mode\/wrap-mouse-wheel","rotation","quil.middlewares.fun-mode\/fun-mode","quil.core\/pmouse-x","quil.core\/pmouse-y"]} \ No newline at end of file diff --git a/assets/viz/2/quil/middlewares/navigation_2d.cljc b/assets/viz/2/quil/middlewares/navigation_2d.cljc new file mode 100644 index 0000000..cd03710 --- /dev/null +++ b/assets/viz/2/quil/middlewares/navigation_2d.cljc @@ -0,0 +1,89 @@ +(ns quil.middlewares.navigation-2d + (:require [quil.core :as q :include-macros true])) + +(def ^:private missing-navigation-key-error + (str "state map is missing :navigation-2d key. " + "Did you accidentally removed it from the state in " + ":update or any other handler?")) + +(defn- assert-state-has-navigation + "Asserts that state map contains :navigation-2d object." + [state] + (when-not (:navigation-2d state) + (throw #?(:clj (RuntimeException. missing-navigation-key-error) + :cljs (js/Error. missing-navigation-key-error))))) + +(defn- default-position + "Default position configuration: zoom is neutral and central point is + width/2, height/2." + [] + {:position [(/ (q/width) 2.0) + (/ (q/height) 2.0)] + :zoom 1}) + +(defn- setup-2d-nav + "Custom 'setup' function which creates initial position + configuration and puts it to the state map." + [user-setup user-settings] + (let [initial-state (-> user-settings + (select-keys [:position :zoom]) + (->> (merge (default-position))))] + (update-in (user-setup) [:navigation-2d] + #(merge initial-state %)))) + +(defn- mouse-dragged + "Changes center of the sketch depending on the last mouse move. Takes + zoom into account as well." + [state event] + (assert-state-has-navigation state) + (let [dx (- (:p-x event) (:x event)) + dy (- (:p-y event) (:y event)) + zoom (-> state :navigation-2d :zoom)] + (-> state + (update-in [:navigation-2d :position 0] + (/ dx zoom)) + (update-in [:navigation-2d :position 1] + (/ dy zoom))))) + +(defn- mouse-wheel + "Changes zoom settings based on scroll." + [state event] + (assert-state-has-navigation state) + (update-in state [:navigation-2d :zoom] * (+ 1 (* -0.1 event)))) + +(defn- draw + "Calls user draw function with necessary all transformations (position + and zoom) applied." + [user-draw state] + (assert-state-has-navigation state) + (q/push-matrix) + (let [nav-2d (:navigation-2d state) + zoom (:zoom nav-2d) + pos (:position nav-2d)] + (q/scale zoom) + (q/with-translation [(- (/ (q/width) 2 zoom) (first pos)) + (- (/ (q/height) 2 zoom) (second pos))] + (user-draw state))) + (q/pop-matrix)) + +(defn navigation-2d + "Enables navigation over 2D sketch. Dragging mouse will move center of the + skecth and mouse wheel controls zoom." + [options] + (let [; 2d-navigation related user settings + user-settings (:navigation-2d options) + + ; user-provided handlers which will be overridden + ; by 3d-navigation + user-draw (:draw options (fn [state])) + user-mouse-dragged (:mouse-dragged options (fn [state _] state)) + user-mouse-wheel (:mouse-wheel options (fn [state _] state)) + setup (:setup options (fn [] {}))] + (assoc options + + :setup (partial setup-2d-nav setup user-settings) + + :draw (partial draw user-draw) + + :mouse-dragged (fn [state event] + (user-mouse-dragged (mouse-dragged state event) event)) + :mouse-wheel (fn [state event] + (user-mouse-wheel (mouse-wheel state event) event))))) diff --git a/assets/viz/2/quil/middlewares/navigation_2d.cljc.cache.edn b/assets/viz/2/quil/middlewares/navigation_2d.cljc.cache.edn new file mode 100644 index 0000000..865d7b4 --- /dev/null +++ b/assets/viz/2/quil/middlewares/navigation_2d.cljc.cache.edn @@ -0,0 +1 @@ +{:rename-macros {}, :renames {}, :externs {Error {}}, :use-macros {}, :excludes #{}, :name quil.middlewares.navigation-2d, :imports nil, :requires {q quil.core, quil.core quil.core}, :uses nil, :defs {missing-navigation-key-error {:name quil.middlewares.navigation-2d/missing-navigation-key-error, :file "out/quil/middlewares/navigation_2d.cljc", :line 4, :column 1, :end-line 4, :end-column 44, :private true, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/navigation_2d.cljc", :line 4, :column 16, :end-line 4, :end-column 44, :private true}, :tag any}, assert-state-has-navigation {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/navigation_2d.cljc", :line 9, :column 8, :end-line 9, :end-column 35, :private true, :arglists (quote ([state])), :doc "Asserts that state map contains :navigation-2d object."}, :private true, :name quil.middlewares.navigation-2d/assert-state-has-navigation, :variadic false, :file "out/quil/middlewares/navigation_2d.cljc", :end-column 35, :method-params ([state]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 9, :end-line 9, :max-fixed-arity 1, :fn-var true, :arglists (quote ([state])), :doc "Asserts that state map contains :navigation-2d object."}, default-position {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/navigation_2d.cljc", :line 16, :column 8, :end-line 16, :end-column 24, :private true, :arglists (quote ([])), :doc "Default position configuration: zoom is neutral and central point is\n width/2, height/2."}, :private true, :name quil.middlewares.navigation-2d/default-position, :variadic false, :file "out/quil/middlewares/navigation_2d.cljc", :end-column 24, :method-params ([]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 16, :end-line 16, :max-fixed-arity 0, :fn-var true, :arglists (quote ([])), :doc "Default position configuration: zoom is neutral and central point is\n width/2, height/2."}, setup-2d-nav {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/navigation_2d.cljc", :line 24, :column 8, :end-line 24, :end-column 20, :private true, :arglists (quote ([user-setup user-settings])), :doc "Custom 'setup' function which creates initial position\n configuration and puts it to the state map."}, :private true, :name quil.middlewares.navigation-2d/setup-2d-nav, :variadic false, :file "out/quil/middlewares/navigation_2d.cljc", :end-column 20, :method-params ([user-setup user-settings]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 24, :end-line 24, :max-fixed-arity 2, :fn-var true, :arglists (quote ([user-setup user-settings])), :doc "Custom 'setup' function which creates initial position\n configuration and puts it to the state map."}, mouse-dragged {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/navigation_2d.cljc", :line 34, :column 8, :end-line 34, :end-column 21, :private true, :arglists (quote ([state event])), :doc "Changes center of the sketch depending on the last mouse move. Takes\n zoom into account as well."}, :private true, :name quil.middlewares.navigation-2d/mouse-dragged, :variadic false, :file "out/quil/middlewares/navigation_2d.cljc", :end-column 21, :method-params ([state event]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 34, :end-line 34, :max-fixed-arity 2, :fn-var true, :arglists (quote ([state event])), :doc "Changes center of the sketch depending on the last mouse move. Takes\n zoom into account as well."}, mouse-wheel {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/navigation_2d.cljc", :line 46, :column 8, :end-line 46, :end-column 19, :private true, :arglists (quote ([state event])), :doc "Changes zoom settings based on scroll."}, :private true, :name quil.middlewares.navigation-2d/mouse-wheel, :variadic false, :file "out/quil/middlewares/navigation_2d.cljc", :end-column 19, :method-params ([state event]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 46, :end-line 46, :max-fixed-arity 2, :fn-var true, :arglists (quote ([state event])), :doc "Changes zoom settings based on scroll."}, draw {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/navigation_2d.cljc", :line 52, :column 8, :end-line 52, :end-column 12, :private true, :arglists (quote ([user-draw state])), :doc "Calls user draw function with necessary all transformations (position\n and zoom) applied."}, :private true, :name quil.middlewares.navigation-2d/draw, :variadic false, :file "out/quil/middlewares/navigation_2d.cljc", :end-column 12, :method-params ([user-draw state]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 52, :end-line 52, :max-fixed-arity 2, :fn-var true, :arglists (quote ([user-draw state])), :doc "Calls user draw function with necessary all transformations (position\n and zoom) applied."}, navigation-2d {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/navigation_2d.cljc", :line 67, :column 7, :end-line 67, :end-column 20, :arglists (quote ([options])), :doc "Enables navigation over 2D sketch. Dragging mouse will move center of the\n skecth and mouse wheel controls zoom."}, :name quil.middlewares.navigation-2d/navigation-2d, :variadic false, :file "out/quil/middlewares/navigation_2d.cljc", :end-column 20, :method-params ([options]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 67, :end-line 67, :max-fixed-arity 1, :fn-var true, :arglists (quote ([options])), :doc "Enables navigation over 2D sketch. Dragging mouse will move center of the\n skecth and mouse wheel controls zoom."}}, :require-macros {q quil.core, quil.core quil.core}, :cljs.analyzer/constants {:seen #{:y :p-y :zoom :mouse-wheel :setup :p-x :position :x :draw :navigation-2d :mouse-dragged}, :order [:navigation-2d :position :zoom :p-x :x :p-y :y :draw :mouse-dragged :mouse-wheel :setup]}, :doc nil} \ No newline at end of file diff --git a/assets/viz/2/quil/middlewares/navigation_2d.js b/assets/viz/2/quil/middlewares/navigation_2d.js new file mode 100644 index 0000000..5216b02 --- /dev/null +++ b/assets/viz/2/quil/middlewares/navigation_2d.js @@ -0,0 +1,116 @@ +// Compiled by ClojureScript 1.9.473 {} +goog.provide('quil.middlewares.navigation_2d'); +goog.require('cljs.core'); +goog.require('quil.core'); +quil.middlewares.navigation_2d.missing_navigation_key_error = [cljs.core.str.cljs$core$IFn$_invoke$arity$1("state map is missing :navigation-2d key. "),cljs.core.str.cljs$core$IFn$_invoke$arity$1("Did you accidentally removed it from the state in "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(":update or any other handler?")].join(''); +/** + * Asserts that state map contains :navigation-2d object. + */ +quil.middlewares.navigation_2d.assert_state_has_navigation = (function quil$middlewares$navigation_2d$assert_state_has_navigation(state){ +if(cljs.core.truth_(new cljs.core.Keyword(null,"navigation-2d","navigation-2d",-1924168611).cljs$core$IFn$_invoke$arity$1(state))){ +return null; +} else { +throw (new Error(quil.middlewares.navigation_2d.missing_navigation_key_error)); +} +}); +/** + * Default position configuration: zoom is neutral and central point is + * width/2, height/2. + */ +quil.middlewares.navigation_2d.default_position = (function quil$middlewares$navigation_2d$default_position(){ +return new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"position","position",-2011731912),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(quil.core.width.call(null) / 2.0),(quil.core.height.call(null) / 2.0)], null),new cljs.core.Keyword(null,"zoom","zoom",-1827487038),(1)], null); +}); +/** + * Custom 'setup' function which creates initial position + * configuration and puts it to the state map. + */ +quil.middlewares.navigation_2d.setup_2d_nav = (function quil$middlewares$navigation_2d$setup_2d_nav(user_setup,user_settings){ +var initial_state = cljs.core.merge.call(null,quil.middlewares.navigation_2d.default_position.call(null),cljs.core.select_keys.call(null,user_settings,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"position","position",-2011731912),new cljs.core.Keyword(null,"zoom","zoom",-1827487038)], null))); +return cljs.core.update_in.call(null,user_setup.call(null),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"navigation-2d","navigation-2d",-1924168611)], null),((function (initial_state){ +return (function (p1__9429_SHARP_){ +return cljs.core.merge.call(null,initial_state,p1__9429_SHARP_); +});})(initial_state)) +); +}); +/** + * Changes center of the sketch depending on the last mouse move. Takes + * zoom into account as well. + */ +quil.middlewares.navigation_2d.mouse_dragged = (function quil$middlewares$navigation_2d$mouse_dragged(state,event){ +quil.middlewares.navigation_2d.assert_state_has_navigation.call(null,state); + +var dx = (new cljs.core.Keyword(null,"p-x","p-x",-1721211211).cljs$core$IFn$_invoke$arity$1(event) - new cljs.core.Keyword(null,"x","x",2099068185).cljs$core$IFn$_invoke$arity$1(event)); +var dy = (new cljs.core.Keyword(null,"p-y","p-y",-530704830).cljs$core$IFn$_invoke$arity$1(event) - new cljs.core.Keyword(null,"y","y",-1757859776).cljs$core$IFn$_invoke$arity$1(event)); +var zoom = new cljs.core.Keyword(null,"zoom","zoom",-1827487038).cljs$core$IFn$_invoke$arity$1(new cljs.core.Keyword(null,"navigation-2d","navigation-2d",-1924168611).cljs$core$IFn$_invoke$arity$1(state)); +return cljs.core.update_in.call(null,cljs.core.update_in.call(null,state,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"navigation-2d","navigation-2d",-1924168611),new cljs.core.Keyword(null,"position","position",-2011731912),(0)], null),cljs.core._PLUS_,(dx / zoom)),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"navigation-2d","navigation-2d",-1924168611),new cljs.core.Keyword(null,"position","position",-2011731912),(1)], null),cljs.core._PLUS_,(dy / zoom)); +}); +/** + * Changes zoom settings based on scroll. + */ +quil.middlewares.navigation_2d.mouse_wheel = (function quil$middlewares$navigation_2d$mouse_wheel(state,event){ +quil.middlewares.navigation_2d.assert_state_has_navigation.call(null,state); + +return cljs.core.update_in.call(null,state,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"navigation-2d","navigation-2d",-1924168611),new cljs.core.Keyword(null,"zoom","zoom",-1827487038)], null),cljs.core._STAR_,((1) + (-0.1 * event))); +}); +/** + * Calls user draw function with necessary all transformations (position + * and zoom) applied. + */ +quil.middlewares.navigation_2d.draw = (function quil$middlewares$navigation_2d$draw(user_draw,state){ +quil.middlewares.navigation_2d.assert_state_has_navigation.call(null,state); + +quil.core.push_matrix.call(null); + +var nav_2d_9430 = new cljs.core.Keyword(null,"navigation-2d","navigation-2d",-1924168611).cljs$core$IFn$_invoke$arity$1(state); +var zoom_9431 = new cljs.core.Keyword(null,"zoom","zoom",-1827487038).cljs$core$IFn$_invoke$arity$1(nav_2d_9430); +var pos_9432 = new cljs.core.Keyword(null,"position","position",-2011731912).cljs$core$IFn$_invoke$arity$1(nav_2d_9430); +quil.core.scale.call(null,zoom_9431); + +var tr__9352__auto___9433 = new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(((quil.core.width.call(null) / (2)) / zoom_9431) - cljs.core.first.call(null,pos_9432)),(((quil.core.height.call(null) / (2)) / zoom_9431) - cljs.core.second.call(null,pos_9432))], null); +quil.core.push_matrix.call(null); + +try{quil.core.translate.call(null,tr__9352__auto___9433); + +user_draw.call(null,state); +}finally {quil.core.pop_matrix.call(null); +} +return quil.core.pop_matrix.call(null); +}); +/** + * Enables navigation over 2D sketch. Dragging mouse will move center of the + * skecth and mouse wheel controls zoom. + */ +quil.middlewares.navigation_2d.navigation_2d = (function quil$middlewares$navigation_2d$navigation_2d(options){ +var user_settings = new cljs.core.Keyword(null,"navigation-2d","navigation-2d",-1924168611).cljs$core$IFn$_invoke$arity$1(options); +var user_draw = new cljs.core.Keyword(null,"draw","draw",1358331674).cljs$core$IFn$_invoke$arity$2(options,((function (user_settings){ +return (function (state){ +return null; +});})(user_settings)) +); +var user_mouse_dragged = new cljs.core.Keyword(null,"mouse-dragged","mouse-dragged",-1220073441).cljs$core$IFn$_invoke$arity$2(options,((function (user_settings,user_draw){ +return (function (state,_){ +return state; +});})(user_settings,user_draw)) +); +var user_mouse_wheel = new cljs.core.Keyword(null,"mouse-wheel","mouse-wheel",1811662439).cljs$core$IFn$_invoke$arity$2(options,((function (user_settings,user_draw,user_mouse_dragged){ +return (function (state,_){ +return state; +});})(user_settings,user_draw,user_mouse_dragged)) +); +var setup = new cljs.core.Keyword(null,"setup","setup",1987730512).cljs$core$IFn$_invoke$arity$2(options,((function (user_settings,user_draw,user_mouse_dragged,user_mouse_wheel){ +return (function (){ +return cljs.core.PersistentArrayMap.EMPTY; +});})(user_settings,user_draw,user_mouse_dragged,user_mouse_wheel)) +); +return cljs.core.assoc.call(null,options,new cljs.core.Keyword(null,"setup","setup",1987730512),cljs.core.partial.call(null,quil.middlewares.navigation_2d.setup_2d_nav,setup,user_settings),new cljs.core.Keyword(null,"draw","draw",1358331674),cljs.core.partial.call(null,quil.middlewares.navigation_2d.draw,user_draw),new cljs.core.Keyword(null,"mouse-dragged","mouse-dragged",-1220073441),((function (user_settings,user_draw,user_mouse_dragged,user_mouse_wheel,setup){ +return (function (state,event){ +return user_mouse_dragged.call(null,quil.middlewares.navigation_2d.mouse_dragged.call(null,state,event),event); +});})(user_settings,user_draw,user_mouse_dragged,user_mouse_wheel,setup)) +,new cljs.core.Keyword(null,"mouse-wheel","mouse-wheel",1811662439),((function (user_settings,user_draw,user_mouse_dragged,user_mouse_wheel,setup){ +return (function (state,event){ +return user_mouse_wheel.call(null,quil.middlewares.navigation_2d.mouse_wheel.call(null,state,event),event); +});})(user_settings,user_draw,user_mouse_dragged,user_mouse_wheel,setup)) +); +}); + +//# sourceMappingURL=navigation_2d.js.map \ No newline at end of file diff --git a/assets/viz/2/quil/middlewares/navigation_2d.js.map b/assets/viz/2/quil/middlewares/navigation_2d.js.map new file mode 100644 index 0000000..59eb670 --- /dev/null +++ b/assets/viz/2/quil/middlewares/navigation_2d.js.map @@ -0,0 +1 @@ +{"version":3,"file":"\/home\/mediocregopher\/src\/viz\/out\/quil\/middlewares\/navigation_2d.js","sources":["navigation_2d.cljc"],"lineCount":116,"mappings":";AAAA;;;AAGA,AAAeA,8DACb,6CAAA,yFAAA,kGAAA;AAIF;;;6DAAA,7DAAOC,kIAEJC;AAFH,AAGE,oBAAU,AAAA,sGAAgBA;AAA1B;;AAAA,AACE,MACgB,KAAAC,MAAWH;;;AAE\/B;;;;kDAAA,lDAAOI;AAAP,AAAA,kDAAA,8DAAA,kKAAA,sDAAA,rIAIc,8BAAA,7BAAG,AAACC,kCACJ,+BAAA,9BAAG,AAACC;;AAGlB;;;;8CAAA,9CAAOC,oGAGJC,WAAWC;AAHd,AAIE,IAAMC,qIAAkBD,hCACA,8CAAA,mFAAA,8DAAA,\/LAACE,rFACI,AAACC,0BAAM,AAACR;AAFrC,AAGE,2DAAA,mFAAA,gFAAA,vNAACU,8BAAU,AAACN;kBAAZK;AAAA,AACY,+CAAAA,xCAACD,0BAAMF;;;;AAEvB;;;;+CAAA,\/CAAOK,sGAGJb,MAAMc;AAHT,AAIE,AAACf,qEAA4BC;;AAC7B,IAAMe,KAAG,CAAG,AAAA,kFAAMD,SAAO,AAAA,6EAAIA;IACvBE,KAAG,CAAG,AAAA,iFAAMF,SAAO,AAAA,8EAAIA;IACvBG,OAAK,AAAA,oFAAA,AAAA,sGAAIjB;AAFf,mEAGKA,9BACA,oCAAA,mFAAA,wEAAA,8DAAA,7PAACY,yQAAuCM,iBAAE,CAA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6BAAmB,AAACrB,uDAAcb,MAAMc,OAAOA;;CAPnE,mEAQe;kBAAKd,MAAMc;AAAX,AACE,OAACsB,2BAAiB,AAACjB,qDAAYnB,MAAMc,OAAOA","names":["quil.middlewares.navigation-2d\/missing-navigation-key-error","quil.middlewares.navigation-2d\/assert-state-has-navigation","state","js\/Error","quil.middlewares.navigation-2d\/default-position","quil.core\/width","quil.core\/height","quil.middlewares.navigation-2d\/setup-2d-nav","user-setup","user-settings","initial-state","cljs.core\/select-keys","cljs.core\/merge","p1__9429#","cljs.core\/update-in","quil.middlewares.navigation-2d\/mouse-dragged","event","dx","dy","zoom","cljs.core\/+","quil.middlewares.navigation-2d\/mouse-wheel","cljs.core\/*","quil.middlewares.navigation-2d\/draw","user-draw","quil.core\/push-matrix","nav-2d","pos","quil.core\/scale","tr__9352__auto__","quil.core\/translate","quil.core\/pop-matrix","cljs.core\/first","cljs.core\/second","quil.middlewares.navigation-2d\/navigation-2d","options","user-mouse-dragged","_","user-mouse-wheel","setup","cljs.core\/assoc","cljs.core\/partial"]} \ No newline at end of file diff --git a/assets/viz/2/quil/middlewares/navigation_3d.cljc b/assets/viz/2/quil/middlewares/navigation_3d.cljc new file mode 100644 index 0000000..3471cfd --- /dev/null +++ b/assets/viz/2/quil/middlewares/navigation_3d.cljc @@ -0,0 +1,188 @@ +(ns quil.middlewares.navigation-3d + (:require [quil.core :as q])) + +(def ^:private missing-navigation-key-error + (str "state map is missing :navigation-3d key. " + "Did you accidentally removed it from the state in " + ":update or any other handler?")) + +(defn- assert-state-has-navigation + "Asserts that state map contains :navigation-2d object." + [state] + (when-not (:navigation-3d state) + (throw #?(:clj (RuntimeException. missing-navigation-key-error) + :cljs (js/Error. missing-navigation-key-error))))) + +(defn- default-position + "Default position configuration. Check default configuration in + 'camera' function." + [] + {:position [(/ (q/width) 2.0) + (/ (q/height) 2.0) + (/ (q/height) 2.0 (q/tan (/ (* q/PI 60.0) 360.0)))] + :straight [0 0 -1] + :up [0 1 0]}) + +(defn- rotate-by-axis-and-angle + "Rotates vector v by angle with axis. + Formula is taken from wiki: + http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle" + [v axis angle] + (let [[a-x a-y a-z] axis + [x y z] v + cs (q/cos angle) + -cs (- 1 cs) + sn (q/sin angle) + ; Matrix is + ; [a b c] + ; [d e f] + ; [g h i] + a (+ cs (* a-x a-x -cs)) + b (- (* a-x a-y -cs) + (* a-z sn)) + c (+ (* a-x a-z -cs) + (* a-y sn)) + d (+ (* a-x a-y -cs) + (* a-z sn)) + e (+ cs (* a-y a-y -cs)) + f (- (* a-y a-z -cs) + (* a-x sn)) + g (- (* a-x a-z -cs) + (* a-y sn)) + h (+ (* a-y a-z -cs) + (* a-x sn)) + i (+ cs (* a-z a-z -cs))] + [(+ (* a x) (* b y) (* c z)) + (+ (* d x) (* e y) (* f z)) + (+ (* g x) (* h y) (* i z))])) + +(defn- rotate-lr + "Rotates nav-3d configuration left-right. angle positive - rotate right, + negative - left." + [nav-3d angle] + (update-in nav-3d [:straight] rotate-by-axis-and-angle (:up nav-3d) angle)) + +(defn- cross-product + "Vector cross-product: http://en.wikipedia.org/wiki/Cross_product" + [[u1 u2 u3] [v1 v2 v3]] + [(- (* u2 v3) (* u3 v2)) + (- (* u3 v1) (* u1 v3)) + (- (* u1 v2) (* u2 v1))]) + +(defn- v-mult + "Multiply vector v by scalar mult." + [v mult] + (mapv #(* % mult) v)) + +(defn- v-plus + "Sum of 2 vectors." + [v1 v2] + (mapv + v1 v2)) + +(defn- v-opposite + "Returns vector opposite to vector v." + [v] + (v-mult v -1)) + +(defn- v-normalize + "Normalize vector, returning vector + which has same direction but with norm equals to 1." + [v] + (let [norm (->> (map q/sq v) + (apply +) + (q/sqrt))] + (v-mult v (/ norm)))) + +(defn- rotate-ud + "Rotates nav-3d configuration up-down." + [nav-3d angle] + (let [axis (cross-product (:straight nav-3d) (:up nav-3d)) + rotate #(rotate-by-axis-and-angle % axis angle)] + (-> nav-3d + (update-in [:straight] rotate) + (update-in [:up] rotate)))) + +(defn- rotate + "Mouse handler function which rotates nav-3d configuration. + It uses mouse from event object and pixels-in-360 to calculate + angles to rotate." + [state event pixels-in-360] + (assert-state-has-navigation state) + (if (= 0 (:p-x event) (:p-y event)) + state + (let [dx (- (:p-x event) (:x event)) + dy (- (:y event) (:p-y event)) + angle-lr (q/map-range dx 0 pixels-in-360 0 q/TWO-PI) + angle-ud (q/map-range dy 0 pixels-in-360 0 q/TWO-PI)] + (update-in state [:navigation-3d] + #(-> % + (rotate-lr angle-lr) + (rotate-ud angle-ud)))))) + +(def ^:private space (keyword " ")) + +(defn- move + "Keyboard handler function which moves nav-3d configuration. + It uses keyboard key from event object to determing in which + direction to move." + [state event step-size] + (assert-state-has-navigation state) + (let [{:keys [up straight]} (:navigation-3d state)] + (if-let [dir (condp = (:key event) + :w straight + :s (v-opposite straight) + space (v-opposite up) + :z up + :d (cross-product straight up) + :a (cross-product up straight) + nil)] + (update-in state [:navigation-3d :position] + #(v-plus % (v-mult dir step-size))) + state))) + +(defn- setup-3d-nav + "Custom 'setup' function which creates initial position + configuration and puts it to the state map." + [user-setup user-settings] + (let [initial-state (-> user-settings + (select-keys [:straight :up :position]) + (->> (merge (default-position))) + (update-in [:straight] v-normalize) + (update-in [:up] v-normalize))] + (update-in (user-setup) [:navigation-3d] + #(merge initial-state %)))) + +(defn navigation-3d + "Enables navigation in 3D space. Similar to how it is done in + shooters: WASD navigation, space is go up, z is go down, + drag mouse to look around." + [options] + (let [; 3d-navigation related user settings + user-settings (:navigation-3d options) + pixels-in-360 (:pixels-in-360 user-settings 1000) + step-size (:step-size user-settings 20) + rotate-on (:rotate-on user-settings :mouse-dragged) + + ; user-provided handlers which will be overridden + ; by 3d-navigation + draw (:draw options (fn [state])) + key-pressed (:key-pressed options (fn [state _] state)) + rotate-on-fn (rotate-on options (fn [state _] state)) + setup (:setup options (fn [] {}))] + (assoc options + + :setup (partial setup-3d-nav setup user-settings) + + :draw (fn [state] + (assert-state-has-navigation state) + (let [{[c-x c-y c-z] :straight + [u-x u-y u-z] :up + [p-x p-y p-z] :position} (:navigation-3d state)] + (q/camera p-x p-y p-z (+ p-x c-x) (+ p-y c-y) (+ p-z c-z) u-x u-y u-z)) + (draw state)) + + :key-pressed (fn [state event] + (key-pressed (move state event step-size) event)) + + rotate-on (fn [state event] + (rotate-on-fn (rotate state event pixels-in-360) event)) ))) diff --git a/assets/viz/2/quil/middlewares/navigation_3d.cljc.cache.edn b/assets/viz/2/quil/middlewares/navigation_3d.cljc.cache.edn new file mode 100644 index 0000000..ffa4e11 --- /dev/null +++ b/assets/viz/2/quil/middlewares/navigation_3d.cljc.cache.edn @@ -0,0 +1 @@ +{:rename-macros {}, :renames {}, :externs {Error {}}, :use-macros {}, :excludes #{}, :name quil.middlewares.navigation-3d, :imports nil, :requires {q quil.core, quil.core quil.core}, :uses nil, :defs {missing-navigation-key-error {:name quil.middlewares.navigation-3d/missing-navigation-key-error, :file "out/quil/middlewares/navigation_3d.cljc", :line 4, :column 1, :end-line 4, :end-column 44, :private true, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/navigation_3d.cljc", :line 4, :column 16, :end-line 4, :end-column 44, :private true}, :tag any}, v-normalize {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/navigation_3d.cljc", :line 87, :column 8, :end-line 87, :end-column 19, :private true, :arglists (quote ([v])), :doc "Normalize vector, returning vector\n which has same direction but with norm equals to 1."}, :private true, :name quil.middlewares.navigation-3d/v-normalize, :variadic false, :file "out/quil/middlewares/navigation_3d.cljc", :end-column 19, :method-params ([v]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 87, :end-line 87, :max-fixed-arity 1, :fn-var true, :arglists (quote ([v])), :doc "Normalize vector, returning vector\n which has same direction but with norm equals to 1."}, v-opposite {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/navigation_3d.cljc", :line 82, :column 8, :end-line 82, :end-column 18, :private true, :arglists (quote ([v])), :doc "Returns vector opposite to vector v."}, :private true, :name quil.middlewares.navigation-3d/v-opposite, :variadic false, :file "out/quil/middlewares/navigation_3d.cljc", :end-column 18, :method-params ([v]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 82, :end-line 82, :max-fixed-arity 1, :fn-var true, :arglists (quote ([v])), :doc "Returns vector opposite to vector v."}, v-plus {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/navigation_3d.cljc", :line 77, :column 8, :end-line 77, :end-column 14, :private true, :arglists (quote ([v1 v2])), :doc "Sum of 2 vectors."}, :private true, :name quil.middlewares.navigation-3d/v-plus, :variadic false, :file "out/quil/middlewares/navigation_3d.cljc", :end-column 14, :method-params ([v1 v2]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 77, :end-line 77, :max-fixed-arity 2, :fn-var true, :arglists (quote ([v1 v2])), :doc "Sum of 2 vectors."}, v-mult {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/navigation_3d.cljc", :line 72, :column 8, :end-line 72, :end-column 14, :private true, :arglists (quote ([v mult])), :doc "Multiply vector v by scalar mult."}, :private true, :name quil.middlewares.navigation-3d/v-mult, :variadic false, :file "out/quil/middlewares/navigation_3d.cljc", :end-column 14, :method-params ([v mult]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 72, :end-line 72, :max-fixed-arity 2, :fn-var true, :arglists (quote ([v mult])), :doc "Multiply vector v by scalar mult."}, space {:name quil.middlewares.navigation-3d/space, :file "out/quil/middlewares/navigation_3d.cljc", :line 122, :column 1, :end-line 122, :end-column 21, :private true, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/navigation_3d.cljc", :line 122, :column 16, :end-line 122, :end-column 21, :private true}, :tag any}, setup-3d-nav {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/navigation_3d.cljc", :line 143, :column 8, :end-line 143, :end-column 20, :private true, :arglists (quote ([user-setup user-settings])), :doc "Custom 'setup' function which creates initial position\n configuration and puts it to the state map."}, :private true, :name quil.middlewares.navigation-3d/setup-3d-nav, :variadic false, :file "out/quil/middlewares/navigation_3d.cljc", :end-column 20, :method-params ([user-setup user-settings]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 143, :end-line 143, :max-fixed-arity 2, :fn-var true, :arglists (quote ([user-setup user-settings])), :doc "Custom 'setup' function which creates initial position\n configuration and puts it to the state map."}, move {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/navigation_3d.cljc", :line 124, :column 8, :end-line 124, :end-column 12, :private true, :arglists (quote ([state event step-size])), :doc "Keyboard handler function which moves nav-3d configuration.\n It uses keyboard key from event object to determing in which\n direction to move."}, :private true, :name quil.middlewares.navigation-3d/move, :variadic false, :file "out/quil/middlewares/navigation_3d.cljc", :end-column 12, :method-params ([state event step-size]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 124, :end-line 124, :max-fixed-arity 3, :fn-var true, :arglists (quote ([state event step-size])), :doc "Keyboard handler function which moves nav-3d configuration.\n It uses keyboard key from event object to determing in which\n direction to move."}, rotate-lr {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/navigation_3d.cljc", :line 59, :column 8, :end-line 59, :end-column 17, :private true, :arglists (quote ([nav-3d angle])), :doc "Rotates nav-3d configuration left-right. angle positive - rotate right,\n negative - left."}, :private true, :name quil.middlewares.navigation-3d/rotate-lr, :variadic false, :file "out/quil/middlewares/navigation_3d.cljc", :end-column 17, :method-params ([nav-3d angle]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 59, :end-line 59, :max-fixed-arity 2, :fn-var true, :arglists (quote ([nav-3d angle])), :doc "Rotates nav-3d configuration left-right. angle positive - rotate right,\n negative - left."}, cross-product {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/navigation_3d.cljc", :line 65, :column 8, :end-line 65, :end-column 21, :private true, :arglists (quote ([[u1 u2 u3] [v1 v2 v3]])), :doc "Vector cross-product: http://en.wikipedia.org/wiki/Cross_product"}, :private true, :name quil.middlewares.navigation-3d/cross-product, :variadic false, :file "out/quil/middlewares/navigation_3d.cljc", :end-column 21, :method-params ([p__8907 p__8908]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 65, :end-line 65, :max-fixed-arity 2, :fn-var true, :arglists (quote ([[u1 u2 u3] [v1 v2 v3]])), :doc "Vector cross-product: http://en.wikipedia.org/wiki/Cross_product"}, rotate-by-axis-and-angle {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/navigation_3d.cljc", :line 26, :column 8, :end-line 26, :end-column 32, :private true, :arglists (quote ([v axis angle])), :doc "Rotates vector v by angle with axis.\n Formula is taken from wiki:\n http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle"}, :private true, :name quil.middlewares.navigation-3d/rotate-by-axis-and-angle, :variadic false, :file "out/quil/middlewares/navigation_3d.cljc", :end-column 32, :method-params ([v axis angle]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 26, :end-line 26, :max-fixed-arity 3, :fn-var true, :arglists (quote ([v axis angle])), :doc "Rotates vector v by angle with axis.\n Formula is taken from wiki:\n http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle"}, assert-state-has-navigation {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/navigation_3d.cljc", :line 9, :column 8, :end-line 9, :end-column 35, :private true, :arglists (quote ([state])), :doc "Asserts that state map contains :navigation-2d object."}, :private true, :name quil.middlewares.navigation-3d/assert-state-has-navigation, :variadic false, :file "out/quil/middlewares/navigation_3d.cljc", :end-column 35, :method-params ([state]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 9, :end-line 9, :max-fixed-arity 1, :fn-var true, :arglists (quote ([state])), :doc "Asserts that state map contains :navigation-2d object."}, navigation-3d {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/navigation_3d.cljc", :line 155, :column 7, :end-line 155, :end-column 20, :arglists (quote ([options])), :doc "Enables navigation in 3D space. Similar to how it is done in\n shooters: WASD navigation, space is go up, z is go down,\n drag mouse to look around."}, :name quil.middlewares.navigation-3d/navigation-3d, :variadic false, :file "out/quil/middlewares/navigation_3d.cljc", :end-column 20, :method-params ([options]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 155, :end-line 155, :max-fixed-arity 1, :fn-var true, :arglists (quote ([options])), :doc "Enables navigation in 3D space. Similar to how it is done in\n shooters: WASD navigation, space is go up, z is go down,\n drag mouse to look around."}, default-position {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/navigation_3d.cljc", :line 16, :column 8, :end-line 16, :end-column 24, :private true, :arglists (quote ([])), :doc "Default position configuration. Check default configuration in\n 'camera' function."}, :private true, :name quil.middlewares.navigation-3d/default-position, :variadic false, :file "out/quil/middlewares/navigation_3d.cljc", :end-column 24, :method-params ([]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 16, :end-line 16, :max-fixed-arity 0, :fn-var true, :arglists (quote ([])), :doc "Default position configuration. Check default configuration in\n 'camera' function."}, rotate {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/navigation_3d.cljc", :line 105, :column 8, :end-line 105, :end-column 14, :private true, :arglists (quote ([state event pixels-in-360])), :doc "Mouse handler function which rotates nav-3d configuration.\n It uses mouse from event object and pixels-in-360 to calculate\n angles to rotate."}, :private true, :name quil.middlewares.navigation-3d/rotate, :variadic false, :file "out/quil/middlewares/navigation_3d.cljc", :end-column 14, :method-params ([state event pixels-in-360]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 105, :end-line 105, :max-fixed-arity 3, :fn-var true, :arglists (quote ([state event pixels-in-360])), :doc "Mouse handler function which rotates nav-3d configuration.\n It uses mouse from event object and pixels-in-360 to calculate\n angles to rotate."}, rotate-ud {:protocol-inline nil, :meta {:file "/home/mediocregopher/src/viz/out/quil/middlewares/navigation_3d.cljc", :line 96, :column 8, :end-line 96, :end-column 17, :private true, :arglists (quote ([nav-3d angle])), :doc "Rotates nav-3d configuration up-down."}, :private true, :name quil.middlewares.navigation-3d/rotate-ud, :variadic false, :file "out/quil/middlewares/navigation_3d.cljc", :end-column 17, :method-params ([nav-3d angle]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 96, :end-line 96, :max-fixed-arity 2, :fn-var true, :arglists (quote ([nav-3d angle])), :doc "Rotates nav-3d configuration up-down."}}, :require-macros nil, :cljs.analyzer/constants {:seen #{:y :pixels-in-360 :p-y :step-size :key :w :s :rotate-on :up :setup :z :straight :key-pressed :p-x :navigation-3d :position :d :x :draw :a :mouse-dragged}, :order [:navigation-3d :position :straight :up :p-x :p-y :x :y :key :w :s :z :d :a :pixels-in-360 :step-size :rotate-on :mouse-dragged :draw :key-pressed :setup]}, :doc nil} \ No newline at end of file diff --git a/assets/viz/2/quil/middlewares/navigation_3d.js b/assets/viz/2/quil/middlewares/navigation_3d.js new file mode 100644 index 0000000..54cac9e --- /dev/null +++ b/assets/viz/2/quil/middlewares/navigation_3d.js @@ -0,0 +1,261 @@ +// Compiled by ClojureScript 1.9.473 {} +goog.provide('quil.middlewares.navigation_3d'); +goog.require('cljs.core'); +goog.require('quil.core'); +quil.middlewares.navigation_3d.missing_navigation_key_error = [cljs.core.str.cljs$core$IFn$_invoke$arity$1("state map is missing :navigation-3d key. "),cljs.core.str.cljs$core$IFn$_invoke$arity$1("Did you accidentally removed it from the state in "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(":update or any other handler?")].join(''); +/** + * Asserts that state map contains :navigation-2d object. + */ +quil.middlewares.navigation_3d.assert_state_has_navigation = (function quil$middlewares$navigation_3d$assert_state_has_navigation(state){ +if(cljs.core.truth_(new cljs.core.Keyword(null,"navigation-3d","navigation-3d",682305301).cljs$core$IFn$_invoke$arity$1(state))){ +return null; +} else { +throw (new Error(quil.middlewares.navigation_3d.missing_navigation_key_error)); +} +}); +/** + * Default position configuration. Check default configuration in + * 'camera' function. + */ +quil.middlewares.navigation_3d.default_position = (function quil$middlewares$navigation_3d$default_position(){ +return new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"position","position",-2011731912),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [(quil.core.width.call(null) / 2.0),(quil.core.height.call(null) / 2.0),((quil.core.height.call(null) / 2.0) / quil.core.tan.call(null,((quil.core.PI * 60.0) / 360.0)))], null),new cljs.core.Keyword(null,"straight","straight",-1252567854),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [(0),(0),(-1)], null),new cljs.core.Keyword(null,"up","up",-269712113),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [(0),(1),(0)], null)], null); +}); +/** + * Rotates vector v by angle with axis. + * Formula is taken from wiki: + * http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle + */ +quil.middlewares.navigation_3d.rotate_by_axis_and_angle = (function quil$middlewares$navigation_3d$rotate_by_axis_and_angle(v,axis,angle){ +var vec__8901 = axis; +var a_x = cljs.core.nth.call(null,vec__8901,(0),null); +var a_y = cljs.core.nth.call(null,vec__8901,(1),null); +var a_z = cljs.core.nth.call(null,vec__8901,(2),null); +var vec__8904 = v; +var x = cljs.core.nth.call(null,vec__8904,(0),null); +var y = cljs.core.nth.call(null,vec__8904,(1),null); +var z = cljs.core.nth.call(null,vec__8904,(2),null); +var cs = quil.core.cos.call(null,angle); +var _cs = ((1) - cs); +var sn = quil.core.sin.call(null,angle); +var a = (cs + ((a_x * a_x) * _cs)); +var b = (((a_x * a_y) * _cs) - (a_z * sn)); +var c = (((a_x * a_z) * _cs) + (a_y * sn)); +var d = (((a_x * a_y) * _cs) + (a_z * sn)); +var e = (cs + ((a_y * a_y) * _cs)); +var f = (((a_y * a_z) * _cs) - (a_x * sn)); +var g = (((a_x * a_z) * _cs) - (a_y * sn)); +var h = (((a_y * a_z) * _cs) + (a_x * sn)); +var i = (cs + ((a_z * a_z) * _cs)); +return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [(((a * x) + (b * y)) + (c * z)),(((d * x) + (e * y)) + (f * z)),(((g * x) + (h * y)) + (i * z))], null); +}); +/** + * Rotates nav-3d configuration left-right. angle positive - rotate right, + * negative - left. + */ +quil.middlewares.navigation_3d.rotate_lr = (function quil$middlewares$navigation_3d$rotate_lr(nav_3d,angle){ +return cljs.core.update_in.call(null,nav_3d,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"straight","straight",-1252567854)], null),quil.middlewares.navigation_3d.rotate_by_axis_and_angle,new cljs.core.Keyword(null,"up","up",-269712113).cljs$core$IFn$_invoke$arity$1(nav_3d),angle); +}); +/** + * Vector cross-product: http://en.wikipedia.org/wiki/Cross_product + */ +quil.middlewares.navigation_3d.cross_product = (function quil$middlewares$navigation_3d$cross_product(p__8907,p__8908){ +var vec__8915 = p__8907; +var u1 = cljs.core.nth.call(null,vec__8915,(0),null); +var u2 = cljs.core.nth.call(null,vec__8915,(1),null); +var u3 = cljs.core.nth.call(null,vec__8915,(2),null); +var vec__8918 = p__8908; +var v1 = cljs.core.nth.call(null,vec__8918,(0),null); +var v2 = cljs.core.nth.call(null,vec__8918,(1),null); +var v3 = cljs.core.nth.call(null,vec__8918,(2),null); +return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [((u2 * v3) - (u3 * v2)),((u3 * v1) - (u1 * v3)),((u1 * v2) - (u2 * v1))], null); +}); +/** + * Multiply vector v by scalar mult. + */ +quil.middlewares.navigation_3d.v_mult = (function quil$middlewares$navigation_3d$v_mult(v,mult){ +return cljs.core.mapv.call(null,(function (p1__8921_SHARP_){ +return (p1__8921_SHARP_ * mult); +}),v); +}); +/** + * Sum of 2 vectors. + */ +quil.middlewares.navigation_3d.v_plus = (function quil$middlewares$navigation_3d$v_plus(v1,v2){ +return cljs.core.mapv.call(null,cljs.core._PLUS_,v1,v2); +}); +/** + * Returns vector opposite to vector v. + */ +quil.middlewares.navigation_3d.v_opposite = (function quil$middlewares$navigation_3d$v_opposite(v){ +return quil.middlewares.navigation_3d.v_mult.call(null,v,(-1)); +}); +/** + * Normalize vector, returning vector + * which has same direction but with norm equals to 1. + */ +quil.middlewares.navigation_3d.v_normalize = (function quil$middlewares$navigation_3d$v_normalize(v){ +var norm = quil.core.sqrt.call(null,cljs.core.apply.call(null,cljs.core._PLUS_,cljs.core.map.call(null,quil.core.sq,v))); +return quil.middlewares.navigation_3d.v_mult.call(null,v,((1) / norm)); +}); +/** + * Rotates nav-3d configuration up-down. + */ +quil.middlewares.navigation_3d.rotate_ud = (function quil$middlewares$navigation_3d$rotate_ud(nav_3d,angle){ +var axis = quil.middlewares.navigation_3d.cross_product.call(null,new cljs.core.Keyword(null,"straight","straight",-1252567854).cljs$core$IFn$_invoke$arity$1(nav_3d),new cljs.core.Keyword(null,"up","up",-269712113).cljs$core$IFn$_invoke$arity$1(nav_3d)); +var rotate = ((function (axis){ +return (function (p1__8922_SHARP_){ +return quil.middlewares.navigation_3d.rotate_by_axis_and_angle.call(null,p1__8922_SHARP_,axis,angle); +});})(axis)) +; +return cljs.core.update_in.call(null,cljs.core.update_in.call(null,nav_3d,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"straight","straight",-1252567854)], null),rotate),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"up","up",-269712113)], null),rotate); +}); +/** + * Mouse handler function which rotates nav-3d configuration. + * It uses mouse from event object and pixels-in-360 to calculate + * angles to rotate. + */ +quil.middlewares.navigation_3d.rotate = (function quil$middlewares$navigation_3d$rotate(state,event,pixels_in_360){ +quil.middlewares.navigation_3d.assert_state_has_navigation.call(null,state); + +if(cljs.core._EQ_.call(null,(0),new cljs.core.Keyword(null,"p-x","p-x",-1721211211).cljs$core$IFn$_invoke$arity$1(event),new cljs.core.Keyword(null,"p-y","p-y",-530704830).cljs$core$IFn$_invoke$arity$1(event))){ +return state; +} else { +var dx = (new cljs.core.Keyword(null,"p-x","p-x",-1721211211).cljs$core$IFn$_invoke$arity$1(event) - new cljs.core.Keyword(null,"x","x",2099068185).cljs$core$IFn$_invoke$arity$1(event)); +var dy = (new cljs.core.Keyword(null,"y","y",-1757859776).cljs$core$IFn$_invoke$arity$1(event) - new cljs.core.Keyword(null,"p-y","p-y",-530704830).cljs$core$IFn$_invoke$arity$1(event)); +var angle_lr = quil.core.map_range.call(null,dx,(0),pixels_in_360,(0),quil.core.TWO_PI); +var angle_ud = quil.core.map_range.call(null,dy,(0),pixels_in_360,(0),quil.core.TWO_PI); +return cljs.core.update_in.call(null,state,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"navigation-3d","navigation-3d",682305301)], null),((function (dx,dy,angle_lr,angle_ud){ +return (function (p1__8923_SHARP_){ +return quil.middlewares.navigation_3d.rotate_ud.call(null,quil.middlewares.navigation_3d.rotate_lr.call(null,p1__8923_SHARP_,angle_lr),angle_ud); +});})(dx,dy,angle_lr,angle_ud)) +); +} +}); +quil.middlewares.navigation_3d.space = cljs.core.keyword.call(null," "); +/** + * Keyboard handler function which moves nav-3d configuration. + * It uses keyboard key from event object to determing in which + * direction to move. + */ +quil.middlewares.navigation_3d.move = (function quil$middlewares$navigation_3d$move(state,event,step_size){ +quil.middlewares.navigation_3d.assert_state_has_navigation.call(null,state); + +var map__8930 = new cljs.core.Keyword(null,"navigation-3d","navigation-3d",682305301).cljs$core$IFn$_invoke$arity$1(state); +var map__8930__$1 = ((((!((map__8930 == null)))?((((map__8930.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__8930.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__8930):map__8930); +var up = cljs.core.get.call(null,map__8930__$1,new cljs.core.Keyword(null,"up","up",-269712113)); +var straight = cljs.core.get.call(null,map__8930__$1,new cljs.core.Keyword(null,"straight","straight",-1252567854)); +var temp__4655__auto__ = (function (){var pred__8932 = cljs.core._EQ_; +var expr__8933 = new cljs.core.Keyword(null,"key","key",-1516042587).cljs$core$IFn$_invoke$arity$1(event); +if(cljs.core.truth_(pred__8932.call(null,new cljs.core.Keyword(null,"w","w",354169001),expr__8933))){ +return straight; +} else { +if(cljs.core.truth_(pred__8932.call(null,new cljs.core.Keyword(null,"s","s",1705939918),expr__8933))){ +return quil.middlewares.navigation_3d.v_opposite.call(null,straight); +} else { +if(cljs.core.truth_(pred__8932.call(null,quil.middlewares.navigation_3d.space,expr__8933))){ +return quil.middlewares.navigation_3d.v_opposite.call(null,up); +} else { +if(cljs.core.truth_(pred__8932.call(null,new cljs.core.Keyword(null,"z","z",-789527183),expr__8933))){ +return up; +} else { +if(cljs.core.truth_(pred__8932.call(null,new cljs.core.Keyword(null,"d","d",1972142424),expr__8933))){ +return quil.middlewares.navigation_3d.cross_product.call(null,straight,up); +} else { +if(cljs.core.truth_(pred__8932.call(null,new cljs.core.Keyword(null,"a","a",-2123407586),expr__8933))){ +return quil.middlewares.navigation_3d.cross_product.call(null,up,straight); +} else { +return null; +} +} +} +} +} +} +})(); +if(cljs.core.truth_(temp__4655__auto__)){ +var dir = temp__4655__auto__; +return cljs.core.update_in.call(null,state,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"navigation-3d","navigation-3d",682305301),new cljs.core.Keyword(null,"position","position",-2011731912)], null),((function (dir,temp__4655__auto__,map__8930,map__8930__$1,up,straight){ +return (function (p1__8924_SHARP_){ +return quil.middlewares.navigation_3d.v_plus.call(null,p1__8924_SHARP_,quil.middlewares.navigation_3d.v_mult.call(null,dir,step_size)); +});})(dir,temp__4655__auto__,map__8930,map__8930__$1,up,straight)) +); +} else { +return state; +} +}); +/** + * Custom 'setup' function which creates initial position + * configuration and puts it to the state map. + */ +quil.middlewares.navigation_3d.setup_3d_nav = (function quil$middlewares$navigation_3d$setup_3d_nav(user_setup,user_settings){ +var initial_state = cljs.core.update_in.call(null,cljs.core.update_in.call(null,cljs.core.merge.call(null,quil.middlewares.navigation_3d.default_position.call(null),cljs.core.select_keys.call(null,user_settings,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"straight","straight",-1252567854),new cljs.core.Keyword(null,"up","up",-269712113),new cljs.core.Keyword(null,"position","position",-2011731912)], null))),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"straight","straight",-1252567854)], null),quil.middlewares.navigation_3d.v_normalize),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"up","up",-269712113)], null),quil.middlewares.navigation_3d.v_normalize); +return cljs.core.update_in.call(null,user_setup.call(null),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"navigation-3d","navigation-3d",682305301)], null),((function (initial_state){ +return (function (p1__8935_SHARP_){ +return cljs.core.merge.call(null,initial_state,p1__8935_SHARP_); +});})(initial_state)) +); +}); +/** + * Enables navigation in 3D space. Similar to how it is done in + * shooters: WASD navigation, space is go up, z is go down, + * drag mouse to look around. + */ +quil.middlewares.navigation_3d.navigation_3d = (function quil$middlewares$navigation_3d$navigation_3d(options){ +var user_settings = new cljs.core.Keyword(null,"navigation-3d","navigation-3d",682305301).cljs$core$IFn$_invoke$arity$1(options); +var pixels_in_360 = new cljs.core.Keyword(null,"pixels-in-360","pixels-in-360",1789567298).cljs$core$IFn$_invoke$arity$2(user_settings,(1000)); +var step_size = new cljs.core.Keyword(null,"step-size","step-size",1545609922).cljs$core$IFn$_invoke$arity$2(user_settings,(20)); +var rotate_on = new cljs.core.Keyword(null,"rotate-on","rotate-on",-1282225937).cljs$core$IFn$_invoke$arity$2(user_settings,new cljs.core.Keyword(null,"mouse-dragged","mouse-dragged",-1220073441)); +var draw = new cljs.core.Keyword(null,"draw","draw",1358331674).cljs$core$IFn$_invoke$arity$2(options,((function (user_settings,pixels_in_360,step_size,rotate_on){ +return (function (state){ +return null; +});})(user_settings,pixels_in_360,step_size,rotate_on)) +); +var key_pressed = new cljs.core.Keyword(null,"key-pressed","key-pressed",-757100364).cljs$core$IFn$_invoke$arity$2(options,((function (user_settings,pixels_in_360,step_size,rotate_on,draw){ +return (function (state,_){ +return state; +});})(user_settings,pixels_in_360,step_size,rotate_on,draw)) +); +var rotate_on_fn = rotate_on.call(null,options,((function (user_settings,pixels_in_360,step_size,rotate_on,draw,key_pressed){ +return (function (state,_){ +return state; +});})(user_settings,pixels_in_360,step_size,rotate_on,draw,key_pressed)) +); +var setup = new cljs.core.Keyword(null,"setup","setup",1987730512).cljs$core$IFn$_invoke$arity$2(options,((function (user_settings,pixels_in_360,step_size,rotate_on,draw,key_pressed,rotate_on_fn){ +return (function (){ +return cljs.core.PersistentArrayMap.EMPTY; +});})(user_settings,pixels_in_360,step_size,rotate_on,draw,key_pressed,rotate_on_fn)) +); +return cljs.core.assoc.call(null,options,new cljs.core.Keyword(null,"setup","setup",1987730512),cljs.core.partial.call(null,quil.middlewares.navigation_3d.setup_3d_nav,setup,user_settings),new cljs.core.Keyword(null,"draw","draw",1358331674),((function (user_settings,pixels_in_360,step_size,rotate_on,draw,key_pressed,rotate_on_fn,setup){ +return (function (state){ +quil.middlewares.navigation_3d.assert_state_has_navigation.call(null,state); + +var map__8947_8958 = new cljs.core.Keyword(null,"navigation-3d","navigation-3d",682305301).cljs$core$IFn$_invoke$arity$1(state); +var map__8947_8959__$1 = ((((!((map__8947_8958 == null)))?((((map__8947_8958.cljs$lang$protocol_mask$partition0$ & (64))) || ((cljs.core.PROTOCOL_SENTINEL === map__8947_8958.cljs$core$ISeq$)))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__8947_8958):map__8947_8958); +var vec__8948_8960 = cljs.core.get.call(null,map__8947_8959__$1,new cljs.core.Keyword(null,"straight","straight",-1252567854)); +var c_x_8961 = cljs.core.nth.call(null,vec__8948_8960,(0),null); +var c_y_8962 = cljs.core.nth.call(null,vec__8948_8960,(1),null); +var c_z_8963 = cljs.core.nth.call(null,vec__8948_8960,(2),null); +var vec__8951_8964 = cljs.core.get.call(null,map__8947_8959__$1,new cljs.core.Keyword(null,"up","up",-269712113)); +var u_x_8965 = cljs.core.nth.call(null,vec__8951_8964,(0),null); +var u_y_8966 = cljs.core.nth.call(null,vec__8951_8964,(1),null); +var u_z_8967 = cljs.core.nth.call(null,vec__8951_8964,(2),null); +var vec__8954_8968 = cljs.core.get.call(null,map__8947_8959__$1,new cljs.core.Keyword(null,"position","position",-2011731912)); +var p_x_8969 = cljs.core.nth.call(null,vec__8954_8968,(0),null); +var p_y_8970 = cljs.core.nth.call(null,vec__8954_8968,(1),null); +var p_z_8971 = cljs.core.nth.call(null,vec__8954_8968,(2),null); +quil.core.camera.call(null,p_x_8969,p_y_8970,p_z_8971,(p_x_8969 + c_x_8961),(p_y_8970 + c_y_8962),(p_z_8971 + c_z_8963),u_x_8965,u_y_8966,u_z_8967); + +return draw.call(null,state); +});})(user_settings,pixels_in_360,step_size,rotate_on,draw,key_pressed,rotate_on_fn,setup)) +,new cljs.core.Keyword(null,"key-pressed","key-pressed",-757100364),((function (user_settings,pixels_in_360,step_size,rotate_on,draw,key_pressed,rotate_on_fn,setup){ +return (function (state,event){ +return key_pressed.call(null,quil.middlewares.navigation_3d.move.call(null,state,event,step_size),event); +});})(user_settings,pixels_in_360,step_size,rotate_on,draw,key_pressed,rotate_on_fn,setup)) +,rotate_on,((function (user_settings,pixels_in_360,step_size,rotate_on,draw,key_pressed,rotate_on_fn,setup){ +return (function (state,event){ +return rotate_on_fn.call(null,quil.middlewares.navigation_3d.rotate.call(null,state,event,pixels_in_360),event); +});})(user_settings,pixels_in_360,step_size,rotate_on,draw,key_pressed,rotate_on_fn,setup)) +); +}); + +//# sourceMappingURL=navigation_3d.js.map \ No newline at end of file diff --git a/assets/viz/2/quil/middlewares/navigation_3d.js.map b/assets/viz/2/quil/middlewares/navigation_3d.js.map new file mode 100644 index 0000000..29e7b12 --- /dev/null +++ b/assets/viz/2/quil/middlewares/navigation_3d.js.map @@ -0,0 +1 @@ +{"version":3,"file":"\/home\/mediocregopher\/src\/viz\/out\/quil\/middlewares\/navigation_3d.js","sources":["navigation_3d.cljc"],"lineCount":261,"mappings":";AAAA;;;AAGA,AAAeA,8DACb,6CAAA,yFAAA,kGAAA;AAIF;;;6DAAA,7DAAOC,kIAEJC;AAFH,AAGE,oBAAU,AAAA,oGAAgBA;AAA1B;;AAAA,AACE,MACgB,KAAAC,MAAWH;;;AAE\/B;;;;kDAAA,lDAAOI;AAAP,AAAA,kDAAA,8DAAA,mQAAA,8DAAA,mFAAA,IAAA,IAAA,aAAA,iDAAA,mFAAA,IAAA,IAAA,leAIc,8BAAA,7BAAG,AAACC,kCACJ,+BAAA,9BAAG,AAACC,mCACJ,CAAA,+BAAA,9BAAG,AAACA,qCAAc,AAACC,wBAAM,yBAAA,xBAAG,gBAAA,fAAGC;;AAI7C;;;;;0DAAA,1DAAOC,4HAIJC,EAAEC,KAAKC;AAJV,AAKE,IAAAC,YAAoBF;UAApB,AAAAG,wBAAAD,UAAA,IAAA,5CAAOG;UAAP,AAAAF,wBAAAD,UAAA,IAAA,5CAAWI;UAAX,AAAAH,wBAAAD,UAAA,IAAA,5CAAeK;IAAfH,YACcL;QADd,AAAAI,wBAAAC,UAAA,IAAA,1CACOI;QADP,AAAAL,wBAAAC,UAAA,IAAA,1CACSK;QADT,AAAAN,wBAAAC,UAAA,IAAA,1CACWM;IACLC,KAAG,AAACC,wBAAMX;IACVY,MAAI,CAAA,M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B,mBAAA;eAAA,AAAA\/F,wBAAAgG,eAAA,IAAA,tDAAQG;eAAR,AAAAnG,wBAAAgG,eAAA,IAAA,tDAAYI;eAAZ,AAAApG,wBAAAgG,eAAA,IAAA,tDAAgBK;IAAhBJ,iBAAA,AAAA3B,wBAAAyB,mBAAA;eAAA,AAAA\/F,wBAAAiG,eAAA,IAAA,tDACQK;eADR,AAAAtG,wBAAAiG,eAAA,IAAA,tDACYM;eADZ,AAAAvG,wBAAAiG,eAAA,IAAA,tDACgBO;IADhBN,iBAAA,AAAA5B,wBAAAyB,mBAAA;eAAA,AAAA\/F,wBAAAkG,eAAA,IAAA,tDAEQO;eAFR,AAAAzG,wBAAAkG,eAAA,IAAA,tDAEYQ;eAFZ,AAAA1G,wBAAAkG,eAAA,IAAA,tDAEgBS;AAFhB,AAGE,AAACC,2BAASH,SAAIC,SAAIC,SAAI,CAAGF,WAAIN,UAAK,CAAGO,WAAIN,UAAK,CAAGO,WAAIN,UAAKC,SAAIC,SAAIC;;AACpE,OAAChB,eAAKpG;;CAVhB,mEAYe;kBAAKA,MAAMiE;AAAX,AACE,OAACoC,sBAAY,AAACxB,8CAAK7E,MAAMiE,MAAMa,WAAWb;;CAEzDkC,UAAU;kBAAKnG,MAAMiE;AAAX,AACE,OAACsC,uBAAa,AAACvC,gDAAOhE,MAAMiE,MAAMC,eAAeD","names":["quil.middlewares.navigation-3d\/missing-navigation-key-error","quil.middlewares.navigation-3d\/assert-state-has-navigation","state","js\/Error","quil.middlewares.navigation-3d\/default-position","quil.core\/width","quil.core\/height","quil.core\/tan","quil.core\/PI","quil.middlewares.navigation-3d\/rotate-by-axis-and-angle","v","axis","angle","vec__8901","cljs.core\/nth","vec__8904","a-x","a-y","a-z","x","y","z","cs","quil.core\/cos","-cs","sn","quil.core\/sin","a","b","c","d","e","f","g","h","i","quil.middlewares.navigation-3d\/rotate-lr","nav-3d","cljs.core\/update-in","p__8907","p__8908","vec__8915","vec__8918","quil.middlewares.navigation-3d\/cross-product","u1","u2","u3","v1","v2","v3","quil.middlewares.navigation-3d\/v-mult","mult","p1__8921#","cljs.core\/mapv","quil.middlewares.navigation-3d\/v-plus","cljs.core\/+","quil.middlewares.navigation-3d\/v-opposite","quil.middlewares.navigation-3d\/v-normalize","norm","cljs.core\/map","quil.core\/sq","cljs.core\/apply","quil.core\/sqrt","quil.middlewares.navigation-3d\/rotate-ud","p1__8922#","rotate","quil.middlewares.navigation-3d\/rotate","event","pixels-in-360","cljs.core\/=","dx","dy","angle-lr","quil.core\/map-range","quil.core\/TWO-PI","angle-ud","p1__8923#","quil.middlewares.navigation-3d\/space","cljs.core\/keyword","quil.middlewares.navigation-3d\/move","step-size","map__8930","cljs.core\/PROTOCOL_SENTINEL","cljs.core\/hash-map","cljs.core\/get","up","straight","temp__4655__auto__","dir","pred__8932","expr__8933","p1__8924#","quil.middlewares.navigation-3d\/setup-3d-nav","user-setup","user-settings","initial-state","cljs.core\/select-keys","cljs.core\/merge","p1__8935#","quil.middlewares.navigation-3d\/navigation-3d","options","rotate-on","draw","key-pressed","_","rotate-on-fn","setup","cljs.core\/assoc","cljs.core\/partial","map__8947","vec__8948","vec__8951","vec__8954","c-x","c-y","c-z","u-x","u-y","u-z","p-x","p-y","p-z","quil.core\/camera"]} \ No newline at end of file -- cgit v1.2.3