diff --git a/examples-jsm/changes.patch b/examples-jsm/changes.patch index ce2438c88..5cfab42a7 100644 --- a/examples-jsm/changes.patch +++ b/examples-jsm/changes.patch @@ -1,5 +1,5 @@ diff --git a/examples-jsm/examples/nodes/core/Node.ts b/examples-jsm/examples/nodes/core/Node.ts -index 438c44d..22392df 100644 +index 438c44dd..22392dfd 100644 --- a/examples-jsm/examples/nodes/core/Node.ts +++ b/examples-jsm/examples/nodes/core/Node.ts @@ -2,12 +2,94 @@ import { EventDispatcher } from 'three'; @@ -444,7 +444,7 @@ index 438c44d..22392df 100644 if (Class !== undefined) { diff --git a/examples-jsm/examples/nodes/core/NodeAttribute.ts b/examples-jsm/examples/nodes/core/NodeAttribute.ts -index 190fe8c..d873bb2 100644 +index 190fe8c5..d873bb24 100644 --- a/examples-jsm/examples/nodes/core/NodeAttribute.ts +++ b/examples-jsm/examples/nodes/core/NodeAttribute.ts @@ -1,5 +1,13 @@ @@ -463,7 +463,7 @@ index 190fe8c..d873bb2 100644 this.name = name; diff --git a/examples-jsm/examples/nodes/core/NodeBuilder.ts b/examples-jsm/examples/nodes/core/NodeBuilder.ts -index ebdc13f..a077bb0 100644 +index ebdc13ff..a077bb0c 100644 --- a/examples-jsm/examples/nodes/core/NodeBuilder.ts +++ b/examples-jsm/examples/nodes/core/NodeBuilder.ts @@ -8,7 +8,7 @@ import NodeCache from './NodeCache.js'; @@ -841,7 +841,7 @@ index ebdc13f..a077bb0 100644 toType = this.getVectorType(toType); diff --git a/examples-jsm/examples/nodes/core/NodeCache.ts b/examples-jsm/examples/nodes/core/NodeCache.ts -index 96a7e0c..b1a61b3 100644 +index 96a7e0c7..b1a61b35 100644 --- a/examples-jsm/examples/nodes/core/NodeCache.ts +++ b/examples-jsm/examples/nodes/core/NodeCache.ts @@ -1,16 +1,52 @@ @@ -900,7 +900,7 @@ index 96a7e0c..b1a61b3 100644 } } diff --git a/examples-jsm/examples/nodes/core/NodeFrame.ts b/examples-jsm/examples/nodes/core/NodeFrame.ts -index b8e8d37..399c788 100644 +index b8e8d37b..399c788b 100644 --- a/examples-jsm/examples/nodes/core/NodeFrame.ts +++ b/examples-jsm/examples/nodes/core/NodeFrame.ts @@ -1,6 +1,16 @@ @@ -939,7 +939,7 @@ index b8e8d37..399c788 100644 const reference = node.updateReference(this); diff --git a/examples-jsm/examples/nodes/core/NodeKeywords.ts b/examples-jsm/examples/nodes/core/NodeKeywords.ts -index 53da9bf..36bdcab 100644 +index 53da9bf5..36bdcabe 100644 --- a/examples-jsm/examples/nodes/core/NodeKeywords.ts +++ b/examples-jsm/examples/nodes/core/NodeKeywords.ts @@ -1,11 +1,18 @@ @@ -990,7 +990,7 @@ index 53da9bf..36bdcab 100644 for (const keywordNode of keywordNodes) { diff --git a/examples-jsm/examples/nodes/core/NodeUniform.ts b/examples-jsm/examples/nodes/core/NodeUniform.ts -index 2918e21..c407d0a 100644 +index 2918e219..c407d0a5 100644 --- a/examples-jsm/examples/nodes/core/NodeUniform.ts +++ b/examples-jsm/examples/nodes/core/NodeUniform.ts @@ -1,5 +1,15 @@ @@ -1011,7 +1011,7 @@ index 2918e21..c407d0a 100644 this.name = name; diff --git a/examples-jsm/examples/nodes/core/NodeUtils.ts b/examples-jsm/examples/nodes/core/NodeUtils.ts -index 16a5f32..6adbec5 100644 +index 16a5f324..6adbec50 100644 --- a/examples-jsm/examples/nodes/core/NodeUtils.ts +++ b/examples-jsm/examples/nodes/core/NodeUtils.ts @@ -1,10 +1,11 @@ @@ -1102,7 +1102,7 @@ index 16a5f32..6adbec5 100644 const typeOf = typeof value; diff --git a/examples-jsm/examples/nodes/core/NodeVar.ts b/examples-jsm/examples/nodes/core/NodeVar.ts -index e6e935b..8d04ff1 100644 +index e6e935b3..8d04ff16 100644 --- a/examples-jsm/examples/nodes/core/NodeVar.ts +++ b/examples-jsm/examples/nodes/core/NodeVar.ts @@ -1,5 +1,10 @@ @@ -1118,7 +1118,7 @@ index e6e935b..8d04ff1 100644 this.name = name; diff --git a/examples-jsm/examples/nodes/core/NodeVarying.ts b/examples-jsm/examples/nodes/core/NodeVarying.ts -index a148236..0a62b23 100644 +index a1482362..0a62b23d 100644 --- a/examples-jsm/examples/nodes/core/NodeVarying.ts +++ b/examples-jsm/examples/nodes/core/NodeVarying.ts @@ -1,7 +1,11 @@ @@ -1135,7 +1135,7 @@ index a148236..0a62b23 100644 this.needsInterpolation = false; diff --git a/examples-jsm/examples/nodes/core/constants.ts b/examples-jsm/examples/nodes/core/constants.ts -index 3b01a9a..5ff6ad5 100644 +index 3b01a9a6..5ff6ad5f 100644 --- a/examples-jsm/examples/nodes/core/constants.ts +++ b/examples-jsm/examples/nodes/core/constants.ts @@ -1,14 +1,14 @@ @@ -1172,7 +1172,7 @@ index 3b01a9a..5ff6ad5 100644 +export const shaderStages: NodeShaderStage[] = [...defaultShaderStages, 'compute']; export const vectorComponents = ['x', 'y', 'z', 'w']; diff --git a/examples-jsm/examples/nodes/fog/FogNode.ts b/examples-jsm/examples/nodes/fog/FogNode.ts -index 9417df5..4376155 100644 +index 9417df5a..43761555 100644 --- a/examples-jsm/examples/nodes/fog/FogNode.ts +++ b/examples-jsm/examples/nodes/fog/FogNode.ts @@ -1,6 +1,7 @@ @@ -1193,7 +1193,7 @@ index 9417df5..4376155 100644 const getViewZ = builder.context.getViewZ; diff --git a/examples-jsm/examples/renderers/common/Animation.ts b/examples-jsm/examples/renderers/common/Animation.ts -index 0b00319..c190633 100644 +index 0b00319a..c190633b 100644 --- a/examples-jsm/examples/renderers/common/Animation.ts +++ b/examples-jsm/examples/renderers/common/Animation.ts @@ -1,5 +1,14 @@ @@ -1244,7 +1244,7 @@ index 0b00319..c190633 100644 } } diff --git a/examples-jsm/examples/renderers/common/Attributes.ts b/examples-jsm/examples/renderers/common/Attributes.ts -index ed9e8e9..f0f7502 100644 +index ed9e8e9e..f0f75022 100644 --- a/examples-jsm/examples/renderers/common/Attributes.ts +++ b/examples-jsm/examples/renderers/common/Attributes.ts @@ -1,9 +1,12 @@ @@ -1262,7 +1262,7 @@ index ed9e8e9..f0f7502 100644 this.backend = backend; diff --git a/examples-jsm/examples/renderers/common/Backend.ts b/examples-jsm/examples/renderers/common/Backend.ts -index e48a802..0084dc8 100644 +index e48a8029..0084dc83 100644 --- a/examples-jsm/examples/renderers/common/Backend.ts +++ b/examples-jsm/examples/renderers/common/Backend.ts @@ -1,22 +1,57 @@ @@ -1359,7 +1359,7 @@ index e48a802..0084dc8 100644 } } diff --git a/examples-jsm/examples/renderers/common/Background.ts b/examples-jsm/examples/renderers/common/Background.ts -index b7902dd..38e1f62 100644 +index b7902dd4..38e1f624 100644 --- a/examples-jsm/examples/renderers/common/Background.ts +++ b/examples-jsm/examples/renderers/common/Background.ts @@ -1,6 +1,6 @@ @@ -1407,7 +1407,7 @@ index b7902dd..38e1f62 100644 const background = this.nodes.getBackgroundNode(scene) || scene.background; diff --git a/examples-jsm/examples/renderers/common/Bindings.ts b/examples-jsm/examples/renderers/common/Bindings.ts -index 9485ec3..6a39a1d 100644 +index 9485ec3b..6a39a1db 100644 --- a/examples-jsm/examples/renderers/common/Bindings.ts +++ b/examples-jsm/examples/renderers/common/Bindings.ts @@ -1,8 +1,28 @@ @@ -1441,7 +1441,7 @@ index 9485ec3..6a39a1d 100644 this.backend = backend; diff --git a/examples-jsm/examples/renderers/common/ChainMap.ts b/examples-jsm/examples/renderers/common/ChainMap.ts -index e233bec..c4e8a2e 100644 +index e233beca..c4e8a2e9 100644 --- a/examples-jsm/examples/renderers/common/ChainMap.ts +++ b/examples-jsm/examples/renderers/common/ChainMap.ts @@ -1,56 +1,48 @@ @@ -1530,7 +1530,7 @@ index e233bec..c4e8a2e 100644 dispose() { diff --git a/examples-jsm/examples/renderers/common/ClippingContext.ts b/examples-jsm/examples/renderers/common/ClippingContext.ts -index 312e0b7..807083f 100644 +index 312e0b77..807083f6 100644 --- a/examples-jsm/examples/renderers/common/ClippingContext.ts +++ b/examples-jsm/examples/renderers/common/ClippingContext.ts @@ -5,6 +5,20 @@ const _plane = new Plane(); @@ -1555,7 +1555,7 @@ index 312e0b7..807083f 100644 this.version = ++_clippingContextVersion; diff --git a/examples-jsm/examples/renderers/common/Color4.ts b/examples-jsm/examples/renderers/common/Color4.ts -index c681cc9..5d03ade 100644 +index c681cc90..5d03adec 100644 --- a/examples-jsm/examples/renderers/common/Color4.ts +++ b/examples-jsm/examples/renderers/common/Color4.ts @@ -1,26 +1,31 @@ @@ -1599,7 +1599,7 @@ index c681cc9..5d03ade 100644 } diff --git a/examples-jsm/examples/renderers/common/Constants.ts b/examples-jsm/examples/renderers/common/Constants.ts -index 0d0c35a..53caf06 100644 +index 0d0c35a2..53caf06e 100644 --- a/examples-jsm/examples/renderers/common/Constants.ts +++ b/examples-jsm/examples/renderers/common/Constants.ts @@ -2,7 +2,7 @@ export const AttributeType = { @@ -1612,7 +1612,7 @@ index 0d0c35a..53caf06 100644 // size of a chunk in bytes (STD140 layout) diff --git a/examples-jsm/examples/renderers/common/DataMap.ts b/examples-jsm/examples/renderers/common/DataMap.ts -index 006bc29..eb39fca 100644 +index 006bc295..eb39fca8 100644 --- a/examples-jsm/examples/renderers/common/DataMap.ts +++ b/examples-jsm/examples/renderers/common/DataMap.ts @@ -1,9 +1,11 @@ @@ -1649,7 +1649,7 @@ index 006bc29..eb39fca 100644 } diff --git a/examples-jsm/examples/renderers/common/Geometries.ts b/examples-jsm/examples/renderers/common/Geometries.ts -index 5da9994..79bed8a 100644 +index 5da99946..79bed8a5 100644 --- a/examples-jsm/examples/renderers/common/Geometries.ts +++ b/examples-jsm/examples/renderers/common/Geometries.ts @@ -1,6 +1,8 @@ @@ -1674,7 +1674,7 @@ index 5da9994..79bed8a 100644 this.attributes = attributes; diff --git a/examples-jsm/examples/renderers/common/Info.ts b/examples-jsm/examples/renderers/common/Info.ts -index c8e7cb4..083e7c4 100644 +index c8e7cb41..083e7c42 100644 --- a/examples-jsm/examples/renderers/common/Info.ts +++ b/examples-jsm/examples/renderers/common/Info.ts @@ -1,4 +1,31 @@ @@ -1740,7 +1740,7 @@ index c8e7cb4..083e7c4 100644 } diff --git a/examples-jsm/examples/renderers/common/Pipelines.ts b/examples-jsm/examples/renderers/common/Pipelines.ts -index f6c570c..0a1c023 100644 +index f6c570c4..0a1c0238 100644 --- a/examples-jsm/examples/renderers/common/Pipelines.ts +++ b/examples-jsm/examples/renderers/common/Pipelines.ts @@ -2,9 +2,18 @@ import DataMap from './DataMap.js'; @@ -1773,7 +1773,7 @@ index f6c570c..0a1c023 100644 const data = this.get(renderObject); diff --git a/examples-jsm/examples/renderers/common/ProgrammableStage.ts b/examples-jsm/examples/renderers/common/ProgrammableStage.ts -index a684e44..6b64362 100644 +index a684e444..6b643625 100644 --- a/examples-jsm/examples/renderers/common/ProgrammableStage.ts +++ b/examples-jsm/examples/renderers/common/ProgrammableStage.ts @@ -1,6 +1,16 @@ @@ -1794,7 +1794,7 @@ index a684e44..6b64362 100644 this.id = _id++; diff --git a/examples-jsm/examples/renderers/common/RenderBundle.ts b/examples-jsm/examples/renderers/common/RenderBundle.ts -index e59e493..c7ba8cd 100644 +index e59e4937..c7ba8cd4 100644 --- a/examples-jsm/examples/renderers/common/RenderBundle.ts +++ b/examples-jsm/examples/renderers/common/RenderBundle.ts @@ -1,5 +1,10 @@ @@ -1810,7 +1810,7 @@ index e59e493..c7ba8cd 100644 this.camera = camera; } diff --git a/examples-jsm/examples/renderers/common/RenderBundles.ts b/examples-jsm/examples/renderers/common/RenderBundles.ts -index 2914036..48f5d59 100644 +index 29140365..48f5d598 100644 --- a/examples-jsm/examples/renderers/common/RenderBundles.ts +++ b/examples-jsm/examples/renderers/common/RenderBundles.ts @@ -1,14 +1,17 @@ @@ -1844,7 +1844,7 @@ index 2914036..48f5d59 100644 } diff --git a/examples-jsm/examples/renderers/common/RenderContext.ts b/examples-jsm/examples/renderers/common/RenderContext.ts -index 3b43028..c4bda4f 100644 +index 3b43028e..c4bda4f7 100644 --- a/examples-jsm/examples/renderers/common/RenderContext.ts +++ b/examples-jsm/examples/renderers/common/RenderContext.ts @@ -1,8 +1,48 @@ @@ -1898,7 +1898,7 @@ index 3b43028..c4bda4f 100644 this.id = id++; diff --git a/examples-jsm/examples/renderers/common/RenderContexts.ts b/examples-jsm/examples/renderers/common/RenderContexts.ts -index 630a2e4..9d99c98 100644 +index 630a2e42..9d99c98e 100644 --- a/examples-jsm/examples/renderers/common/RenderContexts.ts +++ b/examples-jsm/examples/renderers/common/RenderContexts.ts @@ -1,13 +1,16 @@ @@ -1935,7 +1935,7 @@ index 630a2e4..9d99c98 100644 dispose() { diff --git a/examples-jsm/examples/renderers/common/RenderList.ts b/examples-jsm/examples/renderers/common/RenderList.ts -index a72a91d..b72d609 100644 +index a72a91df..b72d6090 100644 --- a/examples-jsm/examples/renderers/common/RenderList.ts +++ b/examples-jsm/examples/renderers/common/RenderList.ts @@ -1,32 +1,62 @@ @@ -2086,7 +2086,7 @@ index a72a91d..b72d609 100644 if (this.transparent.length > 1) this.transparent.sort(customTransparentSort || reversePainterSortStable); } diff --git a/examples-jsm/examples/renderers/common/RenderLists.ts b/examples-jsm/examples/renderers/common/RenderLists.ts -index 3fc3134..0cc369e 100644 +index 3fc3134e..0cc369e5 100644 --- a/examples-jsm/examples/renderers/common/RenderLists.ts +++ b/examples-jsm/examples/renderers/common/RenderLists.ts @@ -1,14 +1,17 @@ @@ -2120,7 +2120,7 @@ index 3fc3134..0cc369e 100644 } diff --git a/examples-jsm/examples/renderers/common/RenderObject.ts b/examples-jsm/examples/renderers/common/RenderObject.ts -index 861c15d..88a944c 100644 +index 861c15dc..88a944c2 100644 --- a/examples-jsm/examples/renderers/common/RenderObject.ts +++ b/examples-jsm/examples/renderers/common/RenderObject.ts @@ -1,4 +1,10 @@ @@ -2244,7 +2244,7 @@ index 861c15d..88a944c 100644 } } diff --git a/examples-jsm/examples/renderers/common/RenderObjects.ts b/examples-jsm/examples/renderers/common/RenderObjects.ts -index 76dc482..a5ce085 100644 +index 76dc482e..a5ce0858 100644 --- a/examples-jsm/examples/renderers/common/RenderObjects.ts +++ b/examples-jsm/examples/renderers/common/RenderObjects.ts @@ -1,8 +1,33 @@ @@ -2345,7 +2345,7 @@ index 76dc482..a5ce085 100644 const chainMap = this.getChainMap(passId); diff --git a/examples-jsm/examples/renderers/common/Renderer.ts b/examples-jsm/examples/renderers/common/Renderer.ts -index acf180d..2973650 100644 +index acf180d8..29736509 100644 --- a/examples-jsm/examples/renderers/common/Renderer.ts +++ b/examples-jsm/examples/renderers/common/Renderer.ts @@ -30,10 +30,40 @@ import { @@ -3359,7 +3359,7 @@ index acf180d..2973650 100644 get compute() { diff --git a/examples-jsm/examples/renderers/common/Textures.ts b/examples-jsm/examples/renderers/common/Textures.ts -index 0eb0509..44c6f79 100644 +index 0eb0509c..6eb18198 100644 --- a/examples-jsm/examples/renderers/common/Textures.ts +++ b/examples-jsm/examples/renderers/common/Textures.ts @@ -14,12 +14,56 @@ import { @@ -3460,7 +3460,7 @@ index 0eb0509..44c6f79 100644 } - return target; -+ return target as Vector3WithSize; ++ return target as SizeVector3; } - getMipLevels(texture, width, height) { @@ -3502,7 +3502,7 @@ index 0eb0509..44c6f79 100644 this.backend.destroyTexture(texture); diff --git a/examples-jsm/examples/renderers/common/nodes/Nodes.ts b/examples-jsm/examples/renderers/common/nodes/Nodes.ts -index 86df565..b038962 100644 +index 86df5654..b0389629 100644 --- a/examples-jsm/examples/renderers/common/nodes/Nodes.ts +++ b/examples-jsm/examples/renderers/common/nodes/Nodes.ts @@ -2,10 +2,16 @@ import DataMap from '../DataMap.js'; diff --git a/examples-jsm/create-examples.js b/examples-jsm/create-examples.js index 3731b6270..eede4f655 100644 --- a/examples-jsm/create-examples.js +++ b/examples-jsm/create-examples.js @@ -4,6 +4,7 @@ import * as path from 'node:path'; import prettier from 'prettier'; const files = [ + 'nodes/core/constants', 'nodes/core/Node', 'nodes/core/NodeAttribute', 'nodes/core/NodeBuilder', @@ -16,7 +17,6 @@ const files = [ 'nodes/core/NodeUtils', 'nodes/core/NodeVar', 'nodes/core/NodeVarying', - 'nodes/core/constants', 'nodes/fog/FogNode', 'nodes/gpgpu/ComputeNode', 'nodes/lighting/EnvironmentNode', diff --git a/examples-jsm/declarations.js b/examples-jsm/declarations.js index 69c9d9046..c4ae6fa94 100644 --- a/examples-jsm/declarations.js +++ b/examples-jsm/declarations.js @@ -3,13 +3,20 @@ import * as path from 'node:path'; import { argv } from 'node:process'; const files = [ + 'nodes/core/constants', 'nodes/core/Node', 'nodes/core/NodeAttribute', 'nodes/core/NodeKeywords', 'nodes/core/NodeParser', 'nodes/core/NodeVar', 'nodes/core/NodeVarying', - 'nodes/core/constants', + 'renderers/common/ChainMap', + 'renderers/common/Color4', + 'renderers/common/Constants', + 'renderers/common/DataMap', + 'renderers/common/Info', + 'renderers/common/RenderContexts', + 'renderers/common/Textures', ]; const inDir = './examples'; diff --git a/types/three/examples/jsm/renderers/common/ChainMap.d.ts b/types/three/examples/jsm/renderers/common/ChainMap.d.ts new file mode 100644 index 000000000..44a140d6c --- /dev/null +++ b/types/three/examples/jsm/renderers/common/ChainMap.d.ts @@ -0,0 +1,10 @@ +type RecursiveWeakMap = WeakMap>; +export default class ChainMap { + weakMap: RecursiveWeakMap; + constructor(); + get(keys: K): V | undefined; + set(keys: K, value: V): V; + delete(keys: K): boolean; + dispose(): void; +} +export {}; diff --git a/types/three/examples/jsm/renderers/common/Color4.d.ts b/types/three/examples/jsm/renderers/common/Color4.d.ts index 1ea8922dc..12665a5c3 100644 --- a/types/three/examples/jsm/renderers/common/Color4.d.ts +++ b/types/three/examples/jsm/renderers/common/Color4.d.ts @@ -1,9 +1,10 @@ -import { Color, ColorRepresentation } from "../../../../src/math/Color.js"; - -export default class Color4 extends Color { +import { Color, ColorRepresentation } from "three"; +declare class Color4 extends Color { + a: number; + constructor(color?: ColorRepresentation); constructor(r: number, g: number, b: number, a?: number); - set(...args: [color: ColorRepresentation] | [r: number, g: number, b: number, a?: number]): this; - + copy(color: Color): this; clone(): this; } +export default Color4; diff --git a/types/three/examples/jsm/renderers/common/Constants.d.ts b/types/three/examples/jsm/renderers/common/Constants.d.ts new file mode 100644 index 000000000..c9e8f4608 --- /dev/null +++ b/types/three/examples/jsm/renderers/common/Constants.d.ts @@ -0,0 +1,8 @@ +export declare const AttributeType: { + readonly VERTEX: 1; + readonly INDEX: 2; + readonly STORAGE: 4; +}; +export declare const GPU_CHUNK_BYTES = 16; +export declare const BlendColorFactor = 211; +export declare const OneMinusBlendColorFactor = 212; diff --git a/types/three/examples/jsm/renderers/common/DataMap.d.ts b/types/three/examples/jsm/renderers/common/DataMap.d.ts new file mode 100644 index 000000000..0113208e3 --- /dev/null +++ b/types/three/examples/jsm/renderers/common/DataMap.d.ts @@ -0,0 +1,20 @@ +declare class DataMap< + M extends { + [key: string]: { + key: object; + value: unknown; + }; + }, +> { + data: WeakMap; + constructor(); + get(object: K): Extract["value"]; + delete(object: K): Extract["value"]; + has(object: M[keyof M]["key"]): boolean; + dispose(): void; +} +export default DataMap; diff --git a/types/three/examples/jsm/renderers/common/Info.d.ts b/types/three/examples/jsm/renderers/common/Info.d.ts index 9b4e1ddbe..986026c1e 100644 --- a/types/three/examples/jsm/renderers/common/Info.d.ts +++ b/types/three/examples/jsm/renderers/common/Info.d.ts @@ -1,22 +1,29 @@ import { Object3D } from "three"; - -export default class Info { +declare class Info { autoReset: boolean; - frame: number; calls: number; - - render: { calls: number; drawCalls: number; triangles: number; points: number; lines: number; timestamp: number }; - - compute: { calls: number; computeCalls: number; timestamp: number }; - - memory: { geometries: number; textures: number }; - + render: { + calls: number; + drawCalls: number; + triangles: number; + points: number; + lines: number; + timestamp: number; + }; + compute: { + calls: number; + computeCalls: number; + timestamp: number; + }; + memory: { + geometries: number; + textures: number; + }; + constructor(); update(object: Object3D, count: number, instanceCount: number): void; - updateTimestamp(type: "render" | "compute", time: number): void; - reset(): void; - dispose(): void; } +export default Info; diff --git a/types/three/examples/jsm/renderers/common/RenderContexts.d.ts b/types/three/examples/jsm/renderers/common/RenderContexts.d.ts new file mode 100644 index 000000000..a93eefc8c --- /dev/null +++ b/types/three/examples/jsm/renderers/common/RenderContexts.d.ts @@ -0,0 +1,13 @@ +import { Camera, RenderTarget, Scene } from "three"; +import ChainMap from "./ChainMap.js"; +import RenderContext from "./RenderContext.js"; +declare class RenderContexts { + chainMaps: { + [attachmentState: string]: ChainMap | undefined; + }; + constructor(); + get(scene: Scene, camera: Camera, renderTarget?: RenderTarget | null): RenderContext; + getChainMap(attachmentState: string): ChainMap; + dispose(): void; +} +export default RenderContexts; diff --git a/types/three/examples/jsm/renderers/common/Textures.d.ts b/types/three/examples/jsm/renderers/common/Textures.d.ts new file mode 100644 index 000000000..243eaff3b --- /dev/null +++ b/types/three/examples/jsm/renderers/common/Textures.d.ts @@ -0,0 +1,64 @@ +import { DepthTexture, RenderTarget, Texture, Vector3 } from "three"; +import Backend from "./Backend.js"; +import DataMap from "./DataMap.js"; +import Info from "./Info.js"; +import Renderer from "./Renderer.js"; +type SizeVector3Unitialized = Vector3 & { + width?: number; + height?: number; + depth?: number; +}; +type SizeVector3 = Vector3 & { + width: number; + height: number; + depth: number; +}; +interface RenderTargetData { + depthTextureMips?: { + [activeMipmapLevel: number]: DepthTexture; + }; + width?: number; + height?: number; + textures?: Texture[]; + depthTexture?: DepthTexture; + depth?: boolean; + stencil?: boolean; + renderTarget?: RenderTarget; + sampleCount?: number; + initialized?: boolean; +} +interface TextureData { + initialized?: boolean; + version?: number; + isDefaultTexture?: boolean; +} +interface TextureOptions { + width?: number; + height?: number; + depth?: number; + needsMipmaps?: boolean; + levels?: number; +} +declare class Textures extends DataMap<{ + renderTarget: { + key: RenderTarget; + value: RenderTargetData; + }; + texture: { + key: Texture; + value: TextureData; + }; +}> { + renderer: Renderer; + backend: Backend; + info: Info; + constructor(renderer: Renderer, backend: Backend, info: Info); + updateRenderTarget(renderTarget: RenderTarget, activeMipmapLevel?: number): void; + updateTexture(texture: Texture, options?: TextureOptions): void; + getSize(texture: Texture, target?: SizeVector3Unitialized): SizeVector3; + getMipLevels(texture: Texture, width: number, height: number): number; + needsMipmaps(texture: Texture): boolean; + isEnvironmentTexture(texture: Texture): boolean; + _destroyTexture(texture: Texture): void; +} +export default Textures;