@mulmoclaude/shapescript-plugin 1.3.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -14
- package/dist/core/definition.d.ts.map +1 -1
- package/dist/core/dispatch.d.ts +8 -3
- package/dist/core/dispatch.d.ts.map +1 -1
- package/dist/core/index.d.ts +5 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/paths.d.ts +5 -0
- package/dist/core/paths.d.ts.map +1 -1
- package/dist/core-BvTjfhU2.js +53 -0
- package/dist/core-DZvhTmuk.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +4 -3
- package/dist/export/tool.d.ts +45 -0
- package/dist/export/tool.d.ts.map +1 -0
- package/dist/export/usdz.d.ts +17 -0
- package/dist/export/usdz.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +4 -4
- package/dist/lang/de.d.ts.map +1 -1
- package/dist/lang/en.d.ts.map +1 -1
- package/dist/lang/es.d.ts.map +1 -1
- package/dist/lang/fr.d.ts.map +1 -1
- package/dist/lang/ja.d.ts.map +1 -1
- package/dist/lang/ko.d.ts.map +1 -1
- package/dist/lang/messages.d.ts +2 -0
- package/dist/lang/messages.d.ts.map +1 -1
- package/dist/lang/ptBR.d.ts.map +1 -1
- package/dist/lang/zh.d.ts.map +1 -1
- package/dist/render.cjs +2 -2
- package/dist/render.js +9 -9
- package/dist/samples-CXhuDdDd.js +1038 -0
- package/dist/samples-DGD0Kjwg.cjs +276 -0
- package/dist/shapescript/evaluator.d.ts +27 -4
- package/dist/shapescript/evaluator.d.ts.map +1 -1
- package/dist/shapescript/parser.d.ts +18 -0
- package/dist/shapescript/parser.d.ts.map +1 -1
- package/dist/shapescript/toThreeJS.d.ts +42 -2
- package/dist/shapescript/toThreeJS.d.ts.map +1 -1
- package/dist/shapescript/types.d.ts +22 -4
- package/dist/shapescript/types.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/{toThreeJS-B5LiF110.js → toThreeJS-FsP-Na75.js} +341 -284
- package/dist/toThreeJS-MvllBF9e.cjs +10 -0
- package/dist/vue/View.vue.d.ts.map +1 -1
- package/dist/vue/index.d.ts +1 -1
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue.cjs +41 -22
- package/dist/vue.js +1784 -1721
- package/package.json +1 -1
- package/dist/samples-DHEKUNs5.cjs +0 -186
- package/dist/samples-SaXsqbHJ.js +0 -180
- package/dist/toThreeJS-BOBpx5Dc.cjs +0 -10
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
const e=require("./toThreeJS-MvllBF9e.cjs");let t=require("@mulmoclaude/core/artifacts");var n=`presentShapeScript`,r={type:`function`,name:n,description:"Display interactive 3D visualizations using ShapeScript with expressions, variables, control flow, and functions. A new `script` is saved to `artifacts/shapes/` and the returned `filePath` names it; pass `path` instead to present a source that already exists.",parameters:{type:`object`,properties:{title:{type:`string`,description:`Title for the 3D visualization`},script:{type:`string`,description:`ShapeScript code defining the 3D scene. Supported features and syntax are listed below. Syntax, evaluation, geometry and resource-limit errors are returned as diagnostics; correct the script and retry.
|
|
2
|
+
|
|
3
|
+
## SYNTAX OVERVIEW:
|
|
4
|
+
|
|
5
|
+
### Expressions & Operators:
|
|
6
|
+
- Arithmetic: +, -, *, /, % with proper precedence
|
|
7
|
+
- Comparison: =, <>, <, <=, >, >=
|
|
8
|
+
- Boolean: and, or, not
|
|
9
|
+
- Parentheses for grouping: (2 + 3) * 4
|
|
10
|
+
|
|
11
|
+
### Variables:
|
|
12
|
+
define radius 2
|
|
13
|
+
define red (1 0 0)
|
|
14
|
+
sphere {
|
|
15
|
+
size radius
|
|
16
|
+
color red
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
### Control Flow:
|
|
20
|
+
|
|
21
|
+
For loops with variables:
|
|
22
|
+
for i in 1 to 5 {
|
|
23
|
+
cube {
|
|
24
|
+
position (i * 2) 0 0
|
|
25
|
+
size 1
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
For loops with step:
|
|
30
|
+
for i in 0 to 10 step 2 {
|
|
31
|
+
sphere { position 0 i 0 }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
If/else conditionals:
|
|
35
|
+
define showSphere 1
|
|
36
|
+
if showSphere {
|
|
37
|
+
sphere { size 2 }
|
|
38
|
+
} else {
|
|
39
|
+
cube { size 2 }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
Switch statements:
|
|
43
|
+
define shape 2
|
|
44
|
+
switch shape {
|
|
45
|
+
case 1
|
|
46
|
+
cube
|
|
47
|
+
case 2
|
|
48
|
+
sphere
|
|
49
|
+
else
|
|
50
|
+
cone
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
### Built-in Functions:
|
|
54
|
+
|
|
55
|
+
Math: round, floor, ceil, abs, sign, sqrt, pow, min, max
|
|
56
|
+
Trig: sin, cos, tan, asin, acos, atan, atan2 (uses radians)
|
|
57
|
+
Vector: dot, cross, length, normalize, sum
|
|
58
|
+
|
|
59
|
+
IMPORTANT: Function calls require NO space between name and parenthesis:
|
|
60
|
+
- sin(x) ✓ function call
|
|
61
|
+
- sin (x) ✗ NOT a function call (identifier + parenthesized expression)
|
|
62
|
+
Separate arguments with spaces, as upstream does: max(0 (j - 1)), pow(2.718 (0 - x)). Commas also work
|
|
63
|
+
here (max(0, j - 1)) but NOT in the upstream ShapeScript app, so prefer spaces. Bare max 0 1 without
|
|
64
|
+
parentheses is not supported.
|
|
65
|
+
Write ONE statement per line. This parser accepts "define a 1 define b 2" on one line; the upstream app
|
|
66
|
+
rejects it, and a script that keeps to one statement per line opens in both.
|
|
67
|
+
|
|
68
|
+
Examples:
|
|
69
|
+
for i in 1 to 8 {
|
|
70
|
+
define angle (i * 0.785) // 45 degrees in radians
|
|
71
|
+
cube { position (cos(angle) * 3) 0 (sin(angle) * 3) }
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
### Primitives & Properties:
|
|
75
|
+
|
|
76
|
+
Shapes: cube, sphere, cylinder, cone, torus, circle, square, polygon (sides 3–256)
|
|
77
|
+
Properties: position X Y Z, orientation ROLL YAW PITCH (alias: rotation), size X Y Z
|
|
78
|
+
Materials: color R G B (0-1), opacity (0-1)
|
|
79
|
+
|
|
80
|
+
UNITS (same as upstream ShapeScript — https://shapescript.info/mac/):
|
|
81
|
+
- size is the DIAMETER of sphere/cylinder/cone/circle/polygon/torus (a bare sphere fits the unit cube); for cube/square it is the edge length.
|
|
82
|
+
- orientation / rotate use HALF-TURNS in roll (Z), yaw (Y), pitch (X) order: 0.5 = 90°, 1 = 180°. Positive is clockwise. A lone value is a roll: orientation 0.25 = 45° about Z. Angle-axis also works: orientation 0.5 0 1 0.
|
|
83
|
+
- rotate / translate / scale as commands are relative and accumulate; orientation as a command is absolute.
|
|
84
|
+
- Trig FUNCTIONS (sin, cos, …) still take radians. Convert with pi: a half-turn value h is h * pi radians.
|
|
85
|
+
|
|
86
|
+
### CSG Operations:
|
|
87
|
+
union, difference, intersection, xor, stencil
|
|
88
|
+
|
|
89
|
+
Example:
|
|
90
|
+
difference {
|
|
91
|
+
sphere {
|
|
92
|
+
size 2
|
|
93
|
+
color (1 0.5 0)
|
|
94
|
+
}
|
|
95
|
+
cube { size 1.5 }
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
### Paths:
|
|
99
|
+
path { point X Y … } — coordinates are ABSOLUTE in the path's frame. Close a path by repeating the first point.
|
|
100
|
+
- curve X Y is a quadratic Bézier CONTROL point: the outline passes through the point commands on either side, not through it. Two curves in a row get an implicit on-curve midpoint, so eight curves in an octagon draw a circle.
|
|
101
|
+
- A path may carry position / orientation / size of its own (path { position 0 0 2 orientation 0 0.5 0 point … }); that is how a loft section is placed in 3D. Give loft and extrude PATH children, not fill{} meshes — the upstream app rejects a mesh there.
|
|
102
|
+
- rotate (half-turns) / translate / scale inside a path move the frame for later points:
|
|
103
|
+
path {
|
|
104
|
+
for 0 to 8 {
|
|
105
|
+
curve 0 1
|
|
106
|
+
rotate 1 / 8
|
|
107
|
+
}
|
|
108
|
+
} // semicircle
|
|
109
|
+
|
|
110
|
+
### Builders:
|
|
111
|
+
- extrude: extrude { polygon { sides 3 } } or an inline path (size Z = depth, default 1):
|
|
112
|
+
extrude path {
|
|
113
|
+
point 0 0
|
|
114
|
+
point 1 0
|
|
115
|
+
point 0 1
|
|
116
|
+
point 0 0
|
|
117
|
+
}
|
|
118
|
+
- fill: fill { square } or fill path { ... }
|
|
119
|
+
- lathe (revolves the XY profile about Y):
|
|
120
|
+
lathe path {
|
|
121
|
+
point 0 0
|
|
122
|
+
point 1 0
|
|
123
|
+
curve 1.5 1
|
|
124
|
+
point 1 2
|
|
125
|
+
point 0 2
|
|
126
|
+
}
|
|
127
|
+
- loft (closed planar sections joined with caps):
|
|
128
|
+
loft {
|
|
129
|
+
square
|
|
130
|
+
translate 0 0 2
|
|
131
|
+
circle
|
|
132
|
+
}
|
|
133
|
+
- hull (convex envelope):
|
|
134
|
+
hull {
|
|
135
|
+
cube { position -1 0 0 }
|
|
136
|
+
cube { position 1 0 0 }
|
|
137
|
+
}
|
|
138
|
+
- stencil preserves the first shape and paints its surface with later shapes' materials.
|
|
139
|
+
Loft sections must each have one perimeter and enclose an area; extrude/fill primitive profiles must lie in XY.
|
|
140
|
+
|
|
141
|
+
### Additional Expressions:
|
|
142
|
+
- Constants: pi, true, false (tau exists here but NOT in the upstream app; write 2 * pi)
|
|
143
|
+
- Scientific notation and unary plus: 1e-3, +2
|
|
144
|
+
- Tuple/vector members: vector.x, vector.y, vector.z; color.red/green/blue/alpha
|
|
145
|
+
- Tuple/string length: value.count; zero-based indexing: values[0]; ordinals: v.first v.second … v.last, v.allButFirst, v.allButLast
|
|
146
|
+
- String literals, join(...), trim(...); min/max also accept tuples
|
|
147
|
+
- Custom shapes with options:
|
|
148
|
+
define post {
|
|
149
|
+
option height 2
|
|
150
|
+
cylinder { size 0.2 height }
|
|
151
|
+
}
|
|
152
|
+
post { height 3 }
|
|
153
|
+
- Random numbers: rnd (0–1) and seed N (scoped to the enclosing block, same generator as upstream)
|
|
154
|
+
|
|
155
|
+
### Compatibility:
|
|
156
|
+
This plugin implements the documented modeling subset, not all upstream ShapeScript syntax; units and
|
|
157
|
+
path semantics follow upstream, so a script written against the upstream docs renders the same here.
|
|
158
|
+
Function calls use name(...). Imports, textures, text/fonts, lights/cameras, arbitrary objects,
|
|
159
|
+
hex/named colours, and general user-defined functions are not supported.
|
|
160
|
+
|
|
161
|
+
### Comments:
|
|
162
|
+
// Single-line comment
|
|
163
|
+
/* Multi-line
|
|
164
|
+
comment */
|
|
165
|
+
|
|
166
|
+
## COMPLETE EXAMPLES:
|
|
167
|
+
|
|
168
|
+
Linear arrangement with expressions:
|
|
169
|
+
define spacing 1.5
|
|
170
|
+
for i in 1 to 4 {
|
|
171
|
+
cylinder {
|
|
172
|
+
position ((i - 2.5) * spacing) 0 0
|
|
173
|
+
size 0.4 1
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
Circular pattern:
|
|
178
|
+
define count 12
|
|
179
|
+
for i in 1 to count {
|
|
180
|
+
define angle ((i / count) * 6.283) // 2 * PI
|
|
181
|
+
cube {
|
|
182
|
+
position (cos(angle) * 3) 0 (sin(angle) * 3)
|
|
183
|
+
color (i / count) 0.5 (1 - i / count)
|
|
184
|
+
size 0.5
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
Conditional geometry:
|
|
189
|
+
define makeHollow 1
|
|
190
|
+
if makeHollow {
|
|
191
|
+
difference {
|
|
192
|
+
sphere {
|
|
193
|
+
size 2
|
|
194
|
+
color (1 0 0)
|
|
195
|
+
}
|
|
196
|
+
sphere { size 1.7 }
|
|
197
|
+
}
|
|
198
|
+
} else {
|
|
199
|
+
sphere {
|
|
200
|
+
size 2
|
|
201
|
+
color (1 0 0)
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
Mathematical visualization:
|
|
206
|
+
for x in -5 to 5 {
|
|
207
|
+
for z in -5 to 5 {
|
|
208
|
+
define height (sin(x * 0.5) * cos(z * 0.5) * 2)
|
|
209
|
+
cube {
|
|
210
|
+
position (x * 0.3) height (z * 0.3)
|
|
211
|
+
size 0.25 (abs(height) + 0.1) 0.25
|
|
212
|
+
color (0.5 + height * 0.25) 0.3 (0.5 - height * 0.25)
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}`},path:{type:`string`,description:"Path to an EXISTING ShapeScript source to present in place, instead of `script` — a `.shape` file this tool saved earlier (`artifacts/shapes/…`) or any other on disk. Provide either `script` or `path`, never both. Edits the user makes in the view write back to that same file."}},required:[`title`]}},i=`shapes`,a=`shape`,o=[`.shape`];function s(e,n=a){return(0,t.slugifyArtifact)(e,n)}function c(){let e=globalThis.crypto;if(e?.getRandomValues){let t=e.getRandomValues(new Uint8Array(4));return Array.from(t,e=>e.toString(16).padStart(2,`0`)).join(``)}return Math.random().toString(16).slice(2,10).padEnd(8,`0`)}function l(e,n=new Date,r=c()){let o=(0,t.buildArtifactRelPath)({dir:i,title:e,ext:`.shape`,fallback:a,now:n,partitioned:!1,suffix:r});return{relPath:o,filePath:(0,t.toWorkspaceArtifactPath)(o)}}function u(e,n=new Date,r=c()){let o=(0,t.buildArtifactRelPath)({dir:i,title:e,ext:`.usdz`,fallback:a,now:n,partitioned:!1,suffix:r});return{relPath:o,filePath:(0,t.toWorkspaceArtifactPath)(o)}}function d(e){return!e.startsWith(`${t.ARTIFACTS_ROOT}/${i}/`)||!e.endsWith(`.shape`)?!1:!(0,t.hasUnsafePathSegment)(e)}function f(e){return e.startsWith(`${t.ARTIFACTS_ROOT}/`)?e.slice(t.ARTIFACTS_ROOT.length+1):e}function p(e){return(0,t.classifyFilePath)(e,o)!==null}function m(e,t){if(d(t))return{files:e.files.artifacts,rel:f(t)};let n=e.files.byPath;return n&&p(t)?{files:n,rel:t}:null}async function h(e,t){if(typeof t?.path!=`string`)throw Error(`path must be an existing .shape file`);let n=m(e,t.path);if(!n)throw Error(`path must be an existing .shape file`);switch(t.kind){case`loadShape`:return{script:await n.files.read(n.rel)};case`saveShape`:if(typeof t.script!=`string`)throw Error("saveShape requires `script` as a string");if(!await n.files.exists(n.rel))throw Error(`No ShapeScript exists at ${t.path}`);return await n.files.write(n.rel,t.script),{path:t.path};default:throw Error(`shapescript plugin: unknown dispatch kind ${JSON.stringify(t)}`)}}var g=`Acknowledge that the 3D visualization has been created and is displayed to the user. They can rotate, zoom, and pan the camera.`,_=e=>typeof e==`string`&&e.trim()!==``;function v(t){e.i(e.r(e.In(t)))}async function y(e,t){let n=e.files;if(!n)throw Error("This host cannot open a ShapeScript by path — pass the source as `script` instead");let r=m({files:n},t);if(!r)throw Error("`path` must be a .shape file, without `.` / `..` segments");if(!await r.files.exists(r.rel))throw Error(`No ShapeScript exists at ${t}`);return r.files.read(r.rel)}var b=5;async function x(e,t,n){let r=e.files?.artifacts;if(r){for(let e=0;e<b;e++){let{relPath:e,filePath:i}=l(n);if(!await r.exists(e))return await r.write(e,t),i}throw Error(`Could not allocate a free path under artifacts/shapes — try again with a different title`)}}async function S(e,t){if(_(t.path)&&_(t.script))throw Error("Provide either `script` or `path`, not both");if(_(t.path))return{script:await y(e,t.path),filePath:t.path};if(!_(t.script))throw Error(`ShapeScript code is required but was not provided`);return{script:t.script}}var C=async(t,n)=>{let r=`INVALID_ARGUMENT`;try{if(!e.Rn(n))throw Error("presentShapeScript args must be an object with `script` or `path`");if(!_(n.title))throw Error(`A nonempty visualization title is required`);let i=await S(t??{},n);r=`EVALUATION_ERROR`,v(i.script);let a=i.filePath??await x(t??{},i.script,n.title);return{message:a?`Saved ShapeScript to ${a}`:`Created 3D visualization: ${n.title}`,title:n.title,data:a?{script:i.script,filePath:a}:{script:i.script},instructions:g}}catch(t){let n={code:t instanceof e.Ln?`PARSE_ERROR`:t instanceof e.n?`LIMIT_EXCEEDED`:r,message:t instanceof Error?t.message:String(t),...t instanceof e.Ln&&t.line!==void 0?{line:t.line}:{},...t instanceof e.Ln&&t.column!==void 0?{column:t.column}:{}};return{message:`ShapeScript error: ${n.message}`,error:n,jsonData:{error:n},instructions:`The visualization was not created. Correct the ShapeScript using the returned diagnostic and call presentShapeScript again.`}}},w={toolDefinition:r,execute:C,generatingMessage:`Creating 3D visualization...`,waitingMessage:`Tell the user that the 3D visualization was created and will be presented shortly.`,isEnabled:()=>!0},T=C,E=Uint8Array,D=Uint16Array,ee=Int32Array,te=new E([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ne=new E([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),O=new E([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),k=function(e,t){for(var n=new D(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new ee(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},A=k(te,2),j=A.b,M=A.r;j[28]=258,M[258]=28;var N=k(ne,0);N.b;for(var P=N.r,F=new D(32768),I=0;I<32768;++I){var L=(I&43690)>>1|(I&21845)<<1;L=(L&52428)>>2|(L&13107)<<2,L=(L&61680)>>4|(L&3855)<<4,F[I]=((L&65280)>>8|(L&255)<<8)>>1}for(var R=(function(e,t,n){for(var r=e.length,i=0,a=new D(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new D(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new D(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[F[d]>>c]=l}else for(s=new D(r),i=0;i<r;++i)e[i]&&(s[i]=F[o[e[i]-1]++]>>15-e[i]);return s}),z=new E(288),I=0;I<144;++I)z[I]=8;for(var I=144;I<256;++I)z[I]=9;for(var I=256;I<280;++I)z[I]=7;for(var I=280;I<288;++I)z[I]=8;for(var B=new E(32),I=0;I<32;++I)B[I]=5;var V=R(z,9,0),re=R(B,5,0),ie=function(e){return(e+7)/8|0},H=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new E(e.subarray(t,n))},U=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],W=function(e,t,n){var r=Error(t||U[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,W),!n)throw r;return r},G=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},K=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},q=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return{t:ce,l:0};if(i==1){var o=new E(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};for(var f=a[0].s,r=1;r<i;++r)a[r].s>f&&(f=a[r].s);var p=new D(f+1),m=J(n[u-1],p,0);if(m>t){var r=0,h=0,g=m-t,_=1<<g;for(a.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r<i;++r){var v=a[r].s;if(p[v]>t)h+=_-(1<<m-p[v]),p[v]=t;else break}for(h>>=g;h>0;){var y=a[r].s;p[y]<t?h-=1<<t-p[y]++-1:++r}for(;r>=0&&h;--r){var b=a[r].s;p[b]==t&&(--p[b],++h)}m=t}return{t:new E(p),l:m}},J=function(e,t,n){return e.s==-1?Math.max(J(e.l,t,n+1),J(e.r,t,n+1)):t[e.s]=n},ae=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new D(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return{c:n.subarray(0,r),n:t}},Y=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},oe=function(e,t,n){var r=n.length,i=ie(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},X=function(e,t,n,r,i,a,o,s,c,l,u){G(t,u++,n),++i[256];for(var d=q(i,15),f=d.t,p=d.l,m=q(a,15),h=m.t,g=m.l,_=ae(f),v=_.c,y=_.n,b=ae(h),x=b.c,S=b.n,C=new D(19),w=0;w<v.length;++w)++C[v[w]&31];for(var w=0;w<x.length;++w)++C[x[w]&31];for(var T=q(C,7),E=T.t,ee=T.l,k=19;k>4&&!E[O[k-1]];--k);var A=l+5<<3,j=Y(i,z)+Y(a,B)+o,M=Y(i,f)+Y(a,h)+o+14+3*k+Y(C,E)+2*C[16]+3*C[17]+7*C[18];if(c>=0&&A<=j&&A<=M)return oe(t,u,e.subarray(c,c+l));var N,P,F,I;if(G(t,u,1+(M<j)),u+=2,M<j){N=R(f,p,0),P=f,F=R(h,g,0),I=h;var L=R(E,ee,0);G(t,u,y-257),G(t,u+5,S-1),G(t,u+10,k-4),u+=14;for(var w=0;w<k;++w)G(t,u+3*w,E[O[w]]);u+=3*k;for(var ie=[v,x],H=0;H<2;++H)for(var U=ie[H],w=0;w<U.length;++w){var W=U[w]&31;G(t,u,L[W]),u+=E[W],W>15&&(G(t,u,U[w]>>5&127),u+=U[w]>>12)}}else N=V,P=z,F=re,I=B;for(var w=0;w<s;++w){var J=r[w];if(J>255){var W=J>>18&31;K(t,u,N[W+257]),u+=P[W+257],W>7&&(G(t,u,J>>23&31),u+=te[W]);var X=J&31;K(t,u,F[X]),u+=I[X],X>3&&(K(t,u,J>>5&8191),u+=ne[X])}else K(t,u,N[J]),u+=P[J]}return K(t,u,N[256]),u+P[256]},se=new ee([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ce=new E(0),le=function(e,t,n,r,i,a){var o=a.z||e.length,s=new E(r+o+5*(1+Math.ceil(o/7e3))+i),c=s.subarray(r,s.length-i),l=a.l,u=(a.r||0)&7;if(t){u&&(c[0]=a.r>>3);for(var d=se[t-1],f=d>>13,p=d&8191,m=(1<<n)-1,h=a.p||new D(32768),g=a.h||new D(m+1),_=Math.ceil(n/3),v=2*_,y=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<v)&m},b=new ee(25e3),x=new D(288),S=new D(32),C=0,w=0,T=a.i||0,O=0,k=a.w||0,A=0;T+2<o;++T){var j=y(T),N=T&32767,F=g[j];if(h[N]=F,g[j]=N,k<=T){var I=o-T;if((C>7e3||O>24576)&&(I>423||!l)){u=X(e,c,0,b,x,S,w,O,A,T-A,u),O=C=w=0,A=T;for(var L=0;L<286;++L)x[L]=0;for(var L=0;L<30;++L)S[L]=0}var R=2,z=0,B=p,V=N-F&32767;if(I>2&&j==y(T-V))for(var re=Math.min(f,I)-1,U=Math.min(32767,T),W=Math.min(258,I);V<=U&&--B&&N!=F;){if(e[T+R]==e[T+R-V]){for(var G=0;G<W&&e[T+G]==e[T+G-V];++G);if(G>R){if(R=G,z=V,G>re)break;for(var K=Math.min(V,G-2),q=0,L=0;L<K;++L){var J=T-V+L&32767,ae=J-h[J]&32767;ae>q&&(q=ae,F=J)}}}N=F,F=h[N],V+=N-F&32767}if(z){b[O++]=268435456|M[R]<<18|P[z];var Y=M[R]&31,ce=P[z]&31;w+=te[Y]+ne[ce],++x[257+Y],++S[ce],k=T+R,++C}else b[O++]=e[T],++x[e[T]]}}for(T=Math.max(T,k);T<o;++T)b[O++]=e[T],++x[e[T]];u=X(e,c,l,b,x,S,w,O,A,T-A,u),l||(a.r=u&7|c[u/8|0]<<3,u-=7,a.h=g,a.p=h,a.i=T,a.w=k)}else{for(var T=a.w||0;T<o+l;T+=65535){var le=T+65535;le>=o&&(c[u/8|0]=l,le=o),u=oe(c,u+1,e.subarray(T,le))}a.i=o}return H(s,0,r+ie(u)+i)},ue=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),de=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=ue[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},fe=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new E(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return le(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)},pe=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},Z=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function me(e,t){return fe(e,t||{},0,0)}var he=function(e,t,n,r){for(var i in e){var a=e[i],o=t+i,s=r;Array.isArray(a)&&(s=pe(r,a[1]),a=a[0]),a instanceof E?n[o]=[a,s]:(n[o+=`/`]=[new E(0),s],he(a,o,n,r))}},ge=typeof TextEncoder<`u`&&new TextEncoder,_e=typeof TextDecoder<`u`&&new TextDecoder;try{_e.decode(ce,{stream:!0})}catch{}function ve(e,t){if(t){for(var n=new E(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}if(ge)return ge.encode(e);for(var i=e.length,a=new E(e.length+(e.length>>1)),o=0,s=function(e){a[o++]=e},r=0;r<i;++r){if(o+5>a.length){var c=new E(o+8+(i-r<<1));c.set(a),a=c}var l=e.charCodeAt(r);l<128||t?s(l):l<2048?(s(192|l>>6),s(128|l&63)):l>55295&&l<57344?(l=65536+(l&1047552)|e.charCodeAt(++r)&1023,s(240|l>>18),s(128|l>>12&63),s(128|l>>6&63),s(128|l&63)):(s(224|l>>12),s(128|l>>6&63),s(128|l&63))}return H(a,0,o)}var ye=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&W(9),t+=r+4}return t},be=function(e,t,n,r,i,a,o,s){var c=r.length,l=n.extra,u=s&&s.length,d=ye(l);Z(e,t,o==null?67324752:33639248),t+=4,o!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(a<0&&8),e[t++]=i&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var f=new Date(n.mtime==null?Date.now():n.mtime),p=f.getFullYear()-1980;if((p<0||p>119)&&W(10),Z(e,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,a!=-1&&(Z(e,t,n.crc),Z(e,t+4,a<0?-a-2:a),Z(e,t+8,n.size)),Z(e,t+12,c),Z(e,t+14,d),t+=16,o!=null&&(Z(e,t,u),Z(e,t+6,n.attrs),Z(e,t+10,o),t+=14),e.set(r,t),t+=c,d)for(var m in l){var h=l[m],g=h.length;Z(e,t,+m),Z(e,t+2,g),e.set(h,t+4),t+=4+g}return u&&(e.set(s,t),t+=u),t},xe=function(e,t,n,r,i){Z(e,t,101010256),Z(e,t+8,n),Z(e,t+10,n),Z(e,t+12,r),Z(e,t+16,i)};function Se(e,t){t||={};var n={},r=[];he(e,``,n,t);var i=0,a=0;for(var o in n){var s=n[o],c=s[0],l=s[1],u=l.level==0?0:8,d=ve(o),f=d.length,p=l.comment,m=p&&ve(p),h=m&&m.length,g=ye(l.extra);f>65535&&W(11);var _=u?me(c,l):c,v=_.length,y=de();y.p(c),r.push(pe(l,{size:c.length,crc:y.d(),c:_,f:d,m,u:f!=o.length||m&&p.length!=h,o:i,compression:u})),i+=30+f+g+v,a+=76+2*(f+g)+(h||0)+v}for(var b=new E(a+22),x=i,S=a-i,C=0;C<r.length;++C){var d=r[C];be(b,d.o,d,d.f,d.u,d.c.length);var w=30+d.f.length+ye(d.extra);b.set(d.c,d.o+w),be(b,i,d,d.f,d.u,d.c.length,d.o,d.m),i+=16+w+(d.m?d.m.length:0)}return xe(b,i,r.length,S,x),b}var Q=class{constructor(e,t=``,n=[],r=[]){this.name=e,this.type=t,this.metadata=n,this.properties=r,this.children=[]}addMetadata(e,t){this.metadata.push({key:e,value:t})}addProperty(e,t=[]){this.properties.push({property:e,metadata:t})}addChild(e){this.children.push(e)}toString(e=0){let t=` `.repeat(e),n=this.metadata.map(e=>{let n=e.key,r=e.value;if(Array.isArray(r)){let e=[];return e.push(`${n} = {`),r.forEach(n=>{e.push(`${t}\t\t${n}`)}),e.push(`${t}\t}`),e.join(`
|
|
216
|
+
`)}return`${n} = ${r}`}),r=n.length?` (\n${n.map(e=>`${t}\t${e}`).join(`
|
|
217
|
+
`)}\n${t})`:``,i=this.properties.map(e=>{let n=e.property.replace(/\n/g,`
|
|
218
|
+
`+t+` `),r=e.metadata.length?` (\n${e.metadata.map(e=>`${t}\t\t${e}`).join(`
|
|
219
|
+
`)}\n${t}\t)`:``;return`${t}\t${n}${r}`}),a=this.children.map(t=>t.toString(e+1)),o=[];if(i.length>0&&o.push(...i),a.length>0){i.length>0&&o.push(``);for(let e=0;e<a.length;e++)o.push(a[e]),e<a.length-1&&o.push(``)}let s=o.join(`
|
|
220
|
+
`);return`${t}def ${this.type?this.type+` `:``}"${this.name}"${r}\n${t}{\n${s}\n${t}}`}},Ce=class{constructor(){this.textureUtils=null}setTextureUtils(e){this.textureUtils=e}parse(e,t,n,r){this.parseAsync(e,r).then(t).catch(n)}async parseAsync(e,t={}){t=Object.assign({ar:{anchoring:{type:`plane`},planeAnchoring:{alignment:`horizontal`}},includeAnchoringProperties:!0,onlyVisible:!0,quickLookCompatible:!1,maxTextureSize:1024,animations:[],animationFrameRate:60},t);let n=new Set,r={},i=`model.usda`;r[i]=null;let a=Oe(e,t.animations);t.animationTracks=a;let o=new Q(`Root`,`Xform`),s=new Q(`Scenes`,`Scope`);s.addMetadata(`kind`,`"sceneLibrary"`),o.addChild(s);let c=`Scene`,l=new Q(c,`Xform`);l.addMetadata(`customData`,[`bool preliminary_collidesWithEnvironment = 0`,`string sceneName = "${c}"`]),l.addMetadata(`sceneName`,`"${c}"`),t.includeAnchoringProperties&&(l.addProperty(`token preliminary:anchoring:type = "${t.ar.anchoring.type}"`),l.addProperty(`token preliminary:planeAnchoring:alignment = "${t.ar.planeAnchoring.alignment}"`)),s.addChild(l);let u,d={},f={};e.isScene?Me(e,l,d,n,r,t):Ne(e,l,d,n,r,t);let p=Ge(d,f,t.quickLookCompatible);u=De(a.size>0?{fps:t.animationFrameRate,endTimeCode:ke(t.animations)*t.animationFrameRate}:null)+`
|
|
221
|
+
`+o.toString()+`
|
|
222
|
+
|
|
223
|
+
`+p.toString(),r[i]=ve(u),u=null;for(let e in f){let n=f[e];if(n.isCompressedTexture===!0){if(this.textureUtils===null)throw Error(`THREE.USDZExporter: setTextureUtils() must be called to process compressed textures.`);n=await this.textureUtils.decompress(n)}let i=Ee(n.image,n.flipY,t.maxTextureSize),a=n.userData.mimeType===`image/jpeg`?`image/jpeg`:`image/png`,o=await new Promise(e=>i.toBlob(e,a));r[`textures/Texture_${e}.${Te(n)}`]=new Uint8Array(await o.arrayBuffer())}let m=0;for(let e in r){let t=r[e],n=34+e.length;m+=n;let i=m&63;if(i!==4){let n=64-i;r[e]=[t,{extra:{12345:new Uint8Array(n)}}]}m=t.length}return Se(r,{level:0})}};function we(e,t){let n=e.name;return n=n.replace(/[^A-Za-z0-9_]/g,``),/^[0-9]/.test(n)&&(n=`_`+n),n===``&&(n=e.isCamera?`Camera`:`Object`),t.has(n)&&(n=n+`_`+e.id),t.add(n),n}function Te(e){return e.userData.mimeType===`image/jpeg`?`jpg`:`png`}function Ee(e,t,n){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<`u`&&e instanceof OffscreenCanvas||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){let r=n/Math.max(e.width,e.height),i=document.createElement(`canvas`);i.width=e.width*Math.min(1,r),i.height=e.height*Math.min(1,r);let a=i.getContext(`2d`);return t===!0&&(a.translate(0,i.height),a.scale(1,-1)),a.drawImage(e,0,0,i.width,i.height),i}throw Error(`THREE.USDZExporter: No valid image data found. Unable to process texture.`)}var $=7;function De(e=null){return`#usda 1.0
|
|
224
|
+
(
|
|
225
|
+
customLayerData = {
|
|
226
|
+
string creator = "Three.js USDZExporter"
|
|
227
|
+
}
|
|
228
|
+
defaultPrim = "Root"
|
|
229
|
+
metersPerUnit = 1
|
|
230
|
+
upAxis = "Y"${e?`
|
|
231
|
+
startTimeCode = 0
|
|
232
|
+
endTimeCode = ${e.endTimeCode}
|
|
233
|
+
timeCodesPerSecond = ${e.fps}
|
|
234
|
+
framesPerSecond = ${e.fps}`:``}
|
|
235
|
+
)
|
|
236
|
+
`}function Oe(t,n){let r=new Map;for(let i=0;i<n.length;i++){let a=n[i];for(let n=0;n<a.tracks.length;n++){let i=a.tracks[n],o=e.it.parseTrackName(i.name),s=e.it.findNode(t,o.nodeName);if(s==null)continue;let c=o.propertyName;if(c!==`position`&&c!==`quaternion`&&c!==`scale`)continue;let l=r.get(s);l===void 0&&(l={},r.set(s,l)),l[c]=i}}return r}function ke(e){let t=0;for(let n=0;n<e.length;n++)e[n].duration>t&&(t=e[n].duration);return t}function Ae(e,t,n,r){let i=n.times,a=n.values,o=[];for(let e=0;e<i.length;e++){let t=e*3;o.push(`${(i[e]*r).toPrecision($)}: (${a[t].toPrecision($)}, ${a[t+1].toPrecision($)}, ${a[t+2].toPrecision($)})`)}return`${t} ${e}.timeSamples = {\n\t${o.join(`,
|
|
237
|
+
`)},\n}`}function je(e,t){let n=e.times,r=e.values,i=[];for(let e=0;e<n.length;e++){let a=e*4;i.push(`${(n[e]*t).toPrecision($)}: (${r[a+3].toPrecision($)}, ${r[a].toPrecision($)}, ${r[a+1].toPrecision($)}, ${r[a+2].toPrecision($)})`)}return`quatf xformOp:orient.timeSamples = {\n\t${i.join(`,
|
|
238
|
+
`)},\n}`}function Me(e,t,n,r,i,a){for(let o=0,s=e.children.length;o<s;o++)Ne(e.children[o],t,n,r,i,a)}function Ne(e,t,n,r,i,a){if(e.visible===!1&&a.onlyVisible===!0)return;let o;if(e.isMesh){let t=e.geometry,s=Array.isArray(e.material),c=s?e.material:[e.material];for(let e=0;e<c.length;e++){let t=c[e];t.isMeshStandardMaterial||console.warn(`THREE.USDZExporter: Use MeshStandardMaterial for best results.`),t.uuid in n||(n[t.uuid]=t)}let l=c.map(e=>n[e.uuid]);if(s===!1){let e=`geometries/Geometry_${t.id}.usda`;if(!(e in i)){let n=ze(t);i[e]=ve(De()+`
|
|
239
|
+
`+n.toString())}}o=Ie(e,t,l,r,a)}else o=e.isCamera?Xe(e,r,a):Fe(e,r,a);t.addChild(o),Me(e,o,n,r,i,a)}function Pe(e,t,n){let r=n.animationTracks.get(t),i=t.pivot!==null;if(!i&&r===void 0){let n=Le(t.matrix);e.addProperty(`matrix4d xformOp:transform = ${n}`),e.addProperty(`uniform token[] xformOpOrder = ["xformOp:transform"]`);return}let a=n.animationFrameRate,o=t.position,s=t.quaternion,c=t.scale;if(r!==void 0&&r.position!==void 0?e.addProperty(Ae(`xformOp:translate`,`float3`,r.position,a)):e.addProperty(`float3 xformOp:translate = (${o.x.toPrecision($)}, ${o.y.toPrecision($)}, ${o.z.toPrecision($)})`),i){let n=t.pivot;e.addProperty(`float3 xformOp:translate:pivot = (${n.x.toPrecision($)}, ${n.y.toPrecision($)}, ${n.z.toPrecision($)})`)}r!==void 0&&r.quaternion!==void 0?e.addProperty(je(r.quaternion,a)):e.addProperty(`quatf xformOp:orient = (${s.w.toPrecision($)}, ${s.x.toPrecision($)}, ${s.y.toPrecision($)}, ${s.z.toPrecision($)})`),r!==void 0&&r.scale!==void 0?e.addProperty(Ae(`xformOp:scale`,`float3`,r.scale,a)):e.addProperty(`float3 xformOp:scale = (${c.x.toPrecision($)}, ${c.y.toPrecision($)}, ${c.z.toPrecision($)})`),i?e.addProperty(`uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:translate:pivot", "xformOp:orient", "xformOp:scale", "!invert!xformOp:translate:pivot"]`):e.addProperty(`uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:orient", "xformOp:scale"]`)}function Fe(e,t,n){let r=we(e,t);e.matrix.determinant()<0&&console.warn(`THREE.USDZExporter: USDZ does not support negative scales`,e);let i=new Q(r,`Xform`);return Pe(i,e,n),i}function Ie(e,t,n,r,i){let a=Fe(e,r,i);return n.length===1?(a.addMetadata(`prepend references`,`@./geometries/Geometry_${t.id}.usda@</Geometry>`),a.addMetadata(`prepend apiSchemas`,`["MaterialBindingAPI"]`),a.addProperty(`rel material:binding = </Materials/Material_${n[0].id}>`)):a.addChild(Be(t,n)),a}function Le(e){let t=e.elements;return`( ${Re(t,0)}, ${Re(t,4)}, ${Re(t,8)}, ${Re(t,12)} )`}function Re(e,t){return`(${e[t+0]}, ${e[t+1]}, ${e[t+2]}, ${e[t+3]})`}function ze(e){let t=new Q(`Geometry`),n=Be(e);return t.addChild(n),t}function Be(e,t=null){let n=e.attributes,r=n.position.count,i=new Q(`Geometry`,`Mesh`);i.addProperty(`int[] faceVertexCounts = [${Ve(e)}]`),i.addProperty(`int[] faceVertexIndices = [${He(e)}]`),i.addProperty(`normal3f[] normals = [${Ue(n.normal,r)}]`,[`interpolation = "vertex"`]),i.addProperty(`point3f[] points = [${Ue(n.position,r)}]`);for(let e=0;e<4;e++){let t=e>0?e:``,r=n[`uv`+t];r!==void 0&&i.addProperty(`texCoord2f[] primvars:st${t} = [${We(r)}]`,[`interpolation = "vertex"`])}let a=n.color;if(a!==void 0&&i.addProperty(`color3f[] primvars:displayColor = [${Ue(a,r)}]`,[`interpolation = "vertex"`]),i.addProperty(`uniform token subdivisionScheme = "none"`),t!==null){let r=e.groups,a=(e.index===null?n.position.count:e.index.count)/3;for(let e=0;e<r.length;e++){let n=r[e],o=t[n.materialIndex];if(o===void 0)continue;let s=Math.floor(n.start/3),c=Math.min(s+Math.floor(n.count/3),a),l=[];for(let e=s;e<c;e++)l.push(e);let u=new Q(`subset_${e}`,`GeomSubset`);u.addMetadata(`prepend apiSchemas`,`["MaterialBindingAPI"]`),u.addProperty(`uniform token elementType = "face"`),u.addProperty(`uniform token familyName = "materialBind"`),u.addProperty(`int[] indices = [${l.join(`, `)}]`),u.addProperty(`rel material:binding = </Materials/Material_${o.id}>`),i.addChild(u)}}return i}function Ve(e){let t=e.index===null?e.attributes.position.count:e.index.count;return Array(t/3).fill(3).join(`, `)}function He(e){let t=e.index,n=[];if(t!==null)for(let e=0;e<t.count;e++)n.push(t.getX(e));else{let t=e.attributes.position.count;for(let e=0;e<t;e++)n.push(e)}return n.join(`, `)}function Ue(e,t){if(e===void 0)return console.warn(`USDZExporter: Normals missing.`),Array(t).fill(`(0, 0, 0)`).join(`, `);let n=[];for(let t=0;t<e.count;t++){let r=e.getX(t),i=e.getY(t),a=e.getZ(t);n.push(`(${r.toPrecision($)}, ${i.toPrecision($)}, ${a.toPrecision($)})`)}return n.join(`, `)}function We(e){let t=[];for(let n=0;n<e.count;n++){let r=e.getX(n),i=e.getY(n);t.push(`(${r.toPrecision($)}, ${1-i.toPrecision($)})`)}return t.join(`, `)}function Ge(e,t,n=!1){let r=new Q(`Materials`);for(let i in e){let a=e[i];r.addChild(Ke(a,t,n))}return r}function Ke(t,n,r=!1){let i=new Q(`Material_${t.id}`,`Material`);function a(e,i,a){let o=e.source.id+`_`+e.flipY;n[o]=e;let s=e.channel>0?`st`+e.channel:`st`,c={1e3:`repeat`,1001:`clamp`,1002:`mirror`},l=e.repeat.clone(),u=e.offset.clone(),d=e.rotation,f=Math.sin(d),p=Math.cos(d);u.y=1-u.y-l.y,r?(u.x/=l.x,u.y/=l.y,u.x+=f/l.x,u.y+=p-1):(u.x+=f*l.x,u.y+=(1-p)*l.y);let m=new Q(`PrimvarReader_${i}`,`Shader`);m.addProperty(`uniform token info:id = "UsdPrimvarReader_float2"`),m.addProperty(`float2 inputs:fallback = (0.0, 0.0)`),m.addProperty(`string inputs:varname = "${s}"`),m.addProperty(`float2 outputs:result`);let h=new Q(`Transform2d_${i}`,`Shader`);h.addProperty(`uniform token info:id = "UsdTransform2d"`),h.addProperty(`float2 inputs:in.connect = </Materials/Material_${t.id}/PrimvarReader_${i}.outputs:result>`),h.addProperty(`float inputs:rotation = ${(180/Math.PI*d).toFixed($)}`),h.addProperty(`float2 inputs:scale = ${Ye(l)}`),h.addProperty(`float2 inputs:translation = ${Ye(u)}`),h.addProperty(`float2 outputs:result`);let g=new Q(`Texture_${e.id}_${i}`,`Shader`);if(g.addProperty(`uniform token info:id = "UsdUVTexture"`),g.addProperty(`asset inputs:file = @textures/Texture_${o}.${Te(e)}@`),g.addProperty(`float2 inputs:st.connect = </Materials/Material_${t.id}/Transform2d_${i}.outputs:result>`),a!==void 0){let e=i===`diffuse`?t.opacity:1;g.addProperty(`float4 inputs:scale = ${Je(a,e)}`)}if(i===`normal`){let e=t.normalScale.x;g.addProperty(`float4 inputs:scale = (${2*e}, ${2*e}, 2, 1)`),g.addProperty(`float4 inputs:bias = (${-e}, ${-e}, -1, 0)`)}return g.addProperty(`token inputs:sourceColorSpace = "${e.colorSpace===``?`raw`:`sRGB`}"`),g.addProperty(`token inputs:wrapS = "${c[e.wrapS]}"`),g.addProperty(`token inputs:wrapT = "${c[e.wrapT]}"`),g.addProperty(`float outputs:r`),g.addProperty(`float outputs:g`),g.addProperty(`float outputs:b`),g.addProperty(`float3 outputs:rgb`),(t.transparent||t.alphaTest>0)&&g.addProperty(`float outputs:a`),[m,h,g]}t.side===2&&console.warn(`THREE.USDZExporter: USDZ does not support double sided materials`,t);let o=new Q(`PreviewSurface`,`Shader`);if(o.addProperty(`uniform token info:id = "UsdPreviewSurface"`),t.map===null?o.addProperty(`color3f inputs:diffuseColor = ${qe(t.color)}`):(o.addProperty(`color3f inputs:diffuseColor.connect = </Materials/Material_${t.id}/Texture_${t.map.id}_diffuse.outputs:rgb>`),t.transparent?o.addProperty(`float inputs:opacity.connect = </Materials/Material_${t.id}/Texture_${t.map.id}_diffuse.outputs:a>`):t.alphaTest>0&&(o.addProperty(`float inputs:opacity.connect = </Materials/Material_${t.id}/Texture_${t.map.id}_diffuse.outputs:a>`),o.addProperty(`float inputs:opacityThreshold = ${t.alphaTest}`)),a(t.map,`diffuse`,t.color).forEach(e=>i.addChild(e))),t.emissive){let n=t.emissiveIntensity??1;if(t.emissiveMap){o.addProperty(`color3f inputs:emissiveColor.connect = </Materials/Material_${t.id}/Texture_${t.emissiveMap.id}_emissive.outputs:rgb>`);let r=new e.m(t.emissive.r*n,t.emissive.g*n,t.emissive.b*n);a(t.emissiveMap,`emissive`,r).forEach(e=>i.addChild(e))}else t.emissive.getHex()>0&&o.addProperty(`color3f inputs:emissiveColor = ${qe(t.emissive)}`)}if(t.normalMap&&(o.addProperty(`normal3f inputs:normal.connect = </Materials/Material_${t.id}/Texture_${t.normalMap.id}_normal.outputs:rgb>`),a(t.normalMap,`normal`).forEach(e=>i.addChild(e))),t.aoMap){o.addProperty(`float inputs:occlusion.connect = </Materials/Material_${t.id}/Texture_${t.aoMap.id}_occlusion.outputs:r>`);let n=t.aoMapIntensity??1,r=new e.m(n,n,n);a(t.aoMap,`occlusion`,r).forEach(e=>i.addChild(e))}if(t.roughnessMap){o.addProperty(`float inputs:roughness.connect = </Materials/Material_${t.id}/Texture_${t.roughnessMap.id}_roughness.outputs:g>`);let n=new e.m(t.roughness,t.roughness,t.roughness);a(t.roughnessMap,`roughness`,n).forEach(e=>i.addChild(e))}else o.addProperty(`float inputs:roughness = ${t.roughness??1}`);if(t.metalnessMap){o.addProperty(`float inputs:metallic.connect = </Materials/Material_${t.id}/Texture_${t.metalnessMap.id}_metallic.outputs:b>`);let n=new e.m(t.metalness,t.metalness,t.metalness);a(t.metalnessMap,`metallic`,n).forEach(e=>i.addChild(e))}else o.addProperty(`float inputs:metallic = ${t.metalness??0}`);if(t.alphaMap?(o.addProperty(`float inputs:opacity.connect = </Materials/Material_${t.id}/Texture_${t.alphaMap.id}_opacity.outputs:r>`),o.addProperty(`float inputs:opacityThreshold = 0.0001`),a(t.alphaMap,`opacity`).forEach(e=>i.addChild(e))):o.addProperty(`float inputs:opacity = ${t.opacity}`),t.isMeshPhysicalMaterial){if(t.clearcoatMap!==null){o.addProperty(`float inputs:clearcoat.connect = </Materials/Material_${t.id}/Texture_${t.clearcoatMap.id}_clearcoat.outputs:r>`);let n=new e.m(t.clearcoat,t.clearcoat,t.clearcoat);a(t.clearcoatMap,`clearcoat`,n).forEach(e=>i.addChild(e))}else o.addProperty(`float inputs:clearcoat = ${t.clearcoat}`);if(t.clearcoatRoughnessMap!==null){o.addProperty(`float inputs:clearcoatRoughness.connect = </Materials/Material_${t.id}/Texture_${t.clearcoatRoughnessMap.id}_clearcoatRoughness.outputs:g>`);let n=new e.m(t.clearcoatRoughness,t.clearcoatRoughness,t.clearcoatRoughness);a(t.clearcoatRoughnessMap,`clearcoatRoughness`,n).forEach(e=>i.addChild(e))}else o.addProperty(`float inputs:clearcoatRoughness = ${t.clearcoatRoughness}`);o.addProperty(`float inputs:ior = ${t.ior}`)}return o.addProperty(`int inputs:useSpecularWorkflow = 0`),o.addProperty(`token outputs:surface`),i.addChild(o),i.addProperty(`token outputs:surface.connect = </Materials/Material_${t.id}/PreviewSurface.outputs:surface>`),i}function qe(e){return`(${e.r}, ${e.g}, ${e.b})`}function Je(e,t=1){return`(${e.r}, ${e.g}, ${e.b}, ${t})`}function Ye(e){return`(${e.x}, ${e.y})`}function Xe(e,t,n){let r=we(e,t);e.matrix.determinant()<0&&console.warn(`THREE.USDZExporter: USDZ does not support negative scales`,e);let i=new Q(r,`Camera`);Pe(i,e,n);let a=e.isOrthographicCamera?`orthographic`:`perspective`;i.addProperty(`token projection = "${a}"`);let o=`(${e.near.toPrecision($)}, ${e.far.toPrecision($)})`;i.addProperty(`float2 clippingRange = ${o}`);let s;s=e.isOrthographicCamera?((Math.abs(e.left)+Math.abs(e.right))*10).toPrecision($):e.getFilmWidth().toPrecision($),i.addProperty(`float horizontalAperture = ${s}`);let c;if(c=e.isOrthographicCamera?((Math.abs(e.top)+Math.abs(e.bottom))*10).toPrecision($):e.getFilmHeight().toPrecision($),i.addProperty(`float verticalAperture = ${c}`),e.isPerspectiveCamera){let t=e.getFocalLength().toPrecision($);i.addProperty(`float focalLength = ${t}`);let n=e.focus.toPrecision($);i.addProperty(`float focusDistance = ${n}`)}return i}var Ze=`model/vnd.usdz+zip`,Qe=`.usdz`;async function $e(e){let t=await new Ce().parseAsync(e,{quickLookCompatible:!0});return new Uint8Array(t)}async function et(t,n={}){let r=e.r(e.In(t),{...n,wireframe:!1});try{return await $e(r)}finally{e.i(r)}}var tt=[{name:`Basic Shapes`,args:{title:`Basic 3D Shapes`,script:`// Basic shapes demonstration
|
|
240
|
+
cube { position -2 0 0 size 1 color (1 0.3 0.3) }
|
|
241
|
+
sphere { position 0 0 0 size 1 color (0.3 1 0.3) }
|
|
242
|
+
cylinder { position 2 0 0 size 0.5 1 color (0.3 0.3 1) }`}},{name:`Circular Pattern`,args:{title:`Circular Pattern`,script:`// 12個の立方体を円形に配置
|
|
243
|
+
|
|
244
|
+
define count 12
|
|
245
|
+
define radius 3
|
|
246
|
+
|
|
247
|
+
for i in 1 to count {
|
|
248
|
+
// 各立方体の角度を計算(2 * PI = 6.283ラジアン)
|
|
249
|
+
define angle ((i / count) * 6.283)
|
|
250
|
+
|
|
251
|
+
// 円形配置のためのX座標とZ座標を計算
|
|
252
|
+
define x (cos(angle) * radius)
|
|
253
|
+
define z (sin(angle) * radius)
|
|
254
|
+
|
|
255
|
+
// グラデーションカラーを作成
|
|
256
|
+
define colorValue (i / count)
|
|
257
|
+
|
|
258
|
+
cube {
|
|
259
|
+
position x 0 z
|
|
260
|
+
size 0.5
|
|
261
|
+
color colorValue 0.5 (1 - colorValue)
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// 中心に参考用の球体を配置
|
|
266
|
+
sphere {
|
|
267
|
+
position 0 0 0
|
|
268
|
+
size 0.3
|
|
269
|
+
color 1 1 0
|
|
270
|
+
opacity 0.5
|
|
271
|
+
}`}},{name:`CSG Difference`,args:{title:`Hollow Sphere`,script:`// Create a hollow sphere using CSG difference
|
|
272
|
+
difference {
|
|
273
|
+
sphere { size 2 color (1 0.5 0) }
|
|
274
|
+
sphere { size 1.7 color (1 1 1) }
|
|
275
|
+
cube { position 0 0 2 size 2 }
|
|
276
|
+
}`}}];Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return et}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return n}});
|
|
@@ -1,10 +1,28 @@
|
|
|
1
1
|
import { Expression, Vector3, Color } from "./types";
|
|
2
2
|
export type Value = number | boolean | string | Value[];
|
|
3
|
+
/** Upstream's `rnd` generator, bit for bit: a 32-bit LCG kept in a double,
|
|
4
|
+
* `x = (x * 1664525 + 1013904223) mod 2^32`, returning `x / 2^32`. Matching
|
|
5
|
+
* it means `seed 57` scatters shapes exactly as it does in the upstream app.
|
|
6
|
+
* A class, not a closure, because scopes SHARE it: a nested block advances
|
|
7
|
+
* its parent's sequence, but `seed` inside the block replaces only the
|
|
8
|
+
* block's own reference (see `SymbolTable.reseed`). */
|
|
9
|
+
export declare class RandomSequence {
|
|
10
|
+
private static readonly MODULUS;
|
|
11
|
+
private state;
|
|
12
|
+
constructor(seed: number);
|
|
13
|
+
private static wrap;
|
|
14
|
+
next(): number;
|
|
15
|
+
}
|
|
3
16
|
export declare class SymbolTable {
|
|
4
17
|
private scopes;
|
|
5
|
-
constructor();
|
|
18
|
+
constructor(seed?: number);
|
|
19
|
+
private innermost;
|
|
6
20
|
pushScope(): void;
|
|
7
21
|
popScope(): void;
|
|
22
|
+
/** `seed N`: a fresh sequence for THIS scope only. The parent keeps the
|
|
23
|
+
* sequence it had, so `rnd` after the closing brace carries on from there. */
|
|
24
|
+
reseed(seed: number): void;
|
|
25
|
+
nextRandom(): number;
|
|
8
26
|
set(name: string, value: Value): void;
|
|
9
27
|
get(name: string): Value | undefined;
|
|
10
28
|
has(name: string): boolean;
|
|
@@ -17,12 +35,17 @@ export declare class SymbolTable {
|
|
|
17
35
|
* can take different branches, so `if rnd < .5 { cube } else { … }` could
|
|
18
36
|
* validate clean and then fail in the viewport, which is exactly the failure
|
|
19
37
|
* the validation exists to prevent. A seeded generator makes both runs agree,
|
|
20
|
-
* and re-rendering a model on every keystroke stops reshuffling it.
|
|
21
|
-
|
|
38
|
+
* and re-rendering a model on every keystroke stops reshuffling it.
|
|
39
|
+
*
|
|
40
|
+
* Zero, like upstream, so a script's `rnd` values here are the ones the
|
|
41
|
+
* upstream app shows for it. */
|
|
42
|
+
export declare const DEFAULT_RANDOM_SEED = 0;
|
|
22
43
|
export declare class Evaluator {
|
|
23
44
|
private symbols;
|
|
24
|
-
private readonly random;
|
|
25
45
|
constructor(symbols?: SymbolTable, seed?: number);
|
|
46
|
+
private random;
|
|
47
|
+
/** The `seed` command. Scoped: see `SymbolTable.reseed`. */
|
|
48
|
+
reseed(seed: number): void;
|
|
26
49
|
getSymbols(): SymbolTable;
|
|
27
50
|
evaluate(expr: Expression | number | string | Vector3 | Color): Value;
|
|
28
51
|
evaluateToNumber(expr: Expression | number): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../src/shapescript/evaluator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErD,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,EAAE,CAAC;AAExD,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../src/shapescript/evaluator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErD,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,EAAE,CAAC;AAExD;;;;;wDAKwD;AACxD,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAC,QAAQ,CA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 +42,7 @@ export declare class Parser {
|
|
|
42
42
|
private parseSwitch;
|
|
43
43
|
private parseDefine;
|
|
44
44
|
private parseDetail;
|
|
45
|
+
private parseSeed;
|
|
45
46
|
private parseBackground;
|
|
46
47
|
private parseTexture;
|
|
47
48
|
private parseGroup;
|
|
@@ -61,6 +62,23 @@ export declare class Parser {
|
|
|
61
62
|
private isStartOfNewValue;
|
|
62
63
|
private parsePathValue;
|
|
63
64
|
private parsePath;
|
|
65
|
+
/** `{ … }` of a path or of a `for` inside one. Both accept the same
|
|
66
|
+
* commands, so one reader serves both instead of two drifting copies.
|
|
67
|
+
* Only the path itself (not a loop inside it) may carry the transform
|
|
68
|
+
* options, which land in `properties`. */
|
|
69
|
+
private parsePathBody;
|
|
70
|
+
/** `position` / `orientation` (alias `rotation`) / `size` inside a path
|
|
71
|
+
* block, as upstream allows on any shape. Returns false for anything else. */
|
|
72
|
+
private parsePathProperty;
|
|
73
|
+
private parsePathCommand;
|
|
74
|
+
/** `point x [y]` / `curve x [y]` — absolute coordinates in the path's local
|
|
75
|
+
* frame, as upstream. Y defaults to 0. */
|
|
76
|
+
private parsePathPoint;
|
|
77
|
+
/** `translate x [y]` / `scale x [y]` inside a path. A lone `translate x`
|
|
78
|
+
* moves along X only; a lone `scale s` is uniform, recorded by leaving `y`
|
|
79
|
+
* out rather than by copying the expression (which would evaluate it twice). */
|
|
80
|
+
private parsePathVector;
|
|
81
|
+
private parsePathFor;
|
|
64
82
|
private parseNode;
|
|
65
83
|
private refuseStalledToken;
|
|
66
84
|
parse(): SceneNode[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/shapescript/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAEL,SAAS,
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/shapescript/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAEL,SAAS,EA4BV,MA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zB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,SAAS;IAOjB;;;+CAG2C;IAC3C,OAAO,CAAC,aAAa;IAgBrB;mFAC+E;IAC/E,OAAO,CAAC,iBAAiB;IAgBzB,OAAO,CAAC,gBAAgB;IA0BxB;+CAC2C;IAC3C,OAAO,CAAC,cAAc;IAOtB;;qFAEiF;IACjF,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,YAAY;IAoBpB,OAAO,CAAC,SAAS;IAqKjB,OAAO,CAAC,kBAAkB;IAM1B,KAAK,IAAI,SAAS,EAAE;CAerB;AAGD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,CAmB5D"}
|
|
@@ -14,8 +14,9 @@ export interface ConversionOptions {
|
|
|
14
14
|
/** Hard ceiling on the wall-clock time one conversion may spend. See
|
|
15
15
|
* `DEFAULT_MAX_DURATION_MS`. */
|
|
16
16
|
maxDurationMs?: number;
|
|
17
|
-
/**
|
|
18
|
-
*
|
|
17
|
+
/** Starting seed for `rnd` / `rand()`, which a `seed` command in the script
|
|
18
|
+
* overrides. Defaults to `DEFAULT_RANDOM_SEED`, which is what keeps server
|
|
19
|
+
* validation and browser rendering on the same branch. */
|
|
19
20
|
randomSeed?: number;
|
|
20
21
|
}
|
|
21
22
|
export declare const DEFAULT_MAX_NODES = 100000;
|
|
@@ -105,6 +106,11 @@ export declare class Converter {
|
|
|
105
106
|
* definition and fall back to a unit size of their own. */
|
|
106
107
|
private requireExtent;
|
|
107
108
|
private createGeometry;
|
|
109
|
+
/** A plugin extension (upstream has no torus). `size` is the OVERALL
|
|
110
|
+
* diameter, tube included, so it follows the same rule as the other curved
|
|
111
|
+
* primitives: the ring radius is what is left once the tube is subtracted.
|
|
112
|
+
* `outerRadius` (ring) and `innerRadius` (tube) override the derivation. */
|
|
113
|
+
private createTorus;
|
|
108
114
|
private materialColor;
|
|
109
115
|
private createMaterial;
|
|
110
116
|
private convertCSG;
|
|
@@ -118,6 +124,15 @@ export declare class Converter {
|
|
|
118
124
|
private currentTransform;
|
|
119
125
|
private applyCurrentTransform;
|
|
120
126
|
private applyExplicitTransforms;
|
|
127
|
+
/** An upstream rotation value as a quaternion.
|
|
128
|
+
*
|
|
129
|
+
* `roll yaw pitch` are HALF-TURNS (0.5 = 90°) about Z, Y and X, applied in
|
|
130
|
+
* that order, and positive is clockwise looking down each axis toward the
|
|
131
|
+
* origin — Euclid stores the negated angle, so the sign is flipped here to
|
|
132
|
+
* match. A lone number is a roll (`orientation 0.25` = 45° about Z, not a
|
|
133
|
+
* uniform tuple like `size`), and four numbers are `angle x y z`. */
|
|
134
|
+
private rotationOf;
|
|
135
|
+
private rotationComponents;
|
|
121
136
|
private handleDetail;
|
|
122
137
|
private handleColorCommand;
|
|
123
138
|
private handleRotateCommand;
|
|
@@ -135,6 +150,31 @@ export declare class Converter {
|
|
|
135
150
|
private requireEnclosedArea;
|
|
136
151
|
private convertExtrude;
|
|
137
152
|
private buildPath;
|
|
153
|
+
/** Bake the path's own `position` / `orientation` / `size` into geometry
|
|
154
|
+
* built from it. Baked rather than set on the mesh so the consuming
|
|
155
|
+
* builder's own options (an `extrude { position … }`) still apply on top,
|
|
156
|
+
* the way they do upstream where the path is a placed shape. */
|
|
157
|
+
private placePath;
|
|
158
|
+
/** Run the path's commands and return its points in path space.
|
|
159
|
+
*
|
|
160
|
+
* Coordinates are ABSOLUTE, as upstream: `point 1 0` is at x=1 however many
|
|
161
|
+
* points came before it. What `translate`, `rotate` and `scale` move is the
|
|
162
|
+
* path's local frame, which every later point is placed through — so
|
|
163
|
+
* `for 0 to 8 { curve 0 1 rotate 1 / 8 }` walks a semicircle. The frame is
|
|
164
|
+
* post-multiplied like the shape transform, and checked after every command
|
|
165
|
+
* because individually finite operands can still overflow it. */
|
|
166
|
+
private collectPathPoints;
|
|
167
|
+
private runPathLoop;
|
|
168
|
+
/** Join path points into an outline, treating `curve` points as upstream does.
|
|
169
|
+
*
|
|
170
|
+
* A `curve` is the CONTROL point of a quadratic Bézier; the outline passes
|
|
171
|
+
* through the `point`s on either side of it, not through the control point
|
|
172
|
+
* itself. Two `curve`s in a row get an implicit on-curve point halfway
|
|
173
|
+
* between them, which is how eight controls in an octagon draw a circle.
|
|
174
|
+
* A closed path (first and last point equal) may start on a control point.
|
|
175
|
+
* An OPEN path's first and last points are taken as corners even when they
|
|
176
|
+
* are `curve`s — upstream extrapolates a tangent there; this does not. */
|
|
177
|
+
private shapeFromPathPoints;
|
|
138
178
|
private convertLathe;
|
|
139
179
|
/** A lathe profile is only a solid once it is SAMPLED.
|
|
140
180
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toThreeJS.d.ts","sourceRoot":"","sources":["../../src/shapescript/toThreeJS.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EACL,SAAS,
|
|
1
|
+
{"version":3,"file":"toThreeJS.d.ts","sourceRoot":"","sources":["../../src/shapescript/toThreeJS.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EACL,SAAS,EA4BV,MAAM,SAAS,CAAC;AAqBjB,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;+BAC2B;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;yCACqC;IACrC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;kCAC8B;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;qCACiC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;+DAE2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAaD,eAAO,MAAM,iBAAiB,SAAU,CAAC;AACzC,eAAO,MAAM,2BAA2B,SAAU,CAAC;AASnD,eAAO,MAAM,UAAU,IAAI,CAAC;AAC5B,eAAO,MAAM,UAAU,MAAM,CAAC;AAU9B,eAAO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O,CAAC,aAAa;IAQrB;;;4CAGwC;IACxC,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,sBAAsB;IAiC9B,OAAO,CAAC,WAAW;CAWpB;AAGD,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,OAAO,GAAE,iBAAsB,GAAG,KAAK,CAAC,KAAK,CAG7F"}
|
|
@@ -43,7 +43,7 @@ export interface TupleExpr {
|
|
|
43
43
|
type: "tuple";
|
|
44
44
|
elements: Expression[];
|
|
45
45
|
}
|
|
46
|
-
export type SceneNode = ShapeNode | CSGNode | BlockNode | ForLoopNode | IfNode | SwitchNode | DefineNode | ExtrudeNode | LoftNode | LatheNode | FillNode | HullNode | GroupNode | DetailNode | PathNode | BackgroundNode | TextureNode | ColorNode | RotateNode | OrientationNode | TranslateNode | ScaleNode | CustomShapeNode;
|
|
46
|
+
export type SceneNode = ShapeNode | CSGNode | BlockNode | ForLoopNode | IfNode | SwitchNode | DefineNode | ExtrudeNode | LoftNode | LatheNode | FillNode | HullNode | GroupNode | DetailNode | SeedNode | PathNode | BackgroundNode | TextureNode | ColorNode | RotateNode | OrientationNode | TranslateNode | ScaleNode | CustomShapeNode;
|
|
47
47
|
export interface ShapeNode {
|
|
48
48
|
type: "shape";
|
|
49
49
|
primitive: "cube" | "sphere" | "cylinder" | "cone" | "torus" | "circle" | "square" | "polygon";
|
|
@@ -118,6 +118,11 @@ export interface DetailNode {
|
|
|
118
118
|
type: "detail";
|
|
119
119
|
value: number | Expression;
|
|
120
120
|
}
|
|
121
|
+
/** `seed N` — reseeds the `rnd` sequence for the rest of the enclosing block. */
|
|
122
|
+
export interface SeedNode {
|
|
123
|
+
type: "seed";
|
|
124
|
+
value: Expression;
|
|
125
|
+
}
|
|
121
126
|
export interface BackgroundNode {
|
|
122
127
|
type: "background";
|
|
123
128
|
value: Expression;
|
|
@@ -184,19 +189,24 @@ export interface GroupNode {
|
|
|
184
189
|
export interface PathNode {
|
|
185
190
|
type: "path";
|
|
186
191
|
commands: PathCommand[];
|
|
192
|
+
/** `position` / `orientation` / `size` given inside the path block — the
|
|
193
|
+
* standard transform options upstream allows on a path, which is how a
|
|
194
|
+
* `loft` section is placed in 3D without a wrapping `fill`. */
|
|
195
|
+
properties?: ShapeProperties;
|
|
187
196
|
}
|
|
188
|
-
export type PathCommand = DefineNode | PointCommand | CurveCommand | RotateCommand | TranslateCommand | DetailPathCommand | ForLoopPathCommand;
|
|
197
|
+
export type PathCommand = DefineNode | PointCommand | CurveCommand | RotateCommand | TranslateCommand | ScaleCommand | DetailPathCommand | ForLoopPathCommand;
|
|
189
198
|
export interface PointCommand {
|
|
190
199
|
type: "point";
|
|
191
200
|
x: number | Expression;
|
|
192
201
|
y: number | Expression;
|
|
193
202
|
}
|
|
203
|
+
/** A quadratic Bézier CONTROL point. The curve passes through the neighbouring
|
|
204
|
+
* `point`s, not through this one; two `curve`s in a row get an implicit
|
|
205
|
+
* on-curve midpoint between them, as upstream does. */
|
|
194
206
|
export interface CurveCommand {
|
|
195
207
|
type: "curve";
|
|
196
208
|
x: number | Expression;
|
|
197
209
|
y: number | Expression;
|
|
198
|
-
controlX?: number | Expression;
|
|
199
|
-
controlY?: number | Expression;
|
|
200
210
|
}
|
|
201
211
|
export interface RotateCommand {
|
|
202
212
|
type: "rotate";
|
|
@@ -207,6 +217,13 @@ export interface TranslateCommand {
|
|
|
207
217
|
x: number | Expression;
|
|
208
218
|
y: number | Expression;
|
|
209
219
|
}
|
|
220
|
+
/** `scale x [y]` inside a path. `y` absent means uniform: the one expression
|
|
221
|
+
* is evaluated once and reused, so `scale rnd` cannot draw two values. */
|
|
222
|
+
export interface ScaleCommand {
|
|
223
|
+
type: "scale";
|
|
224
|
+
x: number | Expression;
|
|
225
|
+
y?: number | Expression;
|
|
226
|
+
}
|
|
210
227
|
export interface DetailPathCommand {
|
|
211
228
|
type: "detail";
|
|
212
229
|
value: number | Expression;
|
|
@@ -238,6 +255,7 @@ export declare enum TokenType {
|
|
|
238
255
|
POINT = "POINT",
|
|
239
256
|
CURVE = "CURVE",
|
|
240
257
|
DETAIL = "DETAIL",
|
|
258
|
+
SEED = "SEED",
|
|
241
259
|
BACKGROUND = "BACKGROUND",
|
|
242
260
|
TEXTURE = "TEXTURE",
|
|
243
261
|
UNION = "UNION",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/shapescript/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAC/C,MAAM,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAG7C,MAAM,MAAM,UAAU,GAAG,aAAa,GAAG,aAAa,GAAG,cAAc,GAAG,UAAU,GAAG,SAAS,GAAG,YAAY,GAAG,YAAY,GAAG,aAAa,GAAG,SAAS,CAAC;AAE3J,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,UAAU,CAAC;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,UAAU,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,EA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