| { | { | ||||
| "name": "@threepipe/plugin-3d-tiles-renderer", | "name": "@threepipe/plugin-3d-tiles-renderer", | ||||
| "version": "0.1.0", | |||||
| "version": "0.2.0", | |||||
| "lockfileVersion": 3, | "lockfileVersion": 3, | ||||
| "requires": true, | "requires": true, | ||||
| "packages": { | "packages": { | ||||
| "": { | "": { | ||||
| "name": "@threepipe/plugin-3d-tiles-renderer", | "name": "@threepipe/plugin-3d-tiles-renderer", | ||||
| "version": "0.1.0", | |||||
| "version": "0.2.0", | |||||
| "license": "Apache-2.0", | "license": "Apache-2.0", | ||||
| "dependencies": { | "dependencies": { | ||||
| "three": "file:./../../node_modules/three", | "three": "file:./../../node_modules/three", | ||||
| "threepipe": "file:./../../src/" | "threepipe": "file:./../../src/" | ||||
| }, | }, | ||||
| "devDependencies": { | "devDependencies": { | ||||
| "3d-tiles-renderer": "^0.4.8" | |||||
| "3d-tiles-renderer": "^0.4.9" | |||||
| } | } | ||||
| }, | }, | ||||
| "../../node_modules/three": { | "../../node_modules/three": { | ||||
| } | } | ||||
| }, | }, | ||||
| "node_modules/@types/react": { | "node_modules/@types/react": { | ||||
| "version": "19.1.2", | |||||
| "resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.2.tgz", | |||||
| "integrity": "sha512-oxLPMytKchWGbnQM9O7D67uPa9paTNxO7jVoNMXgkkErULBPhPARCfkKL9ytcIJJRGjbsVwW4ugJzyFFvm/Tiw==", | |||||
| "version": "19.1.3", | |||||
| "resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.3.tgz", | |||||
| "integrity": "sha512-dLWQ+Z0CkIvK1J8+wrDPwGxEYFA4RAyHoZPxHVGspYmFVnwGSNT24cGIhFJrtfRnWVuW8X7NO52gCXmhkVUWGQ==", | |||||
| "dev": true, | "dev": true, | ||||
| "license": "MIT", | "license": "MIT", | ||||
| "optional": true, | "optional": true, | ||||
| "optional": true | "optional": true | ||||
| }, | }, | ||||
| "node_modules/3d-tiles-renderer": { | "node_modules/3d-tiles-renderer": { | ||||
| "version": "0.4.8", | |||||
| "resolved": "https://registry.npmjs.org/3d-tiles-renderer/-/3d-tiles-renderer-0.4.8.tgz", | |||||
| "integrity": "sha512-hMulyUC1aB6Z20XzhWaQ3jNhwmt8XFNwceFx+ynWzJx9soZpApolSib9MEdW4Yyc2m+WSIwWhe6GVmOo8LDnlQ==", | |||||
| "version": "0.4.9", | |||||
| "resolved": "https://registry.npmjs.org/3d-tiles-renderer/-/3d-tiles-renderer-0.4.9.tgz", | |||||
| "integrity": "sha512-vznWfg6LimEilMfR23xB5kIGllodIE83GOH9w2zIQyvkzUKPY+Qp06JN5sdch+fu5UD92DQILVbzIs31rjXhJw==", | |||||
| "dev": true, | "dev": true, | ||||
| "license": "Apache-2.0", | "license": "Apache-2.0", | ||||
| "optionalDependencies": { | "optionalDependencies": { |
| { | { | ||||
| "name": "@threepipe/plugin-3d-tiles-renderer", | "name": "@threepipe/plugin-3d-tiles-renderer", | ||||
| "description": "Interface for 3d-tiles-renderer", | "description": "Interface for 3d-tiles-renderer", | ||||
| "version": "0.1.0", | |||||
| "version": "0.2.0", | |||||
| "devDependencies": { | "devDependencies": { | ||||
| "3d-tiles-renderer": "^0.4.8" | |||||
| "3d-tiles-renderer": "^0.4.9" | |||||
| }, | }, | ||||
| "dependencies": { | "dependencies": { | ||||
| "three": "file:./../../node_modules/three", | "three": "file:./../../node_modules/three", | ||||
| "replace": { | "replace": { | ||||
| "dependencies": {}, | "dependencies": {}, | ||||
| "peerDependencies": { | "peerDependencies": { | ||||
| "threepipe": "^0.0.41" | |||||
| "threepipe": "^0.0.43" | |||||
| } | } | ||||
| } | } | ||||
| }, | }, |
| import { | |||||
| ACameraControlsPlugin, | |||||
| Camera, | |||||
| serialize, | |||||
| TControlsCtor, | |||||
| uiFolderContainer, | |||||
| uiInput, | |||||
| uiToggle, | |||||
| uiVector, | |||||
| Vector3, | |||||
| } from 'threepipe' | |||||
| import {EnvironmentControls} from '3d-tiles-renderer' | |||||
| import {UiObjectConfig} from 'uiconfig.js' | |||||
| export class EnvironmentControlsPlugin extends ACameraControlsPlugin { | |||||
| public static readonly PluginType = 'EnvironmentControlsPlugin' | |||||
| readonly controlsKey = 'environment' | |||||
| protected _controlsCtor: TControlsCtor = (object, domElement) => { | |||||
| return new EnvironmentControls2(object.parent ?? undefined, object, !domElement?.ownerDocument ? (domElement || document).documentElement : domElement) | |||||
| } | |||||
| } | |||||
| @uiFolderContainer('Environment Controls') | |||||
| export class EnvironmentControls2 extends EnvironmentControls { | |||||
| @uiToggle() @serialize() enabled: boolean | |||||
| @uiInput() @serialize() cameraRadius: number | |||||
| @uiInput() @serialize() rotationSpeed: number | |||||
| @uiInput() @serialize() minAltitude: number | |||||
| @uiInput() @serialize() maxAltitude: number | |||||
| @uiInput() @serialize() minDistance: number | |||||
| @uiInput() @serialize() maxDistance = 1e9 // should be Infinity but this breaks the UI | |||||
| @uiInput() @serialize() minZoom: number | |||||
| @uiInput() @serialize() maxZoom = 1e9 // should be Infinity but this breaks the UI | |||||
| @uiInput() @serialize() zoomSpeed: number | |||||
| @uiToggle() @serialize() adjustHeight: boolean | |||||
| @uiToggle() @serialize() enableDamping: boolean | |||||
| @uiInput() @serialize() dampingFactor: number | |||||
| @uiToggle() @serialize() useFallbackPlane: boolean | |||||
| @uiVector() @serialize() pivotPoint: Vector3 | |||||
| // does nothing right now, required so autoLookAtTarget is not used | |||||
| target = new Vector3() | |||||
| get object() { | |||||
| // @ts-expect-error not in ts | |||||
| return this.camera as Camera/* |null*/ | |||||
| } | |||||
| declare uiConfig: UiObjectConfig<void, 'folder'> | |||||
| } |
| import { | |||||
| ACameraControlsPlugin, ICamera, | |||||
| OrthographicCamera2, | |||||
| PerspectiveCamera2, | |||||
| serialize, | |||||
| TControlsCtor, | |||||
| uiFolderContainer, | |||||
| uiInput, | |||||
| uiToggle, | |||||
| uiVector, | |||||
| Vector3, | |||||
| } from 'threepipe' | |||||
| import {GlobeControls} from '3d-tiles-renderer' | |||||
| import {UiObjectConfig} from 'uiconfig.js' | |||||
| export class GlobeControlsPlugin extends ACameraControlsPlugin { | |||||
| public static readonly PluginType = 'GlobeControlsPlugin' | |||||
| readonly controlsKey = 'globe' | |||||
| protected _controlsCtor: TControlsCtor = (object, domElement) => { | |||||
| if ((object as ICamera).userData.autoNearFar) { | |||||
| console.warn('GlobeControlsPlugin: autoNearFar is not supported with GlobeControlsPlugin, it will be disabled, use EnvironmentControlsPlugin instead to keep default behaviour') | |||||
| ;(object as ICamera).userData.autoNearFar = false | |||||
| } | |||||
| return new GlobeControls2(object.parent ?? undefined, object, !domElement?.ownerDocument ? (domElement || document).documentElement : domElement) | |||||
| } | |||||
| } | |||||
| @uiFolderContainer('Globe Controls') | |||||
| export class GlobeControls2 extends GlobeControls { | |||||
| @uiToggle() @serialize() enabled: boolean | |||||
| @uiInput() @serialize() cameraRadius: number | |||||
| @uiInput() @serialize() rotationSpeed: number | |||||
| @uiInput() @serialize() minAltitude: number | |||||
| @uiInput() @serialize() maxAltitude: number | |||||
| @uiInput() @serialize() minDistance: number | |||||
| @uiInput() @serialize() maxDistance = 1e9 // should be Infinity but this breaks the UI | |||||
| @uiInput() @serialize() minZoom: number | |||||
| @uiInput() @serialize() maxZoom = 1e9 // should be Infinity but this breaks the UI | |||||
| @uiInput() @serialize() zoomSpeed: number | |||||
| @uiToggle() @serialize() adjustHeight: boolean | |||||
| @uiToggle() @serialize() enableDamping: boolean | |||||
| @uiInput() @serialize() dampingFactor: number | |||||
| @uiToggle() @serialize() useFallbackPlane: boolean | |||||
| @uiToggle() @serialize() nearMargin: number | |||||
| @uiToggle() @serialize() farMargin: number | |||||
| @uiVector() @serialize() pivotPoint: Vector3 | |||||
| declare camera: PerspectiveCamera2 | OrthographicCamera2 | |||||
| // does nothing right now, required so autoLookAtTarget is not used | |||||
| target = new Vector3() | |||||
| get object() { | |||||
| return this.camera | |||||
| } | |||||
| declare uiConfig: UiObjectConfig<void, 'folder'> | |||||
| // this is a workaround required because GlobeControls changes the near, far and we need it in minNear and minFar | |||||
| update(deltaTime?: number) { | |||||
| const {near, far} = this.camera | |||||
| super.update(deltaTime) | |||||
| if (this.camera.userData.autoNearFar || this.camera.userData.autoNearFar === undefined) return | |||||
| if (this.camera.near !== near || this.camera.far !== far) { | |||||
| this.camera.userData.minNearPlane = this.camera.near // dont set without userData, as that will trigger setDirty | |||||
| this.camera.userData.maxFarPlane = this.camera.far | |||||
| this.camera.near = near | |||||
| this.camera.far = far | |||||
| this.camera.updateProjectionMatrix() | |||||
| } | |||||
| } | |||||
| } |
| Loader, | Loader, | ||||
| ImportAddOptions, | ImportAddOptions, | ||||
| LoadingManager, | LoadingManager, | ||||
| ThreeViewer, | |||||
| ThreeViewer, Sphere, | |||||
| } from 'threepipe' | } from 'threepipe' | ||||
| import {TilesGroup, TilesRenderer} from '3d-tiles-renderer' | import {TilesGroup, TilesRenderer} from '3d-tiles-renderer' | ||||
| import {gltfCesiumRTCExtension, gltfMeshFeaturesExtension, gltfStructuralMetadataExtension} from './gltf' | import {gltfCesiumRTCExtension, gltfMeshFeaturesExtension, gltfStructuralMetadataExtension} from './gltf' | ||||
| // @ts-expect-error moduleResolution issue | // @ts-expect-error moduleResolution issue | ||||
| import {ImplicitTilingPlugin, TilesFadePlugin, UpdateOnChangePlugin, CesiumIonAuthPlugin} from '3d-tiles-renderer/plugins' | import {ImplicitTilingPlugin, TilesFadePlugin, UpdateOnChangePlugin, CesiumIonAuthPlugin} from '3d-tiles-renderer/plugins' | ||||
| import {Sphere} from 'three' | |||||
| export type TilesRendererGroup = TilesGroup & IObject3D | export type TilesRendererGroup = TilesGroup & IObject3D | ||||
| group.computeBoundingSphere!() | group.computeBoundingSphere!() | ||||
| }) | }) | ||||
| // const sup = group.updateWorldMatrix | |||||
| // todo remove in next version | |||||
| group.updateWorldMatrix = (updateParents) => { | |||||
| if (group.parent && updateParents) { | |||||
| group.parent.updateWorldMatrix(updateParents, false) | |||||
| } | |||||
| // run the normal update function to ensure children and inverse matrices are in sync | |||||
| group.updateMatrixWorld(true) | |||||
| } | |||||
| // Save promise to tell the viewer/scene when the load is finished, it can then autoScale, autoCenter etc | // Save promise to tell the viewer/scene when the load is finished, it can then autoScale, autoCenter etc | ||||
| let resolve: any | let resolve: any | ||||
| // let reject: any | // let reject: any | ||||
| } | } | ||||
| tiles.addEventListener('load-content', setDirty) | tiles.addEventListener('load-content', setDirty) | ||||
| tiles.addEventListener('load-tile-set', setDirty) | tiles.addEventListener('load-tile-set', setDirty) | ||||
| tiles.addEventListener('force-rerender', setDirty) | |||||
| tiles.addEventListener('needs-update', setDirty) | |||||
| // tiles.update() | |||||
| tiles.update() | |||||
| onLoad(group) | onLoad(group) | ||||
| } | } |
| export {CMPTLoadPlugin} from './CMPTLoadPlugin' | export {CMPTLoadPlugin} from './CMPTLoadPlugin' | ||||
| export {DeepZoomImageLoadPlugin} from './DeepZoomImageLoadPlugin' | export {DeepZoomImageLoadPlugin} from './DeepZoomImageLoadPlugin' | ||||
| export {SlippyMapTilesLoadPlugin} from './SlippyMapTilesLoadPlugin' | export {SlippyMapTilesLoadPlugin} from './SlippyMapTilesLoadPlugin' | ||||
| export {EnvironmentControlsPlugin, EnvironmentControls2} from './EnvironmentControlsPlugin' | |||||
| export {GlobeControlsPlugin, GlobeControls2} from './GlobeControlsPlugin' | |||||
| export { | export { | ||||
| CesiumIonAuthPlugin, | CesiumIonAuthPlugin, | ||||
| ReorientationPlugin, | ReorientationPlugin, |