Skip to content

Commit abec044

Browse files
fix shading error
1 parent f60fb38 commit abec044

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/civitas/why/village/shading.clj

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
(ns civitas.why.village.shading
2-
(:require [thi.ng.color.core :as col]))
2+
(:require [thi.ng.color.core :as col]
3+
[thi.ng.math.core :as m]))
34

45
(defn normalize [[x y z]]
56
(let [m (Math/sqrt (+ (* x x) (* y y) (* z z)))]
@@ -13,10 +14,10 @@
1314
(defn shade-color [hex normal]
1415
(let [n (normalize normal)
1516
lighting (max 0.3 (dot n light-dir)) ;; never go below 30%
16-
c (col/hex hex)]
17+
c (col/css hex)]
1718
(-> c
18-
(col/scale lighting)
19-
col/as-hex)))
19+
(m/mix col/BLACK lighting)
20+
col/as-css)))
2021

2122
(defn face-normal [verts face]
2223
(let [[a b c] (map verts face)

0 commit comments

Comments
 (0)