sceneview-mcp 4.0.16 → 4.1.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 +246 -62
- package/dist/analyze-project.js +4 -2
- package/dist/artifact.js +38 -13
- package/dist/debug-issue.js +101 -19
- package/dist/discover.js +106 -0
- package/dist/extra-guides.js +3 -3
- package/dist/generate-scene.js +380 -61
- package/dist/generated/llms-txt.js +1 -1
- package/dist/generated/symbols.js +1030 -26
- package/dist/generated/version.js +12 -3
- package/dist/guides.js +10 -6
- package/dist/http.js +178 -0
- package/dist/index.js +34 -139
- package/dist/issues.js +1 -1
- package/dist/migrate-code.js +5 -3
- package/dist/platform-setup.js +33 -16
- package/dist/samples.js +31 -31
- package/dist/search-models.js +1 -1
- package/dist/server.js +197 -0
- package/dist/surfaces.js +32 -0
- package/dist/telemetry.js +14 -8
- package/dist/tools/definitions.js +176 -14
- package/dist/tools/handler.js +207 -66
- package/dist/tools/index.js +4 -4
- package/dist/tools/types.js +0 -4
- package/dist/validator.js +262 -161
- package/dist/widgets.js +915 -0
- package/package.json +16 -12
- package/dist/proxy.js +0 -176
- package/dist/tiers.js +0 -138
package/dist/generate-scene.js
CHANGED
|
@@ -1,57 +1,362 @@
|
|
|
1
|
+
import { LATEST_SCENEVIEW_RELEASE } from "./generated/version.js";
|
|
1
2
|
const OBJECT_MAPPINGS = [
|
|
2
3
|
// Furniture
|
|
3
|
-
{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
{
|
|
5
|
+
keywords: ["table"],
|
|
6
|
+
nodeType: "CubeNode",
|
|
7
|
+
geometryType: "cube",
|
|
8
|
+
defaultScale: 1.0,
|
|
9
|
+
defaultPosition: [0, 0.4, 0],
|
|
10
|
+
color: "Color(0.55f, 0.35f, 0.17f)",
|
|
11
|
+
comment: "Table (flat cube)",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
keywords: ["chair"],
|
|
15
|
+
nodeType: "ModelNode",
|
|
16
|
+
defaultScale: 0.8,
|
|
17
|
+
defaultPosition: [0, 0, -1],
|
|
18
|
+
comment: "Chair (use GLB model)",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
keywords: ["desk"],
|
|
22
|
+
nodeType: "CubeNode",
|
|
23
|
+
geometryType: "cube",
|
|
24
|
+
defaultScale: 1.2,
|
|
25
|
+
defaultPosition: [0, 0.35, 0],
|
|
26
|
+
color: "Color(0.55f, 0.35f, 0.17f)",
|
|
27
|
+
comment: "Desk",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
keywords: ["shelf", "bookshelf"],
|
|
31
|
+
nodeType: "CubeNode",
|
|
32
|
+
geometryType: "cube",
|
|
33
|
+
defaultScale: 1.5,
|
|
34
|
+
defaultPosition: [2, 0.75, 0],
|
|
35
|
+
color: "Color(0.55f, 0.35f, 0.17f)",
|
|
36
|
+
comment: "Shelf",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
keywords: ["bed"],
|
|
40
|
+
nodeType: "CubeNode",
|
|
41
|
+
geometryType: "cube",
|
|
42
|
+
defaultScale: 2.0,
|
|
43
|
+
defaultPosition: [0, 0.25, 0],
|
|
44
|
+
color: "Color.White",
|
|
45
|
+
comment: "Bed",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
keywords: ["sofa", "couch"],
|
|
49
|
+
nodeType: "CubeNode",
|
|
50
|
+
geometryType: "cube",
|
|
51
|
+
defaultScale: 1.8,
|
|
52
|
+
defaultPosition: [0, 0.35, 0],
|
|
53
|
+
color: "Color(0.3f, 0.3f, 0.6f)",
|
|
54
|
+
comment: "Sofa",
|
|
55
|
+
},
|
|
9
56
|
// Basic shapes
|
|
10
|
-
{
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
57
|
+
{
|
|
58
|
+
keywords: ["box", "cube", "crate"],
|
|
59
|
+
nodeType: "CubeNode",
|
|
60
|
+
geometryType: "cube",
|
|
61
|
+
defaultScale: 0.5,
|
|
62
|
+
defaultPosition: [0, 0.25, 0],
|
|
63
|
+
color: "Color.Red",
|
|
64
|
+
comment: "Box",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
keywords: ["sphere", "ball", "globe", "orb"],
|
|
68
|
+
nodeType: "SphereNode",
|
|
69
|
+
geometryType: "sphere",
|
|
70
|
+
defaultScale: 0.5,
|
|
71
|
+
defaultPosition: [0, 0.5, 0],
|
|
72
|
+
color: "Color.Blue",
|
|
73
|
+
comment: "Sphere",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
keywords: ["cylinder", "pillar", "column"],
|
|
77
|
+
nodeType: "CylinderNode",
|
|
78
|
+
geometryType: "cylinder",
|
|
79
|
+
defaultScale: 0.5,
|
|
80
|
+
defaultPosition: [0, 0.5, 0],
|
|
81
|
+
color: "Color.Green",
|
|
82
|
+
comment: "Cylinder",
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
keywords: ["plane", "floor", "ground"],
|
|
86
|
+
nodeType: "PlaneNode",
|
|
87
|
+
geometryType: "plane",
|
|
88
|
+
defaultScale: 5.0,
|
|
89
|
+
defaultPosition: [0, 0, 0],
|
|
90
|
+
color: "Color.DarkGray",
|
|
91
|
+
comment: "Ground plane",
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
keywords: ["wall"],
|
|
95
|
+
nodeType: "CubeNode",
|
|
96
|
+
geometryType: "cube",
|
|
97
|
+
defaultScale: 3.0,
|
|
98
|
+
defaultPosition: [0, 1.5, -3],
|
|
99
|
+
color: "Color.LightGray",
|
|
100
|
+
comment: "Wall",
|
|
101
|
+
},
|
|
15
102
|
// Environment
|
|
16
|
-
{
|
|
17
|
-
|
|
18
|
-
|
|
103
|
+
{
|
|
104
|
+
keywords: ["tree", "plant"],
|
|
105
|
+
nodeType: "ModelNode",
|
|
106
|
+
defaultScale: 2.0,
|
|
107
|
+
defaultPosition: [2, 0, 2],
|
|
108
|
+
comment: "Tree (use GLB model)",
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
keywords: ["car", "vehicle"],
|
|
112
|
+
nodeType: "ModelNode",
|
|
113
|
+
defaultScale: 2.0,
|
|
114
|
+
defaultPosition: [0, 0, 0],
|
|
115
|
+
comment: "Car (use GLB model)",
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
keywords: ["house", "building"],
|
|
119
|
+
nodeType: "ModelNode",
|
|
120
|
+
defaultScale: 5.0,
|
|
121
|
+
defaultPosition: [0, 0, -5],
|
|
122
|
+
comment: "Building (use GLB model)",
|
|
123
|
+
},
|
|
19
124
|
// People / characters
|
|
20
|
-
{
|
|
21
|
-
|
|
125
|
+
{
|
|
126
|
+
keywords: ["person", "character", "human", "avatar"],
|
|
127
|
+
nodeType: "ModelNode",
|
|
128
|
+
defaultScale: 1.7,
|
|
129
|
+
defaultPosition: [0, 0, 0],
|
|
130
|
+
comment: "Character (use GLB model)",
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
keywords: ["robot", "android"],
|
|
134
|
+
nodeType: "ModelNode",
|
|
135
|
+
defaultScale: 1.5,
|
|
136
|
+
defaultPosition: [0, 0, 0],
|
|
137
|
+
comment: "Robot (use GLB model)",
|
|
138
|
+
},
|
|
22
139
|
// Animals
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
140
|
+
{
|
|
141
|
+
keywords: ["dog", "puppy"],
|
|
142
|
+
nodeType: "ModelNode",
|
|
143
|
+
defaultScale: 0.6,
|
|
144
|
+
defaultPosition: [1, 0, 0],
|
|
145
|
+
comment: "Dog (use GLB model)",
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
keywords: ["cat", "kitten"],
|
|
149
|
+
nodeType: "ModelNode",
|
|
150
|
+
defaultScale: 0.4,
|
|
151
|
+
defaultPosition: [-1, 0, 0],
|
|
152
|
+
comment: "Cat (use GLB model)",
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
keywords: ["bird"],
|
|
156
|
+
nodeType: "ModelNode",
|
|
157
|
+
defaultScale: 0.2,
|
|
158
|
+
defaultPosition: [0, 2, 0],
|
|
159
|
+
comment: "Bird (use GLB model)",
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
keywords: ["horse"],
|
|
163
|
+
nodeType: "ModelNode",
|
|
164
|
+
defaultScale: 2.5,
|
|
165
|
+
defaultPosition: [0, 0, 2],
|
|
166
|
+
comment: "Horse (use GLB model)",
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
keywords: ["fish"],
|
|
170
|
+
nodeType: "ModelNode",
|
|
171
|
+
defaultScale: 0.3,
|
|
172
|
+
defaultPosition: [0, 0.5, 0],
|
|
173
|
+
comment: "Fish (use GLB model)",
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
keywords: ["dinosaur", "dino", "t-rex"],
|
|
177
|
+
nodeType: "ModelNode",
|
|
178
|
+
defaultScale: 5.0,
|
|
179
|
+
defaultPosition: [0, 0, -3],
|
|
180
|
+
comment: "Dinosaur (use GLB model)",
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
keywords: ["dragon"],
|
|
184
|
+
nodeType: "ModelNode",
|
|
185
|
+
defaultScale: 4.0,
|
|
186
|
+
defaultPosition: [0, 2, -3],
|
|
187
|
+
comment: "Dragon (use GLB model)",
|
|
188
|
+
},
|
|
30
189
|
// More vehicles
|
|
31
|
-
{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
190
|
+
{
|
|
191
|
+
keywords: ["airplane", "plane", "jet"],
|
|
192
|
+
nodeType: "ModelNode",
|
|
193
|
+
defaultScale: 5.0,
|
|
194
|
+
defaultPosition: [0, 5, 0],
|
|
195
|
+
comment: "Airplane (use GLB model)",
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
keywords: ["boat", "ship"],
|
|
199
|
+
nodeType: "ModelNode",
|
|
200
|
+
defaultScale: 4.0,
|
|
201
|
+
defaultPosition: [0, 0, -3],
|
|
202
|
+
comment: "Boat (use GLB model)",
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
keywords: ["bicycle", "bike"],
|
|
206
|
+
nodeType: "ModelNode",
|
|
207
|
+
defaultScale: 1.2,
|
|
208
|
+
defaultPosition: [2, 0, 0],
|
|
209
|
+
comment: "Bicycle (use GLB model)",
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
keywords: ["motorcycle", "motorbike"],
|
|
213
|
+
nodeType: "ModelNode",
|
|
214
|
+
defaultScale: 1.5,
|
|
215
|
+
defaultPosition: [2, 0, 0],
|
|
216
|
+
comment: "Motorcycle (use GLB model)",
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
keywords: ["truck"],
|
|
220
|
+
nodeType: "ModelNode",
|
|
221
|
+
defaultScale: 3.0,
|
|
222
|
+
defaultPosition: [0, 0, -2],
|
|
223
|
+
comment: "Truck (use GLB model)",
|
|
224
|
+
},
|
|
36
225
|
// More environment
|
|
37
|
-
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
226
|
+
{
|
|
227
|
+
keywords: ["flower", "rose"],
|
|
228
|
+
nodeType: "ModelNode",
|
|
229
|
+
defaultScale: 0.3,
|
|
230
|
+
defaultPosition: [1, 0, 1],
|
|
231
|
+
comment: "Flower (use GLB model)",
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
keywords: ["rock", "stone", "boulder"],
|
|
235
|
+
nodeType: "SphereNode",
|
|
236
|
+
geometryType: "sphere",
|
|
237
|
+
defaultScale: 0.8,
|
|
238
|
+
defaultPosition: [1, 0.4, 1],
|
|
239
|
+
color: "Color.Gray",
|
|
240
|
+
comment: "Rock",
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
keywords: ["mountain", "hill"],
|
|
244
|
+
nodeType: "ModelNode",
|
|
245
|
+
defaultScale: 10.0,
|
|
246
|
+
defaultPosition: [0, 0, -10],
|
|
247
|
+
comment: "Mountain (use GLB model)",
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
keywords: ["fence"],
|
|
251
|
+
nodeType: "CubeNode",
|
|
252
|
+
geometryType: "cube",
|
|
253
|
+
defaultScale: 2.0,
|
|
254
|
+
defaultPosition: [3, 0.5, 0],
|
|
255
|
+
color: "Color(0.55f, 0.35f, 0.17f)",
|
|
256
|
+
comment: "Fence",
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
keywords: ["bridge"],
|
|
260
|
+
nodeType: "ModelNode",
|
|
261
|
+
defaultScale: 5.0,
|
|
262
|
+
defaultPosition: [0, 0, 0],
|
|
263
|
+
comment: "Bridge (use GLB model)",
|
|
264
|
+
},
|
|
42
265
|
// More furniture / objects
|
|
43
|
-
{
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
{
|
|
266
|
+
{
|
|
267
|
+
keywords: ["lamp", "light fixture"],
|
|
268
|
+
nodeType: "ModelNode",
|
|
269
|
+
defaultScale: 0.5,
|
|
270
|
+
defaultPosition: [1, 0.8, 0],
|
|
271
|
+
comment: "Lamp (use GLB model)",
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
keywords: ["tv", "television", "screen", "monitor"],
|
|
275
|
+
nodeType: "CubeNode",
|
|
276
|
+
geometryType: "cube",
|
|
277
|
+
defaultScale: 1.2,
|
|
278
|
+
defaultPosition: [0, 0.8, -2],
|
|
279
|
+
color: "Color.Black",
|
|
280
|
+
comment: "TV/Screen (flat cube)",
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
keywords: ["door", "gate"],
|
|
284
|
+
nodeType: "CubeNode",
|
|
285
|
+
geometryType: "cube",
|
|
286
|
+
defaultScale: 2.0,
|
|
287
|
+
defaultPosition: [0, 1, -3],
|
|
288
|
+
color: "Color(0.55f, 0.35f, 0.17f)",
|
|
289
|
+
comment: "Door",
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
keywords: ["window"],
|
|
293
|
+
nodeType: "CubeNode",
|
|
294
|
+
geometryType: "cube",
|
|
295
|
+
defaultScale: 1.0,
|
|
296
|
+
defaultPosition: [2, 1.5, -3],
|
|
297
|
+
color: "Color(0.7f, 0.85f, 1f)",
|
|
298
|
+
comment: "Window",
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
keywords: ["stairs", "staircase"],
|
|
302
|
+
nodeType: "ModelNode",
|
|
303
|
+
defaultScale: 2.0,
|
|
304
|
+
defaultPosition: [3, 0, 0],
|
|
305
|
+
comment: "Stairs (use GLB model)",
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
keywords: ["book", "books"],
|
|
309
|
+
nodeType: "CubeNode",
|
|
310
|
+
geometryType: "cube",
|
|
311
|
+
defaultScale: 0.2,
|
|
312
|
+
defaultPosition: [0, 0.5, 0],
|
|
313
|
+
color: "Color(0.6f, 0.1f, 0.1f)",
|
|
314
|
+
comment: "Book",
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
keywords: ["bottle", "vase"],
|
|
318
|
+
nodeType: "CylinderNode",
|
|
319
|
+
geometryType: "cylinder",
|
|
320
|
+
defaultScale: 0.2,
|
|
321
|
+
defaultPosition: [0, 0.3, 0],
|
|
322
|
+
color: "Color(0.2f, 0.6f, 0.3f)",
|
|
323
|
+
comment: "Bottle/Vase",
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
keywords: ["trophy", "cup"],
|
|
327
|
+
nodeType: "ModelNode",
|
|
328
|
+
defaultScale: 0.3,
|
|
329
|
+
defaultPosition: [0, 0.5, 0],
|
|
330
|
+
comment: "Trophy (use GLB model)",
|
|
331
|
+
},
|
|
51
332
|
// Food
|
|
52
|
-
{
|
|
53
|
-
|
|
54
|
-
|
|
333
|
+
{
|
|
334
|
+
keywords: ["pizza"],
|
|
335
|
+
nodeType: "CylinderNode",
|
|
336
|
+
geometryType: "cylinder",
|
|
337
|
+
defaultScale: 0.3,
|
|
338
|
+
defaultPosition: [0, 0.5, 0],
|
|
339
|
+
color: "Color(0.9f, 0.7f, 0.2f)",
|
|
340
|
+
comment: "Pizza (flat cylinder)",
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
keywords: ["cake"],
|
|
344
|
+
nodeType: "CylinderNode",
|
|
345
|
+
geometryType: "cylinder",
|
|
346
|
+
defaultScale: 0.3,
|
|
347
|
+
defaultPosition: [0, 0.5, 0],
|
|
348
|
+
color: "Color(1f, 0.85f, 0.7f)",
|
|
349
|
+
comment: "Cake (cylinder)",
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
keywords: ["apple", "fruit"],
|
|
353
|
+
nodeType: "SphereNode",
|
|
354
|
+
geometryType: "sphere",
|
|
355
|
+
defaultScale: 0.08,
|
|
356
|
+
defaultPosition: [0, 0.5, 0],
|
|
357
|
+
color: "Color.Red",
|
|
358
|
+
comment: "Apple/Fruit",
|
|
359
|
+
},
|
|
55
360
|
];
|
|
56
361
|
// ── Text keywords ───────────────────────────────────────────────────────────
|
|
57
362
|
const TEXT_KEYWORDS = ["label", "text", "sign", "title", "name", "caption", "annotation"];
|
|
@@ -81,9 +386,18 @@ function parseDescription(description) {
|
|
|
81
386
|
let count = 1;
|
|
82
387
|
if (match[1]) {
|
|
83
388
|
const numWords = {
|
|
84
|
-
one: 1,
|
|
85
|
-
|
|
86
|
-
|
|
389
|
+
one: 1,
|
|
390
|
+
two: 2,
|
|
391
|
+
three: 3,
|
|
392
|
+
four: 4,
|
|
393
|
+
five: 5,
|
|
394
|
+
six: 6,
|
|
395
|
+
seven: 7,
|
|
396
|
+
eight: 8,
|
|
397
|
+
nine: 9,
|
|
398
|
+
ten: 10,
|
|
399
|
+
a: 1,
|
|
400
|
+
an: 1,
|
|
87
401
|
};
|
|
88
402
|
count = numWords[match[1].toLowerCase()] || parseInt(match[1]) || 1;
|
|
89
403
|
}
|
|
@@ -121,21 +435,17 @@ function spreadPositions(count, basePos, spacing) {
|
|
|
121
435
|
const positions = [];
|
|
122
436
|
const halfSpan = ((count - 1) * spacing) / 2;
|
|
123
437
|
for (let i = 0; i < count; i++) {
|
|
124
|
-
positions.push([
|
|
125
|
-
basePos[0] + i * spacing - halfSpan,
|
|
126
|
-
basePos[1],
|
|
127
|
-
basePos[2],
|
|
128
|
-
]);
|
|
438
|
+
positions.push([basePos[0] + i * spacing - halfSpan, basePos[1], basePos[2]]);
|
|
129
439
|
}
|
|
130
440
|
return positions;
|
|
131
441
|
}
|
|
132
442
|
/** Generate a material variable name from a color expression */
|
|
133
443
|
function colorToVarName(color) {
|
|
134
|
-
return color
|
|
444
|
+
return (color
|
|
135
445
|
.replace("Color.", "")
|
|
136
446
|
.replace(/Color\(.*\)/, "custom")
|
|
137
447
|
.replace(/[^a-zA-Z0-9]/g, "")
|
|
138
|
-
.toLowerCase() + "Mat";
|
|
448
|
+
.toLowerCase() + "Mat");
|
|
139
449
|
}
|
|
140
450
|
export function generateScene(description) {
|
|
141
451
|
const parsed = parseDescription(description);
|
|
@@ -237,14 +547,19 @@ export function generateScene(description) {
|
|
|
237
547
|
}
|
|
238
548
|
// Build the code
|
|
239
549
|
const isAR = parsed.isAR;
|
|
240
|
-
dependencies.push(isAR
|
|
550
|
+
dependencies.push(isAR
|
|
551
|
+
? `io.github.sceneview:arsceneview:${LATEST_SCENEVIEW_RELEASE}`
|
|
552
|
+
: `io.github.sceneview:sceneview:${LATEST_SCENEVIEW_RELEASE}`);
|
|
241
553
|
// Build model instance declarations
|
|
242
554
|
const modelElements = elements.filter((e) => e.type === "model");
|
|
243
555
|
const uniqueModels = new Map();
|
|
244
556
|
modelElements.forEach((e) => {
|
|
245
557
|
const path = e.properties.modelPath;
|
|
246
558
|
if (!uniqueModels.has(path)) {
|
|
247
|
-
const varName = path
|
|
559
|
+
const varName = path
|
|
560
|
+
.replace("models/", "")
|
|
561
|
+
.replace(".glb", "")
|
|
562
|
+
.replace(/[^a-zA-Z0-9]/g, "") + "Instance";
|
|
248
563
|
uniqueModels.set(path, varName);
|
|
249
564
|
}
|
|
250
565
|
});
|
|
@@ -319,9 +634,9 @@ export function generateScene(description) {
|
|
|
319
634
|
lines.push(" modelLoader = modelLoader,");
|
|
320
635
|
lines.push(" cameraManipulator = rememberCameraManipulator(),");
|
|
321
636
|
if (!parsed.isDark) {
|
|
322
|
-
lines.push(
|
|
637
|
+
lines.push(" environment = rememberEnvironment(environmentLoader) {");
|
|
323
638
|
lines.push(' environmentLoader.createHDREnvironment("environments/sky_2k.hdr")');
|
|
324
|
-
lines.push(
|
|
639
|
+
lines.push(" ?: createEnvironment(environmentLoader)");
|
|
325
640
|
lines.push(" },");
|
|
326
641
|
lines.push(" mainLightNode = rememberMainLightNode(engine) { intensity = 100_000f }");
|
|
327
642
|
}
|
|
@@ -454,7 +769,7 @@ export function generateScene(description) {
|
|
|
454
769
|
notes.push("Free 3D models: https://sketchfab.com/features/free-3d-models (download as GLB)");
|
|
455
770
|
}
|
|
456
771
|
if (isAR) {
|
|
457
|
-
notes.push(
|
|
772
|
+
notes.push('AR requires camera permission at runtime and ARCore on the device. See `get_platform_setup("android", "ar")` for full setup.');
|
|
458
773
|
}
|
|
459
774
|
if (elements.length <= 2 && !hasModel && !hasGeometry) {
|
|
460
775
|
notes.push("Only a light was generated. The description didn't match any known objects. Try mentioning specific objects like 'table', 'chair', 'sphere', 'cube', etc.");
|
|
@@ -479,7 +794,9 @@ export function formatGeneratedScene(result) {
|
|
|
479
794
|
parts.push(`**Elements:** ${result.elements.length} nodes\n`);
|
|
480
795
|
parts.push(`### Dependency\n`);
|
|
481
796
|
parts.push("```kotlin");
|
|
482
|
-
result.dependencies.forEach((d) =>
|
|
797
|
+
result.dependencies.forEach((d) => {
|
|
798
|
+
parts.push(`implementation("${d}")`);
|
|
799
|
+
});
|
|
483
800
|
parts.push("```\n");
|
|
484
801
|
parts.push(`### Code\n`);
|
|
485
802
|
parts.push("```kotlin");
|
|
@@ -487,7 +804,9 @@ export function formatGeneratedScene(result) {
|
|
|
487
804
|
parts.push("```\n");
|
|
488
805
|
if (result.notes.length > 0) {
|
|
489
806
|
parts.push(`### Notes\n`);
|
|
490
|
-
result.notes.forEach((n, i) =>
|
|
807
|
+
result.notes.forEach((n, i) => {
|
|
808
|
+
parts.push(`${i + 1}. ${n}`);
|
|
809
|
+
});
|
|
491
810
|
}
|
|
492
811
|
return parts.join("\n");
|
|
493
812
|
}
|