add class notes. check for gl lost context

This commit is contained in:
Stewart Allen 2022-10-04 12:56:00 -04:00
commit 17b90c4059
4 changed files with 23 additions and 12 deletions

View file

@ -2,6 +2,12 @@
"use strict";
/*
* provides the `output` abstraction for turning poly lines (open and closed)
* into primordial geometries (faces, lines, color ranges). used inside of
* workers as part of slicing and preview output.
*/
// dep: geo.base
// dep: geo.polygon
// dep: geo.polygons
@ -407,18 +413,6 @@ function ProfiledContourGeometry(profileShape, contour, contourClosed) {
index.push(p8, p7, p5);
}
// unrolled / non-indexed geometry provides a cleaner look because vertex
// shading of indexed geometries looks wrong. this takes longer to re-compute
// so it should be produced unrolled above.
//
// let nufaces = new Float32Array(index.length * 3), ii = 0;
// for (let i of index) {
// nufaces[ii++] = faces[i*3];
// nufaces[ii++] = faces[i*3+1];
// nufaces[ii++] = faces[i*3+2];
// }
// return { index:[], faces: nufaces };
return {index, faces};
}

View file

@ -2,6 +2,11 @@
"use strict";
/*
* uses `layers.js` to convert paths (usually preview) into primordial geometries.
* the input is based on an array (layers) of arrays containing `Output` objects
*/
// dep: geo.base
// dep: geo.point
// dep: geo.polygon

View file

@ -6,6 +6,9 @@ gapp.register("kiri.stack", [], (root, exports) => {
const { kiri } = root;
/*
* converts `layers.js` output data structures into three.js meshes for display
*/
class Stack {
constructor(view, freeMem, shiny) {
this._view = view;

View file

@ -403,6 +403,15 @@ gapp.register("moto.space", [], (root, exports) => {
canvas.width = w * scale;
canvas.height = h * scale;
canvas.addEventListener("webglcontextlost", event => {
console.log('WEB GL CONTEXT LOST');
event.preventDefault();
}, false);
canvas.addEventListener("webglcontextrestored", event => {
console.log('WEB GL CONTEXT RESTORED');
}, false);
try {
context.scale(scale, scale);
} catch (e) {