sceneview-mcp 4.0.15 → 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.
@@ -4,8 +4,16 @@
4
4
  * Setup guides for every supported SceneView platform.
5
5
  * Consolidates Android, iOS, Web, Flutter, React Native, Desktop, and TV.
6
6
  */
7
- import { LATEST_SCENEVIEW_RELEASE } from "./generated/version.js";
8
- export const PLATFORM_IDS = ["android", "ios", "web", "flutter", "react-native", "desktop", "tv"];
7
+ import { IOS_NODE_TYPE_COUNT, LATEST_FLUTTER_PUB_RELEASE, LATEST_SCENEVIEW_RELEASE, } from "./generated/version.js";
8
+ export const PLATFORM_IDS = [
9
+ "android",
10
+ "ios",
11
+ "web",
12
+ "flutter",
13
+ "react-native",
14
+ "desktop",
15
+ "tv",
16
+ ];
9
17
  const ANDROID_3D = `## SceneView Android — 3D Setup
10
18
 
11
19
  ### 1. Gradle Dependencies
@@ -248,7 +256,7 @@ struct ContentView: View {
248
256
 
249
257
  ### 5. Available Node Types
250
258
 
251
- SceneViewSwift provides 16 node types:
259
+ SceneViewSwift provides ${IOS_NODE_TYPE_COUNT} node types:
252
260
 
253
261
  | Node | Purpose |
254
262
  |------|---------|
@@ -262,11 +270,15 @@ SceneViewSwift provides 16 node types:
262
270
  | \`LineNode\` | Line segments between 3D points |
263
271
  | \`PathNode\` | Connected line paths through multiple points |
264
272
  | \`MeshNode\` | Custom mesh geometry with vertex data |
273
+ | \`ShapeNode\` | 2D polygon shapes, flat or extruded |
274
+ | \`ViewNode\` | Placeholder plane for embedding a SwiftUI view (content not rendered yet) |
275
+ | \`SpatialAudioNode\` | Positional 3D audio source |
265
276
  | \`PhysicsNode\` | Rigid-body physics (dynamic, static, kinematic) |
266
277
  | \`DynamicSkyNode\` | Time-of-day sun simulation |
267
278
  | \`FogNode\` | Atmospheric fog effects |
268
279
  | \`ReflectionProbeNode\` | Local environment reflection captures |
269
280
  | \`CameraNode\` | Programmatic camera control |
281
+ | \`AnchorNode\` | AR world / plane anchor for placing content |
270
282
  | \`AugmentedImageNode\` | AR image detection and tracking (iOS only) |`;
