Skip to content

Instantly share code, notes, and snippets.

View nshen's full-sized avatar
🤔

Xin Chen nshen

🤔
View GitHub Profile
computeVertexNormals() {
const positionAttribute = this.attributes['position'];
if (positionAttribute !== undefined) {
this.addAttribute('normal', { size: 3, data: new Float32Array(positionAttribute.count * 3) });
let normalAttribute = this.attributes['normal'];
const pA = new Vec3(), pB = new Vec3(), pC = new Vec3();
const nA = new Vec3(), nB = new Vec3(), nC = new Vec3();
const cb = new Vec3(), ab = new Vec3();
@nshen
nshen / 0_reuse_code.js
Created March 24, 2017 03:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console