From 7fba434a0d1fc98a6a6572b1a34e0422fd8e8a38 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Mon, 13 Feb 2023 17:39:13 +0100 Subject: [PATCH] Turtle shapes and demo --- protocols/schemas/shapes.prs | 2 +- protocols/schemas/turtle.prs | 7 ++++ scene/lobby.pr | 64 +++++++++++++++++++++++++++++------- src/shapes.ts | 9 ++++- 4 files changed, 68 insertions(+), 14 deletions(-) create mode 100644 protocols/schemas/turtle.prs diff --git a/protocols/schemas/shapes.prs b/protocols/schemas/shapes.prs index 9295e94..db34423 100644 --- a/protocols/schemas/shapes.prs +++ b/protocols/schemas/shapes.prs @@ -5,7 +5,7 @@ Variable = . Shape = Mesh / Light / Scale / Move / Rotate / @many [Shape ...] / Texture / Color / Sound / Name / Floor / Nonphysical / Touchable / CSG / Skybox . -Mesh = Sphere / Box / Ground / Plane / External . +Mesh = Sphere / Box / Ground / Plane / External / @turtle turtle.Shape . Sphere = . Box = . diff --git a/protocols/schemas/turtle.prs b/protocols/schemas/turtle.prs new file mode 100644 index 0000000..9959ed1 --- /dev/null +++ b/protocols/schemas/turtle.prs @@ -0,0 +1,7 @@ +version 1 . + +Program = Block . +Block = [Token ...] . +Token = @i int / @d double / @b bool / @s string / @v symbol / @block Block . + +Shape = . diff --git a/scene/lobby.pr b/scene/lobby.pr index e2bace7..5b4b0f1 100644 --- a/scene/lobby.pr +++ b/scene/lobby.pr @@ -92,18 +92,58 @@ ; ; >>> - - - ] - - >>> - >>> - ]> - >>>>> +; +; +; ] +; +; >>> +; >>> +; ]> +; >>>>> + +; +; >> + + + >> ; ; >>(); @@ -260,6 +261,12 @@ export function buildMesh( }), }; } + case "turtle": { + const t = new TurtleVM(name, scene, meshSpec.value.program.map(fromJS)); + t.debug = true; + t.exec(); + return { rootnode: t.container }; + } } }