Skip to content

Commit

Permalink
[webgl] update shadergraph dep, bugfix lambert make-shader-spec
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Apr 27, 2015
1 parent ad819e7 commit 1792f97
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion geom-webgl/src/index.org
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ target/geom-webgl-<<conf-version()>>.js
**** [[http://thi.ng/shadergraph][thi.ng/shadergraph]]

#+BEGIN_SRC clojure :exports none :noweb-ref dep-shadergraph
[thi.ng/shadergraph "0.1.0"]
[thi.ng/shadergraph "0.1.1"]
#+END_SRC

**** [[https://github.com/postspectacular/cljs-log][cljs-log]]
Expand Down
22 changes: 11 additions & 11 deletions geom-webgl/src/shaders.org
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ Currently the following options are supported:
[thi.ng.geom.core.matrix :refer [M44]]))

(defn make-shader-spec
[& [{attr? :use-attrib is3d? :3d :or {is3d? true}}]]
[& [{attr? :color-attrib? is3d? :3d :or {is3d? true}}]]
(let [spec {:vs (str "void main(){"
(if attr? "vCol=color;")
"gl_Position=proj*"
Expand All @@ -399,10 +399,10 @@ Currently the following options are supported:
spec))

(defn make-shader-spec-2d
[attrib?] (make-shader-spec {:use-attrib attrib? :3d false}))
[color-attrib?] (make-shader-spec {:color-attrib? color-attrib? :3d false}))

(defn make-shader-spec-3d
[attrib?] (make-shader-spec {:use-attrib attrib? :3d true}))
[color-attrib?] (make-shader-spec {:color-attrib? color-attrib? :3d true}))
#+END_SRC

*** Lambert
Expand Down Expand Up @@ -441,10 +441,10 @@ Currently the following options are supported:

(defn- make-shader-spec
[vs-src]
{:vs (glsl/assemble
(glsl/glsl-spec
[vertex/mvp vertex/normal light/lambert-abs]
vs-src))
{:vs (->> vs-src
(glsl/glsl-spec-plain
[vertex/mvp vertex/normal light/lambert-abs])
(glsl/assemble))
:fs "void main(){gl_FragColor=vCol;}"
:uniforms {:model [:mat4 M44]
:view :mat4
Expand All @@ -462,13 +462,13 @@ Currently the following options are supported:

(def shader-spec
(make-shader-spec
"
<<lambert-vs>>"))
(glsl/minified "
<<lambert-vs>>")))

(def shader-spec-two-sided
(make-shader-spec
"
<<lambert-vs-abs>>"))
(glsl/minified "
<<lambert-vs-abs>>")))

(defn draw
[^WebGLRenderingContext gl spec]
Expand Down

0 comments on commit 1792f97

Please sign in to comment.