Palash Bansal 1 год назад
Родитель
Сommit
af6705c2e5
Аккаунт пользователя с таким Email не найден

+ 1
- 1
examples/html-js-sample/index.html Просмотреть файл

@@ -23,7 +23,7 @@
// or
// import {ThreeViewer, LoadingScreenPlugin} from 'threepipe' // if using import maps
// import {ThreeViewer, LoadingScreenPlugin} from './../../dist/index.mjs'
// import {ThreeViewer, LoadingScreenPlugin} from 'https://threepipe.org/dist/index.mjs'
// import {ThreeViewer, LoadingScreenPlugin} from 'https://unpkg.com/threepipe@latest/dist/index.mjs'

const viewer = new ThreeViewer({canvas: document.getElementById('three-canvas')})


+ 1
- 1
examples/react-js-sample/index.html Просмотреть файл

@@ -17,7 +17,7 @@
<body>
<div id="root"></div>
<script id="example-script" type="module" data-scripts="./index.html">
// import {ThreeViewer, LoadingScreenPlugin} from 'https://threepipe.org/dist/index.mjs'
// import {ThreeViewer, LoadingScreenPlugin} from 'https://unpkg.com/threepipe@latest/dist/index.mjs'
import {ThreeViewer, LoadingScreenPlugin} from './../../dist/index.mjs'
import React from 'https://esm.sh/react@18'
import ReactDOM from 'https://esm.sh/react-dom@18'

+ 1
- 1
examples/react-jsx-sample/index.html Просмотреть файл

@@ -19,7 +19,7 @@
<body>
<div id="root"></div>
<script id="example-script" type="text/babel" data-scripts="./index.html" data-type="module">
// import {ThreeViewer, LoadingScreenPlugin} from 'https://threepipe.org/dist/index.mjs'
// import {ThreeViewer, LoadingScreenPlugin} from 'https://unpkg.com/threepipe@latest/dist/index.mjs'
import {ThreeViewer, LoadingScreenPlugin} from './../../dist/index.mjs'
import React from 'https://esm.sh/react@18'
import ReactDOM from 'https://esm.sh/react-dom@18'

+ 1
- 1
examples/vue-html-sample/index.html Просмотреть файл

@@ -19,7 +19,7 @@
<canvas id="three-canvas" style="width: 800px; height: 600px" ref="canvasRef"></canvas>
</div>
<script id="example-script" type="module" data-scripts="./index.html">
// import { ThreeViewer, LoadingScreenPlugin } from 'https://threepipe.org/dist/index.mjs'
// import { ThreeViewer, LoadingScreenPlugin } from 'https://unpkg.com/threepipe@latest/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";


+ 3
- 2
plugins/extra-importers/src/index.ts Просмотреть файл

