Compare commits

...

2 Commits

Author SHA1 Message Date
Tony Garnock-Jones ce9c15836b Don't die on script errors 2023-02-14 12:16:52 +01:00
Tony Garnock-Jones f5f677291d remove templateScale 2023-02-14 12:16:40 +01:00
3 changed files with 9 additions and 12 deletions

View File

@ -142,10 +142,8 @@
SetPen
Home
[ 1.414 1 1 PenScale ] to big
[ 1 1 1 PenScale ] to normal
[ 1 to k k / [dup F] k times drop ] to ff
[ 2 / dup R big 0 F R normal 0 F ] to rr
[ 2 / dup R 0 F R 0 F ] to rr
PenDown
1 ff 90 rr 1 ff 90 rr 1 ff 90 rr 1 ff 90 rr

View File

@ -263,8 +263,11 @@ export function buildMesh(
}
case "turtle": {
const t = new TurtleVM(name, scene, meshSpec.value.program.map(fromJS));
t.debug = true;
t.exec();
try {
t.exec();
} catch (e) {
console.error(e);
}
return {
rootnode: t.container,
subnodes: Promise.resolve(t.meshes),

View File

@ -13,7 +13,6 @@ import { VM as BaseVM, Input, Primitives, Environment } from './cat.js';
export class PenState {
templatePath: Vector3[] = [new Vector3()];
paths: Vector3[][] | null = null;
templateScale = new Vector3(1, 1, 1);
get isDown(): boolean {
return this.paths !== null;
@ -37,8 +36,9 @@ export class PenState {
push(pos: Vector3, q: Quaternion) {
this.templatePath.forEach((p, i) => {
const r = new Vector3();
p.multiplyToRef(this.templateScale, r);
r.rotateByQuaternionToRef(q, r);
// p.multiplyToRef(this.templateScale, r);
// r.rotateByQuaternionToRef(q, r);
p.rotateByQuaternionToRef(q, r);
r.addInPlace(pos);
this.paths![i].push(r);
});
@ -162,10 +162,6 @@ export const TurtlePrimitives: Environment<TurtleVM> = Object.assign({}, Primiti
'ClearPen'() { this.pen.clear(); return []; },
'SetPen'() { this.pen.set(); return []; },
'PenScale'(sx, sy, sz) {
this.pen.templateScale = new Vector3(sx as number, sy as number, sz as number);
return [];
},
'PenDown'() { this.penDown(); return []; },
'PenUp'() { this.penUp(false); return []; },
'Close'() { this.penUp(true); return []; },