We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f60fb38 commit abec044Copy full SHA for abec044
src/civitas/why/village/shading.clj
@@ -1,5 +1,6 @@
1
(ns civitas.why.village.shading
2
- (:require [thi.ng.color.core :as col]))
+ (:require [thi.ng.color.core :as col]
3
+ [thi.ng.math.core :as m]))
4
5
(defn normalize [[x y z]]
6
(let [m (Math/sqrt (+ (* x x) (* y y) (* z z)))]
@@ -13,10 +14,10 @@
13
14
(defn shade-color [hex normal]
15
(let [n (normalize normal)
16
lighting (max 0.3 (dot n light-dir)) ;; never go below 30%
- c (col/hex hex)]
17
+ c (col/css hex)]
18
(-> c
- (col/scale lighting)
19
- col/as-hex)))
+ (m/mix col/BLACK lighting)
20
+ col/as-css)))
21
22
(defn face-normal [verts face]
23
(let [[a b c] (map verts face)
0 commit comments