| import {_testFinish, downloadBlob, IObject3D, Rhino3dmLoadPlugin, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, downloadBlob, IObject3D, LoadingScreenPlugin, Rhino3dmLoadPlugin, ThreeViewer} from 'threepipe' | |||||
| const viewer = new ThreeViewer({canvas: document.getElementById('mcanvas') as HTMLCanvasElement, msaa: true}) | |||||
| const viewer = new ThreeViewer({ | |||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | |||||
| msaa: true, | |||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | |||||
| async function init() { | async function init() { | ||||
| AmbientLight2, | AmbientLight2, | ||||
| Box3B, | Box3B, | ||||
| IObject3D, | IObject3D, | ||||
| LoadingScreenPlugin, | |||||
| Mesh, | Mesh, | ||||
| Object3DWidgetsPlugin, | Object3DWidgetsPlugin, | ||||
| PhysicalMaterial, | PhysicalMaterial, | ||||
| autoSetEnvironment: true, // when hdr/exr is dropped | autoSetEnvironment: true, // when hdr/exr is dropped | ||||
| }, | }, | ||||
| }, | }, | ||||
| plugins: [Object3DWidgetsPlugin], | |||||
| plugins: [Object3DWidgetsPlugin, LoadingScreenPlugin], | |||||
| }) | }) | ||||
| // viewer.scene.addObject(new HemisphereLight(0xffffff, 0x444444, 10)) | // viewer.scene.addObject(new HemisphereLight(0xffffff, 0x444444, 10)) |
| import {_testFinish, DirectionalLight2, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, DirectionalLight2, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| import {BasicSVGRendererPlugin} from '@threepipe/plugin-svg-renderer' | import {BasicSVGRendererPlugin} from '@threepipe/plugin-svg-renderer' | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: false, | msaa: false, | ||||
| tonemap: false, | tonemap: false, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| viewer.scene.mainCamera.controls!.enableDamping = false | viewer.scene.mainCamera.controls!.enableDamping = false |
| </style> | </style> | ||||
| <script type="module" src="../examples-utils/simple-code-preview.mjs"></script> | <script type="module" src="../examples-utils/simple-code-preview.mjs"></script> | ||||
| <script id="example-script" type="module"> | <script id="example-script" type="module"> | ||||
| import {_testFinish, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| import {BlendLoadPlugin} from '@threepipe/plugin-blend-importer' | import {BlendLoadPlugin} from '@threepipe/plugin-blend-importer' | ||||
| const viewer = new ThreeViewer({canvas: document.getElementById('mcanvas')}) | const viewer = new ThreeViewer({canvas: document.getElementById('mcanvas')}) | ||||
| viewer.addPluginsSync([BlendLoadPlugin]) | |||||
| viewer.addPluginsSync([BlendLoadPlugin, LoadingScreenPlugin]) | |||||
| async function init() { | async function init() { | ||||
| import {_testFinish, IObject3D, ThreeViewer, TonemapPlugin} from 'threepipe' | |||||
| import {_testFinish, IObject3D, LoadingScreenPlugin, ThreeViewer, TonemapPlugin} from 'threepipe' | |||||
| import {BlueprintJsUiPlugin} from '@threepipe/plugin-blueprintjs' | import {BlueprintJsUiPlugin} from '@threepipe/plugin-blueprintjs' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const ui = viewer.addPluginSync(new BlueprintJsUiPlugin()) | const ui = viewer.addPluginSync(new BlueprintJsUiPlugin()) |
| import {_testFinish, IObject3D, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, IObject3D, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true)) | const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true)) |
| import {_testFinish, CameraView, CameraViewPlugin, EasingFunctions, ThreeViewer, Vector3} from 'threepipe' | |||||
| import { | |||||
| _testFinish, | |||||
| CameraView, | |||||
| CameraViewPlugin, | |||||
| EasingFunctions, | |||||
| LoadingScreenPlugin, | |||||
| ThreeViewer, | |||||
| Vector3, | |||||
| } from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| import {createSimpleButtons} from '../examples-utils/simple-bottom-buttons.js' | import {createSimpleButtons} from '../examples-utils/simple-bottom-buttons.js' | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| renderScale: 'auto', | |||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const cameraViewPlugin = viewer.addPluginSync(CameraViewPlugin) | const cameraViewPlugin = viewer.addPluginSync(CameraViewPlugin) | ||||
| console.log(cameraViewPlugin) | console.log(cameraViewPlugin) |
| import {_testFinish, CanvasSnapshotPlugin, isWebpExportSupported, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, CanvasSnapshotPlugin, isWebpExportSupported, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| import {createSimpleButtons} from '../examples-utils/simple-bottom-buttons.js' | import {createSimpleButtons} from '../examples-utils/simple-bottom-buttons.js' | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| renderScale: 'auto', | renderScale: 'auto', | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| async function init() { | async function init() { |
| import {_testFinish, ChromaticAberrationPlugin, IObject3D, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, ChromaticAberrationPlugin, IObject3D, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| renderScale: 'auto', | |||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| viewer.addPluginSync(ChromaticAberrationPlugin) | viewer.addPluginSync(ChromaticAberrationPlugin) |
| import {_testFinish, ClearcoatTintPlugin, IObject3D, PhysicalMaterial, ThreeViewer} from 'threepipe' | |||||
| import { | |||||
| _testFinish, | |||||
| ClearcoatTintPlugin, | |||||
| IObject3D, | |||||
| LoadingScreenPlugin, | |||||
| PhysicalMaterial, | |||||
| ThreeViewer, | |||||
| } from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const clearcoatTint = viewer.addPluginSync(ClearcoatTintPlugin) | const clearcoatTint = viewer.addPluginSync(ClearcoatTintPlugin) |
| import {_testFinish, ContactShadowGroundPlugin, IObject3D, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, ContactShadowGroundPlugin, IObject3D, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| renderScale: 'auto', | |||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| viewer.addPluginSync(ContactShadowGroundPlugin) | viewer.addPluginSync(ContactShadowGroundPlugin) |
| import {_testFinish, CustomBumpMapPlugin, ITexture, Mesh, PhysicalMaterial, PlaneGeometry, ThreeViewer} from 'threepipe' | |||||
| import { | |||||
| _testFinish, | |||||
| CustomBumpMapPlugin, | |||||
| ITexture, | |||||
| LoadingScreenPlugin, | |||||
| Mesh, | |||||
| PhysicalMaterial, | |||||
| PlaneGeometry, | |||||
| ThreeViewer, | |||||
| } from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const customBump = viewer.addPluginSync(CustomBumpMapPlugin) | const customBump = viewer.addPluginSync(CustomBumpMapPlugin) |
| DepthBufferPlugin, | DepthBufferPlugin, | ||||
| downloadBlob, | downloadBlob, | ||||
| HalfFloatType, | HalfFloatType, | ||||
| LoadingScreenPlugin, | |||||
| RenderTargetPreviewPlugin, | RenderTargetPreviewPlugin, | ||||
| ThreeViewer, | ThreeViewer, | ||||
| } from 'threepipe' | } from 'threepipe' | ||||
| msaa: false, | msaa: false, | ||||
| rgbm: true, | rgbm: true, | ||||
| zPrepass: false, | zPrepass: false, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| renderScale: 'auto', | |||||
| }) | }) | ||||
| async function init() { | async function init() { |
| DepthBufferPlugin, | DepthBufferPlugin, | ||||
| downloadBlob, | downloadBlob, | ||||
| HalfFloatType, | HalfFloatType, | ||||
| LoadingScreenPlugin, | |||||
| RenderTargetPreviewPlugin, | RenderTargetPreviewPlugin, | ||||
| ThreeViewer, | ThreeViewer, | ||||
| } from 'threepipe' | } from 'threepipe' | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| async function init() { | async function init() { |
| import {_testFinish, DeviceOrientationControlsPlugin, IObject3D, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, DeviceOrientationControlsPlugin, IObject3D, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [DeviceOrientationControlsPlugin], | |||||
| plugins: [DeviceOrientationControlsPlugin, LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true)) | const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true)) |
| Box3B, | Box3B, | ||||
| DirectionalLight2, | DirectionalLight2, | ||||
| IObject3D, | IObject3D, | ||||
| LoadingScreenPlugin, | |||||
| Mesh, | Mesh, | ||||
| Object3DWidgetsPlugin, | Object3DWidgetsPlugin, | ||||
| PCFSoftShadowMap, | PCFSoftShadowMap, | ||||
| autoSetEnvironment: true, // when hdr/exr is dropped | autoSetEnvironment: true, // when hdr/exr is dropped | ||||
| }, | }, | ||||
| }, | }, | ||||
| plugins: [Object3DWidgetsPlugin], | |||||
| plugins: [Object3DWidgetsPlugin, LoadingScreenPlugin], | |||||
| }) | }) | ||||
| // viewer.scene.addObject(new HemisphereLight(0xffffff, 0x444444, 10)) | // viewer.scene.addObject(new HemisphereLight(0xffffff, 0x444444, 10)) |
| import {_testFinish, DropzonePlugin, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, DropzonePlugin, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| importConfig: true, // import config from file | importConfig: true, // import config from file | ||||
| }, | }, | ||||
| }, | }, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr') | await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr') |
| import {_testFinish, EditorViewWidgetPlugin, IObject3D, ThreeViewer, timeout} from 'threepipe' | |||||
| import {_testFinish, EditorViewWidgetPlugin, IObject3D, LoadingScreenPlugin, ThreeViewer, timeout} from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| viewer.scene.setBackgroundColor(0x151822) | viewer.scene.setBackgroundColor(0x151822) |
| import {_testFinish, GLTFAnimationPlugin, HemisphereLight, ImportAddOptions, IObject3D, ThreeViewer} from 'threepipe' | |||||
| import { | |||||
| _testFinish, | |||||
| GLTFAnimationPlugin, | |||||
| HemisphereLight, | |||||
| ImportAddOptions, | |||||
| IObject3D, | |||||
| LoadingScreenPlugin, | |||||
| ThreeViewer, | |||||
| } from 'threepipe' | |||||
| import { | import { | ||||
| AMFLoadPlugin, | AMFLoadPlugin, | ||||
| BVHLoadPlugin, | BVHLoadPlugin, | ||||
| disposeSceneObjects: true, | disposeSceneObjects: true, | ||||
| }, | }, | ||||
| }, | }, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| viewer.addPluginsSync([ | viewer.addPluginsSync([ | ||||
| GLTFAnimationPlugin, | GLTFAnimationPlugin, |
| import {_testFinish, FilmicGrainPlugin, IObject3D, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, FilmicGrainPlugin, IObject3D, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| renderScale: 'auto', | |||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| viewer.addPluginSync(FilmicGrainPlugin) | viewer.addPluginSync(FilmicGrainPlugin) |
| _testFinish, | _testFinish, | ||||
| FragmentClippingExtensionPlugin, | FragmentClippingExtensionPlugin, | ||||
| IObject3D, | IObject3D, | ||||
| LoadingScreenPlugin, | |||||
| PhysicalMaterial, | PhysicalMaterial, | ||||
| ThreeViewer, | ThreeViewer, | ||||
| Vector4, | Vector4, | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const fragmentClipping = viewer.addPluginSync(FragmentClippingExtensionPlugin) | const fragmentClipping = viewer.addPluginSync(FragmentClippingExtensionPlugin) |
| import {_testFinish, BoxGeometry, FrameFadePlugin, Mesh, PhysicalMaterial, ThreeViewer} from 'threepipe' | |||||
| import { | |||||
| _testFinish, | |||||
| BoxGeometry, | |||||
| FrameFadePlugin, | |||||
| LoadingScreenPlugin, | |||||
| Mesh, | |||||
| PhysicalMaterial, | |||||
| ThreeViewer, | |||||
| } from 'threepipe' | |||||
| import {createSimpleButtons} from '../examples-utils/simple-bottom-buttons.js' | import {createSimpleButtons} from '../examples-utils/simple-bottom-buttons.js' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| renderScale: 'auto', | |||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| viewer.addPluginSync(FrameFadePlugin) | viewer.addPluginSync(FrameFadePlugin) | ||||
| import {_testFinish, FullScreenPlugin, IObject3D, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, FullScreenPlugin, IObject3D, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| import {createSimpleButtons} from '../examples-utils/simple-bottom-buttons.js' | import {createSimpleButtons} from '../examples-utils/simple-bottom-buttons.js' | ||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| renderScale: 'auto', | |||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const fullScreenPlugin = viewer.addPluginSync(new FullScreenPlugin()) | const fullScreenPlugin = viewer.addPluginSync(new FullScreenPlugin()) |
| GBufferPlugin, | GBufferPlugin, | ||||
| HalfFloatType, | HalfFloatType, | ||||
| IObject3D, | IObject3D, | ||||
| LoadingScreenPlugin, | |||||
| RenderTargetPreviewPlugin, | RenderTargetPreviewPlugin, | ||||
| ThreeViewer, | ThreeViewer, | ||||
| } from 'threepipe' | } from 'threepipe' | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| zPrepass: true, | zPrepass: true, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| async function init() { | async function init() { |
| import {_testFinish, CameraViewPlugin, Object3DGeneratorPlugin, PickingPlugin, ThreeViewer} from 'threepipe' | |||||
| import { | |||||
| _testFinish, | |||||
| CameraViewPlugin, | |||||
| LoadingScreenPlugin, | |||||
| Object3DGeneratorPlugin, | |||||
| PickingPlugin, | |||||
| ThreeViewer, | |||||
| } from 'threepipe' | |||||
| import {GeometryGeneratorPlugin} from '@threepipe/plugin-geometry-generator' | import {GeometryGeneratorPlugin} from '@threepipe/plugin-geometry-generator' | ||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [PickingPlugin, CameraViewPlugin, Object3DGeneratorPlugin], | |||||
| plugins: [PickingPlugin, CameraViewPlugin, Object3DGeneratorPlugin, LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const generator = viewer.addPluginSync(GeometryGeneratorPlugin) | const generator = viewer.addPluginSync(GeometryGeneratorPlugin) | ||||
| import {_testFinish, GeometryUVPreviewPlugin, IObject3D, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, GeometryUVPreviewPlugin, IObject3D, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| rgbm: true, | rgbm: true, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| async function init() { | async function init() { |
| import {_testFinish, downloadBlob, IMaterial, IObject3D, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, downloadBlob, IMaterial, IObject3D, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| import {createSimpleButtons} from '../examples-utils/simple-bottom-buttons.js' | import {createSimpleButtons} from '../examples-utils/simple-bottom-buttons.js' | ||||
| const viewer = new ThreeViewer({canvas: document.getElementById('mcanvas') as HTMLCanvasElement, msaa: true}) | const viewer = new ThreeViewer({canvas: document.getElementById('mcanvas') as HTMLCanvasElement, msaa: true}) | ||||
| async function init() { | async function init() { | ||||
| viewer.addPluginSync(LoadingScreenPlugin) | |||||
| // Note: see asset-exporter-plugin example as well | // Note: see asset-exporter-plugin example as well | ||||
| import {_testFinish, GLTFAnimationPlugin, ICamera, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, GLTFAnimationPlugin, ICamera, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const gltfAnimation = viewer.addPluginSync(GLTFAnimationPlugin) | const gltfAnimation = viewer.addPluginSync(GLTFAnimationPlugin) |
| import {_testFinish, GLTFAnimationPlugin, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, GLTFAnimationPlugin, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| async function init() { | async function init() { | ||||
| autoSetEnvironment: true, // when hdr is dropped | autoSetEnvironment: true, // when hdr is dropped | ||||
| }, | }, | ||||
| }, | }, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const gltfAnimation = viewer.addPluginSync(GLTFAnimationPlugin) | const gltfAnimation = viewer.addPluginSync(GLTFAnimationPlugin) |
| import {_testFinish, GLTFAnimationPlugin, ICamera, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, GLTFAnimationPlugin, ICamera, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| async function init() { | async function init() { | ||||
| autoSetEnvironment: true, // when hdr is dropped | autoSetEnvironment: true, // when hdr is dropped | ||||
| }, | }, | ||||
| }, | }, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const gltfAnimation = viewer.addPluginSync(GLTFAnimationPlugin) | const gltfAnimation = viewer.addPluginSync(GLTFAnimationPlugin) |
| import {_testFinish, GLTFKHRMaterialVariantsPlugin, IObject3D, SSAAPlugin, ThreeViewer} from 'threepipe' | |||||
| import { | |||||
| _testFinish, | |||||
| GLTFKHRMaterialVariantsPlugin, | |||||
| IObject3D, | |||||
| LoadingScreenPlugin, | |||||
| SSAAPlugin, | |||||
| ThreeViewer, | |||||
| } from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [SSAAPlugin, GLTFKHRMaterialVariantsPlugin], | |||||
| plugins: [SSAAPlugin, GLTFKHRMaterialVariantsPlugin, LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true)) | const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true)) |
| import {_testFinish, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| async function init() { | async function init() { | ||||
| // plugins: [GLTFMeshOptDecodePlugin, KTX2LoadPlugin, GLTFKHRMaterialVariantsPlugin, ...], | // plugins: [GLTFMeshOptDecodePlugin, KTX2LoadPlugin, GLTFKHRMaterialVariantsPlugin, ...], | ||||
| }) | }) | ||||
| viewer.addPluginSync(LoadingScreenPlugin) | |||||
| await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr', { | await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr', { | ||||
| setBackground: true, | setBackground: true, | ||||
| }) | }) |
| import {_testFinish, IObject3D, RenderTargetPreviewPlugin, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, IObject3D, LoadingScreenPlugin, RenderTargetPreviewPlugin, ThreeViewer} from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| msaa: true, | msaa: true, | ||||
| rgbm: true, | rgbm: true, | ||||
| zPrepass: false, | zPrepass: false, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| async function init() { | async function init() { |
| import {_testFinish, IObject3D, RenderTargetPreviewPlugin, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, IObject3D, LoadingScreenPlugin, RenderTargetPreviewPlugin, ThreeViewer} from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| msaa: false, | msaa: false, | ||||
| rgbm: true, | rgbm: true, | ||||
| zPrepass: false, | zPrepass: false, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| async function init() { | async function init() { |
| import {_testFinish, BoxGeometry, Color, Mesh, PhysicalMaterial, ThreeViewer, TonemapPlugin} from 'threepipe' | |||||
| import { | |||||
| _testFinish, | |||||
| BoxGeometry, | |||||
| Color, | |||||
| LoadingScreenPlugin, | |||||
| Mesh, | |||||
| PhysicalMaterial, | |||||
| ThreeViewer, | |||||
| TonemapPlugin, | |||||
| } from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| rgbm: false, | rgbm: false, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| viewer.scene.backgroundColor = new Color().set('black') | viewer.scene.backgroundColor = new Color().set('black') | ||||
| viewer.getPlugin(TonemapPlugin)!.exposure = 0.04 | viewer.getPlugin(TonemapPlugin)!.exposure = 0.04 |
| import {_testFinish, downloadBlob, IAsset, ITexture, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, downloadBlob, IAsset, ITexture, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| const viewer = new ThreeViewer({canvas: document.getElementById('mcanvas') as HTMLCanvasElement}) | const viewer = new ThreeViewer({canvas: document.getElementById('mcanvas') as HTMLCanvasElement}) | ||||
| async function init() { | async function init() { | ||||
| viewer.addPluginSync(LoadingScreenPlugin) | |||||
| // import a hdr file | // import a hdr file | ||||
| const dataTexture = await viewer.import<ITexture>('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr') | const dataTexture = await viewer.import<ITexture>('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr') |
| import {_testFinish, CameraViewPlugin, HDRiGroundPlugin, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, CameraViewPlugin, HDRiGroundPlugin, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| autoSetBackground: true, | autoSetBackground: true, | ||||
| }, | }, | ||||
| }, | }, | ||||
| plugins: [CameraViewPlugin], | |||||
| plugins: [CameraViewPlugin, LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const hdriGround = viewer.addPluginSync(HDRiGroundPlugin) | const hdriGround = viewer.addPluginSync(HDRiGroundPlugin) | ||||
| Box3B, | Box3B, | ||||
| HemisphereLight2, | HemisphereLight2, | ||||
| IObject3D, | IObject3D, | ||||
| LoadingScreenPlugin, | |||||
| Mesh, | Mesh, | ||||
| Object3DWidgetsPlugin, | Object3DWidgetsPlugin, | ||||
| PhysicalMaterial, | PhysicalMaterial, | ||||
| autoSetEnvironment: true, // when hdr/exr is dropped | autoSetEnvironment: true, // when hdr/exr is dropped | ||||
| }, | }, | ||||
| }, | }, | ||||
| plugins: [Object3DWidgetsPlugin], | |||||
| plugins: [Object3DWidgetsPlugin, LoadingScreenPlugin], | |||||
| }) | }) | ||||
| // viewer.scene.addObject(new HemisphereLight(0xffffff, 0x444444, 10)) | // viewer.scene.addObject(new HemisphereLight(0xffffff, 0x444444, 10)) |
| <body> | <body> | ||||
| <canvas id="three-canvas" style="width: 800px; height: 600px;"></canvas> | <canvas id="three-canvas" style="width: 800px; height: 600px;"></canvas> | ||||
| <script id="example-script" type="module" data-scripts="./index.html"> | <script id="example-script" type="module" data-scripts="./index.html"> | ||||
| // import {ThreeViewer} from 'https://threepipe.org/dist/index.mjs' | |||||
| import {ThreeViewer} from './../../dist/index.mjs' | |||||
| // import {ThreeViewer, LoadingScreenPlugin} from 'https://threepipe.org/dist/index.mjs' | |||||
| import {ThreeViewer, LoadingScreenPlugin} from './../../dist/index.mjs' | |||||
| const viewer = new ThreeViewer({canvas: document.getElementById('three-canvas')}) | const viewer = new ThreeViewer({canvas: document.getElementById('three-canvas')}) | ||||
| viewer.addPluginSync(LoadingScreenPlugin) | |||||
| // Load an environment map | // Load an environment map | ||||
| const envPromise = viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr') | const envPromise = viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr') | ||||
| const modelPromise = viewer.load('https://threejs.org/examples/models/gltf/DamagedHelmet/glTF/DamagedHelmet.gltf', { | const modelPromise = viewer.load('https://threejs.org/examples/models/gltf/DamagedHelmet/glTF/DamagedHelmet.gltf', { |
| import {_testFinish, ITexture, Mesh, PlaneGeometry, SRGBColorSpace, ThreeViewer, UnlitMaterial} from 'threepipe' | |||||
| import { | |||||
| _testFinish, | |||||
| ITexture, | |||||
| LoadingScreenPlugin, | |||||
| Mesh, | |||||
| PlaneGeometry, | |||||
| SRGBColorSpace, | |||||
| ThreeViewer, | |||||
| UnlitMaterial, | |||||
| } from 'threepipe' | |||||
| async function init() { | async function init() { | ||||
| autoSetBackground: false, | autoSetBackground: false, | ||||
| }, | }, | ||||
| }, | }, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| viewer.scene.setBackgroundColor('#555555') | viewer.scene.setBackgroundColor('#555555') |
| import {_testFinish, downloadBlob, isWebpExportSupported, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, downloadBlob, isWebpExportSupported, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| import {createSimpleButtons} from '../examples-utils/simple-bottom-buttons.js' | import {createSimpleButtons} from '../examples-utils/simple-bottom-buttons.js' | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| // Note: see also: CanvasSnapshotPlugin | // Note: see also: CanvasSnapshotPlugin |
| import {_testFinish, InteractionPromptPlugin, IObject3D, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, InteractionPromptPlugin, IObject3D, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| renderScale: 'auto', | |||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const interactionPrompt = viewer.addPluginSync(new InteractionPromptPlugin()) | const interactionPrompt = viewer.addPluginSync(new InteractionPromptPlugin()) |
| _testFinish, | _testFinish, | ||||
| ITexture, | ITexture, | ||||
| KTXLoadPlugin, | KTXLoadPlugin, | ||||
| LoadingScreenPlugin, | |||||
| Mesh, | Mesh, | ||||
| PlaneGeometry, | PlaneGeometry, | ||||
| SRGBColorSpace, | SRGBColorSpace, | ||||
| dropzone: { | dropzone: { | ||||
| allowedExtensions: ['ktx'], | allowedExtensions: ['ktx'], | ||||
| }, | }, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| viewer.addPluginSync(KTXLoadPlugin) | viewer.addPluginSync(KTXLoadPlugin) | ||||
| _testFinish, | _testFinish, | ||||
| ITexture, | ITexture, | ||||
| KTX2LoadPlugin, | KTX2LoadPlugin, | ||||
| LoadingScreenPlugin, | |||||
| Mesh, | Mesh, | ||||
| PlaneGeometry, | PlaneGeometry, | ||||
| SRGBColorSpace, | SRGBColorSpace, | ||||
| dropzone: { | dropzone: { | ||||
| allowedExtensions: ['ktx2'], | allowedExtensions: ['ktx2'], | ||||
| }, | }, | ||||
| plugins: [KTX2LoadPlugin], | |||||
| plugins: [KTX2LoadPlugin, LoadingScreenPlugin], | |||||
| }) | }) | ||||
| viewer.scene.setBackgroundColor('#555555') | viewer.scene.setBackgroundColor('#555555') |
| import {_testFinish, IObject3D, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, IObject3D, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true)) | const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true)) |
| import {_testFinish, IObject3D, MeshOptSimplifyModifierPlugin, PickingPlugin, ThreeViewer} from 'threepipe' | |||||
| import { | |||||
| _testFinish, | |||||
| IObject3D, | |||||
| LoadingScreenPlugin, | |||||
| MeshOptSimplifyModifierPlugin, | |||||
| PickingPlugin, | |||||
| ThreeViewer, | |||||
| } from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| import {createSimpleButtons} from '../examples-utils/simple-bottom-buttons.js' | import {createSimpleButtons} from '../examples-utils/simple-bottom-buttons.js' | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [PickingPlugin], | |||||
| plugins: [PickingPlugin, LoadingScreenPlugin], | |||||
| dropzone: { | dropzone: { | ||||
| addOptions: { | addOptions: { | ||||
| disposeSceneObjects: true, | disposeSceneObjects: true, |
| import {_testFinish, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| const models = [ | const models = [ | ||||
| 'https://threejs.org/examples/models/gltf/DamagedHelmet/glTF/DamagedHelmet.gltf', | 'https://threejs.org/examples/models/gltf/DamagedHelmet/glTF/DamagedHelmet.gltf', | ||||
| autoSetBackground: true, | autoSetBackground: true, | ||||
| }, | }, | ||||
| }, | }, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr', { | await viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr', { |
| import {_testFinish, IObject3D, NoiseBumpMaterialPlugin, PhysicalMaterial, ThreeViewer} from 'threepipe' | |||||
| import { | |||||
| _testFinish, | |||||
| IObject3D, | |||||
| LoadingScreenPlugin, | |||||
| NoiseBumpMaterialPlugin, | |||||
| PhysicalMaterial, | |||||
| ThreeViewer, | |||||
| } from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const noiseBump = viewer.addPluginSync(NoiseBumpMaterialPlugin) | const noiseBump = viewer.addPluginSync(NoiseBumpMaterialPlugin) |
| _testFinish, | _testFinish, | ||||
| downloadBlob, | downloadBlob, | ||||
| HalfFloatType, | HalfFloatType, | ||||
| LoadingScreenPlugin, | |||||
| NoColorSpace, | NoColorSpace, | ||||
| NormalBufferPlugin, | NormalBufferPlugin, | ||||
| RenderTargetPreviewPlugin, | RenderTargetPreviewPlugin, | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| async function init() { | async function init() { |
| import {_testFinish, downloadBlob, IObject3D, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, downloadBlob, IObject3D, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| const viewer = new ThreeViewer({canvas: document.getElementById('mcanvas') as HTMLCanvasElement, msaa: true}) | |||||
| const viewer = new ThreeViewer({canvas: document.getElementById('mcanvas') as HTMLCanvasElement, msaa: true, | |||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | |||||
| async function init() { | async function init() { | ||||
| import {_testFinish, IObject3D, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, IObject3D, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true)) | const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true)) |
| import { | import { | ||||
| _testFinish, | _testFinish, | ||||
| CameraViewPlugin, | CameraViewPlugin, | ||||
| LoadingScreenPlugin, | |||||
| Object3DGeneratorPlugin, | Object3DGeneratorPlugin, | ||||
| Object3DWidgetsPlugin, | Object3DWidgetsPlugin, | ||||
| PickingPlugin, | PickingPlugin, | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [PickingPlugin, CameraViewPlugin, Object3DWidgetsPlugin, HierarchyUiPlugin], | |||||
| plugins: [PickingPlugin, CameraViewPlugin, Object3DWidgetsPlugin, HierarchyUiPlugin, LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const generator = viewer.addPluginSync(Object3DGeneratorPlugin) | const generator = viewer.addPluginSync(Object3DGeneratorPlugin) | ||||
| import { | import { | ||||
| _testFinish, | _testFinish, | ||||
| CameraViewPlugin, | CameraViewPlugin, | ||||
| LoadingScreenPlugin, | |||||
| Object3DGeneratorPlugin, | Object3DGeneratorPlugin, | ||||
| Object3DWidgetsPlugin, | Object3DWidgetsPlugin, | ||||
| ThreeViewer, | ThreeViewer, | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [CameraViewPlugin, Object3DGeneratorPlugin], | |||||
| plugins: [CameraViewPlugin, Object3DGeneratorPlugin, LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const widgets = viewer.addPluginSync(Object3DWidgetsPlugin) | const widgets = viewer.addPluginSync(Object3DWidgetsPlugin) | ||||
| _testFinish, | _testFinish, | ||||
| BoxGeometry, | BoxGeometry, | ||||
| ITexture, | ITexture, | ||||
| LoadingScreenPlugin, | |||||
| Mesh, | Mesh, | ||||
| ParallaxMappingPlugin, | ParallaxMappingPlugin, | ||||
| PhysicalMaterial, | PhysicalMaterial, | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [new SSAAPlugin(4)], | |||||
| plugins: [new SSAAPlugin(4), LoadingScreenPlugin], | |||||
| dropzone: { | dropzone: { | ||||
| addOptions: { | addOptions: { | ||||
| disposeSceneObjects: true, | disposeSceneObjects: true, |
| import {_testFinish, IObject3D, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, IObject3D, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: false, | msaa: false, | ||||
| rgbm: true, | rgbm: true, | ||||
| zPrepass: false, | zPrepass: false, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| async function init() { | async function init() { |
| import {_testFinish, IObject3D, PickingPlugin, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, IObject3D, LoadingScreenPlugin, PickingPlugin, ThreeViewer} from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const picking = viewer.addPluginSync(PickingPlugin) | const picking = viewer.addPluginSync(PickingPlugin) |
| import {_testFinish, IObject3D, PLYLoadPlugin, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, IObject3D, LoadingScreenPlugin, PLYLoadPlugin, ThreeViewer} from 'threepipe' | |||||
| async function init() { | async function init() { | ||||
| autoSetBackground: true, | autoSetBackground: true, | ||||
| }, | }, | ||||
| }, | }, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| viewer.addPluginSync(PLYLoadPlugin) | viewer.addPluginSync(PLYLoadPlugin) |
| import {_testFinish, downloadBlob, IMaterial, IObject3D, Mesh, SphereGeometry, ThreeViewer} from 'threepipe' | |||||
| import { | |||||
| _testFinish, | |||||
| downloadBlob, | |||||
| IMaterial, | |||||
| IObject3D, | |||||
| LoadingScreenPlugin, | |||||
| Mesh, | |||||
| SphereGeometry, | |||||
| ThreeViewer, | |||||
| } from 'threepipe' | |||||
| import {createSimpleButtons} from '../examples-utils/simple-bottom-buttons.js' | import {createSimpleButtons} from '../examples-utils/simple-bottom-buttons.js' | ||||
| const viewer = new ThreeViewer({canvas: document.getElementById('mcanvas') as HTMLCanvasElement, msaa: true}) | |||||
| const viewer = new ThreeViewer({canvas: document.getElementById('mcanvas') as HTMLCanvasElement, msaa: true, | |||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | |||||
| async function init() { | async function init() { | ||||
| _testFinish, | _testFinish, | ||||
| Box3B, | Box3B, | ||||
| IObject3D, | IObject3D, | ||||
| LoadingScreenPlugin, | |||||
| Mesh, | Mesh, | ||||
| Object3DWidgetsPlugin, | Object3DWidgetsPlugin, | ||||
| PCFSoftShadowMap, | PCFSoftShadowMap, | ||||
| autoSetEnvironment: true, // when hdr/exr is dropped | autoSetEnvironment: true, // when hdr/exr is dropped | ||||
| }, | }, | ||||
| }, | }, | ||||
| plugins: [Object3DWidgetsPlugin], | |||||
| plugins: [Object3DWidgetsPlugin, LoadingScreenPlugin], | |||||
| }) | }) | ||||
| // viewer.scene.addObject(new HemisphereLight(0xffffff, 0x444444, 10)) | // viewer.scene.addObject(new HemisphereLight(0xffffff, 0x444444, 10)) |
| import {_testFinish, IObject3D, PointerLockControlsPlugin, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, IObject3D, LoadingScreenPlugin, PointerLockControlsPlugin, ThreeViewer} from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [PointerLockControlsPlugin], | |||||
| plugins: [PointerLockControlsPlugin, LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true)) | const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true)) |
| import {_testFinish, BoxGeometry, Color, Mesh, PhysicalMaterial, PopmotionPlugin, ThreeViewer, Vector3} from 'threepipe' | |||||
| import { | |||||
| _testFinish, | |||||
| BoxGeometry, | |||||
| Color, | |||||
| LoadingScreenPlugin, | |||||
| Mesh, | |||||
| PhysicalMaterial, | |||||
| PopmotionPlugin, | |||||
| ThreeViewer, | |||||
| Vector3, | |||||
| } from 'threepipe' | |||||
| import {createSimpleButtons} from '../examples-utils/simple-bottom-buttons.js' | import {createSimpleButtons} from '../examples-utils/simple-bottom-buttons.js' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| renderScale: 'auto', | |||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const popmotion = viewer.addPluginSync(PopmotionPlugin) | const popmotion = viewer.addPluginSync(PopmotionPlugin) | ||||
| DataUtils, | DataUtils, | ||||
| DirectionalLight, | DirectionalLight, | ||||
| IObject3D, | IObject3D, | ||||
| LoadingScreenPlugin, | |||||
| MaterialExtension, | MaterialExtension, | ||||
| ProgressivePlugin, | ProgressivePlugin, | ||||
| ShaderChunk, | ShaderChunk, | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: false, | msaa: false, | ||||
| rgbm: false, | rgbm: false, | ||||
| plugins: [new ProgressivePlugin((window as any).TESTING ? 20 : 200), SSAAPlugin], | |||||
| plugins: [new ProgressivePlugin((window as any).TESTING ? 20 : 200), SSAAPlugin, LoadingScreenPlugin], | |||||
| dropzone: { | dropzone: { | ||||
| addOptions: { | addOptions: { | ||||
| disposeSceneObjects: true, | disposeSceneObjects: true, |
| Box3B, | Box3B, | ||||
| DirectionalLight, | DirectionalLight, | ||||
| IObject3D, | IObject3D, | ||||
| LoadingScreenPlugin, | |||||
| Mesh, | Mesh, | ||||
| PhysicalMaterial, | PhysicalMaterial, | ||||
| PlaneGeometry, | PlaneGeometry, | ||||
| importConfig: true, | importConfig: true, | ||||
| }, | }, | ||||
| }, | }, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| viewer.addPluginSync(new ProgressivePlugin((window as any).TESTING ? 20 : 200)) | viewer.addPluginSync(new ProgressivePlugin((window as any).TESTING ? 20 : 200)) | ||||
| viewer.addPluginSync(new SSAAPlugin()) | viewer.addPluginSync(new SSAAPlugin()) |
| <body> | <body> | ||||
| <div id="root"></div> | <div id="root"></div> | ||||
| <script id="example-script" type="module" data-scripts="./index.html"> | <script id="example-script" type="module" data-scripts="./index.html"> | ||||
| // import {ThreeViewer} from 'https://threepipe.org/dist/index.mjs' | |||||
| import {ThreeViewer} from './../../dist/index.mjs' | |||||
| // import {ThreeViewer, LoadingScreenPlugin} from 'https://threepipe.org/dist/index.mjs' | |||||
| import {ThreeViewer, LoadingScreenPlugin} from './../../dist/index.mjs' | |||||
| import React from 'https://esm.sh/react' | import React from 'https://esm.sh/react' | ||||
| import ReactDOM from 'https://esm.sh/react-dom' | import ReactDOM from 'https://esm.sh/react-dom' | ||||
| function ThreeViewerComponent({ src }) { | function ThreeViewerComponent({ src }) { | ||||
| const canvasRef = React.useRef(null); | const canvasRef = React.useRef(null); | ||||
| React.useEffect(() => { | React.useEffect(() => { | ||||
| const viewer = new ThreeViewer({canvas: canvasRef.current}) | |||||
| const viewer = new ThreeViewer({ | |||||
| canvas: canvasRef.current, | |||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | |||||
| // Load an environment map | // Load an environment map | ||||
| const envPromise = viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr') | const envPromise = viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr') |
| <body> | <body> | ||||
| <div id="root"></div> | <div id="root"></div> | ||||
| <script id="example-script" type="text/babel" data-scripts="./index.html" data-type="module"> | <script id="example-script" type="text/babel" data-scripts="./index.html" data-type="module"> | ||||
| // import {ThreeViewer} from 'https://threepipe.org/dist/index.mjs' | |||||
| import {ThreeViewer} from './../../dist/index.mjs' | |||||
| // import {ThreeViewer, LoadingScreenPlugin} from 'https://threepipe.org/dist/index.mjs' | |||||
| import {ThreeViewer, LoadingScreenPlugin} from './../../dist/index.mjs' | |||||
| import React from 'https://esm.sh/react' | import React from 'https://esm.sh/react' | ||||
| import ReactDOM from 'https://esm.sh/react-dom' | import ReactDOM from 'https://esm.sh/react-dom' | ||||
| function ThreeViewerComponent({ src, env }) { | function ThreeViewerComponent({ src, env }) { | ||||
| const canvasRef = React.useRef(null); | const canvasRef = React.useRef(null); | ||||
| React.useEffect(() => { | React.useEffect(() => { | ||||
| const viewer = new ThreeViewer({canvas: canvasRef.current}) | |||||
| const viewer = new ThreeViewer({canvas: canvasRef.current, | |||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | |||||
| // Load an environment map | // Load an environment map | ||||
| const envPromise = viewer.setEnvironmentMap(env) | const envPromise = viewer.setEnvironmentMap(env) |
| import {_testFinish, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| // @ts-expect-error no need react here | // @ts-expect-error no need react here | ||||
| import React from 'react' | import React from 'react' | ||||
| // @ts-expect-error no need react-dom here | // @ts-expect-error no need react-dom here | ||||
| function ThreeViewerComponent({src, env}: {src: string, env: string}) { | function ThreeViewerComponent({src, env}: {src: string, env: string}) { | ||||
| const canvasRef = React.useRef(null) | const canvasRef = React.useRef(null) | ||||
| React.useEffect(() => { | React.useEffect(() => { | ||||
| const viewer = new ThreeViewer({canvas: canvasRef.current}) | |||||
| const viewer = new ThreeViewer({canvas: canvasRef.current, | |||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | |||||
| // Load an environment map | // Load an environment map | ||||
| const envPromise = viewer.setEnvironmentMap(env) | const envPromise = viewer.setEnvironmentMap(env) |
| _testFinish, | _testFinish, | ||||
| Box3B, | Box3B, | ||||
| IObject3D, | IObject3D, | ||||
| LoadingScreenPlugin, | |||||
| Mesh, | Mesh, | ||||
| Object3DWidgetsPlugin, | Object3DWidgetsPlugin, | ||||
| PhysicalMaterial, | PhysicalMaterial, | ||||
| autoSetEnvironment: true, // when hdr/exr is dropped | autoSetEnvironment: true, // when hdr/exr is dropped | ||||
| }, | }, | ||||
| }, | }, | ||||
| plugins: [Object3DWidgetsPlugin], | |||||
| plugins: [Object3DWidgetsPlugin, LoadingScreenPlugin], | |||||
| }) | }) | ||||
| // viewer.scene.addObject(new HemisphereLight(0xffffff, 0x444444, 10)) | // viewer.scene.addObject(new HemisphereLight(0xffffff, 0x444444, 10)) |
| DepthBufferPlugin, | DepthBufferPlugin, | ||||
| downloadBlob, | downloadBlob, | ||||
| isWebpExportSupported, | isWebpExportSupported, | ||||
| LoadingScreenPlugin, | |||||
| ThreeViewer, | ThreeViewer, | ||||
| UnsignedByteType, | UnsignedByteType, | ||||
| WebGLRenderTarget, | WebGLRenderTarget, | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| rgbm: false, // this will make the composer target not use RGBM encoding, and use HalfFloat. Otherwise, its UnsignedByteType | rgbm: false, // this will make the composer target not use RGBM encoding, and use HalfFloat. Otherwise, its UnsignedByteType | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| async function init() { | async function init() { |
| _testFinish, | _testFinish, | ||||
| DepthBufferPlugin, | DepthBufferPlugin, | ||||
| HalfFloatType, | HalfFloatType, | ||||
| LoadingScreenPlugin, | |||||
| NormalBufferPlugin, | NormalBufferPlugin, | ||||
| RenderTargetPreviewPlugin, | RenderTargetPreviewPlugin, | ||||
| ThreeViewer, | ThreeViewer, | ||||
| msaa: true, | msaa: true, | ||||
| rgbm: true, | rgbm: true, | ||||
| zPrepass: false, | zPrepass: false, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| async function init() { | async function init() { |
| import {_testFinish, IObject3D, Rhino3dmLoadPlugin, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, IObject3D, LoadingScreenPlugin, Rhino3dmLoadPlugin, ThreeViewer} from 'threepipe' | |||||
| async function init() { | async function init() { | ||||
| autoSetBackground: true, | autoSetBackground: true, | ||||
| }, | }, | ||||
| }, | }, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| viewer.addPluginSync(Rhino3dmLoadPlugin) | viewer.addPluginSync(Rhino3dmLoadPlugin) |
| import {_testFinish, IObject3D, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, IObject3D, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true)) | const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true)) |
| IGeometry, | IGeometry, | ||||
| IMaterial, | IMaterial, | ||||
| IObject3D, | IObject3D, | ||||
| LoadingScreenPlugin, | |||||
| PickingPlugin, | PickingPlugin, | ||||
| SimplifyModifierPlugin, | SimplifyModifierPlugin, | ||||
| ThreeViewer, | ThreeViewer, | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [PickingPlugin], | |||||
| plugins: [PickingPlugin, LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const simplify = viewer.addPluginSync(SimplifyModifierPluginImpl) | const simplify = viewer.addPluginSync(SimplifyModifierPluginImpl) |
| </style> | </style> | ||||
| <script type="module" src="../examples-utils/simple-code-preview.mjs"></script> | <script type="module" src="../examples-utils/simple-code-preview.mjs"></script> | ||||
| <script id="example-script" type="module"> | <script id="example-script" type="module"> | ||||
| import {_testFinish, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| import {GaussianSplattingPlugin} from '@threepipe/plugin-gaussian-splatting' | import {GaussianSplattingPlugin} from '@threepipe/plugin-gaussian-splatting' | ||||
| const viewer = new ThreeViewer({canvas: document.getElementById('mcanvas')}) | |||||
| const viewer = new ThreeViewer({canvas: document.getElementById('mcanvas'), | |||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | |||||
| viewer.addPluginsSync([GaussianSplattingPlugin]) | viewer.addPluginsSync([GaussianSplattingPlugin]) | ||||
| async function init() { | async function init() { |
| _testFinish, | _testFinish, | ||||
| Box3B, | Box3B, | ||||
| IObject3D, | IObject3D, | ||||
| LoadingScreenPlugin, | |||||
| Mesh, | Mesh, | ||||
| Object3DWidgetsPlugin, | Object3DWidgetsPlugin, | ||||
| PCFSoftShadowMap, | PCFSoftShadowMap, | ||||
| autoSetEnvironment: true, // when hdr/exr is dropped | autoSetEnvironment: true, // when hdr/exr is dropped | ||||
| }, | }, | ||||
| }, | }, | ||||
| plugins: [Object3DWidgetsPlugin], | |||||
| plugins: [Object3DWidgetsPlugin, LoadingScreenPlugin], | |||||
| }) | }) | ||||
| // viewer.scene.addObject(new HemisphereLight(0xffffff, 0x444444, 10)) | // viewer.scene.addObject(new HemisphereLight(0xffffff, 0x444444, 10)) |
| import {_testFinish, IObject3D, PhysicalMaterial, ProgressivePlugin, SSAAPlugin, ThreeViewer} from 'threepipe' | |||||
| import { | |||||
| _testFinish, | |||||
| IObject3D, | |||||
| LoadingScreenPlugin, | |||||
| PhysicalMaterial, | |||||
| ProgressivePlugin, | |||||
| SSAAPlugin, | |||||
| ThreeViewer, | |||||
| } from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| importConfig: true, | importConfig: true, | ||||
| }, | }, | ||||
| }, | }, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| viewer.addPluginSync(new SSAAPlugin()) | viewer.addPluginSync(new SSAAPlugin()) | ||||
| import {_testFinish, RenderTargetPreviewPlugin, SSAAPlugin, SSAOPlugin, ThreeViewer, UnsignedByteType} from 'threepipe' | |||||
| import { | |||||
| _testFinish, | |||||
| LoadingScreenPlugin, | |||||
| RenderTargetPreviewPlugin, | |||||
| SSAAPlugin, | |||||
| SSAOPlugin, | |||||
| ThreeViewer, | |||||
| UnsignedByteType, | |||||
| } from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [SSAAPlugin], | |||||
| plugins: [SSAAPlugin, LoadingScreenPlugin], | |||||
| tonemap: false, | tonemap: false, | ||||
| }) | }) | ||||
| import {_testFinish, IObject3D, STLLoadPlugin, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, IObject3D, LoadingScreenPlugin, STLLoadPlugin, ThreeViewer} from 'threepipe' | |||||
| async function init() { | async function init() { | ||||
| autoSetBackground: true, | autoSetBackground: true, | ||||
| }, | }, | ||||
| }, | }, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| viewer.addPluginSync(STLLoadPlugin) | viewer.addPluginSync(STLLoadPlugin) |
| <script> | <script> | ||||
| import {onDestroy, onMount} from 'svelte'; | import {onDestroy, onMount} from 'svelte'; | ||||
| const {ThreeViewer} = window.threepipe; // umd imported from unpkg in index.html | |||||
| const {ThreeViewer, LoadingScreenPlugin} = window.threepipe; // umd imported from unpkg in index.html | |||||
| // or | // or | ||||
| // import {ThreeViewer} from 'threepipe'; // esm imported from npm | |||||
| // import {ThreeViewer, LoadingScreenPlugin} from 'threepipe'; // esm imported from npm | |||||
| let canvasRef; | let canvasRef; | ||||
| let viewer; | let viewer; | ||||
| onMount(() => { | onMount(() => { | ||||
| viewer = new ThreeViewer({canvas: canvasRef}); | |||||
| viewer = new ThreeViewer({canvas: canvasRef, | |||||
| plugins: [LoadingScreenPlugin], | |||||
| }); | |||||
| // Load an environment map | // Load an environment map | ||||
| const envPromise = viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr'); | const envPromise = viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr'); |
| _testFinish, | _testFinish, | ||||
| EditorViewWidgetPlugin, | EditorViewWidgetPlugin, | ||||
| GBufferPlugin, | GBufferPlugin, | ||||
| LoadingScreenPlugin, | |||||
| PickingPlugin, | PickingPlugin, | ||||
| ThreeViewer, | ThreeViewer, | ||||
| TransformControlsPlugin, | TransformControlsPlugin, | ||||
| rgbm: false, | rgbm: false, | ||||
| // zPrepass: true, | // zPrepass: true, | ||||
| tonemap: false, | tonemap: false, | ||||
| plugins: [GBufferPlugin, PickingPlugin, TransformControlsPlugin], | |||||
| plugins: [GBufferPlugin, PickingPlugin, TransformControlsPlugin, LoadingScreenPlugin], | |||||
| }) | }) | ||||
| viewer.addPluginSync(new EditorViewWidgetPlugin('bottom-left', 128)) | viewer.addPluginSync(new EditorViewWidgetPlugin('bottom-left', 128)) | ||||
| import {_testFinish, IObject3D, ThreeFirstPersonControlsPlugin, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, IObject3D, LoadingScreenPlugin, ThreeFirstPersonControlsPlugin, ThreeViewer} from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [ThreeFirstPersonControlsPlugin], | |||||
| plugins: [ThreeFirstPersonControlsPlugin, LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true)) | const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true)) |
| import { | import { | ||||
| _testFinish, | _testFinish, | ||||
| DropzonePlugin, | |||||
| EditorViewWidgetPlugin, | EditorViewWidgetPlugin, | ||||
| GBufferPlugin, | GBufferPlugin, | ||||
| GLTFAnimationPlugin, | GLTFAnimationPlugin, | ||||
| IObject3D, | IObject3D, | ||||
| LoadingScreenPlugin, | |||||
| PickingPlugin, | PickingPlugin, | ||||
| ThreeViewer, | ThreeViewer, | ||||
| TransformControlsPlugin, | TransformControlsPlugin, | ||||
| rgbm: false, | rgbm: false, | ||||
| // zPrepass: true, | // zPrepass: true, | ||||
| tonemap: false, | tonemap: false, | ||||
| plugins: [GBufferPlugin, PickingPlugin, TransformControlsPlugin], /* TransformControlsPlugin */ // todo: transform controls doesnt work when selected object is in a parent. | |||||
| plugins: [GBufferPlugin, PickingPlugin, TransformControlsPlugin, LoadingScreenPlugin], /* TransformControlsPlugin */ // todo: transform controls doesnt work when selected object is in a parent. | |||||
| dropzone: { | |||||
| autoAdd: true, | |||||
| addOptions: { | |||||
| disposeSceneObjects: true, | |||||
| }, | |||||
| }, | |||||
| }) | }) | ||||
| viewer.addPluginSync(new EditorViewWidgetPlugin('bottom-left', 128)) | viewer.addPluginSync(new EditorViewWidgetPlugin('bottom-left', 128)) | ||||
| 'https://threejs.org/examples/models/obj/male02/male02.obj', | 'https://threejs.org/examples/models/obj/male02/male02.obj', | ||||
| 'https://threejs.org/examples/models/gltf/kira.glb', // slow | 'https://threejs.org/examples/models/gltf/kira.glb', // slow | ||||
| // to test | |||||
| 'https://cdn.jsdelivr.net/gh/KhronosGroup/glTF-Sample-Assets/Models/WaterBottle/glTF-Draco/WaterBottle.gltf', | |||||
| 'https://cdn.jsdelivr.net/gh/KhronosGroup/glTF-Sample-Assets/Models/MaterialsVariantsShoe/glTF/MaterialsVariantsShoe.gltf', | |||||
| // not working/very slow | // not working/very slow | ||||
| 'https://threejs.org/examples/models/gltf/Soldier.glb', | 'https://threejs.org/examples/models/gltf/Soldier.glb', | ||||
| 'https://threejs.org/examples/models/gltf/LittlestTokyo.glb', | 'https://threejs.org/examples/models/gltf/LittlestTokyo.glb', | ||||
| const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true)) | const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true)) | ||||
| ui.setupPlugins(ThreeSVGRendererPlugin) | ui.setupPlugins(ThreeSVGRendererPlugin) | ||||
| ui.setupPlugins(GLTFAnimationPlugin) | |||||
| ui.setupPlugins(PickingPlugin) | |||||
| ui.setupPlugins(GLTFAnimationPlugin, PickingPlugin, DropzonePlugin) | |||||
| } | } | ||||
| init().finally(_testFinish) | init().finally(_testFinish) |
| import {_testFinish, DepthBufferPlugin, IObject3D, ThreeViewer, TonemapPlugin, UnsignedByteType} from 'threepipe' | |||||
| import { | |||||
| _testFinish, | |||||
| DepthBufferPlugin, | |||||
| IObject3D, | |||||
| LoadingScreenPlugin, | |||||
| ThreeViewer, | |||||
| TonemapPlugin, | |||||
| UnsignedByteType, | |||||
| } from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| tonemap: true, // this is true by default | tonemap: true, // this is true by default | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| // A GBuffer(depth buffer here) is required for the `tonemapBackground` flag in TonemapPlugin to work | // A GBuffer(depth buffer here) is required for the `tonemapBackground` flag in TonemapPlugin to work |
| import {_testFinish, IObject3D, PopmotionPlugin, ThreeViewer, TransformAnimationPlugin} from 'threepipe' | |||||
| import { | |||||
| _testFinish, | |||||
| IObject3D, | |||||
| LoadingScreenPlugin, | |||||
| PopmotionPlugin, | |||||
| ThreeViewer, | |||||
| TransformAnimationPlugin, | |||||
| } from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| import {createSimpleButtons} from '../examples-utils/simple-bottom-buttons.js' | import {createSimpleButtons} from '../examples-utils/simple-bottom-buttons.js' | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| plugins: [PopmotionPlugin], | |||||
| plugins: [PopmotionPlugin, LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const transformAnimPlugin = viewer.addPluginSync(TransformAnimationPlugin) | const transformAnimPlugin = viewer.addPluginSync(TransformAnimationPlugin) | ||||
| console.log(transformAnimPlugin) | console.log(transformAnimPlugin) |
| import {_testFinish, IObject3D, PickingPlugin, ThreeViewer, TransformControlsPlugin} from 'threepipe' | |||||
| import { | |||||
| _testFinish, | |||||
| IObject3D, | |||||
| LoadingScreenPlugin, | |||||
| PickingPlugin, | |||||
| ThreeViewer, | |||||
| TransformControlsPlugin, | |||||
| } from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| renderScale: 'auto', | |||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| viewer.scene.setBackgroundColor(0x151822) | viewer.scene.setBackgroundColor(0x151822) |
| import {_testFinish, IObject3D, ThreeViewer, TonemapPlugin} from 'threepipe' | |||||
| import {_testFinish, IObject3D, LoadingScreenPlugin, ThreeViewer, TonemapPlugin} from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true)) | const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true)) |
| import {_testFinish, BoxGeometry, Color, Mesh, PhysicalMaterial, ThreeViewer, TonemapPlugin} from 'threepipe' | |||||
| import { | |||||
| _testFinish, | |||||
| BoxGeometry, | |||||
| Color, | |||||
| LoadingScreenPlugin, | |||||
| Mesh, | |||||
| PhysicalMaterial, | |||||
| ThreeViewer, | |||||
| TonemapPlugin, | |||||
| } from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| rgbm: true, | rgbm: true, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| viewer.scene.backgroundColor = new Color().set('black') | viewer.scene.backgroundColor = new Color().set('black') | ||||
| viewer.getPlugin(TonemapPlugin)!.exposure = 0.04 | viewer.getPlugin(TonemapPlugin)!.exposure = 0.04 |
| import {_testFinish, IObject3D, ThreeViewer, USDZLoadPlugin} from 'threepipe' | |||||
| import {_testFinish, IObject3D, LoadingScreenPlugin, ThreeViewer, USDZLoadPlugin} from 'threepipe' | |||||
| async function init() { | async function init() { | ||||
| autoSetBackground: true, | autoSetBackground: true, | ||||
| }, | }, | ||||
| }, | }, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| viewer.addPluginSync(USDZLoadPlugin) | viewer.addPluginSync(USDZLoadPlugin) |
| import {_testFinish, IObject3D, ThreeViewer} from 'threepipe' | |||||
| import {_testFinish, IObject3D, LoadingScreenPlugin, ThreeViewer} from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| msaa: true, | msaa: true, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true)) | const ui = viewer.addPluginSync(new TweakpaneUiPlugin(true)) |
| import {_testFinish, IObject3D, ThreeViewer, VignettePlugin} from 'threepipe' | |||||
| import {_testFinish, IObject3D, LoadingScreenPlugin, ThreeViewer, VignettePlugin} from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | ||||
| async function init() { | async function init() { | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| renderScale: 'auto', | |||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| viewer.addPluginSync(VignettePlugin) | viewer.addPluginSync(VignettePlugin) |
| _testFinish, | _testFinish, | ||||
| IObject3D, | IObject3D, | ||||
| LinearToneMapping, | LinearToneMapping, | ||||
| LoadingScreenPlugin, | |||||
| Mesh, | Mesh, | ||||
| PerspectiveCamera2, | PerspectiveCamera2, | ||||
| PlaneGeometry, | PlaneGeometry, | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| debug: true, | debug: true, | ||||
| plugins: [new ProgressivePlugin(16)], | |||||
| plugins: [new ProgressivePlugin(16), LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const virtualCameras = viewer.addPluginSync(VirtualCamerasPlugin) | const virtualCameras = viewer.addPluginSync(VirtualCamerasPlugin) | ||||
| const popmotion = viewer.addPluginSync(PopmotionPlugin) | const popmotion = viewer.addPluginSync(PopmotionPlugin) |
| _testFinish, | _testFinish, | ||||
| HemisphereLight, | HemisphereLight, | ||||
| IObject3D, | IObject3D, | ||||
| LoadingScreenPlugin, | |||||
| PerspectiveCamera2, | PerspectiveCamera2, | ||||
| ProgressivePlugin, | ProgressivePlugin, | ||||
| RenderTargetPreviewPlugin, | RenderTargetPreviewPlugin, | ||||
| const viewer = new ThreeViewer({ | const viewer = new ThreeViewer({ | ||||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | ||||
| debug: true, | debug: true, | ||||
| plugins: [new ProgressivePlugin(16), SSAAPlugin], | |||||
| plugins: [new ProgressivePlugin(16), SSAAPlugin, LoadingScreenPlugin], | |||||
| }) | }) | ||||
| const virtualCameras = viewer.addPluginSync(VirtualCamerasPlugin) | const virtualCameras = viewer.addPluginSync(VirtualCamerasPlugin) | ||||
| <canvas id="three-canvas" style="width: 800px; height: 600px" ref="canvasRef"></canvas> | <canvas id="three-canvas" style="width: 800px; height: 600px" ref="canvasRef"></canvas> | ||||
| </div> | </div> | ||||
| <script id="example-script" type="module" data-scripts="./index.html"> | <script id="example-script" type="module" data-scripts="./index.html"> | ||||
| // import { ThreeViewer } from 'https://threepipe.org/dist/index.mjs' | |||||
| import { ThreeViewer } from './../../dist/index.mjs' | |||||
| // import { ThreeViewer, LoadingScreenPlugin } from 'https://threepipe.org/dist/index.mjs' | |||||
| import { ThreeViewer, LoadingScreenPlugin } from './../../dist/index.mjs' | |||||
| import { createApp, ref, onMounted, onBeforeUnmount } from "https://unpkg.com/vue@3/dist/vue.esm-browser.prod.js"; | import { createApp, ref, onMounted, onBeforeUnmount } from "https://unpkg.com/vue@3/dist/vue.esm-browser.prod.js"; | ||||
| const ThreeViewerComponent = { | const ThreeViewerComponent = { | ||||
| const canvasRef = ref(null); | const canvasRef = ref(null); | ||||
| onMounted(() => { | onMounted(() => { | ||||
| const viewer = new ThreeViewer({ canvas: canvasRef.value }); | |||||
| const viewer = new ThreeViewer({ | |||||
| canvas: canvasRef.value, | |||||
| plugins: [LoadingScreenPlugin], | |||||
| }); | |||||
| // Load an environment map | // Load an environment map | ||||
| const envPromise = viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr'); | const envPromise = viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr'); |
| </template> | </template> | ||||
| <script> | <script> | ||||
| import {ThreeViewer} from "threepipe"; | |||||
| import {LoadingScreenPlugin, ThreeViewer} from "threepipe"; | |||||
| import {onBeforeUnmount, onMounted, ref} from "vue" | import {onBeforeUnmount, onMounted, ref} from "vue" | ||||
| export default { | export default { | ||||
| const canvasRef = ref(null); | const canvasRef = ref(null); | ||||
| onMounted(() => { | onMounted(() => { | ||||
| const viewer = new ThreeViewer({canvas: canvasRef.value}); | |||||
| const viewer = new ThreeViewer({ | |||||
| canvas: canvasRef.value, | |||||
| plugins: [LoadingScreenPlugin], | |||||
| }); | |||||
| // Load an environment map | // Load an environment map | ||||
| const envPromise = viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr'); | const envPromise = viewer.setEnvironmentMap('https://threejs.org/examples/textures/equirectangular/venice_sunset_1k.hdr'); |
| </style> | </style> | ||||
| <script type="module" src="../examples-utils/simple-code-preview.mjs"></script> | <script type="module" src="../examples-utils/simple-code-preview.mjs"></script> | ||||
| <script id="example-script" type="module"> | <script id="example-script" type="module"> | ||||
| import {_testFinish, DepthBufferPlugin, ThreeViewer, UnsignedByteType} from 'threepipe' | |||||
| import {_testFinish, DepthBufferPlugin, LoadingScreenPlugin, ThreeViewer, UnsignedByteType} from 'threepipe' | |||||
| async function init() { | async function init() { | ||||
| msaa: true, | msaa: true, | ||||
| rgbm: true, | rgbm: true, | ||||
| zPrepass: true, | zPrepass: true, | ||||
| plugins: [LoadingScreenPlugin], | |||||
| }) | }) | ||||
| viewer.addPluginSync(new DepthBufferPlugin(UnsignedByteType, true)) | viewer.addPluginSync(new DepthBufferPlugin(UnsignedByteType, true)) |