Преглед на файлове

Fixes in three-ts-types, three-modded package update, some type fixes.

master
Palash Bansal преди 3 години
родител
ревизия
a701036be7
No account linked to committer's email address

+ 14
- 14
package-lock.json Целия файл

@@ -1,15 +1,15 @@
{
"name": "threepipe",
"version": "0.0.5",
"version": "0.0.6-dev",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "threepipe",
"version": "0.0.5",
"version": "0.0.6-dev",
"license": "MIT",
"dependencies": {
"@types/three": "https://github.com/repalash/three-ts-types/releases/download/v0.152.1008/package.tgz",
"@types/three": "https://github.com/repalash/three-ts-types/releases/download/v0.152.1010/package.tgz",
"@types/webxr": "^0.5.1",
"@types/wicg-file-system-access": "^2020.9.5",
"ts-browser-helpers": "^0.6.0"
@@ -37,7 +37,7 @@
"rollup-plugin-license": "^3.0.1",
"rollup-plugin-postcss": "^4.0.2",
"stats.js": "^0.17.0",
"three": "https://github.com/repalash/three.js-modded/releases/download/v0.152.2007/package.tgz",
"three": "https://github.com/repalash/three.js-modded/releases/download/v0.152.2009/package.tgz",
"tslib": "^2.5.0",
"tweakpane": "^3.1.9",
"tweakpane-image-plugin": "https://github.com/repalash/tweakpane-image-plugin/releases/download/v1.1.403/package.tgz",
@@ -670,9 +670,9 @@
"dev": true
},
"node_modules/@types/three": {
"version": "0.152.1008",
"resolved": "https://github.com/repalash/three-ts-types/releases/download/v0.152.1008/package.tgz",
"integrity": "sha512-TAoOxd0SXOsgp2q0SzLWSmZrEQO+bUzhgMczw6JlNGhaNDR/uNzr915DaD/cOw6KC592QfTC/RVhrFNV7e9WmA==",
"version": "0.152.1010",
"resolved": "https://github.com/repalash/three-ts-types/releases/download/v0.152.1010/package.tgz",
"integrity": "sha512-Mnl6+lJhZUj2zLMqK7a5qrG8QLHHqHVQ8MJ7i5NzjGZ/ZJ//GqY6B24q7Z8F3ei8ASWQv0YteEfH5noc3Z2lMQ==",
"dependencies": {
"@tweenjs/tween.js": "~18.6.4",
"fflate": "~0.6.9",
@@ -9445,9 +9445,9 @@
}
},
"node_modules/three": {
"version": "0.152.2007",
"resolved": "https://github.com/repalash/three.js-modded/releases/download/v0.152.2007/package.tgz",
"integrity": "sha512-++0udqOCSmsl6U1OaB0QBIVTTUeKAkG6PnWLqPyAwUESZFC175oqZVX2UmcY63iTDdVyVkNKNYWXVKh0gc9Tuw==",
"version": "0.152.2009",
"resolved": "https://github.com/repalash/three.js-modded/releases/download/v0.152.2009/package.tgz",
"integrity": "sha512-qUqy+/uRzvW3F4xvyRCnnJVZ8yssgSYurrUCU1I3AJq7lz/p2CoWbdZYWXBXpNxR8+0Awx9S6Cy0Ah5Lq7g6Hw==",
"dev": true,
"license": "MIT"
},
@@ -10802,8 +10802,8 @@
"dev": true
},
"@types/three": {
"version": "https://github.com/repalash/three-ts-types/releases/download/v0.152.1008/package.tgz",
"integrity": "sha512-TAoOxd0SXOsgp2q0SzLWSmZrEQO+bUzhgMczw6JlNGhaNDR/uNzr915DaD/cOw6KC592QfTC/RVhrFNV7e9WmA==",
"version": "https://github.com/repalash/three-ts-types/releases/download/v0.152.1010/package.tgz",
"integrity": "sha512-Mnl6+lJhZUj2zLMqK7a5qrG8QLHHqHVQ8MJ7i5NzjGZ/ZJ//GqY6B24q7Z8F3ei8ASWQv0YteEfH5noc3Z2lMQ==",
"requires": {
"@tweenjs/tween.js": "~18.6.4",
"fflate": "~0.6.9",
@@ -17131,8 +17131,8 @@
}
},
"three": {
"version": "https://github.com/repalash/three.js-modded/releases/download/v0.152.2007/package.tgz",
"integrity": "sha512-++0udqOCSmsl6U1OaB0QBIVTTUeKAkG6PnWLqPyAwUESZFC175oqZVX2UmcY63iTDdVyVkNKNYWXVKh0gc9Tuw==",
"version": "https://github.com/repalash/three.js-modded/releases/download/v0.152.2009/package.tgz",
"integrity": "sha512-qUqy+/uRzvW3F4xvyRCnnJVZ8yssgSYurrUCU1I3AJq7lz/p2CoWbdZYWXBXpNxR8+0Awx9S6Cy0Ah5Lq7g6Hw==",
"dev": true
},
"through": {

+ 6
- 6
package.json Целия файл

@@ -87,7 +87,7 @@
"rollup-plugin-license": "^3.0.1",
"rollup-plugin-postcss": "^4.0.2",
"stats.js": "^0.17.0",
"three": "https://github.com/repalash/three.js-modded/releases/download/v0.152.2007/package.tgz",
"three": "https://github.com/repalash/three.js-modded/releases/download/v0.152.2009/package.tgz",
"tslib": "^2.5.0",
"tweakpane": "^3.1.9",
"@tweakpane/core": "^1.1.8",
@@ -99,7 +99,7 @@
"tweakpane-image-plugin": "https://github.com/repalash/tweakpane-image-plugin/releases/download/v1.1.403/package.tgz"
},
"dependencies": {
"@types/three": "https://github.com/repalash/three-ts-types/releases/download/v0.152.1008/package.tgz",
"@types/three": "https://github.com/repalash/three-ts-types/releases/download/v0.152.1010/package.tgz",
"@types/webxr": "^0.5.1",
"@types/wicg-file-system-access": "^2020.9.5",
"ts-browser-helpers": "^0.6.0"
@@ -109,10 +109,10 @@
"uiconfig.js": "^0.0.4",
"ts-browser-helpers": "^0.5.0",
"uiconfig-tweakpane": "^0.0.3",
"three": "https://github.com/repalash/three.js-modded/releases/download/v0.152.2007/package.tgz",
"three-f": "https://github.com/repalash/three.js-modded/archive/refs/tags/v0.152.2007.tar.gz",
"@types/three": "https://github.com/repalash/three-ts-types/releases/download/v0.152.1008/package.tgz",
"@types/three-f": "https://github.com/repalash/three-ts-types/archive/refs/tags/v0.152.1008.tar.gz",
"three": "https://github.com/repalash/three.js-modded/releases/download/v0.152.2009/package.tgz",
"three-f": "https://github.com/repalash/three.js-modded/archive/refs/tags/v0.152.2009.tar.gz",
"@types/three": "https://github.com/repalash/three-ts-types/releases/download/v0.152.1010/package.tgz",
"@types/three-f": "https://github.com/repalash/three-ts-types/archive/refs/tags/v0.152.1010.tar.gz",
"@types/three-pkg": "https://gitpkg.now.sh/repalash/three-ts-types/types/three?modded_three",
"tweakpane-image-plugin": "git+ssh://github.com/repalash/tweakpane-image-plugin.git#52d5542047fd07d2e7225b5b67c9f7620366f2c7"
},

