| # Datasource local storage ignored files | # Datasource local storage ignored files | ||||
| /dataSources/ | /dataSources/ | ||||
| /dataSources.local.xml | /dataSources.local.xml | ||||
| # GitHub Copilot persisted chat sessions | |||||
| /copilot/chatSessions |
| export type IGeometryEvent<T extends string = IGeometryEventTypes> = Event & { | export type IGeometryEvent<T extends string = IGeometryEventTypes> = Event & { | ||||
| type: T | type: T | ||||
| bubbleToObject?: boolean // bubble event to parent root | bubbleToObject?: boolean // bubble event to parent root | ||||
| geometry: IGeometry | |||||
| geometry?: IGeometry | |||||
| // change?: string | // change?: string | ||||
| } | } | ||||
| export type IGeometrySetDirtyOptions = AnyOptions & {bubbleToObject?: boolean} | export type IGeometrySetDirtyOptions = AnyOptions & {bubbleToObject?: boolean} |
| renderToGBuffer?: boolean | renderToGBuffer?: boolean | ||||
| /** | /** | ||||
| * Same as {@link renderToGBuffer} for now | |||||
| * Same as {@link renderToGBuffer} but for depth only, not normal or flags etc | |||||
| */ | */ | ||||
| renderToDepth?: boolean | renderToDepth?: boolean | ||||
| isRawShaderMaterial?: boolean | isRawShaderMaterial?: boolean | ||||
| isPhysicalMaterial?: boolean | isPhysicalMaterial?: boolean | ||||
| isUnlitMaterial?: boolean | isUnlitMaterial?: boolean | ||||
| isGBufferMaterial?: boolean | |||||
| // [key: string]: any | // [key: string]: any | ||||
| } | } |
| ['FORCED_LINEAR_DEPTH']: material.userData.forcedLinearDepth ?? undefined, | ['FORCED_LINEAR_DEPTH']: material.userData.forcedLinearDepth ?? undefined, | ||||
| }, material) | }, material) | ||||
| // todo: do the same in DepthBufferPlugin and NormalBufferPlugin | |||||
| // what about the material extension settings in the userData of the source materials? | |||||
| if (material.materialExtensions?.length) { | |||||
| this.registerMaterialExtensions(material.materialExtensions) | |||||
| } | |||||
| // this.transparent = true | // this.transparent = true | ||||
| this.needsUpdate = true | this.needsUpdate = true | ||||
| onAfterRender(renderer: WebGLRenderer, scene: Scene, camera: Camera, geometry: BufferGeometry, object: Object3D) { | onAfterRender(renderer: WebGLRenderer, scene: Scene, camera: Camera, geometry: BufferGeometry, object: Object3D) { | ||||
| super.onAfterRender(renderer, scene, camera, geometry, object) | super.onAfterRender(renderer, scene, camera, geometry, object) | ||||
| let material = (object as any).material as IMaterial & Partial<PhysicalMaterial> | |||||
| if (Array.isArray(material)) { // todo: add support for multi materials. | |||||
| material = material[0] | |||||
| } | |||||
| if (!material) return | |||||
| if (material.materialExtensions?.length) { | |||||
| this.unregisterMaterialExtensions(material.materialExtensions) | |||||
| } | |||||
| this.reset() | this.reset() | ||||
| } | } | ||||
| preserveDrawingBuffer: true, | preserveDrawingBuffer: true, | ||||
| powerPreference: RenderManager.POWER_PREFERENCE, | powerPreference: RenderManager.POWER_PREFERENCE, | ||||
| }) | }) | ||||
| renderer.info.autoReset = false | |||||
| renderer.useLegacyLights = false | renderer.useLegacyLights = false | ||||
| renderer.setAnimationLoop(this._animationLoop) | renderer.setAnimationLoop(this._animationLoop) | ||||
| renderer.onContextLost = (event: WebGLContextEvent) => { | renderer.onContextLost = (event: WebGLContextEvent) => { | ||||
| if (renderToScreen) { | if (renderToScreen) { | ||||
| this._frameCount += 1 | this._frameCount += 1 | ||||
| this._totalFrameCount += 1 | this._totalFrameCount += 1 | ||||
| this._renderer.info.reset() | |||||
| } | } | ||||
| this._dirty = false | this._dirty = false | ||||
| } | } |
| export * from 'three/src/constants.js' | export * from 'three/src/constants.js' | ||||
| export type {Shader} from 'three' | export type {Shader} from 'three' | ||||
| export type {IUniform} from 'three' | |||||
| export * from 'three/examples/jsm/libs/fflate.module.js' | export * from 'three/examples/jsm/libs/fflate.module.js' | ||||
| * @param prepend - prepend new string to old string | * @param prepend - prepend new string to old string | ||||
| * @param append - append new string to old string | * @param append - append new string to old string | ||||
| */ | */ | ||||
| export function shaderReplaceString(shader: string, str: string, newStr: string, { | |||||
| export function shaderReplaceString(shader: string, str: string|RegExp, newStr: string, { | |||||
| replaceAll = false, | replaceAll = false, | ||||
| prepend = false, | prepend = false, | ||||
| append = false, | append = false, | ||||
| } = {}) { | } = {}) { | ||||
| // todo: use safeReplaceString from ts-browser-helpers | // todo: use safeReplaceString from ts-browser-helpers | ||||
| if (warnEnabled /* && ThreeViewer.ViewerDebugging */) { | if (warnEnabled /* && ThreeViewer.ViewerDebugging */) { | ||||
| if (!shader.includes(str)) { | |||||
| if (typeof str === 'string' ? !shader.includes(str) : !str.test(shader)) { | |||||
| console.error(`${str} not found in shader`) | console.error(`${str} not found in shader`) | ||||
| return shader | return shader | ||||
| } | } |
| */ | */ | ||||
| rgbm?: boolean | rgbm?: boolean | ||||
| /** | /** | ||||
| * Use rendered gbuffer as depth-prepass / z-prepass. | |||||
| * Use rendered gbuffer as depth-prepass / z-prepass. (Requires DepthBufferPlugin/GBufferPlugin) | |||||
| * todo: It will be disabled when there are any transparent/transmissive objects with render to depth buffer enabled. | |||||
| */ | */ | ||||
| zPrepass?: boolean | zPrepass?: boolean | ||||
| /** | /** | ||||
| * @returns {HTMLElement} | * @returns {HTMLElement} | ||||
| */ | */ | ||||
| get container(): HTMLElement { | get container(): HTMLElement { | ||||
| // todo console.warn('container is deprecated, NOTE: subscribe to events when the canvas is moved to another container') | |||||
| if (this._canvas.parentElement !== this._container) { | |||||
| this.console.error('ThreeViewer: Canvas is not in the container, this might cause issues with some plugins.') | |||||
| } | |||||
| return this._container | return this._container | ||||
| } | } | ||||