271
283
  const IOS_AR = `## SceneViewSwift — iOS AR Setup
272
284
 
@@ -339,16 +351,19 @@ SceneView Web uses **Filament.js** — the same rendering engine as Android, com
339
351
  ### 1. Install
340
352
 
341
353
  \`\`\`bash
342
- npm install @sceneview/sceneview-web
354
+ npm install sceneview-web
343
355
  \`\`\`
344
356
 
345
- Or in a Kotlin/JS Gradle project:
357
+ The npm package is the prebuilt browser bundle (global \`sceneview\` namespace).
358
+ For the Kotlin API (\`io.github.sceneview.web.SceneView\`), depend on the module
359
+ itself from a Kotlin/JS Gradle build — \`sceneview-web\` ships on npm only and has
360
+ no Maven coordinate, so it cannot be resolved as a Gradle module dependency:
346
361
  \`\`\`kotlin
347
362
  kotlin {
348
363
  js(IR) { browser(); binaries.executable() }
349
364
  sourceSets {
350
365
  jsMain.dependencies {
351
- implementation("@sceneview/sceneview-web")
366
+ implementation(project(":sceneview-web"))
352
367
  }
353
368
  }
354
369
  }
@@ -421,7 +436,7 @@ SceneView Flutter uses **PlatformView** to embed native SceneView (Android: Fila
421
436
  \`\`\`yaml
422
437
  # pubspec.yaml
423
438
  dependencies:
424
- flutter_sceneview: ^${LATEST_SCENEVIEW_RELEASE}
439
+ flutter_sceneview: ^${LATEST_FLUTTER_PUB_RELEASE}
425
440
  \`\`\`
426
441
 
427
442
  ### 2. Android Setup
@@ -441,32 +456,60 @@ android {
441
456
 
442
457
  ### 3. iOS Setup
443
458
 
444
- In \`ios/Podfile\`:
459
+ Both lines in \`ios/Podfile\` are required — skipping the second one fails the
460
+ build with \`Unable to find a specification for 'SceneViewSwift'\`:
461
+
445
462
  \`\`\`ruby
446
463
  platform :ios, '18.0'
464
+
465
+ target 'Runner' do
466
+ use_frameworks!
467
+ pod 'SceneViewSwift',
468
+ :podspec => 'https://raw.githubusercontent.com/sceneview/sceneview/main/SceneViewSwift.podspec'
469
+ flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
470
+ end
447
471
  \`\`\`
448
472
 
473
+ Adding \`SceneViewSwift\` as a **Swift package** in Xcode does not work: the bridge
474
+ is itself a pod and compiles inside the generated \`Pods.xcodeproj\`, which cannot
475
+ see a package added to \`Runner.xcodeproj\`. \`:podspec\` reads from the mutable
476
+ \`main\` branch because no released tag carries the root podspec yet; the sources
477
+ it pulls are tag-pinned via \`s.source\`, and this becomes a tagged coordinate once
478
+ a release includes it.
479
+
449
480
  ### 4. Basic 3D Scene
450
481
 
451
482
  \`\`\`dart
452
- import 'package:sceneview_flutter/sceneview_flutter.dart';
483
+ import 'package:flutter/foundation.dart' show TargetPlatform, defaultTargetPlatform;
484
+ import 'package:flutter_sceneview/flutter_sceneview.dart';
453
485
 
454
486
  class My3DScreen extends StatelessWidget {
455
487
  @override
456
488
  Widget build(BuildContext context) {
489
+ // Not one path for both: Filament reads glTF/GLB, RealityKit reads USDZ and
490
+ // cannot read glTF at all. A hardcoded .glb compiles and renders nothing on iOS.
491
+ // Branch on defaultTargetPlatform, never on dart:io's Platform — importing
492
+ // dart:io makes the file uncompilable on Flutter web.
493
+ final model = defaultTargetPlatform == TargetPlatform.iOS
494
+ ? 'models/chair.usdz'
495
+ : 'models/chair.glb';
496
+
457
497
  return SceneView(
458
- modelUrl: 'assets/models/chair.glb', // Android: GLB, iOS: USDZ
459
- environment: 'assets/environments/sky_2k.hdr',
460
- cameraOrbit: true,
461
- scaleToUnits: 1.0,
462
- onModelLoaded: (controller) {
463
- print('Model loaded');
464
- },
498
+ initialModels: [
499
+ ModelNode(modelPath: model, x: 0, y: 0, z: -2, scale: 1.0),
500
+ ],
501
+ // Android only today — the iOS path is wired but no entity resolves, so
502
+ // this never fires (#3045). Not the shared RealityKit hit test: React
503
+ // Native reaches the same hook and fires on iOS (#3086).
504
+ onTap: (nodeName) => print('tapped: $nodeName'),
465
505
  );
466
506
  }
467
507
  }
468
508
  \`\`\`
469
509
 
510
+ For imperative loading, attach a \`SceneViewController\` via \`onViewCreated\` and
511
+ call \`loadModel\` / \`setEnvironment\` / \`clearScene\` on it.
512
+
470
513
  ### 5. Platform Differences
471
514
 
472
515
  | Feature | Android | iOS |
@@ -481,7 +524,7 @@ const FLUTTER_AR = `## SceneView Flutter — AR Setup
481
524
  \`\`\`yaml
482
525
  # pubspec.yaml — published on pub.dev (the names sceneview / sceneview_flutter are unrelated third-party uploads)
483
526
  dependencies:
484
- flutter_sceneview: ^${LATEST_SCENEVIEW_RELEASE}
527
+ flutter_sceneview: ^${LATEST_FLUTTER_PUB_RELEASE}
485
528
  \`\`\`
486
529
 
487
530
  ### 2. Android Manifest
@@ -494,29 +537,50 @@ dependencies:
494
537
  </application>
495
538
  \`\`\`
496
539
 
497
- ### 3. iOS Info.plist
540
+ ### 3. iOS Setup
541
+
542
+ Both lines in \`ios/Podfile\` are required — skipping the second one fails the
543
+ build with \`Unable to find a specification for 'SceneViewSwift'\`:
544
+
545
+ \`\`\`ruby
546
+ platform :ios, '18.0'
547
+
548
+ target 'Runner' do
549
+ use_frameworks!
550
+ pod 'SceneViewSwift',
551
+ :podspec => 'https://raw.githubusercontent.com/sceneview/sceneview/main/SceneViewSwift.podspec'
552
+ flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
553
+ end
554
+ \`\`\`
555
+
556
+ Adding \`SceneViewSwift\` as a **Swift package** in Xcode does not work: the bridge
557
+ is itself a pod and compiles inside the generated \`Pods.xcodeproj\`, which cannot
558
+ see a package added to \`Runner.xcodeproj\`. \`:podspec\` reads from the mutable
559
+ \`main\` branch because no released tag carries the root podspec yet; the sources
560
+ it pulls are tag-pinned via \`s.source\`, and this becomes a tagged coordinate once
561
+ a release includes it.
562
+
563
+ ### 4. iOS Info.plist
498
564
 
499
565
  \`\`\`xml
500
566
  <key>NSCameraUsageDescription</key>
501
567
  <string>This app uses the camera for augmented reality.</string>
502
568
  \`\`\`
503
569
 
504
- ### 4. Basic AR Scene
570
+ ### 5. Basic AR Scene
505
571
 
506
572
  \`\`\`dart
507
- import 'package:sceneview_flutter/sceneview_flutter.dart';
573
+ import 'package:flutter_sceneview/flutter_sceneview.dart';
508
574
 
509
575
  class MyARScreen extends StatelessWidget {
510
576
  @override
511
577
  Widget build(BuildContext context) {
512
578
  return ARSceneView(
513
- modelUrl: 'assets/models/robot.glb',
514
- planeDetection: PlaneDetection.horizontal,
515
- tapToPlace: true,
516
- scaleToUnits: 0.5,
517
- onAnchorCreated: (anchor) {
518
- print('Object placed at: \${anchor.position}');
519
- },
579
+ planeDetection: true,
580
+ onPlaneDetected: (planeType) => print('plane: $planeType'),
581
+ // Android only: SceneViewSwift's ARSceneView exposes no entity
582
+ // hit-test hook, so on iOS this never fires (#2051).
583
+ onTap: (nodeName) => print('tapped: $nodeName'),
520
584
  );
521
585
  }
522
586
  }
@@ -528,7 +592,9 @@ SceneView React Native uses **Fabric/Turbo** to bridge to native SceneView.
528
592
  ### 1. Install
529
593
 
530
594
  \`\`\`bash
531
- npm install @sceneview/react-native
595
+ npm install @sceneview-sdk/react-native
596
+ # iOS: edit ios/Podfile as in step 3 FIRST — a stock Podfile makes this
597
+ # \`pod install\` fail with "Unable to find a specification for 'SceneViewSwift'"
532
598
  cd ios && pod install
533
599
  \`\`\`
534
600
 
@@ -545,25 +611,33 @@ android {
545
611
 
546
612
  ### 3. iOS Setup
547
613
 
548
- In \`ios/Podfile\`:
614
+ In \`ios/Podfile\` — both lines, before \`pod install\`. \`SceneViewSwift\` is not on
615
+ the CocoaPods trunk, so the module's \`s.dependency\` on it cannot resolve without
616
+ an explicit coordinate (use \`:path => '<repo-root>'\` from a checkout), and a
617
+ stock React Native Podfile's 13.4 target is below its iOS 18.0 floor. A Swift
618
+ package added in Xcode does not work here: this module compiles inside
619
+ \`Pods.xcodeproj\`, which cannot see the host project's packages.
549
620
  \`\`\`ruby
550
621
  platform :ios, '18.0'
622
+ pod 'SceneViewSwift',
623
+ :podspec => 'https://raw.githubusercontent.com/sceneview/sceneview/main/SceneViewSwift.podspec'
551
624
  \`\`\`
552
625
 
553
626
  ### 4. Basic 3D Scene
554
627
 
555
628
  \`\`\`tsx
556
- import { SceneView } from '@sceneview/react-native';
629
+ import { SceneView } from '@sceneview-sdk/react-native';
557
630
 
558
631
  export default function My3DScreen() {
559
632
  return (
560
633
  <SceneView
561
634
  style={{ flex: 1 }}
562
- modelUrl={require('./assets/models/chair.glb')}
563
- environment={require('./assets/environments/sky_2k.hdr')}
564
- cameraOrbit={true}
565
- scaleToUnits={1.0}
566
- onModelLoaded={() => console.log('Model loaded')}
635
+ modelNodes={[{ src: 'models/chair.glb', position: [0, 0, -1], scale: 1.0 }]}
636
+ environment="environments/sky_2k.hdr"
637
+ cameraControlMode="orbit"
638
+ // Fires on Android and iOS — the iOS half is measured (#3086). Only the
639
+ // Flutter bridge's 3D onTap is still dead on iOS (#3045).
640
+ onTap={(e) => console.log(e.nativeEvent.nodeName)}
567
641
  />
568
642
  );
569
643
  }
@@ -580,8 +654,21 @@ const REACT_NATIVE_AR = `## SceneView React Native — AR Setup
580
654
 
