Compare commits
2 Commits
e37c7e5998
...
ce9c15836b
Author | SHA1 | Date |
---|---|---|
Tony Garnock-Jones | ce9c15836b | |
Tony Garnock-Jones | f5f677291d |
|
@ -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
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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 []; },
|
||||
|
|
Loading…
Reference in New Issue