@@ -6,6 +6,7 @@ import {
Color,
Group,
ILoader,
ImportAddOptions,
Importer,
Mesh,
Object3D,
@@ -149,7 +150,7 @@ export class MDDLoadPlugin extends BaseImporterPlugin {
export class PCDLoadPlugin extends BaseImporterPlugin {
public static readonly PluginType = 'PCDLoadPlugin'
protected _importer = new Importer(class extends PCDLoader implements ILoader {
transform(points: Points, options: AnyOptions): any {
transform(points: Points, options: ImportAddOptions): any {
if (options.autoCenter) points.geometry.center()
points.geometry.rotateX(Math.PI)
return points
@@ -215,7 +216,7 @@ export class VTKLoadPlugin extends BaseImporterPlugin {
export class XYZLoadPlugin extends BaseImporterPlugin {
public static readonly PluginType = 'XYZLoadPlugin'
protected _importer = new Importer(class extends XYZLoader implements ILoader {
transform(res: BufferGeometry, options: AnyOptions): Points|undefined {
transform(res: BufferGeometry, options: ImportAddOptions): Points|undefined {
if (!res.attributes?.normal) res.computeVertexNormals()
if (options.autoCenter) res.center()
return res ? new Points(res, new PointsMaterial({

+ 2
- 2
src/assetmanager/AssetImporter.ts Просмотреть файл

@@ -302,7 +302,7 @@ export class AssetImporter extends EventDispatcher<IAssetImporterEventMap> imple
// baseUrl: LoaderUtils.extractUrlBase(url),
}

loader.loadFileOptions = options
loader.importOptions = options
res = await loader.loadAsync(path + (options.queryString ? (path.includes('?') ? '&' : '?') + options.queryString : ''), (e)=>{
if (onDownloadProgress) onDownloadProgress(e)
const total = e.lengthComputable ? e.total : undefined
@@ -315,7 +315,7 @@ export class AssetImporter extends EventDispatcher<IAssetImporterEventMap> imple
})
})
if (loader.transform) res = await loader.transform(res, options)
delete loader.loadFileOptions
delete loader.importOptions

this._rootContext = undefined


+ 2
- 2
src/assetmanager/AssetManager.ts Просмотреть файл

@@ -84,8 +84,8 @@ export interface AddAssetOptions extends AddObjectOptions{
*/
autoSetBackground?: boolean
}
export type ImportAddOptions = ImportAssetOptions & AddAssetOptions
export type AddRawOptions = ProcessRawOptions & AddAssetOptions
export interface ImportAddOptions extends ImportAssetOptions, AddAssetOptions{}
export interface AddRawOptions extends ProcessRawOptions, AddAssetOptions{}

export interface AssetManagerEventMap{
loadAsset: {data: ImportResult}

+ 4
- 3
src/assetmanager/IImporter.ts Просмотреть файл

@@ -1,16 +1,17 @@
import {Loader} from 'three'
import {IAssetImporter, LoadFileOptions} from './IAssetImporter'
import {IAssetImporter} from './IAssetImporter'
import {IDisposable} from 'ts-browser-helpers'
import {ImportAddOptions} from './AssetManager'

export interface ILoader<T = any, T2 = T> extends Loader, Partial<IDisposable> {
loadFileOptions?: LoadFileOptions
importOptions?: ImportAddOptions
loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<any>;
/**
* Transform after load, like convert geometry to mesh, etc. for reference see {@link DRACOLoader2} or {@link PLYLoadPlugin}
* @param res - result of load
* @param options
*/
transform?(res: T, options: LoadFileOptions): T2|Promise<T2>
transform?(res: T, options: ImportAddOptions): T2|Promise<T2>
}
export interface IImporter {
ext: string[];

+ 4
- 4
src/three/controls/OrbitControls3.ts Просмотреть файл

@@ -42,11 +42,11 @@ export class OrbitControls3 extends OrbitControls implements IUiConfigContainer,
@uiInput() @serialize() minPolarAngle = 0
@uiInput() @serialize() maxPolarAngle = Math.PI

@uiInput() @serialize() minAzimuthAngle = -10000 // should be -Infinity but this breaks the UI
@uiInput() @serialize() maxAzimuthAngle = 10000 // should be Infinity but this breaks the UI
@uiInput() @serialize() minAzimuthAngle = -1e6 // should be -Infinity but this breaks the UI
@uiInput() @serialize() maxAzimuthAngle = 1e6 // should be Infinity but this breaks the UI

@uiVector() @serialize() clampMin = new Vector3(-10000, -10000, -10000) // should be -Infinity but this breaks the UI
@uiVector() @serialize() clampMax = new Vector3(10000, 10000, 10000) // should be Infinity but this breaks the UI
@uiVector() @serialize() clampMin = new Vector3(-1e6, -1e6, -1e6) // should be -Infinity but this breaks the UI
@uiVector() @serialize() clampMax = new Vector3(1e6, 1e6, 1e6) // should be Infinity but this breaks the UI

// @uiToggle()
@serialize() screenSpacePanning = true

Загрузка…
Отмена
Сохранить