(ns civitas.why.village.shading
(:require [thi.ng.color.core :as col]))(defn normalize [[x y z]]
(let [m (Math/sqrt (+ (* x x) (* y y) (* z z)))]
[(/ x m) (/ y m) (/ z m)]))(defn dot [[ax ay az] [bx by bz]]
(+ (* ax bx) (* ay by) (* az bz)))(def light-dir (normalize [1 1 1]))(defn shade-color [hex normal]
(let [n (normalize normal)
lighting (max 0.3 (dot n light-dir)) ;; never go below 30%
c (col/hex hex)]
(-> c
(col/scale lighting)
col/as-hex)))
ImportantSyntax error compiling at (16:11).
No such var: col/hex
clojure.core/eval core.clj: 3232
...
java.lang.RuntimeException: No such var: col/hex
clojure.lang.Compiler$CompilerException: Syntax error compiling at (16:11).
data: #:clojure.error{:phase :compile-syntax-check,
:line 16,
:column 11,
:source "NO_SOURCE_PATH"}