@babylonjs/inspector 8.45.5 → 8.46.0-preview

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.
@@ -0,0 +1,669 @@
1
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
+ import { P as Popover, b as Button, c as TextInputPropertyLine, d as SpinButtonPropertyLine, e as CheckboxPropertyLine, V as Vector3PropertyLine, u as useProperty, f as MessageBar, g as ShellServiceIdentity, h as SceneContextIdentity, i as useObservableState, A as Accordion, j as AccordionSection } from './index-9hCGH1vt.js';
3
+ import { SettingsRegular, CollectionsAdd20Regular } from '@fluentui/react-icons';
4
+ import '@babylonjs/core/Particles/webgl2ParticleSystem.js';
5
+ import { MeshBuilder } from '@babylonjs/core/Meshes/meshBuilder.js';
6
+ import { useState, useRef } from 'react';
7
+ import { FilesInput } from '@babylonjs/core/Misc/filesInput.js';
8
+ import { makeStyles, tokens } from '@fluentui/react-components';
9
+ import { NodeMaterial } from '@babylonjs/core/Materials/Node/nodeMaterial.js';
10
+ import { PBRMaterial } from '@babylonjs/core/Materials/PBR/pbrMaterial.js';
11
+ import { StandardMaterial } from '@babylonjs/core/Materials/standardMaterial.js';
12
+ import { PointLight } from '@babylonjs/core/Lights/pointLight.js';
13
+ import { DirectionalLight } from '@babylonjs/core/Lights/directionalLight.js';
14
+ import { SpotLight } from '@babylonjs/core/Lights/spotLight.js';
15
+ import { Vector3 } from '@babylonjs/core/Maths/math.vector.js';
16
+ import { ArcRotateCamera } from '@babylonjs/core/Cameras/arcRotateCamera.js';
17
+ import { UniversalCamera } from '@babylonjs/core/Cameras/universalCamera.js';
18
+ import { FreeCamera } from '@babylonjs/core/Cameras/freeCamera.js';
19
+ import { FollowCamera } from '@babylonjs/core/Cameras/followCamera.js';
20
+ import { FlyCamera } from '@babylonjs/core/Cameras/flyCamera.js';
21
+ import { GeospatialCamera } from '@babylonjs/core/Cameras/geospatialCamera.js';
22
+ import { ParticleSystem } from '@babylonjs/core/Particles/particleSystem.js';
23
+ import { GPUParticleSystem } from '@babylonjs/core/Particles/gpuParticleSystem.js';
24
+ import { NodeParticleSystemSet } from '@babylonjs/core/Particles/Node/nodeParticleSystemSet.js';
25
+ import { Texture } from '@babylonjs/core/Materials/Textures/texture.js';
26
+ import { DefaultRenderingPipeline } from '@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js';
27
+ import { SSAORenderingPipeline } from '@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js';
28
+ import { SSAO2RenderingPipeline } from '@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js';
29
+ import { SSRRenderingPipeline } from '@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js';
30
+ import { IblShadowsRenderPipeline } from '@babylonjs/core/Rendering/IBLShadows/iblShadowsRenderPipeline.js';
31
+ import { NodeRenderGraph } from '@babylonjs/core/FrameGraph/Node/nodeRenderGraph.js';
32
+ import { SpriteManager } from '@babylonjs/core/Sprites/spriteManager.js';
33
+ import '@babylonjs/core/Maths/math.color.js';
34
+ import '@babylonjs/core/Misc/observable.js';
35
+ import '@babylonjs/core/Misc/typeStore.js';
36
+ import '@fluentui/react-motion-components-preview';
37
+ import 'usehooks-ts';
38
+ import '@babylonjs/core/Misc/asyncLock.js';
39
+ import '@babylonjs/core/Misc/deferred.js';
40
+ import '@babylonjs/core/Misc/logger.js';
41
+ import '@babylonjs/core/Maths/math.scalar.functions.js';
42
+ import '@fluentui-contrib/react-virtualizer';
43
+ import '@babylonjs/addons/msdfText/fontAsset.js';
44
+ import '@babylonjs/addons/msdfText/textRenderer.js';
45
+ import '@babylonjs/core/Debug/physicsViewer.js';
46
+ import '@babylonjs/core/Materials/materialFlags.js';
47
+ import '@babylonjs/core/Meshes/Builders/groundBuilder.js';
48
+ import '@babylonjs/core/Misc/tools.js';
49
+ import '@babylonjs/core/Rendering/utilityLayerRenderer.js';
50
+ import '@babylonjs/materials/grid/gridMaterial.js';
51
+ import '@babylonjs/core/Misc/dataStorage.js';
52
+ import '@babylonjs/core/Instrumentation/engineInstrumentation.js';
53
+ import '@babylonjs/core/Instrumentation/sceneInstrumentation.js';
54
+ import '@babylonjs/core/Engines/AbstractEngine/abstractEngine.timeQuery.js';
55
+ import '@babylonjs/core/Engines/Extensions/engine.query.js';
56
+ import '@babylonjs/core/Engines/WebGPU/Extensions/engine.query.js';
57
+ import '@babylonjs/core/Misc/PerformanceViewer/performanceViewerCollectionStrategies.js';
58
+ import '@babylonjs/core/Misc/PerformanceViewer/performanceViewerSceneExtension.js';
59
+ import '@babylonjs/core/Misc/pressureObserverWrapper.js';
60
+ import '@babylonjs/core/Engines/abstractEngine.js';
61
+ import 'react-dom/client';
62
+ import '@babylonjs/core/FrameGraph/frameGraphUtils.js';
63
+ import '@babylonjs/core/Gizmos/cameraGizmo.js';
64
+ import '@babylonjs/core/Gizmos/lightGizmo.js';
65
+ import '@babylonjs/core/Bones/bone.js';
66
+ import '@babylonjs/core/Cameras/camera.js';
67
+ import '@babylonjs/core/Gizmos/gizmoManager.js';
68
+ import '@babylonjs/core/Lights/light.js';
69
+ import '@babylonjs/core/Meshes/abstractMesh.js';
70
+ import '@babylonjs/core/node.js';
71
+ import '@babylonjs/core/Animations/animationGroup.js';
72
+ import '@babylonjs/core/Animations/animationPropertiesOverride.js';
73
+ import '@babylonjs/addons/atmosphere/atmosphere.js';
74
+ import '@babylonjs/core/Cameras/targetCamera.js';
75
+ import '@babylonjs/core/scene.js';
76
+ import '@babylonjs/core/FrameGraph/frameGraph.js';
77
+ import '@babylonjs/core/Lights/hemisphericLight.js';
78
+ import '@babylonjs/core/Lights/rectAreaLight.js';
79
+ import '@babylonjs/core/Lights/shadowLight.js';
80
+ import '@babylonjs/core/Lights/Shadows/cascadedShadowGenerator.js';
81
+ import '@babylonjs/core/Debug/directionalLightFrustumViewer.js';
82
+ import '@babylonjs/core/Lights/Shadows/shadowGenerator.js';
83
+ import '@babylonjs/core/Lights/Shadows/shadowGeneratorSceneComponent.js';
84
+ import '@babylonjs/core/Materials/material.js';
85
+ import '@babylonjs/core/Materials/multiMaterial.js';
86
+ import '@babylonjs/core/Materials/PBR/openpbrMaterial.js';
87
+ import '@babylonjs/core/Materials/PBR/pbrBaseMaterial.js';
88
+ import '@babylonjs/materials/sky/skyMaterial.js';
89
+ import '@babylonjs/core/Engines/constants.js';
90
+ import '@babylonjs/core/Engines/engine.js';
91
+ import '@babylonjs/core/Misc/fileTools.js';
92
+ import '@babylonjs/core/Materials/Textures/cubeTexture.js';
93
+ import '@babylonjs/core/Meshes/GaussianSplatting/gaussianSplattingMesh.js';
94
+ import '@babylonjs/core/Meshes/mesh.js';
95
+ import '@babylonjs/core/Debug/skeletonViewer.js';
96
+ import '@babylonjs/core/Meshes/buffer.js';
97
+ import '@babylonjs/core/Meshes/Builders/linesBuilder.js';
98
+ import '@babylonjs/core/Meshes/instancedMesh.js';
99
+ import '@babylonjs/core/Rendering/renderingManager.js';
100
+ import '@babylonjs/core/Rendering/edgesRenderer.js';
101
+ import '@babylonjs/core/Rendering/outlineRenderer.js';
102
+ import '@babylonjs/core/Particles/EmitterTypes/boxParticleEmitter.js';
103
+ import '@babylonjs/core/Particles/EmitterTypes/coneParticleEmitter.js';
104
+ import '@babylonjs/core/Particles/EmitterTypes/cylinderParticleEmitter.js';
105
+ import '@babylonjs/core/Particles/EmitterTypes/hemisphericParticleEmitter.js';
106
+ import '@babylonjs/core/Particles/EmitterTypes/meshParticleEmitter.js';
107
+ import '@babylonjs/core/Particles/EmitterTypes/pointParticleEmitter.js';
108
+ import '@babylonjs/core/Particles/EmitterTypes/sphereParticleEmitter.js';
109
+ import '@babylonjs/core/Particles/Node/nodeParticleSystemSet.helper.js';
110
+ import '@babylonjs/core/Particles/particleHelper.js';
111
+ import '@babylonjs/core/Misc/gradients.js';
112
+ import '@babylonjs/core/Materials/Node/Blocks/gradientBlock.js';
113
+ import '@babylonjs/core/Particles/attractor.js';
114
+ import '@babylonjs/core/Meshes/Builders/sphereBuilder.js';
115
+ import '@babylonjs/core/Meshes/transformNode.js';
116
+ import '@babylonjs/core/Physics/v2/IPhysicsEnginePlugin.js';
117
+ import '@babylonjs/core/Physics/v2/physicsEngineComponent.js';
118
+ import '@babylonjs/core/PostProcesses/postProcess.js';
119
+ import '@babylonjs/core/Materials/imageProcessingConfiguration.js';
120
+ import '@babylonjs/core/Bones/skeleton.js';
121
+ import '@babylonjs/core/Sprites/sprite.js';
122
+ import '@babylonjs/core/Misc/textureTools.js';
123
+ import '@babylonjs/core/Materials/Textures/baseTexture.js';
124
+ import '@babylonjs/core/Materials/Textures/multiRenderTarget.js';
125
+ import '@babylonjs/core/Materials/Textures/renderTargetTexture.js';
126
+ import '@babylonjs/core/Materials/Textures/thinTexture.js';
127
+ import '@babylonjs/core/Events/keyboardEvents.js';
128
+ import '@babylonjs/core/Events/pointerEvents.js';
129
+ import '@babylonjs/core/Materials/Textures/htmlElementTexture.js';
130
+ import '@babylonjs/core/Materials/shaderMaterial.js';
131
+ import '@babylonjs/core/Meshes/Builders/planeBuilder.js';
132
+ import '@babylonjs/core/Lights/Clustered/clusteredLightContainer.js';
133
+ import '@babylonjs/core/Rendering/boundingBoxRenderer.js';
134
+ import '@babylonjs/core/PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.js';
135
+ import '@babylonjs/core/Sprites/spriteSceneComponent.js';
136
+ import '@babylonjs/core/Materials/Textures/dynamicTexture.js';
137
+ import '@babylonjs/core/Engines/engineStore.js';
138
+ import '@babylonjs/core/Misc/uniqueIdGenerator.js';
139
+ import '@babylonjs/core/Debug/debugLayer.js';
140
+ import '@babylonjs/core/Misc/lazy.js';
141
+
142
+ /**
143
+ * Settings popover component
144
+ * @param props
145
+ * @returns
146
+ */
147
+ const SettingsPopover = (props) => {
148
+ return jsxs(Popover, { icon: SettingsRegular, children: [" ", props.children, " "] });
149
+ };
150
+
151
+ const useStyles = makeStyles({
152
+ section: {
153
+ display: "flex",
154
+ flexDirection: "column",
155
+ rowGap: tokens.spacingVerticalM,
156
+ },
157
+ row: { display: "flex", alignItems: "center", gap: "4px" },
158
+ });
159
+ /**
160
+ * Container component for quick create sections that provides consistent column layout with spacing
161
+ * @param props - Component props
162
+ * @returns React component
163
+ */
164
+ const QuickCreateSection = ({ children }) => {
165
+ const classes = useStyles();
166
+ return jsx("div", { className: classes.section, children: children });
167
+ };
168
+ /**
169
+ * Container component for quick create rows that provides consistent row layout for button + settings popover
170
+ * @param props - Component props
171
+ * @returns React component
172
+ */
173
+ const QuickCreateRow = ({ children }) => {
174
+ const classes = useStyles();
175
+ return jsx("div", { className: classes.row, children: children });
176
+ };
177
+
178
+ const SetCamera = function (scene) {
179
+ const camera = scene.activeCamera;
180
+ if (camera && camera.radius !== undefined) {
181
+ camera.radius = 5;
182
+ }
183
+ };
184
+ /**
185
+ * @internal
186
+ */
187
+ const MeshesContent = ({ scene }) => {
188
+ const [sphereParams, setSphereParams] = useState({
189
+ name: "Sphere",
190
+ segments: 32,
191
+ diameter: 1,
192
+ diameterX: 1,
193
+ diameterY: 1,
194
+ diameterZ: 1,
195
+ arc: 1,
196
+ slice: 1,
197
+ uniform: true,
198
+ });
199
+ const handleSphereParamChange = (key, value) => {
200
+ setSphereParams((prev) => ({
201
+ ...prev,
202
+ [key]: value,
203
+ }));
204
+ };
205
+ const [boxParams, setBoxParams] = useState({
206
+ name: "Box",
207
+ size: 1,
208
+ width: 1,
209
+ height: 1,
210
+ depth: 1,
211
+ });
212
+ const handleBoxParamChange = (key, value) => {
213
+ setBoxParams((prev) => ({
214
+ ...prev,
215
+ [key]: value,
216
+ }));
217
+ };
218
+ const [cylinderParams, setCylinderParams] = useState({
219
+ name: "Cylinder",
220
+ height: 2,
221
+ diameterTop: 1,
222
+ diameterBottom: 1,
223
+ diameter: 1,
224
+ tessellation: 32,
225
+ subdivisions: 1,
226
+ arc: 1,
227
+ });
228
+ const handleCylinderParamChange = (key, value) => {
229
+ setCylinderParams((prev) => ({
230
+ ...prev,
231
+ [key]: value,
232
+ }));
233
+ };
234
+ const [coneParams, setConeParams] = useState({
235
+ name: "Cone",
236
+ height: 2,
237
+ diameter: 1,
238
+ diameterTop: 0,
239
+ diameterBottom: 1,
240
+ tessellation: 32,
241
+ subdivisions: 1,
242
+ arc: 1,
243
+ });
244
+ const [coneUp, setConeUp] = useState(true);
245
+ const handleConeParamChange = (key, value) => {
246
+ setConeParams((prev) => ({
247
+ ...prev,
248
+ [key]: value,
249
+ }));
250
+ };
251
+ const [groundParams, setGroundParams] = useState({
252
+ name: "Ground",
253
+ width: 10,
254
+ height: 10,
255
+ subdivisions: 1,
256
+ subdivisionsX: 1,
257
+ subdivisionsY: 1,
258
+ });
259
+ const handleGroundParamChange = (key, value) => {
260
+ setGroundParams((prev) => ({
261
+ ...prev,
262
+ [key]: value,
263
+ }));
264
+ };
265
+ const fileInputRef = useRef(null);
266
+ const [importMeshName, setImportMeshName] = useState("ImportedMesh");
267
+ const handleLocalMeshImport = (event) => {
268
+ const files = event.target.files;
269
+ if (!files || files.length === 0) {
270
+ return;
271
+ }
272
+ const filesArray = Array.from(files);
273
+ if (importMeshName.trim().length > 0 && filesArray.length > 0) {
274
+ const originalFile = filesArray[0];
275
+ const extensionIndex = originalFile.name.lastIndexOf(".");
276
+ const extension = extensionIndex >= 0 ? originalFile.name.substring(extensionIndex) : "";
277
+ const sanitizedName = importMeshName.trim();
278
+ const desiredFileName = sanitizedName.toLowerCase().endsWith(extension.toLowerCase()) ? sanitizedName : `${sanitizedName}${extension}`;
279
+ filesArray[0] = new File([originalFile], desiredFileName, { type: originalFile.type, lastModified: originalFile.lastModified });
280
+ }
281
+ const filesInput = new FilesInput(scene.getEngine(), scene, null, null, null, null, null, null, (_sceneFile, _scene, message) => {
282
+ alert(message ? `Failed to import mesh: ${message}` : "Failed to import mesh.");
283
+ }, true);
284
+ filesInput.displayLoadingUI = false;
285
+ filesInput.loadFiles({ target: { files: filesArray } });
286
+ filesInput.dispose();
287
+ event.target.value = "";
288
+ };
289
+ return (jsxs(QuickCreateSection, { children: [jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: () => {
290
+ MeshBuilder.CreateSphere("Sphere", {}, scene);
291
+ SetCamera(scene);
292
+ }, label: "Sphere" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: sphereParams.name, onChange: (val) => handleSphereParamChange("name", val) }), jsx(SpinButtonPropertyLine, { label: "Segments", value: sphereParams.segments, min: 0, onChange: (val) => handleSphereParamChange("segments", val) }), jsx(SpinButtonPropertyLine, { label: "Diameter", value: sphereParams.diameter, min: 0, step: 0.1, onChange: (val) => handleSphereParamChange("diameter", val), disabled: !sphereParams.uniform }), jsx(CheckboxPropertyLine, { label: "Uniform", value: sphereParams.uniform, onChange: (checked) => handleSphereParamChange("uniform", checked) }), jsx(SpinButtonPropertyLine, { label: "Diameter X", value: sphereParams.diameterX, min: 0, step: 0.1, onChange: (val) => handleSphereParamChange("diameterX", val), disabled: sphereParams.uniform }), jsx(SpinButtonPropertyLine, { label: "Diameter Y", value: sphereParams.diameterY, min: 0, step: 0.1, onChange: (val) => handleSphereParamChange("diameterY", val), disabled: sphereParams.uniform }), jsx(SpinButtonPropertyLine, { label: "Diameter Z", value: sphereParams.diameterZ, min: 0, step: 0.1, onChange: (val) => handleSphereParamChange("diameterZ", val), disabled: sphereParams.uniform }), jsx(SpinButtonPropertyLine, { label: "Arc", value: sphereParams.arc, min: 0, max: 1, step: 0.1, onChange: (val) => handleSphereParamChange("arc", val) }), jsx(SpinButtonPropertyLine, { label: "Slice", value: sphereParams.slice, min: 0, max: 1, step: 0.1, onChange: (val) => handleSphereParamChange("slice", val) }), jsx("div", { style: { display: "flex", justifyContent: "flex-end", gap: 8, marginTop: 16 }, children: jsx(Button, { appearance: "primary", onClick: () => {
293
+ // Create params object based on uniform checkbox
294
+ const createParams = {
295
+ segments: sphereParams.segments,
296
+ arc: sphereParams.arc,
297
+ slice: sphereParams.slice,
298
+ };
299
+ if (sphereParams.uniform) {
300
+ // If uniform is checked, use diameter
301
+ createParams.diameter = sphereParams.diameter;
302
+ }
303
+ else {
304
+ // If uniform is unchecked, use individual diameters
305
+ createParams.diameterX = sphereParams.diameterX;
306
+ createParams.diameterY = sphereParams.diameterY;
307
+ createParams.diameterZ = sphereParams.diameterZ;
308
+ }
309
+ MeshBuilder.CreateSphere(sphereParams.name, createParams, scene);
310
+ SetCamera(scene);
311
+ }, label: "Create" }) })] })] }), jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: () => {
312
+ MeshBuilder.CreateBox("Box", {}, scene);
313
+ SetCamera(scene);
314
+ }, label: "Box" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: boxParams.name, onChange: (val) => handleBoxParamChange("name", val) }), jsx(SpinButtonPropertyLine, { label: "Size", value: boxParams.size, min: 0, step: 0.1, onChange: (val) => handleBoxParamChange("size", val) }), jsx(SpinButtonPropertyLine, { label: "Width", value: boxParams.width, min: 0, step: 0.1, onChange: (val) => handleBoxParamChange("width", val) }), jsx(SpinButtonPropertyLine, { label: "Height", value: boxParams.height, min: 0, step: 0.1, onChange: (val) => handleBoxParamChange("height", val) }), jsx(SpinButtonPropertyLine, { label: "Depth", value: boxParams.depth, min: 0, step: 0.1, onChange: (val) => handleBoxParamChange("depth", val) }), jsx("div", { style: { display: "flex", justifyContent: "flex-end", gap: 8, marginTop: 16 }, children: jsx(Button, { appearance: "primary", onClick: () => {
315
+ MeshBuilder.CreateBox(boxParams.name, boxParams, scene);
316
+ SetCamera(scene);
317
+ }, label: "Create" }) })] })] }), jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: () => {
318
+ MeshBuilder.CreateCylinder("Cylinder", {}, scene);
319
+ SetCamera(scene);
320
+ }, label: "Cylinder" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: cylinderParams.name, onChange: (val) => handleCylinderParamChange("name", val) }), jsx(SpinButtonPropertyLine, { label: "Height", value: cylinderParams.height, min: 0, step: 0.1, onChange: (val) => handleCylinderParamChange("height", val) }), jsx(SpinButtonPropertyLine, { label: "Diameter Top", value: cylinderParams.diameterTop, min: 0, step: 0.1, onChange: (val) => handleCylinderParamChange("diameterTop", val) }), jsx(SpinButtonPropertyLine, { label: "Diameter Bottom", value: cylinderParams.diameterBottom, min: 0, step: 0.1, onChange: (val) => handleCylinderParamChange("diameterBottom", val) }), jsx(SpinButtonPropertyLine, { label: "Diameter", value: cylinderParams.diameter, min: 0, step: 0.1, onChange: (val) => handleCylinderParamChange("diameter", val) }), jsx(SpinButtonPropertyLine, { label: "Tessellation", value: cylinderParams.tessellation, min: 3, onChange: (val) => handleCylinderParamChange("tessellation", val) }), jsx(SpinButtonPropertyLine, { label: "Subdivisions", value: cylinderParams.subdivisions, min: 1, onChange: (val) => handleCylinderParamChange("subdivisions", val) }), jsx(SpinButtonPropertyLine, { label: "Arc", value: cylinderParams.arc, min: 0, max: 1, step: 0.1, onChange: (val) => handleCylinderParamChange("arc", val) }), jsx("div", { style: { display: "flex", justifyContent: "flex-end", gap: 8, marginTop: 16 }, children: jsx(Button, { appearance: "primary", onClick: () => {
321
+ MeshBuilder.CreateCylinder(cylinderParams.name, cylinderParams, scene);
322
+ SetCamera(scene);
323
+ }, label: "Create" }) })] })] }), jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: () => {
324
+ MeshBuilder.CreateCylinder("Cone", { diameterTop: 0 }, scene);
325
+ SetCamera(scene);
326
+ }, label: "Cone" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: coneParams.name, onChange: (val) => handleConeParamChange("name", val) }), jsx(SpinButtonPropertyLine, { label: "Height", value: coneParams.height, min: 0, step: 0.1, onChange: (val) => handleConeParamChange("height", val) }), jsx(SpinButtonPropertyLine, { label: "Diameter", value: coneParams.diameter, min: 0, step: 0.1, onChange: (val) => handleConeParamChange("diameter", val) }), jsx(SpinButtonPropertyLine, { label: "Tessellation", value: coneParams.tessellation, min: 3, onChange: (val) => handleConeParamChange("tessellation", val) }), jsx(SpinButtonPropertyLine, { label: "Subdivisions", value: coneParams.subdivisions, min: 1, onChange: (val) => handleConeParamChange("subdivisions", val) }), jsx(SpinButtonPropertyLine, { label: "Arc", value: coneParams.arc, min: 0, max: 1, step: 0.1, onChange: (val) => handleConeParamChange("arc", val) }), jsx(CheckboxPropertyLine, { label: "Up", value: coneUp, onChange: (val) => setConeUp(val) }), jsx("div", { style: { display: "flex", justifyContent: "flex-end", gap: 8, marginTop: 16 }, children: jsx(Button, { appearance: "primary", onClick: () => {
327
+ const coneParamsToUse = {
328
+ ...coneParams,
329
+ diameterTop: coneUp ? 0 : coneParams.diameterTop,
330
+ diameterBottom: coneUp ? coneParams.diameterBottom : 0,
331
+ };
332
+ MeshBuilder.CreateCylinder(coneParams.name, coneParamsToUse, scene);
333
+ SetCamera(scene);
334
+ }, label: "Create" }) })] })] }), jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: () => {
335
+ MeshBuilder.CreateGround("Ground", {}, scene);
336
+ SetCamera(scene);
337
+ }, label: "Ground" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: groundParams.name, onChange: (val) => handleGroundParamChange("name", val) }), jsx(SpinButtonPropertyLine, { label: "Width", value: groundParams.width, min: 0, step: 0.1, onChange: (val) => handleGroundParamChange("width", val) }), jsx(SpinButtonPropertyLine, { label: "Height", value: groundParams.height, min: 0, step: 0.1, onChange: (val) => handleGroundParamChange("height", val) }), jsx(SpinButtonPropertyLine, { label: "Subdivisions", value: groundParams.subdivisions, min: 1, onChange: (val) => handleGroundParamChange("subdivisions", val) }), jsx(SpinButtonPropertyLine, { label: "Subdivisions X", value: groundParams.subdivisionsX, min: 1, onChange: (val) => handleGroundParamChange("subdivisionsX", val) }), jsx(SpinButtonPropertyLine, { label: "Subdivisions Y", value: groundParams.subdivisionsY, min: 1, onChange: (val) => handleGroundParamChange("subdivisionsY", val) }), jsx("div", { style: { display: "flex", justifyContent: "flex-end", gap: 8, marginTop: 16 }, children: jsx(Button, { appearance: "primary", onClick: () => {
338
+ MeshBuilder.CreateGround(groundParams.name, groundParams, scene);
339
+ SetCamera(scene);
340
+ }, label: "Create" }) })] })] }), jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: () => {
341
+ fileInputRef.current?.click();
342
+ }, label: "Import Mesh" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: importMeshName, onChange: (val) => setImportMeshName(val) }), jsx("div", { style: { display: "flex", justifyContent: "flex-end", gap: 8 }, children: jsx(Button, { appearance: "primary", onClick: () => {
343
+ fileInputRef.current?.click();
344
+ }, label: "Import" }) })] }), jsx("input", { ref: fileInputRef, type: "file", accept: ".babylon,.glb,.gltf,.obj,.stl,.ply,.mesh,.babylonmeshdata", multiple: true, style: { display: "none" }, onChange: handleLocalMeshImport })] })] }));
345
+ };
346
+
347
+ /**
348
+ * Materials content component
349
+ * @param props - Component props
350
+ * @returns React component
351
+ */
352
+ const MaterialsContent = ({ scene }) => {
353
+ // Node Material state
354
+ const [nodeMaterialName, setNodeMaterialName] = useState("Node Material");
355
+ const [nodeMaterialSnippetId, setNodeMaterialSnippetId] = useState("");
356
+ // PBR Material state
357
+ const [pbrMaterialName, setPbrMaterialName] = useState("PBR Material");
358
+ // Standard Material state
359
+ const [standardMaterialName, setStandardMaterialName] = useState("Standard Material");
360
+ const handleCreateNodeMaterialAsync = async () => {
361
+ if (nodeMaterialSnippetId) {
362
+ try {
363
+ const nodeMaterial = await NodeMaterial.ParseFromSnippetAsync(nodeMaterialSnippetId, scene);
364
+ nodeMaterial.name = nodeMaterialName;
365
+ }
366
+ catch (e) {
367
+ alert("Failed to load Node Material from snippet: " + e);
368
+ }
369
+ }
370
+ else {
371
+ const nodeMaterial = new NodeMaterial(nodeMaterialName, scene);
372
+ nodeMaterial.build();
373
+ }
374
+ };
375
+ const handleCreatePBRMaterial = () => {
376
+ new PBRMaterial(pbrMaterialName, scene);
377
+ };
378
+ const handleCreateStandardMaterial = () => {
379
+ new StandardMaterial(standardMaterialName, scene);
380
+ };
381
+ return (jsxs(QuickCreateSection, { children: [jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: handleCreateNodeMaterialAsync, label: "Node Material" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: nodeMaterialName, onChange: (value) => setNodeMaterialName(value) }), jsx(TextInputPropertyLine, { label: "Snippet ID", value: nodeMaterialSnippetId, onChange: (value) => setNodeMaterialSnippetId(value) }), jsx(Button, { appearance: "primary", onClick: handleCreateNodeMaterialAsync, label: "Create" })] })] }), jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: handleCreatePBRMaterial, label: "PBR Material" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: pbrMaterialName, onChange: (value) => setPbrMaterialName(value) }), jsx(Button, { appearance: "primary", onClick: handleCreatePBRMaterial, label: "Create" })] })] }), jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: handleCreateStandardMaterial, label: "Standard Material" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: standardMaterialName, onChange: (value) => setStandardMaterialName(value) }), jsx(Button, { appearance: "primary", onClick: handleCreateStandardMaterial, label: "Create" })] })] })] }));
382
+ };
383
+
384
+ /**
385
+ * Lights content component
386
+ * @param props - Component props
387
+ * @returns React component
388
+ */
389
+ const LightsContent = ({ scene }) => {
390
+ // Point Light state
391
+ const [pointLightName, setPointLightName] = useState("Point Light");
392
+ const [pointLightPosition, setPointLightPosition] = useState(new Vector3(0, 5, 0));
393
+ // Directional Light state
394
+ const [directionalLightName, setDirectionalLightName] = useState("Directional Light");
395
+ const [directionalLightDirection, setDirectionalLightDirection] = useState(new Vector3(1, -1, 0));
396
+ // Spotlight state
397
+ const [spotlightName, setSpotlightName] = useState("Spotlight");
398
+ const [spotlightPosition, setSpotlightPosition] = useState(new Vector3(0, 5, 0));
399
+ const [spotlightDirection, setSpotlightDirection] = useState(new Vector3(0, -1, 0));
400
+ const [spotlightAngle, setSpotlightAngle] = useState(1);
401
+ const [spotlightExponent, setSpotlightExponent] = useState(1);
402
+ const handleCreatePointLight = () => {
403
+ const light = new PointLight(pointLightName, pointLightPosition, scene);
404
+ light.intensity = 1.0;
405
+ };
406
+ const handleCreateDirectionalLight = () => {
407
+ const dirLight = new DirectionalLight(directionalLightName, directionalLightDirection, scene);
408
+ dirLight.intensity = 1.0;
409
+ };
410
+ const handleCreateSpotlight = () => {
411
+ const spotlight = new SpotLight(spotlightName, spotlightPosition, spotlightDirection, spotlightAngle, spotlightExponent, scene);
412
+ spotlight.intensity = 1.0;
413
+ };
414
+ return (jsxs(QuickCreateSection, { children: [jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: handleCreatePointLight, label: "Point Light" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: pointLightName, onChange: (value) => setPointLightName(value) }), jsx(Vector3PropertyLine, { label: "Position", value: pointLightPosition, onChange: (value) => setPointLightPosition(value) }), jsx(Button, { appearance: "primary", onClick: handleCreatePointLight, label: "Create" })] })] }), jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: handleCreateDirectionalLight, label: "Directional Light" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: directionalLightName, onChange: (value) => setDirectionalLightName(value) }), jsx(Vector3PropertyLine, { label: "Direction", value: directionalLightDirection, onChange: (value) => setDirectionalLightDirection(value) }), jsx(Button, { appearance: "primary", onClick: handleCreateDirectionalLight, label: "Create" })] })] }), jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: handleCreateSpotlight, label: "Spotlight" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: spotlightName, onChange: (value) => setSpotlightName(value) }), jsx(Vector3PropertyLine, { label: "Position", value: spotlightPosition, onChange: (value) => setSpotlightPosition(value) }), jsx(Vector3PropertyLine, { label: "Direction", value: spotlightDirection, onChange: (value) => setSpotlightDirection(value) }), jsx(SpinButtonPropertyLine, { label: "Angle", value: spotlightAngle, onChange: (value) => setSpotlightAngle(value), min: 0, max: Math.PI, step: 0.1 }), jsx(SpinButtonPropertyLine, { label: "Exponent", value: spotlightExponent, onChange: (value) => setSpotlightExponent(value), min: 0, max: 10, step: 0.1 }), jsx(Button, { appearance: "primary", onClick: handleCreateSpotlight, label: "Create" })] })] })] }));
415
+ };
416
+
417
+ /**
418
+ * Cameras content component
419
+ * @param props - Component props
420
+ * @returns React component
421
+ */
422
+ const CamerasContent = ({ scene }) => {
423
+ // ArcRotate Camera state
424
+ const [arcRotateCameraName, setArcRotateCameraName] = useState("ArcRotate Camera");
425
+ const [arcRotateCameraTarget, setArcRotateCameraTarget] = useState(new Vector3(0, 0, 0));
426
+ const [arcRotateCameraRadius, setArcRotateCameraRadius] = useState(10);
427
+ const [arcRotateCameraAlpha, setArcRotateCameraAlpha] = useState(0);
428
+ const [arcRotateCameraBeta, setArcRotateCameraBeta] = useState(45);
429
+ const [arcRotateCameraUseRadians, setArcRotateCameraUseRadians] = useState(false);
430
+ // Universal Camera state
431
+ const [universalCameraName, setUniversalCameraName] = useState("Universal Camera");
432
+ const [universalCameraPosition, setUniversalCameraPosition] = useState(new Vector3(0, 1, -10));
433
+ // Free Camera state
434
+ const [freeCameraName, setFreeCameraName] = useState("Free Camera");
435
+ const [freeCameraPosition, setFreeCameraPosition] = useState(new Vector3(0, 1, -10));
436
+ // Follow Camera state
437
+ const [followCameraName, setFollowCameraName] = useState("Follow Camera");
438
+ const [followCameraPosition, setFollowCameraPosition] = useState(new Vector3(0, 5, -10));
439
+ const [followCameraRadius, setFollowCameraRadius] = useState(10);
440
+ const [followCameraHeightOffset, setFollowCameraHeightOffset] = useState(4);
441
+ const [followCameraRotationOffset, setFollowCameraRotationOffset] = useState(0);
442
+ // Fly Camera state
443
+ const [flyCameraName, setFlyCameraName] = useState("Fly Camera");
444
+ const [flyCameraPosition, setFlyCameraPosition] = useState(new Vector3(0, 1, -10));
445
+ // Geospatial Camera state
446
+ const [geospatialCameraName, setGeospatialCameraName] = useState("Geospatial Camera");
447
+ const [geospatialCameraPlanetRadius, setGeospatialCameraPlanetRadius] = useState(6371000);
448
+ const handleCreateArcRotateCamera = () => {
449
+ const alpha = arcRotateCameraUseRadians ? arcRotateCameraAlpha : (arcRotateCameraAlpha * Math.PI) / 180;
450
+ const beta = arcRotateCameraUseRadians ? arcRotateCameraBeta : (arcRotateCameraBeta * Math.PI) / 180;
451
+ const camera = new ArcRotateCamera(arcRotateCameraName, alpha, beta, arcRotateCameraRadius, arcRotateCameraTarget, scene);
452
+ camera.attachControl(scene.getEngine().getRenderingCanvas(), true);
453
+ if (!scene.activeCamera) {
454
+ scene.activeCamera = camera;
455
+ }
456
+ };
457
+ const handleCreateUniversalCamera = () => {
458
+ const camera = new UniversalCamera(universalCameraName, universalCameraPosition, scene);
459
+ camera.attachControl(scene.getEngine().getRenderingCanvas(), true);
460
+ if (!scene.activeCamera) {
461
+ scene.activeCamera = camera;
462
+ }
463
+ };
464
+ const handleCreateFreeCamera = () => {
465
+ const camera = new FreeCamera(freeCameraName, freeCameraPosition, scene);
466
+ camera.attachControl(scene.getEngine().getRenderingCanvas(), true);
467
+ if (!scene.activeCamera) {
468
+ scene.activeCamera = camera;
469
+ }
470
+ };
471
+ const handleCreateFollowCamera = () => {
472
+ const camera = new FollowCamera(followCameraName, followCameraPosition, scene);
473
+ camera.radius = followCameraRadius;
474
+ camera.heightOffset = followCameraHeightOffset;
475
+ camera.rotationOffset = followCameraRotationOffset;
476
+ camera.attachControl(true);
477
+ if (!scene.activeCamera) {
478
+ scene.activeCamera = camera;
479
+ }
480
+ };
481
+ const handleCreateFlyCamera = () => {
482
+ const camera = new FlyCamera(flyCameraName, flyCameraPosition, scene);
483
+ camera.attachControl(true);
484
+ if (!scene.activeCamera) {
485
+ scene.activeCamera = camera;
486
+ }
487
+ };
488
+ const handleCreateGeospatialCamera = () => {
489
+ const camera = new GeospatialCamera(geospatialCameraName, scene, { planetRadius: geospatialCameraPlanetRadius });
490
+ camera.attachControl(true);
491
+ if (!scene.activeCamera) {
492
+ scene.activeCamera = camera;
493
+ }
494
+ };
495
+ return (jsxs(QuickCreateSection, { children: [jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: handleCreateArcRotateCamera, label: "ArcRotate Camera" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: arcRotateCameraName, onChange: (value) => setArcRotateCameraName(value) }), jsx(Vector3PropertyLine, { label: "Target", value: arcRotateCameraTarget, onChange: (value) => setArcRotateCameraTarget(value) }), jsx(SpinButtonPropertyLine, { label: "Radius", value: arcRotateCameraRadius, onChange: (value) => setArcRotateCameraRadius(value), min: 0.1, max: 1000, step: 0.5 }), jsx(SpinButtonPropertyLine, { label: `Alpha ${arcRotateCameraUseRadians ? "(rad)" : "(deg)"}`, value: arcRotateCameraAlpha, onChange: (value) => setArcRotateCameraAlpha(value), min: arcRotateCameraUseRadians ? -Math.PI * 2 : -360, max: arcRotateCameraUseRadians ? Math.PI * 2 : 360, step: arcRotateCameraUseRadians ? 0.1 : 5 }), jsx(SpinButtonPropertyLine, { label: `Beta ${arcRotateCameraUseRadians ? "(rad)" : "(deg)"}`, value: arcRotateCameraBeta, onChange: (value) => setArcRotateCameraBeta(value), min: arcRotateCameraUseRadians ? 0 : 0, max: arcRotateCameraUseRadians ? Math.PI : 180, step: arcRotateCameraUseRadians ? 0.1 : 5 }), jsx(CheckboxPropertyLine, { label: "Use Radians", value: arcRotateCameraUseRadians, onChange: (value) => setArcRotateCameraUseRadians(value) }), jsx(Button, { appearance: "primary", onClick: handleCreateArcRotateCamera, label: "Create" })] })] }), jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: handleCreateUniversalCamera, label: "Universal Camera" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: universalCameraName, onChange: (value) => setUniversalCameraName(value) }), jsx(Vector3PropertyLine, { label: "Position", value: universalCameraPosition, onChange: (value) => setUniversalCameraPosition(value) }), jsx(Button, { appearance: "primary", onClick: handleCreateUniversalCamera, label: "Create" })] })] }), jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: handleCreateFreeCamera, label: "Free Camera" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: freeCameraName, onChange: (value) => setFreeCameraName(value) }), jsx(Vector3PropertyLine, { label: "Position", value: freeCameraPosition, onChange: (value) => setFreeCameraPosition(value) }), jsx(Button, { appearance: "primary", onClick: handleCreateFreeCamera, label: "Create" })] })] }), jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: handleCreateFollowCamera, label: "Follow Camera" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: followCameraName, onChange: (value) => setFollowCameraName(value) }), jsx(Vector3PropertyLine, { label: "Position", value: followCameraPosition, onChange: (value) => setFollowCameraPosition(value) }), jsx(SpinButtonPropertyLine, { label: "Radius", value: followCameraRadius, onChange: (value) => setFollowCameraRadius(value), min: 0.1, max: 1000, step: 0.5 }), jsx(SpinButtonPropertyLine, { label: "Height Offset", value: followCameraHeightOffset, onChange: (value) => setFollowCameraHeightOffset(value), min: -100, max: 100, step: 0.5 }), jsx(SpinButtonPropertyLine, { label: "Rotation Offset (deg)", value: followCameraRotationOffset, onChange: (value) => setFollowCameraRotationOffset(value), min: -180, max: 180, step: 5 }), jsx(Button, { appearance: "primary", onClick: handleCreateFollowCamera, label: "Create" })] })] }), jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: handleCreateFlyCamera, label: "Fly Camera" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: flyCameraName, onChange: (value) => setFlyCameraName(value) }), jsx(Vector3PropertyLine, { label: "Position", value: flyCameraPosition, onChange: (value) => setFlyCameraPosition(value) }), jsx(Button, { appearance: "primary", onClick: handleCreateFlyCamera, label: "Create" })] })] }), jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: handleCreateGeospatialCamera, label: "Geospatial Camera" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: geospatialCameraName, onChange: (value) => setGeospatialCameraName(value) }), jsx(SpinButtonPropertyLine, { label: "Planet Radius (m)", value: geospatialCameraPlanetRadius, onChange: (value) => setGeospatialCameraPlanetRadius(value), min: 1000, max: 100000000, step: 1000 }), jsx(Button, { appearance: "primary", onClick: handleCreateGeospatialCamera, label: "Create" })] })] })] }));
496
+ };
497
+
498
+ /**
499
+ * Particles content component
500
+ * @param props - Component props
501
+ * @returns React component
502
+ */
503
+ const ParticlesContent = ({ scene }) => {
504
+ // CPU Particle System state
505
+ const [cpuParticleSystemName, setCpuParticleSystemName] = useState("Particle System");
506
+ const [cpuParticleSystemCapacity, setCpuParticleSystemCapacity] = useState(2000);
507
+ // GPU Particle System state
508
+ const [gpuParticleSystemName, setGpuParticleSystemName] = useState("GPU Particle System");
509
+ const [gpuParticleSystemCapacity, setGpuParticleSystemCapacity] = useState(2000);
510
+ // Node Particle System state
511
+ const [nodeParticleSystemName, setNodeParticleSystemName] = useState("Node Particle System");
512
+ const [nodeParticleSystemSnippetId, setNodeParticleSystemSnippetId] = useState("");
513
+ const handleCreateCPUParticleSystem = () => {
514
+ setTimeout(() => {
515
+ const system = new ParticleSystem(cpuParticleSystemName, cpuParticleSystemCapacity, scene);
516
+ system.particleTexture = new Texture("https://assets.babylonjs.com/textures/flare.png", scene);
517
+ system.start();
518
+ }, 0);
519
+ };
520
+ const handleCreateGPUParticleSystem = () => {
521
+ if (GPUParticleSystem.IsSupported) {
522
+ setTimeout(() => {
523
+ const system = new GPUParticleSystem(gpuParticleSystemName, { capacity: gpuParticleSystemCapacity }, scene);
524
+ system.particleTexture = new Texture("https://assets.babylonjs.com/textures/flare.png", scene);
525
+ system.start();
526
+ }, 0);
527
+ }
528
+ else {
529
+ alert("GPU Particle System is not supported.");
530
+ }
531
+ };
532
+ const handleCreateNodeParticleSystemAsync = async () => {
533
+ try {
534
+ let nodeParticleSet;
535
+ const snippetId = nodeParticleSystemSnippetId.trim();
536
+ if (snippetId) {
537
+ nodeParticleSet = await NodeParticleSystemSet.ParseFromSnippetAsync(snippetId);
538
+ nodeParticleSet.name = nodeParticleSystemName;
539
+ }
540
+ else {
541
+ nodeParticleSet = NodeParticleSystemSet.CreateDefault(nodeParticleSystemName);
542
+ }
543
+ const particleSystemSet = await nodeParticleSet.buildAsync(scene);
544
+ for (const system of particleSystemSet.systems) {
545
+ system.name = nodeParticleSystemName;
546
+ }
547
+ particleSystemSet.start();
548
+ }
549
+ catch (e) {
550
+ global.console.error("Error creating Node Particle System:", e);
551
+ alert("Failed to create Node Particle System: " + e);
552
+ }
553
+ };
554
+ return (jsxs(QuickCreateSection, { children: [jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: handleCreateCPUParticleSystem, label: "CPU Particle System" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: cpuParticleSystemName, onChange: (value) => setCpuParticleSystemName(value) }), jsx(SpinButtonPropertyLine, { label: "Capacity", value: cpuParticleSystemCapacity, onChange: (value) => setCpuParticleSystemCapacity(value), min: 1, max: 100000, step: 100 }), jsx(Button, { appearance: "primary", onClick: handleCreateCPUParticleSystem, label: "Create" })] })] }), jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: handleCreateGPUParticleSystem, label: "GPU Particle System" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: gpuParticleSystemName, onChange: (value) => setGpuParticleSystemName(value) }), jsx(SpinButtonPropertyLine, { label: "Capacity", value: gpuParticleSystemCapacity, onChange: (value) => setGpuParticleSystemCapacity(value), min: 1, max: 1000000, step: 1000 }), jsx(Button, { appearance: "primary", onClick: handleCreateGPUParticleSystem, label: "Create" })] })] }), jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: handleCreateNodeParticleSystemAsync, label: "Node Particle System" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: nodeParticleSystemName, onChange: (value) => setNodeParticleSystemName(value) }), jsx(TextInputPropertyLine, { label: "Snippet ID", value: nodeParticleSystemSnippetId, onChange: (value) => setNodeParticleSystemSnippetId(value) }), jsx(Button, { appearance: "primary", onClick: handleCreateNodeParticleSystemAsync, label: "Create" })] })] })] }));
555
+ };
556
+
557
+ /**
558
+ * Rendering Pipelines content component
559
+ * @param props - Component props
560
+ * @returns React component
561
+ */
562
+ const RenderingPipelinesContent = ({ scene }) => {
563
+ // Default Rendering Pipeline state
564
+ const [defaultPipelineName, setDefaultPipelineName] = useState("Default rendering pipeline");
565
+ // SSAO Pipeline state
566
+ const [ssaoPipelineName, setSsaoPipelineName] = useState("SSAO rendering pipeline");
567
+ // SSAO2 Pipeline state
568
+ const [ssao2PipelineName, setSsao2PipelineName] = useState("SSAO2 rendering pipeline");
569
+ // SSR Pipeline state
570
+ const [ssrPipelineName, setSsrPipelineName] = useState("SSR rendering pipeline");
571
+ // IBL Shadows Pipeline state
572
+ const [iblShadowsPipelineName, setIblShadowsPipelineName] = useState("IBL Shadows rendering pipeline");
573
+ const handleCreateDefaultPipeline = () => {
574
+ new DefaultRenderingPipeline(defaultPipelineName, true, scene, scene.cameras);
575
+ };
576
+ const handleCreateSSAOPipeline = () => {
577
+ new SSAORenderingPipeline(ssaoPipelineName, scene, 1, scene.cameras);
578
+ };
579
+ const handleCreateSSAO2Pipeline = () => {
580
+ new SSAO2RenderingPipeline(ssao2PipelineName, scene, 1, scene.cameras);
581
+ };
582
+ const handleCreateSSRPipeline = () => {
583
+ new SSRRenderingPipeline(ssrPipelineName, scene, scene.cameras);
584
+ };
585
+ const handleCreateIBLShadowsPipeline = () => {
586
+ new IblShadowsRenderPipeline(iblShadowsPipelineName, scene, {}, scene.cameras);
587
+ };
588
+ const caps = scene.getEngine().getCaps();
589
+ const hasDrawBuffers = caps.drawBuffersExtension;
590
+ const hasTexelFetch = caps.texelFetch;
591
+ const camera = useProperty(scene, "activeCamera");
592
+ return (jsx(QuickCreateSection, { children: !camera ? (jsx(MessageBar, { message: "Cannot create rendering pipeline without an active camera.", title: "No active camera", intent: "info" })) : (jsxs(Fragment, { children: [jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: handleCreateDefaultPipeline, label: "Default Pipeline" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: defaultPipelineName, onChange: (value) => setDefaultPipelineName(value) }), jsx(Button, { appearance: "primary", onClick: handleCreateDefaultPipeline, label: "Create" })] })] }), jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: handleCreateSSAOPipeline, label: "SSAO Pipeline" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: ssaoPipelineName, onChange: (value) => setSsaoPipelineName(value) }), jsx(Button, { appearance: "primary", onClick: handleCreateSSAOPipeline, label: "Create" })] })] }), hasDrawBuffers && (jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: handleCreateSSAO2Pipeline, label: "SSAO2 Pipeline" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: ssao2PipelineName, onChange: (value) => setSsao2PipelineName(value) }), jsx(Button, { appearance: "primary", onClick: handleCreateSSAO2Pipeline, label: "Create" })] })] })), hasDrawBuffers && hasTexelFetch && (jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: handleCreateSSRPipeline, label: "SSR Pipeline" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: ssrPipelineName, onChange: (value) => setSsrPipelineName(value) }), jsx(Button, { appearance: "primary", onClick: handleCreateSSRPipeline, label: "Create" })] })] })), hasDrawBuffers && hasTexelFetch && (jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: handleCreateIBLShadowsPipeline, label: "IBL Shadows Pipeline" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: iblShadowsPipelineName, onChange: (value) => setIblShadowsPipelineName(value) }), jsx(Button, { appearance: "primary", onClick: handleCreateIBLShadowsPipeline, label: "Create" })] })] }))] })) }));
593
+ };
594
+
595
+ /**
596
+ * Helper to generate a unique frame graph name
597
+ * @param baseName - The base name to use
598
+ * @param scene - The scene to check for existing frame graphs
599
+ * @returns A unique name
600
+ */
601
+ function GetUniqueName(baseName, scene) {
602
+ let name = baseName;
603
+ let idSubscript = 1;
604
+ while (scene.getFrameGraphByName(name)) {
605
+ name = baseName + " " + idSubscript++;
606
+ }
607
+ return name;
608
+ }
609
+ /**
610
+ * Frame Graphs content component
611
+ * @param props - Component props
612
+ * @returns React component
613
+ */
614
+ const FrameGraphsContent = ({ scene }) => {
615
+ // Node Render Graph state
616
+ const [frameGraphName, setFrameGraphName] = useState("Frame Graph");
617
+ const handleCreateFrameGraph = () => {
618
+ const uniqueName = GetUniqueName(frameGraphName, scene);
619
+ const newNodeRenderGraph = new NodeRenderGraph(uniqueName, scene);
620
+ newNodeRenderGraph.setToDefault();
621
+ void newNodeRenderGraph.buildAsync();
622
+ };
623
+ return (jsx(QuickCreateSection, { children: jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: handleCreateFrameGraph, label: "Frame Graph" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: frameGraphName, onChange: (value) => setFrameGraphName(value) }), jsx(Button, { appearance: "primary", onClick: handleCreateFrameGraph, label: "Create" })] })] }) }));
624
+ };
625
+
626
+ /**
627
+ * Sprite Managers content component
628
+ * @param props - Component props
629
+ * @returns React component
630
+ */
631
+ const SpriteManagersContent = ({ scene }) => {
632
+ // Sprite Manager state
633
+ const [spriteManagerName, setSpriteManagerName] = useState("Sprite Manager");
634
+ const [spriteManagerCapacity, setSpriteManagerCapacity] = useState(500);
635
+ const [spriteManagerCellSize, setSpriteManagerCellSize] = useState(64);
636
+ const [spriteManagerTextureUrl, setSpriteManagerTextureUrl] = useState("https://assets.babylonjs.com/textures/player.png");
637
+ const handleCreateSpriteManager = () => {
638
+ new SpriteManager(spriteManagerName, spriteManagerTextureUrl, spriteManagerCapacity, spriteManagerCellSize, scene);
639
+ };
640
+ return (jsx(QuickCreateSection, { children: jsxs(QuickCreateRow, { children: [jsx(Button, { onClick: handleCreateSpriteManager, label: "Sprite Manager" }), jsxs(SettingsPopover, { children: [jsx(TextInputPropertyLine, { label: "Name", value: spriteManagerName, onChange: (value) => setSpriteManagerName(value) }), jsx(TextInputPropertyLine, { label: "Texture URL", value: spriteManagerTextureUrl, onChange: (value) => setSpriteManagerTextureUrl(value) }), jsx(SpinButtonPropertyLine, { label: "Capacity", value: spriteManagerCapacity, onChange: (value) => setSpriteManagerCapacity(value), min: 1, max: 10000, step: 100 }), jsx(SpinButtonPropertyLine, { label: "Cell Size", value: spriteManagerCellSize, onChange: (value) => setSpriteManagerCellSize(value), min: 1, max: 1024, step: 1 }), jsx(Button, { appearance: "primary", onClick: handleCreateSpriteManager, label: "Create" })] })] }) }));
641
+ };
642
+
643
+ // TODO: This is just a placeholder for a dynamically installed extension that brings in asset creation tools (node materials, etc.).
644
+ const CreateToolsServiceDefinition = {
645
+ friendlyName: "Creation Tools",
646
+ consumes: [ShellServiceIdentity, SceneContextIdentity],
647
+ factory: (shellService, sceneContext) => {
648
+ const registration = shellService.addSidePane({
649
+ key: "Create",
650
+ title: "Creation Tools",
651
+ icon: CollectionsAdd20Regular,
652
+ horizontalLocation: "left",
653
+ verticalLocation: "top",
654
+ content: () => {
655
+ const scene = useObservableState(() => sceneContext.currentScene, sceneContext.currentSceneObservable);
656
+ return (scene && (jsx(Fragment, { children: jsxs(Accordion, { children: [jsx(AccordionSection, { title: "Meshes", children: jsx(MeshesContent, { scene: scene }) }), jsx(AccordionSection, { title: "Materials", children: jsx(MaterialsContent, { scene: scene }) }), jsx(AccordionSection, { title: "Lights", children: jsx(LightsContent, { scene: scene }) }), jsx(AccordionSection, { title: "Particles", children: jsx(ParticlesContent, { scene: scene }) }), jsx(AccordionSection, { title: "Cameras", children: jsx(CamerasContent, { scene: scene }) }), jsx(AccordionSection, { title: "Rendering Pipelines", children: jsx(RenderingPipelinesContent, { scene: scene }) }), jsx(AccordionSection, { title: "Frame Graphs", children: jsx(FrameGraphsContent, { scene: scene }) }), jsx(AccordionSection, { title: "Sprite Managers", children: jsx(SpriteManagersContent, { scene: scene }) })] }) })));
657
+ },
658
+ });
659
+ return {
660
+ dispose: () => registration.dispose(),
661
+ };
662
+ },
663
+ };
664
+ var quickCreateToolsService = {
665
+ serviceDefinitions: [CreateToolsServiceDefinition],
666
+ };
667
+
668
+ export { CreateToolsServiceDefinition, quickCreateToolsService as default };
669
+ //# sourceMappingURL=quickCreateToolsService-hEV1m5Nc.js.map