Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 1x 78x 26x 8x 18x 12x 6x | import { quat, mat4, vec3 } from 'gl-matrix'; // Labels used to encode handle position in the handle state's name property export const AXES = ['-', '=', '+']; // ---------------------------------------------------------------------------- export function transformVec3(ain, transform) { const vout = new Float64Array(3); vec3.transformMat4(vout, ain, transform); return vout; } // ---------------------------------------------------------------------------- export function rotateVec3(vec, transform) { // transform is a mat4 const out = vec3.create(); const q = quat.create(); mat4.getRotation(q, transform); vec3.transformQuat(out, vec, q); return out; } // ---------------------------------------------------------------------------- export function handleTypeFromName(name) { const [i, j, k] = name.split('').map((l) => AXES.indexOf(l) - 1); if (i * j * k !== 0) { return 'corners'; } if (i * j !== 0 || j * k !== 0 || k * i !== 0) { return 'edges'; } return 'faces'; } |