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
/* | |
* signed distance fields generation in javascript | |
* uses the 8SSEDT algorithm for linear-time processing | |
* | |
* done in conjustion with the signed distance fields text experiment | |
* | |
* references: | |
* http://www.lems.brown.edu/vision/people/leymarie/Refs/CompVision/DT/DTpaper.pdf | |
* http://www.codersnotes.com/notes/signed-distance-fields | |
* http://guides4it.com/Mobile/iphone-3d-programming---crisper-text-with-distance-fields-(part-1)---generating-distance-fields-with-python.aspx |
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
message Dog { | |
} | |
message Cat { | |
} | |
message Elephant { |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>three.js webgl - modifier - Fast Quadric Mesh Simplification</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> | |
<style> | |
body { | |
font-family: Monospace; | |
background-color: #f0f0f0; |
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
// TODO add colors | |
sample = { a: { b: { c: 1, moo: [3,2,1] } }, z: 'zzzz' } | |
const asciitree = require('ascii-tree'); | |
function pretty_json(v) { | |
console.log(JSON.stringify( v, 0, 2 )) | |
} |
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
<script id="toon" type="frag/shader"> | |
// Based on http://coding-experiments.blogspot.sg/2011/01/toon-pixel-shader.html | |
uniform float width; | |
uniform float height; | |
uniform sampler2D tDiffuse; | |
varying vec2 vUv; | |
#define HueLevCount 6 | |
#define SatLevCount 7 |
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
// Simple Undo / Redo System | |
/* | |
* @author joshua koo / http://joshuakoo.com | |
* | |
* There are usually 2 different ways to handle undo / redo | |
* 1. you snapshot and store the states, so you can load them anytime | |
* 2. you store the deltas, actions, events or commands between save points. | |
* | |
* Method 1 is simplistic. But it works. It's a lot like git. |
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
function createNoiseTexture(width, height) { | |
var canvas = document.createElement("canvas"); | |
canvas.width = width; | |
canvas.height = height; | |
var context = canvas.getContext('2d'); | |
var image = context.createImageData( width, height ); | |
var imageData = image.data; |
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
// https://github.com/zz85/ | |
// implements Point - in - Polygon | |
// described in "A Winding Number and Point-in-Polygon Algorithm" | |
// returns 0 if point is not in polygon | |
// returns n > 0 if contour winds around point in counter-clockwise manner n times | |
// returns n < 0 if contour winds around point in clockwise manner -n times | |
function pointInPolygon(point, contour) { | |
// Creates a copy of contour | |
var adjustedContour = []; | |
var i,il; |
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.LetterZ = function () { | |
THREE.Geometry.call( this ); | |
var scope = this; | |
vertices = [{"x":90.3,"y":0},{"x":0,"y":0},{"x":0,"y":-14.85},{"x":63.599999999999994,"y":-94.35},{"x":3,"y":-94.35},{"x":3,"y":-110.55},{"x":87.3,"y":-110.55},{"x":87.3,"y":-95.25},{"x":24,"y":-16.349999999999998},{"x":90.3,"y":-16.349999999999998}]; | |
faces = [[9,0,1],[1,2,3],[3,4,5],[5,6,7],[8,9,1],[3,5,7],[7,8,1],[1,3,7]]; | |
for (var i in vertices) { |
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
/** | |
* @author zz85 / http://www.lab4games.net/zz85/blog | |
* Creates free form path. | |
**/ | |
THREE.Path = function (path) { | |
this.path = path || []; | |
}; | |
var ACTIONS = { |
NewerOlder