581
655
  ### 1. Install
582
656
 
657
+ Both \`ios/Podfile\` lines are required before \`pod install\`: \`SceneViewSwift\` is
658
+ not on the CocoaPods trunk, so the module's \`s.dependency\` on it cannot resolve
659
+ without an explicit coordinate, and a stock React Native Podfile's 13.4
660
+ deployment target is below its iOS 18.0 floor. A Swift package added in Xcode
661
+ does not replace that line — this module compiles inside \`Pods.xcodeproj\`,
662
+ which cannot see the host project's packages.
663
+
664
+ \`\`\`ruby
665
+ platform :ios, '18.0'
666
+ pod 'SceneViewSwift',
667
+ :podspec => 'https://raw.githubusercontent.com/sceneview/sceneview/main/SceneViewSwift.podspec'
668
+ \`\`\`
669
+
583
670
  \`\`\`bash
584
- npm install @sceneview/react-native
671
+ npm install @sceneview-sdk/react-native
585
672
  cd ios && pod install
586
673
  \`\`\`
587
674
 
@@ -607,17 +694,22 @@ Add to \`Info.plist\`:
607
694
  ### 4. Basic AR Scene
608
695
 
609
696
  \`\`\`tsx
610
- import { ARSceneView } from '@sceneview/react-native';
697
+ import { ARSceneView } from '@sceneview-sdk/react-native';
611
698
 
612
699
  export default function MyARScreen() {
613
700
  return (
614
701
  <ARSceneView
615
702
  style={{ flex: 1 }}
616
- modelUrl={require('./assets/models/robot.glb')}
617
- planeDetection="horizontal"
618
- tapToPlace={true}
619
- scaleToUnits={0.5}
620
- onAnchorCreated={(anchor) => console.log('Placed:', anchor)}
703
+ modelNodes={[{ src: 'models/robot.glb', scale: 0.5 }]}
704
+ planeDetection={true}
705
+ // Declared so the API surface is stable, but NOT bridged natively yet:
706
+ // setting it true changes nothing today (#909). Left explicitly false so
707
+ // nobody ships an app that silently expects LiDAR occlusion.
708
+ depthOcclusion={false}
709
+ onPlaneDetected={(e) => console.log(e.nativeEvent.type)}
710
+ // Android only: SceneViewSwift's ARSceneView exposes no entity
711
+ // hit-test hook, so on iOS this never fires (#2051).
712
+ onTap={(e) => console.log(e.nativeEvent.nodeName)}
621
713
  />
622
714
  );
623
715
  }
@@ -637,32 +729,31 @@ plugins {
637
729
 
638
730
  dependencies {
639
731
  implementation(compose.desktop.currentOs)
640
- implementation("io.github.sceneview:sceneview-desktop:${LATEST_SCENEVIEW_RELEASE}") // when published
732
+ // NOTE: there is no published \`io.github.sceneview:sceneview-desktop\`
733
+ // artifact. Desktop is a Compose Canvas placeholder living in
734
+ // \`samples/desktop-demo\`, not a library you can depend on yet.
641
735
  }
642
736
  \`\`\`
643
737
 
644
738
  ### 2. Basic Desktop Scene
645
739
 
740
+ There is no \`SceneView\` composable on desktop. The sample draws its wireframe
741
+ with a plain Compose \`Canvas\`, so the starting point is ordinary Compose
742
+ Desktop — copy \`samples/desktop-demo/src/desktopMain/kotlin/io/github/sceneview/desktop/Main.kt\`
743
+ rather than importing a SceneView type that does not exist.
744
+
646
745
  \`\`\`kotlin
647
746
  import androidx.compose.ui.window.Window
648
747
  import androidx.compose.ui.window.application
649
- import { LATEST_SCENEVIEW_RELEASE } from "./generated/version.js";
650
748
 
651
749
  fun main() = application {
652
750
  Window(
653
751
  onCloseRequest = ::exitApplication,
654
752
  title = "SceneView Desktop"
655
753
  ) {
656
- // Current: software wireframe renderer
657
- DesktopScene(
658
- modifier = Modifier.fillMaxSize(),
659
- shapes = listOf(
660
- WireframeCube(position = Float3(0f, 0f, 0f), size = 1f),
661
- WireframeSphere(position = Float3(2f, 0f, 0f), radius = 0.5f)
662
- ),
663
- cameraOrbit = true,
664
- backgroundColor = Color(0xFF1A1A2E)
665
- )
754
+ // From samples/desktop-demo — a Compose Canvas animating a wireframe,
755
+ // NOT a Filament scene. The only public entry point that exists today.
756
+ WireframeCubeViewer()
666
757
  }
667
758
  }
668
759
  \`\`\`
@@ -754,14 +845,14 @@ const SETUPS = {
754
845
  android: {
755
846
  name: "Android (Jetpack Compose)",
756
847
  renderer: "Filament (OpenGL ES / Vulkan)",
757
- status: "Stable (v${LATEST_SCENEVIEW_RELEASE})",
848
+ status: `Stable (v${LATEST_SCENEVIEW_RELEASE})`,
758
849
  guide3d: ANDROID_3D,
759
850
  guideAr: ANDROID_AR,
760
851
  },
761
852
  ios: {
762
853
  name: "iOS / macOS / visionOS (SwiftUI)",
763
854
  renderer: "RealityKit (Metal)",
764
- status: "Alpha (v${LATEST_SCENEVIEW_RELEASE})",
855
+ status: `Alpha (v${LATEST_SCENEVIEW_RELEASE})`,
765
856
  guide3d: IOS_3D,
766
857
  guideAr: IOS_AR,
767
858
  },
@@ -818,5 +909,7 @@ export function listPlatforms() {
818
909
  const s = SETUPS[id];
819
910
  return `| ${s.name} | ${s.renderer} | ${s.status} | Yes | ${s.guideAr ? "Yes" : "No"} |`;
820
911
  }).join("\n");
821
- return header + rows + "\n\nUse `get_platform_setup` with a specific platform for full setup instructions.";
912
+ return (header +
913
+ rows +
914
+ "\n\nUse `get_platform_setup` with a specific platform for full setup instructions.");
822
915
  }