Skip to content

Commit

Permalink
Merge pull request #301 from jesse-small/jcs-export-cesiumRTCExtension
Browse files Browse the repository at this point in the history
Exporting GLTFCesiumRTCExtension
  • Loading branch information
gkjohnson authored Nov 8, 2022
2 parents 15a0e1d + 2672393 commit 62e3762
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export { B3DMLoader } from './three/B3DMLoader';
export { I3DMLoader } from './three/I3DMLoader';
export { PNTSLoader } from './three/PNTSLoader';
export { CMPTLoader } from './three/CMPTLoader';
export { GLTFCesiumRTCExtension } from './three/GLTFCesiumRTCExtension';
export { GLTFExtensionLoader } from './three/GLTFExtensionLoader';
export { Ellipsoid } from './three/math/Ellipsoid';
export { EllipsoidRegion } from './three/math/EllipsoidRegion';
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export { B3DMLoader } from './three/B3DMLoader.js';
export { PNTSLoader } from './three/PNTSLoader.js';
export { I3DMLoader } from './three/I3DMLoader.js';
export { CMPTLoader } from './three/CMPTLoader.js';
export { GLTFCesiumRTCExtension } from './three/GLTFCesiumRTCExtension.js';
export { GLTFExtensionLoader } from './three/GLTFExtensionLoader.js';
export { EllipsoidRegionHelper, EllipsoidRegionLineHelper } from './three/objects/EllipsoidRegionHelper.js';
export { SphereHelper } from './three/objects/SphereHelper.js';
Expand Down
2 changes: 1 addition & 1 deletion src/three/GLTFCesiumRTCExtension.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader';

export default class GLTFCesiumRTCExtension{
export class GLTFCesiumRTCExtension{
name: 'CESIUM_RTC';

afterRoot(result: GLTF): null
Expand Down
20 changes: 14 additions & 6 deletions src/three/GLTFCesiumRTCExtension.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

export default class GLTFCesiumRTCExtension {
export class GLTFCesiumRTCExtension {

constructor() {

Expand All @@ -9,10 +8,19 @@ export default class GLTFCesiumRTCExtension {

afterRoot( res ) {

const { center } = res.parser.json.extensions.CESIUM_RTC;
res.scene.position.x += center[ 0 ];
res.scene.position.y += center[ 1 ];
res.scene.position.z += center[ 2 ];
if ( res.parser.json.extensions && res.parser.json.extensions.CESIUM_RTC ) {

const { center } = res.parser.json.extensions.CESIUM_RTC;

if ( center ) {

res.scene.position.x += center[ 0 ];
res.scene.position.y += center[ 1 ];
res.scene.position.z += center[ 2 ];

}

}

}

Expand Down

0 comments on commit 62e3762

Please sign in to comment.