+ 6
- 3
src/assetmanager/IExporter.ts Целия файл

@@ -20,11 +20,14 @@ export type ExportFileOptions = {
*/
exportExt?: string,
/**
* Export the viewer config (scene settings).
* only works for rootSceneModelRoot. default = true
* Export and bundle the viewer config (scene settings).
* only works for rootSceneModelRoot and supported only in GLTFExporter2 {@link GLTFExporter2Options.viewerConfig}
* @default true
*/
viewerConfig?: boolean,
} & GLTFExporter2Options & AnyOptions

[key: string]: any
} & GLTFExporter2Options

export interface IAssetExporter extends IEventDispatcher<'exportFile' | 'exporterCreate'>{
getExporter(...ext: string[]): IExporter|undefined

+ 2
- 3
src/assetmanager/export/GLTFExporter2.ts Целия файл

@@ -15,7 +15,7 @@ import {
} from '../gltf'
import {glbEncryptionProcessor} from '../gltf/gltfEncyptionHelpers'

export type GLTFExporter2Options = GLTFExporterOptions & {
export type GLTFExporter2Options = {
/**
* embed images in glb even when remote url is available, {@default false}
*/
@@ -55,7 +55,7 @@ export type GLTFExporter2Options = GLTFExporterOptions & {
encryptKey?: string|Uint8Array,

[key: string]: any
}
} & GLTFExporterOptions

export class GLTFExporter2 extends GLTFExporter implements IExportParser {

@@ -137,7 +137,6 @@ export class GLTFExporter2 extends GLTFExporter implements IExportParser {
}
// eslint-disable-next-line @typescript-eslint/naming-convention
onDone(Object.assign(o, {__isGLTFOutput: true}))
// @ts-expect-error wrong ts
}, onError, gltfOptions, new GLTFWriter2())
}


