This is a notepad for my journey to learn opengl's programmable pipeline
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 setup() { | |
pinMode(13, OUTPUT); | |
Serial.begin(9600); | |
} | |
int lasta=0, lastb=0; | |
int dira=0, dirb=0; | |
int peaka=346, peakb=349; | |
int position = 0; | |
int cycle = 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
gmon.out | |
v8.log |
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
const ctx = require('fc')(render, 1) | |
const center = require('ctx-translate-center') | |
const {vec2, vec3, mat2, mat3 } = require('gl-matrix') | |
const renderGrid = require('ctx-render-grid-lines') | |
const segseg = require('segseg') | |
const ndarray = require('ndarray') | |
const raySlab = require('ray-aabb-slab') | |
const particles = [] | |
const constraints = [] |
Ok, so you've built your first module, but now you want to make it use one of the many libraries available via the npm registry.
There are a few ways to find a module. You can use http://npmjs.org or http://npmsearch.com to find modules that may fit what you need.
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
var | |
serialport = require('serialport'), | |
intelHex2Binary = require('./intelhex'), | |
fs = require('fs'), | |
sp = new serialport.SerialPort('/dev/tty.usbmodemfd121'), | |
argv = require('optimist').argv, | |
debug = 1, | |
s = function(d, fn) { | |
if (fn) { | |
cmds.push(function() { |
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
#include <node.h> | |
#include <v8.h> | |
using namespace v8; | |
using namespace node; | |
struct Obj { | |
int x; | |
}; |
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
uniform float aoIntensity; // {"label":"AO intensity", "min":0, "max":1, "step":0.01, "default":0.15, "group":"Shading", "group_label":"Ambient occlusion"} | |
uniform float aoSpread; // {"label":"AO spread", "min":0, "max":20, "step":0.01, "default":9, "group":"Shading"} | |
// Ambient occlusion approximation. | |
// Based upon boxplorer's implementation which is derived from: | |
// http://www.iquilezles.org/www/material/nvscene2008/rwwtt.pdf | |
float ambientOcclusion(vec3 p, vec3 n, float eps) | |
{ | |
float o = 1.0; // Start at full output colour intensity | |
eps *= aoSpread; // Spread diffuses the effect |
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
var isLeft = function(p1, p2, p3) { | |
return (p2.position[0] - p1.position[0])*(p3.position[1] - p1.position[1]) - (p3.position[0] - p1.position[0])*(p2.position[1] - p1.position[1]); | |
}; | |
// chainHull_2D(): Andrew's monotone chain 2D convex hull algorithm | |
// see: http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain | |
// Input: P[] = an array of 2D points | |
// presorted by increasing x- and y-coordinates | |
// n = the number of points in P[] | |
// Output: H[] = an array of the convex hull vertices (max is n) |
I hereby claim:
- I am tmpvar on github.
- I am tmpvar (https://keybase.io/tmpvar) on keybase.
- I have a public key ASDnoLe66_72oRYokyihcVYh5fOCT6WzjzKDPNYZPT-QXQo
To claim this, I am signing this object: