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
struct FragmentOutput { | |
[[location(0)]] out_color: vec4<f32>; | |
}; | |
[[block]] | |
struct Data { | |
time: f32; | |
}; | |
[[group(0), binding(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
// A demonstration of drawing to a very large texture, capturing the texture in its original size | |
// as a PNG and displaying a down-scaled version of the image within the window each frame. | |
use nannou::prelude::*; | |
fn main() { | |
nannou::app(model).update(update).run(); | |
} | |
struct Model { |
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
//THREE.PLYLoader returns a BufferGeometry | |
createMesh(buffGeometry){ | |
let geometry = new THREE.Geometry().fromBufferGeometry( buffGeometry ); | |
var material = new THREE.MeshPhongMaterial( { specular: 0x111111, shininess: 200, vertexColors: THREE.VertexColors } ); | |
var mesh = new THREE.Mesh( geometry, material ); | |
mesh.scale.multiplyScalar( 0.5 ); | |
return mesh; | |
} |
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
Tech Toolbox | |
http://www.gdcvault.com/play/1024145/Tech | |
Practical Procedural Generation for Everyone | |
http://www.gdcvault.com/play/1024213/Practical-Procedural-Generation-for | |
Building Worlds Using Math(s) | |
http://www.gdcvault.com/play/1024514/Building-Worlds-Using | |
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 leaf | |
[n-stripes width] | |
(let [ | |
end (mg/scale-edge :ab :x | |
:scale 0.02 | |
:out [(make-stripes n-stripes)]) | |
middle (mg/reflect :s :out[{} | |
(mg/scale-edge :bc :z | |
:len width | |
:out [(mg/extrude |
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 scale-side | |
[hex distorsion] | |
(mg/scale-edge :ef :y | |
:scale distorsion | |
:out [hex])) | |
(defn displace-ring | |
[& {:keys [offset scale] :or {offset 0.2 scale 1.0}}] | |
(let [displace-it (mg/split-displace :y :z :offset offset :out [nil {}]) | |
scale-it (mg/scale-edge :bc :z :scale scale :out [displace-it])] |
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 punch | |
{:op :sd-inset, :args {:dir :w, :inset 0.999}, :out [{} {} {} {} nil]} | |
[dir w & [out]] | |
(mg/subdiv-inset :dir dir :inset w :out (or out {4 nil}))) | |
(defn petal | |
[scale offset punch-y] | |
(let [punch-it (mg/skew :e :e :offset offset | |
:out [(punch :y punch-y)]) | |
tree (mg/scale-edge :ef :y :scale scale |
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 star | |
[] | |
(let [side (mg/apply-recursively (mg/reflect :e) 13 [1] 1) | |
seed (mg/sphere-lattice-seg 6 0.355 0.0955 0.2) | |
skewed-side (mg/skew | |
:n | |
:e | |
:offset 0.3 | |
:out [side]) | |
tree (mg/scale-edge |
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 morphogen-mesh | |
[seed tree] | |
(-> seed | |
(mg/seed-box) | |
(mg/generate-mesh tree) | |
(g/center))) | |
(def strip-quad | |
"Arrangement of quads" | |
(let [quad (mg/apply-recursively (mg/reflect :e) 4 [1] 1) |
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 da-example-apply-recursively | |
[] | |
(let [hex (mg/apply-recursively (mg/reflect :e) 5 [1] 1) | |
seed (a/aabb [0 0 0] 0.95) | |
tree (mg/skew | |
:n | |
:e | |
:offset 0.3 | |
:out [hex]) | |
] |
NewerOlder