This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns user | |
(:use arcadia.core) | |
(:import [UnityEngine | |
Vector3 | |
Time | |
Gizmos | |
Color | |
Debug | |
Plane | |
Mathf])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<meta charset="utf-8"> | |
<script src="js/jquery.js"></script> | |
<script src="js/jqconsole.js"></script> | |
<script src="js/sugar.js"></script> | |
<script src="js/peg.js"></script> | |
<script src="js/plt.js"></script> | |
<script type="text/javascript"> | |
// uncomment next line to enable refresh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns shady | |
(:require [clojure.string :as s])) | |
;; analyze | |
;; break shader up into logical bits | |
;; right now just uniforms and main fn | |
(def analysis {'uniform (fn [out form] | |
(update-in out [:uniforms] conj form)) | |
:default (fn [out form] | |
(update-in out [:fns :main] conj form))}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns flappy.bird | |
(:use arcadia.core) | |
(:import [UnityEngine Vector2 Input Time Vector3])) | |
(defcomponent Bird [^Vector2 force] | |
(Update [this] | |
;; flap on any keypress | |
(if Input/anyKeyDown | |
(.. this rigidbody2D | |
(AddForce force ForceMode2D/Impulse))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main(void) | |
{ | |
if(floor(gl_FragCoord.x) == floor(iMouse.x) || | |
floor(gl_FragCoord.y) == floor(iMouse.y)) { | |
gl_FragColor = vec4(1.0); | |
} else { | |
gl_FragColor = vec4(0.0); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main(void) | |
{ | |
vec2 uv = gl_FragCoord.xy / iResolution.xy; | |
if(uv.y < 0.5 + 0.2*sin(20.0*uv.x + iGlobalTime)) { | |
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); | |
} else { | |
gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main(void) | |
{ | |
float radius = 50.0; | |
float distanceToMouse = distance(gl_FragCoord.xy, iMouse.xy); | |
if(floor(distanceToMouse) == floor(radius)) { | |
gl_FragColor = vec4(1.); | |
} else { | |
gl_FragColor = vec4(0.); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main(void) | |
{ | |
vec2 px = gl_FragCoord.xy - mod(gl_FragCoord.xy, 10.); | |
vec2 uv = px / iResolution.xy * vec2(1., -1.); | |
gl_FragColor = texture2D(iChannel0, uv); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn tri-strip | |
([size] (tri-strip 0 size)) | |
([start size] | |
(->> (range start (+ start size)) | |
(partition 4 1) | |
(map (fn [[a b c d]] [a b c | |
c b d])) | |
flatten))) | |
(defn tri-fan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import Selection MeshFilter Vector3 Mesh Mathf) | |
(use 'clojure.repl) | |
;; mesh updates | |
(defn update-mesh! [^MeshFilter mf vs tris] | |
(set! (.. mf mesh vertices) | |
(into-array Vector3 vs)) | |
(set! (.. mf mesh triangles) | |
(into-array System.Int32 tris))) |