+ 0
- 1
src/assetmanager/export/GLTFWriter2.ts Целия файл

@@ -235,7 +235,6 @@ export class GLTFWriter2 extends GLTFExporter.Utils.GLTFWriter {
// Add extra check for null images. This is set in processTexture when we have a rootPath
processImage(image: any, format: PixelFormat, flipY: boolean, mimeType = 'image/png') {
if (!image) return -1
// @ts-expect-error todo: update in three-ts-types
return super.processImage(image, format, flipY, mimeType, image._savePreview ? 32 : undefined, image._savePreview ? 32 : undefined)
}


+ 0
- 1
src/assetmanager/gltf/GLTFViewerConfigExtension.ts Целия файл

@@ -212,7 +212,6 @@ export class GLTFViewerConfigExtension {
const d = encodingVersion < 3 ? halfFloatToRgbe2(buffer.data, 4) : halfFloatToRgbe(buffer.data, 4)
const id = new ImageData(d, buffer.width, buffer.height)

// @ts-expect-error patched three. todo: update the types
const b64 = ImageUtils.getDataURL(id, true).split(',')[1]

mime = 'image/png'

+ 1
- 2
src/assetmanager/import/Rhino3dmLoader2.ts Целия файл

@@ -12,14 +12,13 @@ export class Rhino3dmLoader2 extends Rhino3dmLoader {

materials: Material[] = []

private _createMaterial(material: any): Material {
protected _createMaterial(material: any): Material {
if (!Rhino3dmLoader2.ImportMaterials) return this.materials[0] || new MeshStandardMaterial({
color: new Color(1, 1, 1),
metalness: 0.8,
name: 'default',
side: DoubleSide,
})
// @ts-expect-error not in ts
return super._createMaterial(material)
}
private _compareMaterials!: (material: Material) => Material

+ 2
- 4
src/postprocessing/ExtendedRenderPass.ts Целия файл

@@ -92,8 +92,7 @@ export class ExtendedRenderPass extends RenderPass implements IPipelinePass<'ren
}

let renderFn = ()=> {
// @ts-expect-error patched three.js RenderPass to accept depthBuffer
super.render(renderer, undefined, readBuffer, deltaTime, maskActive, depthRenderBuffer) // read is write in super.render (RenderPass)
super.render(renderer, null, readBuffer, deltaTime, maskActive, depthRenderBuffer) // read is write in super.render (RenderPass)
}

if (!this.renderManager.rgbm) {
@@ -189,8 +188,7 @@ export class ExtendedRenderPass extends RenderPass implements IPipelinePass<'ren
depthRenderBuffer = renderBufferProps2.__webglDepthRenderbuffer || renderBufferProps2.__webglDepthbuffer
}
renderFn = ()=> {
// @ts-expect-error patched three.js RenderPass to accept depthBuffer
super.render(renderer, undefined, this.transparentTarget, deltaTime, maskActive, depthRenderBuffer)
super.render(renderer, null, this.transparentTarget as any, deltaTime, maskActive, depthRenderBuffer)
}

// Transparent

+ 2
- 4
src/rendering/RenderManager.ts Целия файл

@@ -33,10 +33,8 @@ import {
} from '../core'
import {base64ToArrayBuffer, Class, onChange2, serializable, serialize, ValOrArr} from 'ts-browser-helpers'
import {uiConfig, uiFolderContainer, uiMonitor, uiSlider, uiToggle} from 'uiconfig.js'
import {generateUUID} from '../three'
import {textureDataToImageData} from '../three/utils/texture'
import {EXRExporter2} from '../assetmanager/export/EXRExporter2'
import {BlobExt} from '../assetmanager'
import {generateUUID, textureDataToImageData} from '../three'
import {BlobExt, EXRExporter2} from '../assetmanager'

@serializable('RenderManager')
@uiFolderContainer('Render Manager')

+ 1
- 0
src/rendering/RenderTarget.ts Целия файл

@@ -27,6 +27,7 @@ export interface IRenderTarget extends EventDispatcher {
targetKey?: string // for caching.
clone(trackTarget?: boolean): this
setSize(width: number, height: number, depth?: number): void;
copy(source: IRenderTarget): this;
dispose(): void;

scissor: Vector4;

+ 0
- 10
src/three/controls/OrbitControls3.ts Целия файл

@@ -50,14 +50,4 @@ export class OrbitControls3 extends OrbitControls implements IUiConfigContainer,

throttleUpdate = 60 // throttle to 60 updates per second (implemented in OrbitControls.js.update() method)

zoomIn(delta: number) {
// @ts-expect-error not in ts
super.zoomIn(delta)
}

zoomOut(delta: number) {
// @ts-expect-error not in ts
super.zoomOut(delta)
}

}

+ 1
- 1
src/utils/index.ts Целия файл

@@ -3,7 +3,7 @@ export {windowDialogWrapper, type IDialogWrapper} from './DialogWrapper'
export {GLStatsJS} from './GLStatsJS'
export {CustomContextMenu} from './CustomContextMenu'
export {Dropzone, type DropFile, type ListenerCallback, type DropEventType} from './Dropzone'
export {ThreeSerialization, type SerializationMetaType, type SerializationResourcesType, MetaImporter, metaToResources, getEmptyMeta, metaFromResources, convertArrayBufferToStringsInMeta, convertStringsToArrayBuffersInMeta, copyMaterialUserData, copyObject3DUserData, copyUserData, copyTextureUserData} from './serialization'
export {ThreeSerialization, type SerializationMetaType, type SerializationResourcesType, MetaImporter, metaToResources, getEmptyMeta, metaFromResources, convertArrayBufferToStringsInMeta, convertStringsToArrayBuffersInMeta, copyMaterialUserData, copyObject3DUserData, copyUserData, copyTextureUserData, jsonToBlob} from './serialization'
export {shaderReplaceString} from './shader-helpers'
export {makeGLBFile} from './gltf'


+ 1
- 1
src/viewer/ThreeViewer.ts Целия файл

@@ -763,7 +763,7 @@ export class ThreeViewer extends EventDispatcher<IViewerEvent, IViewerEventTypes
if (plugin && typeof plugin === 'string' || (plugin as any).PluginType) plugin = this.getPlugin(plugin as any)
if (!plugin) return {}
const meta = getEmptyMeta()
const data = (plugin as IViewerPlugin).toJSON?.(meta)
const data = (<IViewerPlugin>plugin).toJSON?.(meta)
if (!data) return {}
data.resources = metaToResources(meta)
return data

Loading…
Отказ
Запис