11import { Camera , Engine , Vector3 , Matrix } from '@babylonjs/core' ;
2- import * as Cesium from 'cesium' ;
2+ import {
3+ Ion ,
4+ IonResource ,
5+ Cartesian3 ,
6+ Cartographic ,
7+ Ellipsoid ,
8+ PerspectiveFrustum ,
9+ SceneMode ,
10+ JulianDate ,
11+ GeographicProjection
12+ } from 'cesium' ;
13+
14+ // Import internal Cesium classes that may not be publicly exported
15+ import * as CesiumInternal from 'cesium' ;
316
417import { SimpleBabylonTileContent } from './SimpleBabylonTileContent' ;
518
619//This can go away after PR to cesium is accepted
7- import CesiumTilesetDerived from './cesium_derived/CesiumTilesetDerived.js' ;
20+ //import CesiumTilesetDerived from './cesium_derived/CesiumTilesetDerived.js';
21+ import CesiumTilesetDerived from './cesium_derived/Cesium3DTileset' ;
822
923import { DebugVisualization } from './DebugVisualization' ;
1024
@@ -38,8 +52,8 @@ export class SimpleIntegration {
3852
3953 // Set up Cesium Ion authentication using native Cesium
4054 // TODO: Update with your new Cesium Ion token from https://cesium.com/ion/tokens
41- Cesium . Ion . defaultAccessToken =
42- 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI4ZWNjOTdkOS03ODQ2LTRiYzAtOGNiZC0yMmUwY2ZiOTM2M2MiLCJpZCI6MjIwODczLCJpYXQiOjE3NjQ2OTMxODh9.QlACQnWP4oWZCFQKuR2FXWw_KiLJwm9wsg6U6ynqIw4 ' ;
55+ Ion . defaultAccessToken =
56+ 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI4OWQ5MDg2Mi02MDRmLTRhMWItYjZjZS1mMGE3YWI1MDAyOWYiLCJpZCI6MjIwODczLCJpYXQiOjE3NjQ4NjgxNDh9.Grk7U6JuiU7YNrP5bjCAsrifDqBJIxtQZF4Lf52ocMo ' ;
4357
4458 // BABYLON.JS: Set up proper Cesium content factory registration
4559 this . setupBabylonContentFactory ( ) ;
@@ -49,8 +63,8 @@ export class SimpleIntegration {
4963
5064 // Create reusable pass state exactly like Cesium Scene does
5165 // Access internal classes through Cesium namespace
52- const Cesium3DTilePassState = ( Cesium as any ) . Cesium3DTilePassState ;
53- const Cesium3DTilePass = ( Cesium as any ) . Cesium3DTilePass ;
66+ const Cesium3DTilePassState = ( CesiumInternal as any ) . Cesium3DTilePassState ;
67+ const Cesium3DTilePass = ( CesiumInternal as any ) . Cesium3DTilePass ;
5468
5569 this . renderTilesetPassState = new Cesium3DTilePassState ( {
5670 pass : Cesium3DTilePass . RENDER ,
@@ -72,36 +86,36 @@ export class SimpleIntegration {
7286 const babylonUp = this . camera . upVector || Vector3 . Up ( ) ;
7387
7488 // Simple coordinate transformation: Babylon → Cesium ECEF
75- const position = new Cesium . Cartesian3 ( babylonPos . x , - babylonPos . z , babylonPos . y ) ;
89+ const position = new Cartesian3 ( babylonPos . x , - babylonPos . z , babylonPos . y ) ;
7690
7791 // Transform direction vector (from camera toward target)
78- const direction = new Cesium . Cartesian3 ( babylonDir . x , - babylonDir . z , babylonDir . y ) ;
79- Cesium . Cartesian3 . normalize ( direction , direction ) ;
92+ const direction = new Cartesian3 ( babylonDir . x , - babylonDir . z , babylonDir . y ) ;
93+ Cartesian3 . normalize ( direction , direction ) ;
8094
81- const up = new Cesium . Cartesian3 ( babylonUp . x , - babylonUp . z , babylonUp . y ) ;
82- Cesium . Cartesian3 . normalize ( up , up ) ;
95+ const up = new Cartesian3 ( babylonUp . x , - babylonUp . z , babylonUp . y ) ;
96+ Cartesian3 . normalize ( up , up ) ;
8397
8498 // Calculate right vector
85- const right = new Cesium . Cartesian3 ( ) ;
86- Cesium . Cartesian3 . cross ( direction , up , right ) ;
87- Cesium . Cartesian3 . normalize ( right , right ) ;
99+ const right = new Cartesian3 ( ) ;
100+ Cartesian3 . cross ( direction , up , right ) ;
101+ Cartesian3 . normalize ( right , right ) ;
88102
89103 // Recalculate up to ensure orthogonality
90- Cesium . Cartesian3 . cross ( right , direction , up ) ;
91- Cesium . Cartesian3 . normalize ( up , up ) ;
104+ Cartesian3 . cross ( right , direction , up ) ;
105+ Cartesian3 . normalize ( up , up ) ;
92106
93107 // Create frustum
94- const frustum = new Cesium . PerspectiveFrustum ( {
108+ const frustum = new PerspectiveFrustum ( {
95109 fov : this . camera . fov ,
96110 aspectRatio : this . engine . getRenderWidth ( ) / this . engine . getRenderHeight ( ) ,
97111 near : this . camera . minZ , // Now consistent: both use 0.1
98112 far : this . camera . maxZ ,
99113 } ) ;
100114
101115 // Calculate cartographic position for geographic reference
102- const positionCartographic = Cesium . Cartographic . fromCartesian (
116+ const positionCartographic = Cartographic . fromCartesian (
103117 position ,
104- Cesium . Ellipsoid . WGS84
118+ Ellipsoid . WGS84
105119 ) ;
106120
107121 return {
@@ -134,11 +148,12 @@ export class SimpleIntegration {
134148 ) : Promise < void > {
135149 try {
136150 // Use standard Cesium Ion asset loading
137- const resource = await Cesium . IonResource . fromAssetId ( assetId ) ;
151+ const resource = await IonResource . fromAssetId ( assetId ) ;
138152
139153 this . cesiumTileset = ( await CesiumTilesetDerived . fromUrl ( resource , {
140154 show : true ,
141155 shadows : 1 ,
156+ disableDynamicMapManager : true
142157 } ) ) as CesiumTilesetDerived ;
143158
144159 await this . cesiumTileset . readyPromise ;
@@ -201,14 +216,14 @@ export class SimpleIntegration {
201216 drawingBufferHeight : this . engine . getRenderHeight ( ) ,
202217 } ,
203218 cullingVolume : cullingVolume ,
204- mode : Cesium . SceneMode . SCENE3D ,
219+ mode : SceneMode . SCENE3D ,
205220 frameNumber : ++ this . frameCount ,
206221 // CRITICAL: Add JulianDate time for BaseTraversal tile prioritization
207- time : Cesium . JulianDate . now ( ) ,
222+ time : JulianDate . now ( ) ,
208223 // CESIUM EXACT: newFrame flag - true only for actual new frames
209224 newFrame : this . frameCount !== this . lastFrameNumber ,
210225 // CRITICAL: Add pass information that SkipTraversal needs
211- pass : ( Cesium as any ) . Pass ? ( Cesium as any ) . Pass . RENDER : 0 ,
226+ pass : ( CesiumInternal as any ) . Pass ? ( CesiumInternal as any ) . Pass . RENDER : 0 ,
212227 // Let Cesium use its default maximumScreenSpaceError for Google tiles
213228 tilesetPassState : this . renderTilesetPassState , // Required by CesiumTilesetDerived
214229 // CREDIT DISPLAY: Add credits as HTML comments once
@@ -219,7 +234,7 @@ export class SimpleIntegration {
219234 } ,
220235 // Additional properties from working commit 72dfb2e:
221236 pixelRatio : 1.0 ,
222- mapProjection : new Cesium . GeographicProjection ( ) ,
237+ mapProjection : new GeographicProjection ( ) ,
223238 verticalExaggeration : 1.0 ,
224239 verticalExaggerationRelativeHeight : 0.0 ,
225240 commandList : [ ] ,
@@ -233,12 +248,12 @@ export class SimpleIntegration {
233248 try {
234249 // Set up load timestamp if needed (from prePassesUpdate)
235250 if ( ! ( this . cesiumTileset as any ) . _loadTimestamp ) {
236- ( this . cesiumTileset as any ) . _loadTimestamp = Cesium . JulianDate . clone ( frameState . time ) ;
251+ ( this . cesiumTileset as any ) . _loadTimestamp = JulianDate . clone ( frameState . time ) ;
237252 }
238253
239254 // Calculate time since load (from prePassesUpdate)
240255 const timeSinceLoad = Math . max (
241- Cesium . JulianDate . secondsDifference (
256+ JulianDate . secondsDifference (
242257 frameState . time ,
243258 ( this . cesiumTileset as any ) . _loadTimestamp
244259 ) * 1000 ,
@@ -279,7 +294,7 @@ export class SimpleIntegration {
279294 * BABYLON.JS: Set up proper Cesium content factory to create BabylonTileContent
280295 */
281296 private setupBabylonContentFactory ( ) : void {
282- const Cesium3DTileContentFactory = ( Cesium as any ) . Cesium3DTileContentFactory ;
297+ const Cesium3DTileContentFactory = ( CesiumInternal as any ) . Cesium3DTileContentFactory ;
283298 const babylonScene = this . camera . getScene ( ) ;
284299
285300 Cesium3DTileContentFactory . b3dm = function (
@@ -315,7 +330,7 @@ export class SimpleIntegration {
315330 * CRITICAL FIX: Optimize RequestScheduler for Google 3D Tiles massive tile hierarchy
316331 */
317332 private optimizeRequestSchedulerForGoogle3DTiles ( ) : void {
318- const RequestScheduler = ( Cesium as any ) . RequestScheduler ;
333+ const RequestScheduler = ( CesiumInternal as any ) . RequestScheduler ;
319334 if ( ! RequestScheduler ) return ;
320335
321336 RequestScheduler . maximumRequests = 100 ;
0 commit comments