@plastic-software/three 0.179.0 → 0.180.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +166 -106
- package/build/three.core.js +112 -20
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +55 -89
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +30 -5
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +2896 -1048
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +2896 -1048
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +1 -1
- package/examples/jsm/controls/ArcballControls.js +7 -7
- package/examples/jsm/controls/DragControls.js +6 -56
- package/examples/jsm/controls/FirstPersonControls.js +2 -2
- package/examples/jsm/controls/PointerLockControls.js +0 -8
- package/examples/jsm/exporters/GLTFExporter.js +30 -22
- package/examples/jsm/exporters/KTX2Exporter.js +4 -2
- package/examples/jsm/exporters/PLYExporter.js +1 -1
- package/examples/jsm/libs/ktx-parse.module.js +1 -1
- package/examples/jsm/lines/Line2.js +3 -3
- package/examples/jsm/lines/LineGeometry.js +1 -1
- package/examples/jsm/lines/LineSegments2.js +2 -2
- package/examples/jsm/lines/Wireframe.js +2 -2
- package/examples/jsm/lines/WireframeGeometry2.js +1 -1
- package/examples/jsm/lines/webgpu/LineSegments2.js +1 -1
- package/examples/jsm/lines/webgpu/Wireframe.js +1 -1
- package/examples/jsm/loaders/ColladaLoader.js +1 -1
- package/examples/jsm/loaders/EXRLoader.js +5 -5
- package/examples/jsm/loaders/GLTFLoader.js +9 -5
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +5 -5
- package/examples/jsm/loaders/HDRLoader.js +486 -0
- package/examples/jsm/loaders/KTX2Loader.js +112 -32
- package/examples/jsm/loaders/RGBELoader.js +7 -473
- package/examples/jsm/loaders/TTFLoader.js +4 -4
- package/examples/jsm/loaders/UltraHDRLoader.js +1 -1
- package/examples/jsm/loaders/lwo/IFFParser.js +1 -1
- package/examples/jsm/materials/WoodNodeMaterial.js +533 -0
- package/examples/jsm/math/ColorSpaces.js +19 -1
- package/examples/jsm/math/ConvexHull.js +2 -2
- package/examples/jsm/math/Lut.js +2 -2
- package/examples/jsm/misc/MD2CharacterComplex.js +1 -1
- package/examples/jsm/misc/ProgressiveLightMap.js +1 -1
- package/examples/jsm/misc/Volume.js +1 -1
- package/examples/jsm/postprocessing/OutlinePass.js +1 -1
- package/examples/jsm/postprocessing/SSRPass.js +37 -8
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +1 -1
- package/examples/jsm/transpiler/GLSLDecoder.js +22 -19
- package/examples/jsm/transpiler/TSLEncoder.js +2 -10
- package/examples/jsm/transpiler/WGSLEncoder.js +24 -0
- package/examples/jsm/tsl/display/AnamorphicNode.js +27 -4
- package/examples/jsm/tsl/display/BloomNode.js +3 -3
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +2 -1
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +439 -90
- package/examples/jsm/tsl/display/GTAONode.js +8 -0
- package/examples/jsm/tsl/display/GaussianBlurNode.js +47 -35
- package/examples/jsm/tsl/display/OutlineNode.js +2 -2
- package/examples/jsm/tsl/display/SSRNode.js +180 -65
- package/examples/jsm/tsl/display/TRAANode.js +1 -1
- package/examples/jsm/tsl/display/boxBlur.js +64 -0
- package/examples/jsm/tsl/display/hashBlur.js +15 -18
- package/examples/jsm/utils/BufferGeometryUtils.js +1 -1
- package/examples/jsm/utils/ShadowMapViewerGPU.js +12 -5
- package/examples/jsm/webxr/OculusHandModel.js +1 -1
- package/package.json +1 -1
- package/src/Three.Core.js +1 -0
- package/src/Three.TSL.js +29 -4
- package/src/animation/AnimationClip.js +17 -2
- package/src/constants.js +11 -3
- package/src/core/BufferGeometry.js +2 -2
- package/src/extras/TextureUtils.js +2 -1
- package/src/extras/lib/earcut.js +1 -1
- package/src/lights/webgpu/ProjectorLight.js +1 -1
- package/src/materials/Material.js +12 -0
- package/src/materials/MeshDistanceMaterial.js +1 -1
- package/src/materials/nodes/PointsNodeMaterial.js +81 -28
- package/src/materials/nodes/SpriteNodeMaterial.js +3 -15
- package/src/materials/nodes/manager/NodeMaterialObserver.js +1 -1
- package/src/math/ColorManagement.js +7 -1
- package/src/nodes/Nodes.js +3 -0
- package/src/nodes/TSL.js +3 -0
- package/src/nodes/accessors/BufferNode.js +1 -1
- package/src/nodes/accessors/Camera.js +133 -7
- package/src/nodes/accessors/ClippingNode.js +6 -5
- package/src/nodes/accessors/CubeTextureNode.js +2 -2
- package/src/nodes/accessors/InstanceNode.js +3 -1
- package/src/nodes/accessors/Object3DNode.js +1 -1
- package/src/nodes/accessors/ReferenceBaseNode.js +1 -1
- package/src/nodes/accessors/ReferenceNode.js +1 -1
- package/src/nodes/accessors/Texture3DNode.js +13 -0
- package/src/nodes/accessors/TextureNode.js +71 -19
- package/src/nodes/code/FunctionCallNode.js +19 -0
- package/src/nodes/code/FunctionNode.js +23 -0
- package/src/nodes/core/AssignNode.js +4 -3
- package/src/nodes/core/ContextNode.js +24 -0
- package/src/nodes/core/Node.js +16 -20
- package/src/nodes/core/NodeBuilder.js +48 -14
- package/src/nodes/core/NodeFrame.js +1 -1
- package/src/nodes/core/NodeUniform.js +1 -1
- package/src/nodes/core/NodeUtils.js +1 -2
- package/src/nodes/core/StackNode.js +29 -4
- package/src/nodes/core/StructNode.js +5 -5
- package/src/nodes/core/StructTypeNode.js +1 -0
- package/src/nodes/core/SubBuildNode.js +2 -2
- package/src/nodes/core/UniformNode.js +16 -9
- package/src/nodes/core/VarNode.js +0 -21
- package/src/nodes/display/FrontFacingNode.js +4 -8
- package/src/nodes/display/PassNode.js +1 -1
- package/src/nodes/display/ScreenNode.js +42 -13
- package/src/nodes/display/ViewportDepthTextureNode.js +16 -4
- package/src/nodes/display/ViewportSharedTextureNode.js +12 -0
- package/src/nodes/display/ViewportTextureNode.js +42 -12
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +430 -0
- package/src/nodes/lighting/LightsNode.js +1 -1
- package/src/nodes/math/BitcastNode.js +156 -0
- package/src/nodes/math/ConditionalNode.js +18 -2
- package/src/nodes/math/MathNode.js +3 -15
- package/src/nodes/math/OperatorNode.js +4 -3
- package/src/nodes/tsl/TSLCore.js +432 -152
- package/src/nodes/utils/JoinNode.js +3 -1
- package/src/nodes/utils/MemberNode.js +58 -7
- package/src/nodes/utils/RTTNode.js +1 -1
- package/src/nodes/utils/ReflectorNode.js +51 -7
- package/src/nodes/utils/SampleNode.js +12 -2
- package/src/nodes/utils/SplitNode.js +11 -0
- package/src/nodes/utils/Timer.js +0 -47
- package/src/objects/BatchedMesh.js +2 -2
- package/src/objects/LOD.js +1 -1
- package/src/objects/Sprite.js +2 -2
- package/src/renderers/WebGLRenderer.js +0 -9
- package/src/renderers/common/Attributes.js +1 -1
- package/src/renderers/common/Backend.js +19 -1
- package/src/renderers/common/Bindings.js +2 -0
- package/src/renderers/common/ChainMap.js +1 -1
- package/src/renderers/common/DataMap.js +1 -1
- package/src/renderers/common/Pipelines.js +1 -1
- package/src/renderers/common/RenderContext.js +2 -2
- package/src/renderers/common/RenderObject.js +14 -2
- package/src/renderers/common/Renderer.js +39 -19
- package/src/renderers/common/SampledTexture.js +1 -1
- package/src/renderers/common/Sampler.js +25 -13
- package/src/renderers/common/Textures.js +34 -12
- package/src/renderers/common/TimestampQueryPool.js +3 -3
- package/src/renderers/common/XRManager.js +35 -19
- package/src/renderers/common/nodes/NodeBuilderState.js +1 -1
- package/src/renderers/common/nodes/NodeLibrary.js +5 -5
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +7 -15
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +1 -1
- package/src/renderers/webgl/WebGLProgram.js +4 -4
- package/src/renderers/webgl/WebGLShadowMap.js +1 -1
- package/src/renderers/webgl/WebGLTextures.js +1 -0
- package/src/renderers/webgl/WebGLUtils.js +3 -2
- package/src/renderers/webgl-fallback/WebGLBackend.js +186 -135
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +110 -17
- package/src/renderers/webgl-fallback/utils/WebGLState.js +1 -1
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +52 -3
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +9 -10
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +3 -2
- package/src/renderers/webgpu/WebGPUBackend.js +35 -31
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +124 -34
- package/src/renderers/webgpu/utils/WebGPUConstants.js +2 -2
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +9 -18
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +114 -25
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +3 -3
- package/src/renderers/webxr/WebXRManager.js +39 -24
- package/src/textures/ExternalTexture.js +15 -4
- package/src/textures/Source.js +1 -1
- package/src/textures/VideoTexture.js +0 -3
- package/examples/jsm/loaders/RGBMLoader.js +0 -1148
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import { float, Fn, vec2, uv, sin, rand, degrees, cos, Loop, vec4, premultiplyAlpha, unpremultiplyAlpha } from 'three/tsl';
|
|
1
|
+
import { float, Fn, vec2, uv, sin, rand, degrees, cos, Loop, vec4, premultiplyAlpha, unpremultiplyAlpha, convertToTexture, nodeObject } from 'three/tsl';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Applies a hash blur effect to the given texture node.
|
|
5
5
|
*
|
|
6
|
+
* The approach of this blur is different compared to Gaussian and box blur since
|
|
7
|
+
* it does not rely on a kernel to apply a convolution. Instead, it reads the base
|
|
8
|
+
* texture multiple times in a random pattern and then averages the samples. A
|
|
9
|
+
* typical artifact of this technique is a slightly noisy appearance of the blur which
|
|
10
|
+
* can be mitigated by increasing the number of iterations (see `repeats` parameter).
|
|
11
|
+
* Compared to Gaussian blur, hash blur requires just a single pass.
|
|
12
|
+
*
|
|
6
13
|
* Reference: {@link https://www.shadertoy.com/view/4lXXWn}.
|
|
7
14
|
*
|
|
8
15
|
* @function
|
|
@@ -10,42 +17,32 @@ import { float, Fn, vec2, uv, sin, rand, degrees, cos, Loop, vec4, premultiplyAl
|
|
|
10
17
|
* @param {Node<float>} [bluramount=float(0.1)] - This node determines the amount of blur.
|
|
11
18
|
* @param {Object} [options={}] - Additional options for the hash blur effect.
|
|
12
19
|
* @param {Node<float>} [options.repeats=float(45)] - The number of iterations for the blur effect.
|
|
13
|
-
* @param {Node<vec4>} [options.mask=null] - A mask node to control the alpha blending of the blur.
|
|
14
20
|
* @param {boolean} [options.premultipliedAlpha=false] - Whether to use premultiplied alpha for the blur effect.
|
|
15
21
|
* @return {Node<vec4>} The blurred texture node.
|
|
16
22
|
*/
|
|
17
23
|
export const hashBlur = /*#__PURE__*/ Fn( ( [ textureNode, bluramount = float( 0.1 ), options = {} ] ) => {
|
|
18
24
|
|
|
19
|
-
|
|
20
|
-
repeats = float( 45 ),
|
|
21
|
-
mask = null,
|
|
22
|
-
premultipliedAlpha = false
|
|
23
|
-
} = options;
|
|
24
|
-
|
|
25
|
-
const draw = ( uv ) => {
|
|
26
|
-
|
|
27
|
-
let sample = textureNode.sample( uv );
|
|
28
|
-
|
|
29
|
-
if ( mask !== null ) {
|
|
25
|
+
textureNode = convertToTexture( textureNode );
|
|
30
26
|
|
|
31
|
-
|
|
27
|
+
const repeats = nodeObject( options.repeats ) || float( 45 );
|
|
28
|
+
const premultipliedAlpha = options.premultipliedAlpha || false;
|
|
32
29
|
|
|
33
|
-
|
|
30
|
+
const tap = ( uv ) => {
|
|
34
31
|
|
|
35
|
-
|
|
32
|
+
const sample = textureNode.sample( uv );
|
|
36
33
|
|
|
37
34
|
return premultipliedAlpha ? premultiplyAlpha( sample ) : sample;
|
|
38
35
|
|
|
39
36
|
};
|
|
40
37
|
|
|
41
38
|
const targetUV = textureNode.uvNode || uv();
|
|
42
|
-
const blurred_image = vec4( 0. )
|
|
39
|
+
const blurred_image = vec4( 0. );
|
|
43
40
|
|
|
44
41
|
Loop( { start: 0., end: repeats, type: 'float' }, ( { i } ) => {
|
|
45
42
|
|
|
46
43
|
const q = vec2( vec2( cos( degrees( i.div( repeats ).mul( 360. ) ) ), sin( degrees( i.div( repeats ).mul( 360. ) ) ) ).mul( rand( vec2( i, targetUV.x.add( targetUV.y ) ) ).add( bluramount ) ) );
|
|
47
44
|
const uv2 = vec2( targetUV.add( q.mul( bluramount ) ) );
|
|
48
|
-
blurred_image.addAssign(
|
|
45
|
+
blurred_image.addAssign( tap( uv2 ) );
|
|
49
46
|
|
|
50
47
|
} );
|
|
51
48
|
|
|
@@ -446,7 +446,7 @@ function deepCloneAttribute( attribute ) {
|
|
|
446
446
|
* single {@link InterleavedBuffer} instance. All attributes must have compatible types.
|
|
447
447
|
*
|
|
448
448
|
* @param {Array<BufferAttribute>} attributes - The attributes to interleave.
|
|
449
|
-
* @return {Array<InterleavedBufferAttribute>} An array of interleaved attributes. If interleave does not succeed, the method returns `null`.
|
|
449
|
+
* @return {?Array<InterleavedBufferAttribute>} An array of interleaved attributes. If interleave does not succeed, the method returns `null`.
|
|
450
450
|
*/
|
|
451
451
|
function interleaveAttributes( attributes ) {
|
|
452
452
|
|
|
@@ -7,9 +7,10 @@ import {
|
|
|
7
7
|
OrthographicCamera,
|
|
8
8
|
PlaneGeometry,
|
|
9
9
|
Scene,
|
|
10
|
-
|
|
10
|
+
DepthTexture,
|
|
11
|
+
Vector2
|
|
11
12
|
} from 'three';
|
|
12
|
-
import {
|
|
13
|
+
import { uv, uniform, textureLoad } from 'three/tsl';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* This is a helper for visualising a given light's shadow map.
|
|
@@ -60,8 +61,10 @@ class ShadowMapViewer {
|
|
|
60
61
|
|
|
61
62
|
const material = new NodeMaterial();
|
|
62
63
|
|
|
63
|
-
const
|
|
64
|
-
|
|
64
|
+
const textureDimension = uniform( new Vector2() );
|
|
65
|
+
|
|
66
|
+
const shadowMapUniform = textureLoad( new DepthTexture(), uv().flipY().mul( textureDimension ) );
|
|
67
|
+
material.fragmentNode = shadowMapUniform.x.oneMinus();
|
|
65
68
|
|
|
66
69
|
const plane = new PlaneGeometry( frame.width, frame.height );
|
|
67
70
|
const mesh = new Mesh( plane, material );
|
|
@@ -173,7 +176,11 @@ class ShadowMapViewer {
|
|
|
173
176
|
//always end up with the scene's first added shadow casting light's shadowMap
|
|
174
177
|
//in the shader
|
|
175
178
|
//See: https://github.com/mrdoob/three.js/issues/5932
|
|
176
|
-
|
|
179
|
+
|
|
180
|
+
const depthTexture = light.shadow.map.depthTexture;
|
|
181
|
+
|
|
182
|
+
shadowMapUniform.value = depthTexture;
|
|
183
|
+
textureDimension.value.set( depthTexture.width, depthTexture.height );
|
|
177
184
|
|
|
178
185
|
currentAutoClear = renderer.autoClear;
|
|
179
186
|
renderer.autoClear = false; // To allow render overlay
|
|
@@ -122,7 +122,7 @@ class OculusHandModel extends Object3D {
|
|
|
122
122
|
/**
|
|
123
123
|
* Returns the pointer position which is the position of the index finger tip.
|
|
124
124
|
*
|
|
125
|
-
* @return {Vector3
|
|
125
|
+
* @return {?Vector3} The pointer position. Returns `null` if not index finger tip joint was found.
|
|
126
126
|
*/
|
|
127
127
|
getPointerPosition() {
|
|
128
128
|
|
package/package.json
CHANGED
package/src/Three.Core.js
CHANGED
|
@@ -34,6 +34,7 @@ export { CompressedCubeTexture } from './textures/CompressedCubeTexture.js';
|
|
|
34
34
|
export { CubeTexture } from './textures/CubeTexture.js';
|
|
35
35
|
export { CanvasTexture } from './textures/CanvasTexture.js';
|
|
36
36
|
export { DepthTexture } from './textures/DepthTexture.js';
|
|
37
|
+
export { ExternalTexture } from './textures/ExternalTexture.js';
|
|
37
38
|
export { Texture } from './textures/Texture.js';
|
|
38
39
|
export * from './geometries/Geometries.js';
|
|
39
40
|
export * from './materials/Materials.js';
|
package/src/Three.TSL.js
CHANGED
|
@@ -97,6 +97,7 @@ export const buffer = TSL.buffer;
|
|
|
97
97
|
export const bufferAttribute = TSL.bufferAttribute;
|
|
98
98
|
export const bumpMap = TSL.bumpMap;
|
|
99
99
|
export const burn = TSL.burn;
|
|
100
|
+
export const builtin = TSL.builtin;
|
|
100
101
|
export const bvec2 = TSL.bvec2;
|
|
101
102
|
export const bvec3 = TSL.bvec3;
|
|
102
103
|
export const bvec4 = TSL.bvec4;
|
|
@@ -111,6 +112,7 @@ export const cameraPosition = TSL.cameraPosition;
|
|
|
111
112
|
export const cameraProjectionMatrix = TSL.cameraProjectionMatrix;
|
|
112
113
|
export const cameraProjectionMatrixInverse = TSL.cameraProjectionMatrixInverse;
|
|
113
114
|
export const cameraViewMatrix = TSL.cameraViewMatrix;
|
|
115
|
+
export const cameraViewport = TSL.cameraViewport;
|
|
114
116
|
export const cameraWorldMatrix = TSL.cameraWorldMatrix;
|
|
115
117
|
export const cbrt = TSL.cbrt;
|
|
116
118
|
export const cdl = TSL.cdl;
|
|
@@ -177,6 +179,8 @@ export const faceDirection = TSL.faceDirection;
|
|
|
177
179
|
export const faceForward = TSL.faceForward;
|
|
178
180
|
export const faceforward = TSL.faceforward;
|
|
179
181
|
export const float = TSL.float;
|
|
182
|
+
export const floatBitsToInt = TSL.floatBitsToInt;
|
|
183
|
+
export const floatBitsToUint = TSL.floatBitsToUint;
|
|
180
184
|
export const floor = TSL.floor;
|
|
181
185
|
export const fog = TSL.fog;
|
|
182
186
|
export const fract = TSL.fract;
|
|
@@ -219,6 +223,7 @@ export const instancedBufferAttribute = TSL.instancedBufferAttribute;
|
|
|
219
223
|
export const instancedDynamicBufferAttribute = TSL.instancedDynamicBufferAttribute;
|
|
220
224
|
export const instancedMesh = TSL.instancedMesh;
|
|
221
225
|
export const int = TSL.int;
|
|
226
|
+
export const intBitsToFloat = TSL.intBitsToFloat;
|
|
222
227
|
export const inverse = TSL.inverse;
|
|
223
228
|
export const inverseSqrt = TSL.inverseSqrt;
|
|
224
229
|
export const inversesqrt = TSL.inversesqrt;
|
|
@@ -465,6 +470,7 @@ export const saturate = TSL.saturate;
|
|
|
465
470
|
export const saturation = TSL.saturation;
|
|
466
471
|
export const screen = TSL.screen;
|
|
467
472
|
export const screenCoordinate = TSL.screenCoordinate;
|
|
473
|
+
export const screenDPR = TSL.screenDPR;
|
|
468
474
|
export const screenSize = TSL.screenSize;
|
|
469
475
|
export const screenUV = TSL.screenUV;
|
|
470
476
|
export const scriptable = TSL.scriptable;
|
|
@@ -504,15 +510,35 @@ export const storageTexture = TSL.storageTexture;
|
|
|
504
510
|
export const string = TSL.string;
|
|
505
511
|
export const struct = TSL.struct;
|
|
506
512
|
export const sub = TSL.sub;
|
|
513
|
+
export const subgroupAdd = TSL.subgroupAdd;
|
|
514
|
+
export const subgroupAll = TSL.subgroupAll;
|
|
515
|
+
export const subgroupAnd = TSL.subgroupAnd;
|
|
516
|
+
export const subgroupAny = TSL.subgroupAny;
|
|
517
|
+
export const subgroupBallot = TSL.subgroupBallot;
|
|
518
|
+
export const subgroupBroadcast = TSL.subgroupBroadcast;
|
|
519
|
+
export const subgroupBroadcastFirst = TSL.subgroupBroadcastFirst;
|
|
507
520
|
export const subBuild = TSL.subBuild;
|
|
521
|
+
export const subgroupElect = TSL.subgroupElect;
|
|
522
|
+
export const subgroupExclusiveAdd = TSL.subgroupExclusiveAdd;
|
|
523
|
+
export const subgroupExclusiveMul = TSL.subgroupExclusiveMul;
|
|
524
|
+
export const subgroupInclusiveAdd = TSL.subgroupInclusiveAdd;
|
|
525
|
+
export const subgroupInclusiveMul = TSL.subgroupInclusiveMul;
|
|
508
526
|
export const subgroupIndex = TSL.subgroupIndex;
|
|
527
|
+
export const subgroupMax = TSL.subgroupMax;
|
|
528
|
+
export const subgroupMin = TSL.subgroupMin;
|
|
529
|
+
export const subgroupMul = TSL.subgroupMul;
|
|
530
|
+
export const subgroupOr = TSL.subgroupOr;
|
|
531
|
+
export const subgroupShuffle = TSL.subgroupShuffle;
|
|
532
|
+
export const subgroupShuffleDown = TSL.subgroupShuffleDown;
|
|
533
|
+
export const subgroupShuffleUp = TSL.subgroupShuffleUp;
|
|
534
|
+
export const subgroupShuffleXor = TSL.subgroupShuffleXor;
|
|
509
535
|
export const subgroupSize = TSL.subgroupSize;
|
|
536
|
+
export const subgroupXor = TSL.subgroupXor;
|
|
510
537
|
export const tan = TSL.tan;
|
|
511
538
|
export const tangentGeometry = TSL.tangentGeometry;
|
|
512
539
|
export const tangentLocal = TSL.tangentLocal;
|
|
513
540
|
export const tangentView = TSL.tangentView;
|
|
514
541
|
export const tangentWorld = TSL.tangentWorld;
|
|
515
|
-
export const temp = TSL.temp;
|
|
516
542
|
export const texture = TSL.texture;
|
|
517
543
|
export const texture3D = TSL.texture3D;
|
|
518
544
|
export const textureBarrier = TSL.textureBarrier;
|
|
@@ -524,9 +550,6 @@ export const textureSize = TSL.textureSize;
|
|
|
524
550
|
export const textureStore = TSL.textureStore;
|
|
525
551
|
export const thickness = TSL.thickness;
|
|
526
552
|
export const time = TSL.time;
|
|
527
|
-
export const timerDelta = TSL.timerDelta;
|
|
528
|
-
export const timerGlobal = TSL.timerGlobal;
|
|
529
|
-
export const timerLocal = TSL.timerLocal;
|
|
530
553
|
export const toneMapping = TSL.toneMapping;
|
|
531
554
|
export const toneMappingExposure = TSL.toneMappingExposure;
|
|
532
555
|
export const toonOutlinePass = TSL.toonOutlinePass;
|
|
@@ -543,10 +566,12 @@ export const triplanarTexture = TSL.triplanarTexture;
|
|
|
543
566
|
export const triplanarTextures = TSL.triplanarTextures;
|
|
544
567
|
export const trunc = TSL.trunc;
|
|
545
568
|
export const uint = TSL.uint;
|
|
569
|
+
export const uintBitsToFloat = TSL.uintBitsToFloat;
|
|
546
570
|
export const uniform = TSL.uniform;
|
|
547
571
|
export const uniformArray = TSL.uniformArray;
|
|
548
572
|
export const uniformCubeTexture = TSL.uniformCubeTexture;
|
|
549
573
|
export const uniformGroup = TSL.uniformGroup;
|
|
574
|
+
export const uniformFlow = TSL.uniformFlow;
|
|
550
575
|
export const uniformTexture = TSL.uniformTexture;
|
|
551
576
|
export const unpremultiplyAlpha = TSL.unpremultiplyAlpha;
|
|
552
577
|
export const userData = TSL.userData;
|
|
@@ -67,6 +67,14 @@ class AnimationClip {
|
|
|
67
67
|
*/
|
|
68
68
|
this.uuid = generateUUID();
|
|
69
69
|
|
|
70
|
+
/**
|
|
71
|
+
* An object that can be used to store custom data about the animation clip.
|
|
72
|
+
* It should not hold references to functions as these will not be cloned.
|
|
73
|
+
*
|
|
74
|
+
* @type {Object}
|
|
75
|
+
*/
|
|
76
|
+
this.userData = {};
|
|
77
|
+
|
|
70
78
|
// this means it should figure out its duration by scanning the tracks
|
|
71
79
|
if ( this.duration < 0 ) {
|
|
72
80
|
|
|
@@ -98,6 +106,8 @@ class AnimationClip {
|
|
|
98
106
|
const clip = new this( json.name, json.duration, tracks, json.blendMode );
|
|
99
107
|
clip.uuid = json.uuid;
|
|
100
108
|
|
|
109
|
+
clip.userData = JSON.parse( json.userData || '{}' );
|
|
110
|
+
|
|
101
111
|
return clip;
|
|
102
112
|
|
|
103
113
|
}
|
|
@@ -120,7 +130,8 @@ class AnimationClip {
|
|
|
120
130
|
'duration': clip.duration,
|
|
121
131
|
'tracks': tracks,
|
|
122
132
|
'uuid': clip.uuid,
|
|
123
|
-
'blendMode': clip.blendMode
|
|
133
|
+
'blendMode': clip.blendMode,
|
|
134
|
+
'userData': JSON.stringify( clip.userData ),
|
|
124
135
|
|
|
125
136
|
};
|
|
126
137
|
|
|
@@ -515,7 +526,11 @@ class AnimationClip {
|
|
|
515
526
|
|
|
516
527
|
}
|
|
517
528
|
|
|
518
|
-
|
|
529
|
+
const clip = new this.constructor( this.name, this.duration, tracks, this.blendMode );
|
|
530
|
+
|
|
531
|
+
clip.userData = JSON.parse( JSON.stringify( this.userData ) );
|
|
532
|
+
|
|
533
|
+
return clip;
|
|
519
534
|
|
|
520
535
|
}
|
|
521
536
|
|
package/src/constants.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const REVISION = '
|
|
1
|
+
export const REVISION = '180';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Represents mouse buttons and interaction types in context of controls.
|
|
@@ -724,6 +724,14 @@ export const UnsignedInt248Type = 1020;
|
|
|
724
724
|
*/
|
|
725
725
|
export const UnsignedInt5999Type = 35902;
|
|
726
726
|
|
|
727
|
+
/**
|
|
728
|
+
* An unsigned int 10_11_11 (packed) data type for textures.
|
|
729
|
+
*
|
|
730
|
+
* @type {number}
|
|
731
|
+
* @constant
|
|
732
|
+
*/
|
|
733
|
+
export const UnsignedInt101111Type = 35899;
|
|
734
|
+
|
|
727
735
|
/**
|
|
728
736
|
* Discards the red, green and blue components and reads just the alpha component.
|
|
729
737
|
*
|
|
@@ -1665,6 +1673,6 @@ export const InterpolationSamplingMode = {
|
|
|
1665
1673
|
* @property {string} NORMAL - Normal sampling mode.
|
|
1666
1674
|
* @property {string} CENTROID - Centroid sampling mode.
|
|
1667
1675
|
* @property {string} SAMPLE - Sample-specific sampling mode.
|
|
1668
|
-
* @property {string}
|
|
1669
|
-
* @property {string}
|
|
1676
|
+
* @property {string} FIRST - Flat interpolation using the first vertex.
|
|
1677
|
+
* @property {string} EITHER - Flat interpolation using either vertex.
|
|
1670
1678
|
*/
|
|
@@ -156,7 +156,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
156
156
|
/**
|
|
157
157
|
* Bounding box for the geometry which can be calculated with `computeBoundingBox()`.
|
|
158
158
|
*
|
|
159
|
-
* @type {Box3}
|
|
159
|
+
* @type {?Box3}
|
|
160
160
|
* @default null
|
|
161
161
|
*/
|
|
162
162
|
this.boundingBox = null;
|
|
@@ -164,7 +164,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
164
164
|
/**
|
|
165
165
|
* Bounding sphere for the geometry which can be calculated with `computeBoundingSphere()`.
|
|
166
166
|
*
|
|
167
|
-
* @type {Sphere}
|
|
167
|
+
* @type {?Sphere}
|
|
168
168
|
* @default null
|
|
169
169
|
*/
|
|
170
170
|
this.boundingSphere = null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AlphaFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBFormat, RGBAFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, UnsignedByteType, ByteType, UnsignedShortType, ShortType, HalfFloatType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedIntType, IntType, FloatType, UnsignedInt5999Type } from '../constants.js';
|
|
1
|
+
import { AlphaFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBFormat, RGBAFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, UnsignedByteType, ByteType, UnsignedShortType, ShortType, HalfFloatType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedIntType, IntType, FloatType, UnsignedInt5999Type, UnsignedInt101111Type } from '../constants.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Scales the texture as large as possible within its surface without cropping
|
|
@@ -215,6 +215,7 @@ function getTextureTypeByteLength( type ) {
|
|
|
215
215
|
case FloatType:
|
|
216
216
|
return { byteLength: 4, components: 1 };
|
|
217
217
|
case UnsignedInt5999Type:
|
|
218
|
+
case UnsignedInt101111Type:
|
|
218
219
|
return { byteLength: 4, components: 3 };
|
|
219
220
|
|
|
220
221
|
}
|
package/src/extras/lib/earcut.js
CHANGED
|
@@ -487,7 +487,7 @@ function pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, px, py) {
|
|
|
487
487
|
|
|
488
488
|
// check if a diagonal between two polygon nodes is valid (lies in polygon interior)
|
|
489
489
|
function isValidDiagonal(a, b) {
|
|
490
|
-
return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && //
|
|
490
|
+
return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // doesn't intersect other edges
|
|
491
491
|
(locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible
|
|
492
492
|
(area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors
|
|
493
493
|
equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case
|
|
@@ -664,6 +664,18 @@ class Material extends EventDispatcher {
|
|
|
664
664
|
|
|
665
665
|
}
|
|
666
666
|
|
|
667
|
+
if ( this.sheenColorMap && this.sheenColorMap.isTexture ) {
|
|
668
|
+
|
|
669
|
+
data.sheenColorMap = this.sheenColorMap.toJSON( meta ).uuid;
|
|
670
|
+
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
if ( this.sheenRoughnessMap && this.sheenRoughnessMap.isTexture ) {
|
|
674
|
+
|
|
675
|
+
data.sheenRoughnessMap = this.sheenRoughnessMap.toJSON( meta ).uuid;
|
|
676
|
+
|
|
677
|
+
}
|
|
678
|
+
|
|
667
679
|
if ( this.dispersion !== undefined ) data.dispersion = this.dispersion;
|
|
668
680
|
|
|
669
681
|
if ( this.iridescence !== undefined ) data.iridescence = this.iridescence;
|
|
@@ -7,7 +7,7 @@ import { Material } from './Material.js';
|
|
|
7
7
|
* Can also be used to customize the shadow casting of an object by assigning
|
|
8
8
|
* an instance of `MeshDistanceMaterial` to {@link Object3D#customDistanceMaterial}.
|
|
9
9
|
* The following examples demonstrates this approach in order to ensure
|
|
10
|
-
* transparent parts of objects do
|
|
10
|
+
* transparent parts of objects do not cast shadows.
|
|
11
11
|
*
|
|
12
12
|
* @augments Material
|
|
13
13
|
*/
|
|
@@ -1,18 +1,36 @@
|
|
|
1
1
|
import SpriteNodeMaterial from './SpriteNodeMaterial.js';
|
|
2
|
-
import {
|
|
2
|
+
import { viewportSize, screenDPR } from '../../nodes/display/ScreenNode.js';
|
|
3
3
|
import { positionGeometry, positionLocal, positionView } from '../../nodes/accessors/Position.js';
|
|
4
4
|
import { modelViewMatrix } from '../../nodes/accessors/ModelNode.js';
|
|
5
5
|
import { materialPointSize } from '../../nodes/accessors/MaterialNode.js';
|
|
6
6
|
import { rotate } from '../../nodes/utils/RotateNode.js';
|
|
7
|
-
import { float, vec2, vec3, vec4 } from '../../nodes/tsl/TSLBase.js';
|
|
7
|
+
import { float, uniform, vec2, vec3, vec4 } from '../../nodes/tsl/TSLBase.js';
|
|
8
8
|
|
|
9
9
|
import { PointsMaterial } from '../PointsMaterial.js';
|
|
10
|
+
import { Vector2 } from '../../math/Vector2.js';
|
|
10
11
|
|
|
11
12
|
const _defaultValues = /*@__PURE__*/ new PointsMaterial();
|
|
13
|
+
const _size = /*@__PURE__*/ new Vector2();
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Node material version of {@link PointsMaterial}.
|
|
15
17
|
*
|
|
18
|
+
* This material can be used in two ways:
|
|
19
|
+
*
|
|
20
|
+
* - By rendering point primitives with {@link Points}. Since WebGPU only supports point primitives
|
|
21
|
+
* with a pixel size of `1`, it's not possible to define a size.
|
|
22
|
+
*
|
|
23
|
+
* ```js
|
|
24
|
+
* const pointCloud = new THREE.Points( geometry, new THREE.PointsNodeMaterial() );
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* - By rendering point primitives with {@link Sprites}. In this case, size is honored,
|
|
28
|
+
* see {@link PointsNodeMaterial#sizeNode}.
|
|
29
|
+
*
|
|
30
|
+
* ```js
|
|
31
|
+
* const instancedPoints = new THREE.Sprite( new THREE.PointsNodeMaterial( { positionNode: instancedBufferAttribute( positionAttribute ) } ) );
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
16
34
|
* @augments SpriteNodeMaterial
|
|
17
35
|
*/
|
|
18
36
|
class PointsNodeMaterial extends SpriteNodeMaterial {
|
|
@@ -68,68 +86,95 @@ class PointsNodeMaterial extends SpriteNodeMaterial {
|
|
|
68
86
|
|
|
69
87
|
}
|
|
70
88
|
|
|
71
|
-
|
|
89
|
+
setupVertexSprite( builder ) {
|
|
72
90
|
|
|
73
|
-
const
|
|
91
|
+
const { material, camera } = builder;
|
|
92
|
+
|
|
93
|
+
const { rotationNode, scaleNode, sizeNode, sizeAttenuation } = this;
|
|
94
|
+
|
|
95
|
+
let mvp = super.setupVertex( builder );
|
|
74
96
|
|
|
75
97
|
// skip further processing if the material is not a node material
|
|
76
98
|
|
|
77
|
-
if (
|
|
99
|
+
if ( material.isNodeMaterial !== true ) {
|
|
78
100
|
|
|
79
101
|
return mvp;
|
|
80
102
|
|
|
81
103
|
}
|
|
82
104
|
|
|
83
|
-
//
|
|
105
|
+
// point size
|
|
84
106
|
|
|
85
|
-
|
|
107
|
+
let pointSize = sizeNode !== null ? vec2( sizeNode ) : materialPointSize;
|
|
86
108
|
|
|
87
|
-
|
|
88
|
-
const aspect = viewport.z.div( viewport.w );
|
|
109
|
+
pointSize = pointSize.mul( screenDPR );
|
|
89
110
|
|
|
90
|
-
//
|
|
111
|
+
// size attenuation
|
|
91
112
|
|
|
92
|
-
if (
|
|
113
|
+
if ( camera.isPerspectiveCamera && sizeAttenuation === true ) {
|
|
93
114
|
|
|
94
|
-
|
|
115
|
+
// follow WebGLRenderer's implementation, and scale by half the canvas height in logical units
|
|
95
116
|
|
|
96
|
-
|
|
117
|
+
pointSize = pointSize.mul( scale.div( positionView.z.negate() ) );
|
|
97
118
|
|
|
98
119
|
}
|
|
99
120
|
|
|
100
|
-
//
|
|
101
|
-
|
|
102
|
-
let pointSize = sizeNode !== null ? vec2( sizeNode ) : materialPointSize;
|
|
121
|
+
// scale
|
|
103
122
|
|
|
104
|
-
if (
|
|
123
|
+
if ( scaleNode && scaleNode.isNode ) {
|
|
105
124
|
|
|
106
|
-
pointSize = pointSize.mul(
|
|
125
|
+
pointSize = pointSize.mul( vec2( scaleNode ) );
|
|
107
126
|
|
|
108
127
|
}
|
|
109
128
|
|
|
110
|
-
//
|
|
129
|
+
// compute offset
|
|
111
130
|
|
|
112
|
-
|
|
131
|
+
let offset = positionGeometry.xy;
|
|
113
132
|
|
|
114
|
-
|
|
133
|
+
// apply rotation
|
|
134
|
+
|
|
135
|
+
if ( rotationNode && rotationNode.isNode ) {
|
|
136
|
+
|
|
137
|
+
const rotation = float( rotationNode );
|
|
138
|
+
|
|
139
|
+
offset = rotate( offset, rotation );
|
|
115
140
|
|
|
116
141
|
}
|
|
117
142
|
|
|
118
|
-
|
|
143
|
+
// account for point size
|
|
144
|
+
|
|
145
|
+
offset = offset.mul( pointSize );
|
|
146
|
+
|
|
147
|
+
// scale by viewport size
|
|
148
|
+
|
|
149
|
+
offset = offset.div( viewportSize.div( 2 ) );
|
|
119
150
|
|
|
120
|
-
|
|
121
|
-
alignedPosition.y.assign( alignedPosition.y.mul( aspect ) );
|
|
151
|
+
// compensate for the perspective divide
|
|
122
152
|
|
|
123
|
-
|
|
124
|
-
alignedPosition.assign( alignedPosition.mul( mvp.w ) );
|
|
153
|
+
offset = offset.mul( mvp.w );
|
|
125
154
|
|
|
126
|
-
//
|
|
127
|
-
|
|
155
|
+
// add offset
|
|
156
|
+
|
|
157
|
+
mvp = mvp.add( vec4( offset, 0, 0 ) );
|
|
128
158
|
|
|
129
159
|
return mvp;
|
|
130
160
|
|
|
131
161
|
}
|
|
132
162
|
|
|
163
|
+
setupVertex( builder ) {
|
|
164
|
+
|
|
165
|
+
if ( builder.object.isPoints ) {
|
|
166
|
+
|
|
167
|
+
return super.setupVertex( builder );
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
} else {
|
|
171
|
+
|
|
172
|
+
return this.setupVertexSprite( builder );
|
|
173
|
+
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
}
|
|
177
|
+
|
|
133
178
|
/**
|
|
134
179
|
* Whether alpha to coverage should be used or not.
|
|
135
180
|
*
|
|
@@ -155,4 +200,12 @@ class PointsNodeMaterial extends SpriteNodeMaterial {
|
|
|
155
200
|
|
|
156
201
|
}
|
|
157
202
|
|
|
203
|
+
const scale = /*@__PURE__*/ uniform( 1 ).onFrameUpdate( function ( { renderer } ) {
|
|
204
|
+
|
|
205
|
+
const size = renderer.getSize( _size ); // logical units
|
|
206
|
+
|
|
207
|
+
this.value = 0.5 * size.y;
|
|
208
|
+
|
|
209
|
+
} );
|
|
210
|
+
|
|
158
211
|
export default PointsNodeMaterial;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import NodeMaterial from './NodeMaterial.js';
|
|
2
|
-
import { cameraProjectionMatrix } from '../../nodes/accessors/Camera.js';
|
|
3
2
|
import { materialRotation } from '../../nodes/accessors/MaterialNode.js';
|
|
4
3
|
import { modelViewMatrix, modelWorldMatrix } from '../../nodes/accessors/ModelNode.js';
|
|
5
4
|
import { positionGeometry } from '../../nodes/accessors/Position.js';
|
|
@@ -111,9 +110,7 @@ class SpriteNodeMaterial extends NodeMaterial {
|
|
|
111
110
|
|
|
112
111
|
const { object, camera } = builder;
|
|
113
112
|
|
|
114
|
-
const sizeAttenuation = this
|
|
115
|
-
|
|
116
|
-
const { positionNode, rotationNode, scaleNode } = this;
|
|
113
|
+
const { positionNode, rotationNode, scaleNode, sizeAttenuation } = this;
|
|
117
114
|
|
|
118
115
|
const mvPosition = modelViewMatrix.mul( vec3( positionNode || 0 ) );
|
|
119
116
|
|
|
@@ -125,18 +122,9 @@ class SpriteNodeMaterial extends NodeMaterial {
|
|
|
125
122
|
|
|
126
123
|
}
|
|
127
124
|
|
|
128
|
-
if ( sizeAttenuation === false ) {
|
|
129
|
-
|
|
130
|
-
if ( camera.isPerspectiveCamera ) {
|
|
131
|
-
|
|
132
|
-
scale = scale.mul( mvPosition.z.negate() );
|
|
133
|
-
|
|
134
|
-
} else {
|
|
135
|
-
|
|
136
|
-
const orthoScale = float( 2.0 ).div( cameraProjectionMatrix.element( 1 ).element( 1 ) );
|
|
137
|
-
scale = scale.mul( orthoScale.mul( 2 ) );
|
|
125
|
+
if ( camera.isPerspectiveCamera && sizeAttenuation === false ) {
|
|
138
126
|
|
|
139
|
-
|
|
127
|
+
scale = scale.mul( mvPosition.z.negate() );
|
|
140
128
|
|
|
141
129
|
}
|
|
142
130
|
|
|
@@ -548,7 +548,7 @@ class NodeMaterialObserver {
|
|
|
548
548
|
*
|
|
549
549
|
* @param {LightsNode} lightsNode - The lights node.
|
|
550
550
|
* @param {number} renderId - The render ID.
|
|
551
|
-
* @return {Array} The lights for the given lights node and render ID.
|
|
551
|
+
* @return {Array<Object>} The lights for the given lights node and render ID.
|
|
552
552
|
*/
|
|
553
553
|
getLights( lightsNode, renderId ) {
|
|
554
554
|
|
|
@@ -34,7 +34,7 @@ function createColorManagement() {
|
|
|
34
34
|
* - luminanceCoefficients: RGB luminance coefficients
|
|
35
35
|
*
|
|
36
36
|
* Optional:
|
|
37
|
-
* - outputColorSpaceConfig: { drawingBufferColorSpace: ColorSpace }
|
|
37
|
+
* - outputColorSpaceConfig: { drawingBufferColorSpace: ColorSpace, toneMappingMode: 'extended' | 'standard' }
|
|
38
38
|
* - workingColorSpaceConfig: { unpackColorSpace: ColorSpace }
|
|
39
39
|
*
|
|
40
40
|
* Reference:
|
|
@@ -103,6 +103,12 @@ function createColorManagement() {
|
|
|
103
103
|
|
|
104
104
|
},
|
|
105
105
|
|
|
106
|
+
getToneMappingMode: function ( colorSpace ) {
|
|
107
|
+
|
|
108
|
+
return this.spaces[ colorSpace ].outputColorSpaceConfig.toneMappingMode || 'standard';
|
|
109
|
+
|
|
110
|
+
},
|
|
111
|
+
|
|
106
112
|
getLuminanceCoefficients: function ( target, colorSpace = this.workingColorSpace ) {
|
|
107
113
|
|
|
108
114
|
return target.fromArray( this.spaces[ colorSpace ].luminanceCoefficients );
|
package/src/nodes/Nodes.js
CHANGED
|
@@ -57,6 +57,9 @@ export { default as MemberNode } from './utils/MemberNode.js';
|
|
|
57
57
|
export { default as DebugNode } from './utils/DebugNode.js';
|
|
58
58
|
export { default as EventNode } from './utils/EventNode.js';
|
|
59
59
|
|
|
60
|
+
// math
|
|
61
|
+
export { default as BitcastNode } from './math/BitcastNode.js';
|
|
62
|
+
|
|
60
63
|
// accessors
|
|
61
64
|
export { default as UniformArrayNode } from './accessors/UniformArrayNode.js';
|
|
62
65
|
export { default as BufferAttributeNode } from './accessors/BufferAttributeNode.js';
|