| "@types/webxr": "^0.5.1", | "@types/webxr": "^0.5.1", | ||||
| "@types/wicg-file-system-access": "^2020.9.5", | "@types/wicg-file-system-access": "^2020.9.5", | ||||
| "stats.js": "^0.17.0", | "stats.js": "^0.17.0", | ||||
| "ts-browser-helpers": "^0.13.0", | |||||
| "ts-browser-helpers": "^0.14.2", | |||||
| "uiconfig.js": "^0.0.12" | "uiconfig.js": "^0.0.12" | ||||
| }, | }, | ||||
| "devDependencies": { | "devDependencies": { | ||||
| } | } | ||||
| }, | }, | ||||
| "node_modules/ts-browser-helpers": { | "node_modules/ts-browser-helpers": { | ||||
| "version": "0.13.0", | |||||
| "resolved": "https://registry.npmjs.org/ts-browser-helpers/-/ts-browser-helpers-0.13.0.tgz", | |||||
| "integrity": "sha512-n0qO5+Nr9pngVechioLzWueQWqOItYhyu3O0cvFxz/lPt2M9zipqyFTLg5LdNA7NJnvHxv588eUZHmzmLcEa4Q==", | |||||
| "version": "0.14.2", | |||||
| "resolved": "https://registry.npmjs.org/ts-browser-helpers/-/ts-browser-helpers-0.14.2.tgz", | |||||
| "integrity": "sha512-YAj98YRAl5uKWCBCh4pAHqJK/6tBcstIFa9Z9Q9SQTtzFSKKHo3TVHWdmC/fZxRIhuKthMmDHD5xb+qqb7a9xQ==", | |||||
| "dependencies": { | "dependencies": { | ||||
| "@types/wicg-file-system-access": "^2020.9.5" | "@types/wicg-file-system-access": "^2020.9.5" | ||||
| } | } |
| "new:pack": "npm run prepare && clean-package && npm pack && clean-package restore", | "new:pack": "npm run prepare && clean-package && npm pack && clean-package restore", | ||||
| "new:publish": "npm run prepare && clean-package && npm publish && clean-package restore", | "new:publish": "npm run prepare && clean-package && npm publish && clean-package restore", | ||||
| "build:rollup": "rimraf dist && npm run update-version && NODE_ENV=production rollup -c", | "build:rollup": "rimraf dist && npm run update-version && NODE_ENV=production rollup -c", | ||||
| "build": "npm run update-version && vite build", | |||||
| "build": "npm run update-version && npm run compile && vite build", | |||||
| "dev:rollup": "rollup -c -w", | "dev:rollup": "rollup -c -w", | ||||
| "dev": "NODE_ENV=development vite build --watch", | "dev": "NODE_ENV=development vite build --watch", | ||||
| "build-examples": "tsc --project examples/tsconfig.build.json", | "build-examples": "tsc --project examples/tsconfig.build.json", | ||||
| "docs-plugins": "node scripts/each-plugin.mjs run docs", | "docs-plugins": "node scripts/each-plugin.mjs run docs", | ||||
| "docs-all": "npm run docs && npm run docs-plugins", | "docs-all": "npm run docs && npm run docs-plugins", | ||||
| "build-plugins": "node scripts/each-plugin.mjs install", | "build-plugins": "node scripts/each-plugin.mjs install", | ||||
| "prepare": "npm run build && npm run compile && npm run build-plugins && npm run build-examples", | |||||
| "prepare": "npm run build && npm run build-plugins && npm run build-examples", | |||||
| "update-version": "node scripts/update-version.mjs" | "update-version": "node scripts/update-version.mjs" | ||||
| }, | }, | ||||
| "clean-package": { | "clean-package": { | ||||
| "@types/webxr": "^0.5.1", | "@types/webxr": "^0.5.1", | ||||
| "@types/wicg-file-system-access": "^2020.9.5", | "@types/wicg-file-system-access": "^2020.9.5", | ||||
| "stats.js": "^0.17.0", | "stats.js": "^0.17.0", | ||||
| "ts-browser-helpers": "^0.13.0", | |||||
| "ts-browser-helpers": "^0.14.2", | |||||
| "uiconfig.js": "^0.0.12" | "uiconfig.js": "^0.0.12" | ||||
| }, | }, | ||||
| "//": { | "//": { | ||||
| "dependencies": { | "dependencies": { | ||||
| "uiconfig.js": "^0.0.12", | "uiconfig.js": "^0.0.12", | ||||
| "ts-browser-helpers": "^0.12.0", | |||||
| "ts-browser-helpers": "^0.14.2", | |||||
| "three": "https://github.com/repalash/three.js-modded/releases/download/v0.153.1003/package.tgz", | "three": "https://github.com/repalash/three.js-modded/releases/download/v0.153.1003/package.tgz", | ||||
| "three-f": "https://github.com/repalash/three.js-modded/archive/refs/tags/v0.153.1003.tar.gz", | "three-f": "https://github.com/repalash/three.js-modded/archive/refs/tags/v0.153.1003.tar.gz", | ||||
| "@types/three": "https://github.com/repalash/three-ts-types/releases/download/v0.153.1002/package.tgz", | "@types/three": "https://github.com/repalash/three-ts-types/releases/download/v0.153.1002/package.tgz", |
| */ | */ | ||||
| private _canvas?: HTMLCanvasElement | private _canvas?: HTMLCanvasElement | ||||
| get isMainCamera(): boolean { | get isMainCamera(): boolean { | ||||
| return this.userData.__isMainCamera || false | |||||
| return this.userData ? this.userData.__isMainCamera || false : false | |||||
| } | } | ||||
| @serialize() | @serialize() |
| export {PMREMGenerator} from 'three' | export {PMREMGenerator} from 'three' | ||||
| export {WebGLUtils} from 'three' | export {WebGLUtils} from 'three' | ||||
| export type {ColorRepresentation, HSL, RGB} from 'three' | |||||
| export type {ShaderMaterialParameters} from 'three' | |||||
| export * from 'three/src/constants.js' | export * from 'three/src/constants.js' | ||||
| export type {Shader} from 'three' | export type {Shader} from 'three' |
| import {AnyFunction, getOrCall, objectHasOwn, safeSetProperty, ValOrFunc} from 'ts-browser-helpers' | |||||
| import {FnCaller, getOrCall, objectHasOwn, safeSetProperty, ValOrFunc} from 'ts-browser-helpers' | |||||
| /** | /** | ||||
| * | * | ||||
| if (val === newVal) return | if (val === newVal) return | ||||
| u.value = newVal | u.value = newVal | ||||
| safeSetProperty(this, 'uniformsNeedUpdate', true, true) | safeSetProperty(this, 'uniformsNeedUpdate', true, true) | ||||
| onChange && callOnChange.call(this, onChange, [propertyKey, newVal]) | |||||
| onChange && FnCaller.callFunction(onChange, this, [propertyKey, newVal]) | |||||
| }, | }, | ||||
| // configurable: true, | // configurable: true, | ||||
| // enumerable: true, | // enumerable: true, | ||||
| } | } | ||||
| } | } | ||||
| function callOnChange(this: any, onChange: (...args: any[]) => any, params: any[]) { | |||||
| // same logic as onChange in ts-browser-helpers. todo: loop through object prototype chain like in onChange? | |||||
| if (onChange.name) { | |||||
| const fn: AnyFunction = this[onChange.name] | |||||
| if (fn && fn === onChange) | |||||
| onChange.call(this, ...params) | |||||
| else if (fn && fn.name.endsWith(`bound ${onChange.name}`)) | |||||
| fn(...params) | |||||
| else onChange(...params) | |||||
| } else onChange(...params) | |||||
| } | |||||
| // todo migrate to new decorators - https://2ality.com/2022/10/javascript-decorators.html | // todo migrate to new decorators - https://2ality.com/2022/10/javascript-decorators.html | ||||
| /** | /** | ||||
| * Decorator to create a three.js style define in this.material or this and bind to a property. | * Decorator to create a three.js style define in this.material or this and bind to a property. | ||||
| safeSetProperty(t, p, newVal, true) | safeSetProperty(t, p, newVal, true) | ||||
| if (newVal === undefined) delete t[p] | if (newVal === undefined) delete t[p] | ||||
| if (onChange && typeof onChange === 'function') { | if (onChange && typeof onChange === 'function') { | ||||
| callOnChange.call(this, onChange, [p, newVal]) | |||||
| FnCaller.callFunction(onChange, this, [p, newVal]) | |||||
| } else { | } else { | ||||
| safeSetProperty(thisMat ? this : this.material, 'needsUpdate', true, true) | safeSetProperty(thisMat ? this : this.material, 'needsUpdate', true, true) | ||||
| } | } | ||||
| safeSetProperty(t, p, newVal, true) | safeSetProperty(t, p, newVal, true) | ||||
| if (newVal === undefined) delete t[p] | if (newVal === undefined) delete t[p] | ||||
| let oc = onChange | let oc = onChange | ||||
| if (oc && (typeof oc === 'string' || typeof oc === 'symbol')) oc = this[oc] | |||||
| if (oc && typeof oc === 'function') callOnChange.call(this, oc, [p, newVal]) | |||||
| if (oc && (typeof oc === 'string' || typeof oc === 'symbol')) oc = this[oc] // todo just call it here directly | |||||
| if (oc && typeof oc === 'function') FnCaller.callFunction(oc, this, [p, newVal]) | |||||
| }, | }, | ||||
| // configurable: true, | // configurable: true, | ||||
| // enumerable: true, | // enumerable: true, |
| export {pathJoin, getUrlQueryParam, setUrlQueryParam, remoteWorkerURL} from 'ts-browser-helpers' | export {pathJoin, getUrlQueryParam, setUrlQueryParam, remoteWorkerURL} from 'ts-browser-helpers' | ||||
| export {css, glsl, html, svgUrl} from 'ts-browser-helpers' | export {css, glsl, html, svgUrl} from 'ts-browser-helpers' | ||||
| export {Serialization} from 'ts-browser-helpers' | export {Serialization} from 'ts-browser-helpers' | ||||
| export {FnCaller} from 'ts-browser-helpers' |