super-three 0.169.1 → 0.170.1
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 +24628 -24228
- package/build/three.core.js +37002 -0
- package/build/three.core.min.js +6 -0
- package/build/three.module.js +10519 -47108
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +533 -0
- package/build/three.tsl.min.js +6 -0
- package/build/three.webgpu.js +17071 -53583
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +17134 -53623
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +3 -3
- package/examples/jsm/animation/MMDAnimationHelper.js +2 -0
- package/examples/jsm/animation/MMDPhysics.js +2 -0
- package/examples/jsm/capabilities/WebGPU.js +1 -10
- package/examples/jsm/controls/ArcballControls.js +25 -21
- package/examples/jsm/controls/OrbitControls.js +41 -9
- package/examples/jsm/controls/PointerLockControls.js +2 -5
- package/examples/jsm/controls/TransformControls.js +22 -6
- package/examples/jsm/csm/CSM.js +2 -2
- package/examples/jsm/csm/CSMFrustum.js +7 -4
- package/examples/jsm/csm/CSMHelper.js +2 -0
- package/examples/jsm/csm/CSMShadowNode.js +437 -0
- package/examples/jsm/curves/NURBSCurve.js +34 -3
- package/examples/jsm/exporters/GLTFExporter.js +138 -71
- package/examples/jsm/exporters/KTX2Exporter.js +35 -12
- package/examples/jsm/exporters/MMDExporter.js +6 -0
- package/examples/jsm/exporters/USDZExporter.js +21 -3
- package/examples/jsm/geometries/DecalGeometry.js +70 -21
- package/examples/jsm/geometries/InstancedPointsGeometry.js +2 -0
- package/examples/jsm/helpers/TextureHelperGPU.js +175 -0
- package/examples/jsm/interactive/HTMLMesh.js +1 -0
- package/examples/jsm/lighting/TiledLighting.js +18 -0
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +1 -1
- package/examples/jsm/lines/LineGeometry.js +25 -0
- package/examples/jsm/lines/LineMaterial.js +0 -1
- package/examples/jsm/lines/LineSegmentsGeometry.js +2 -0
- package/examples/jsm/lines/webgpu/Line2.js +2 -1
- package/examples/jsm/lines/webgpu/LineSegments2.js +2 -16
- package/examples/jsm/lines/webgpu/Wireframe.js +57 -0
- package/examples/jsm/loaders/3DMLoader.js +1 -0
- package/examples/jsm/loaders/3MFLoader.js +91 -0
- package/examples/jsm/loaders/FBXLoader.js +12 -2
- package/examples/jsm/loaders/GLTFLoader.js +2 -0
- package/examples/jsm/loaders/KTX2Loader.js +143 -49
- package/examples/jsm/loaders/LDrawLoader.js +22 -136
- package/examples/jsm/loaders/LottieLoader.js +1 -0
- package/examples/jsm/loaders/MMDLoader.js +3 -0
- package/examples/jsm/loaders/MaterialXLoader.js +2 -2
- package/examples/jsm/materials/LDrawConditionalLineMaterial.js +143 -0
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +114 -0
- package/examples/jsm/math/ColorSpaces.js +76 -0
- package/examples/jsm/misc/ProgressiveLightMap.js +52 -40
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +293 -0
- package/examples/jsm/misc/VolumeSlice.js +1 -0
- package/examples/jsm/objects/InstancedPoints.js +2 -4
- package/examples/jsm/objects/LensflareMesh.js +4 -2
- package/examples/jsm/objects/SkyMesh.js +5 -3
- package/examples/jsm/objects/Water2Mesh.js +7 -3
- package/examples/jsm/objects/WaterMesh.js +12 -10
- package/examples/jsm/postprocessing/AfterimagePass.js +14 -3
- package/examples/jsm/postprocessing/SSRPass.js +6 -0
- package/examples/jsm/renderers/CSS2DRenderer.js +6 -3
- package/examples/jsm/renderers/CSS3DRenderer.js +7 -4
- package/examples/jsm/shaders/FXAAShader.js +225 -224
- package/examples/jsm/transpiler/AST.js +2 -2
- package/examples/jsm/transpiler/GLSLDecoder.js +57 -25
- package/examples/jsm/transpiler/ShaderToyDecoder.js +1 -1
- package/examples/jsm/transpiler/TSLEncoder.js +11 -6
- package/{src/nodes → examples/jsm/tsl}/display/AfterImageNode.js +18 -21
- package/{src/nodes → examples/jsm/tsl}/display/AnaglyphPassNode.js +2 -6
- package/{src/nodes → examples/jsm/tsl}/display/AnamorphicNode.js +12 -18
- package/{src/nodes → examples/jsm/tsl}/display/BleachBypass.js +1 -3
- package/{src/nodes → examples/jsm/tsl}/display/BloomNode.js +12 -41
- package/{src/nodes → examples/jsm/tsl}/display/DenoiseNode.js +60 -47
- package/{src/nodes → examples/jsm/tsl}/display/DepthOfFieldNode.js +4 -9
- package/{src/nodes → examples/jsm/tsl}/display/DotScreenNode.js +2 -9
- package/examples/jsm/tsl/display/FXAANode.js +316 -0
- package/{src/nodes → examples/jsm/tsl}/display/FilmNode.js +4 -7
- package/{src/nodes → examples/jsm/tsl}/display/GTAONode.js +73 -78
- package/{src/nodes → examples/jsm/tsl}/display/GaussianBlurNode.js +78 -42
- package/examples/jsm/tsl/display/LensflareNode.js +161 -0
- package/{src/nodes → examples/jsm/tsl}/display/Lut3DNode.js +3 -5
- package/{src/nodes → examples/jsm/tsl}/display/MotionBlur.js +2 -3
- package/examples/jsm/tsl/display/OutlineNode.js +434 -0
- package/{src/nodes → examples/jsm/tsl}/display/ParallaxBarrierPassNode.js +2 -5
- package/{src/nodes → examples/jsm/tsl}/display/PixelationPassNode.js +5 -17
- package/{src/nodes → examples/jsm/tsl}/display/RGBShiftNode.js +2 -6
- package/examples/jsm/tsl/display/SMAANode.js +620 -0
- package/{src/nodes → examples/jsm/tsl}/display/SSAAPassNode.js +10 -25
- package/examples/jsm/tsl/display/SSRNode.js +366 -0
- package/{src/nodes → examples/jsm/tsl}/display/Sepia.js +1 -2
- package/{src/nodes → examples/jsm/tsl}/display/SobelOperatorNode.js +4 -12
- package/{src/nodes → examples/jsm/tsl}/display/StereoCompositePassNode.js +9 -11
- package/{src/nodes → examples/jsm/tsl}/display/StereoPassNode.js +10 -11
- package/examples/jsm/tsl/display/TRAAPassNode.js +355 -0
- package/{src/nodes → examples/jsm/tsl}/display/TransitionNode.js +3 -7
- package/examples/jsm/tsl/display/hashBlur.js +24 -0
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +389 -0
- package/examples/jsm/utils/SceneOptimizer.js +410 -0
- package/examples/jsm/utils/UVsDebug.js +1 -1
- package/examples/jsm/utils/{TextureUtilsGPU.js → WebGPUTextureUtils.js} +2 -1
- package/examples/jsm/webxr/OculusHandPointerModel.js +21 -21
- package/examples/jsm/webxr/Text2D.js +6 -6
- package/package.json +4 -4
- package/src/Three.Core.js +178 -0
- package/src/Three.TSL.js +526 -0
- package/src/Three.WebGPU.Nodes.js +9 -186
- package/src/Three.WebGPU.js +8 -186
- package/src/Three.js +1 -177
- package/src/animation/AnimationClip.js +2 -2
- package/src/animation/AnimationObjectGroup.js +2 -2
- package/src/audio/Audio.js +38 -0
- package/src/cameras/PerspectiveCamera.js +6 -6
- package/src/cameras/StereoCamera.js +2 -2
- package/src/constants.js +1 -6
- package/src/core/BufferGeometry.js +48 -8
- package/src/core/InterleavedBuffer.js +4 -4
- package/src/core/Object3D.js +2 -2
- package/src/extras/core/Curve.js +3 -3
- package/src/extras/core/Shape.js +2 -2
- package/src/geometries/CylinderGeometry.js +2 -2
- package/src/geometries/EdgesGeometry.js +2 -2
- package/src/geometries/LatheGeometry.js +2 -2
- package/src/lights/SpotLightShadow.js +2 -2
- package/src/materials/LineDashedMaterial.js +0 -1
- package/src/materials/Material.js +2 -2
- package/src/materials/MeshPhongMaterial.js +1 -1
- package/src/materials/MeshPhysicalMaterial.js +2 -2
- package/src/materials/MeshStandardMaterial.js +2 -2
- package/src/materials/nodes/Line2NodeMaterial.js +32 -13
- package/src/materials/nodes/LineDashedNodeMaterial.js +4 -2
- package/src/materials/nodes/NodeMaterial.js +93 -23
- package/src/materials/nodes/SpriteNodeMaterial.js +11 -2
- package/src/materials/nodes/manager/NodeMaterialObserver.js +119 -7
- package/src/math/ColorManagement.js +143 -102
- package/src/math/Line3.js +2 -2
- package/src/math/Quaternion.js +2 -2
- package/src/math/Spherical.js +3 -3
- package/src/math/Vector2.js +7 -7
- package/src/math/Vector3.js +9 -9
- package/src/math/Vector4.js +22 -9
- package/src/nodes/Nodes.js +2 -21
- package/src/nodes/TSL.js +9 -25
- package/src/nodes/accessors/Arrays.js +27 -0
- package/src/nodes/accessors/BuiltinNode.js +26 -0
- package/src/nodes/accessors/Camera.js +0 -1
- package/src/nodes/accessors/ClippingNode.js +76 -42
- package/src/nodes/accessors/InstanceNode.js +17 -20
- package/src/nodes/accessors/InstancedMeshNode.js +26 -0
- package/src/nodes/accessors/Lights.js +32 -0
- package/src/nodes/accessors/SceneNode.js +35 -1
- package/src/nodes/accessors/StorageBufferNode.js +61 -19
- package/src/nodes/accessors/StorageTextureNode.js +10 -4
- package/src/nodes/accessors/TextureNode.js +1 -1
- package/src/nodes/accessors/VelocityNode.js +13 -3
- package/src/nodes/code/FunctionCallNode.js +16 -5
- package/src/nodes/code/ScriptableNode.js +4 -4
- package/src/nodes/core/Node.js +1 -0
- package/src/nodes/core/NodeBuilder.js +31 -14
- package/src/nodes/core/NodeUtils.js +28 -0
- package/src/nodes/core/VarNode.js +15 -3
- package/src/nodes/core/constants.js +6 -0
- package/src/nodes/display/BlendModes.js +99 -0
- package/src/nodes/display/ColorAdjustment.js +53 -4
- package/src/nodes/display/ColorSpaceFunctions.js +5 -5
- package/src/nodes/display/ColorSpaceNode.js +27 -39
- package/src/nodes/display/PassNode.js +6 -4
- package/src/nodes/display/ToneMappingNode.js +1 -1
- package/src/nodes/display/ToonOutlinePassNode.js +3 -3
- package/src/nodes/display/ViewportDepthNode.js +48 -1
- package/src/nodes/functions/PhysicalLightingModel.js +21 -15
- package/src/nodes/functions/material/getAlphaHashThreshold.js +70 -0
- package/src/nodes/functions/material/getGeometryRoughness.js +8 -2
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +22 -0
- package/src/nodes/gpgpu/ComputeNode.js +9 -1
- package/src/nodes/lighting/AnalyticLightNode.js +23 -419
- package/src/nodes/lighting/LightsNode.js +24 -12
- package/src/nodes/lighting/PointLightNode.js +41 -22
- package/src/nodes/lighting/PointShadowNode.js +254 -0
- package/src/nodes/lighting/RectAreaLightNode.js +3 -0
- package/src/nodes/lighting/ShadowNode.js +593 -0
- package/src/nodes/lighting/SpotLightNode.js +14 -2
- package/src/nodes/utils/LoopNode.js +2 -2
- package/src/nodes/utils/Oscillators.js +6 -0
- package/src/nodes/utils/PostProcessingUtils.js +89 -0
- package/src/nodes/utils/RTTNode.js +9 -1
- package/src/nodes/utils/ReflectorNode.js +101 -15
- package/src/nodes/utils/StorageArrayElementNode.js +2 -2
- package/src/nodes/utils/Timer.js +29 -0
- package/src/objects/BatchedMesh.js +472 -296
- package/src/objects/ClippingGroup.js +19 -0
- package/src/objects/Skeleton.js +2 -2
- package/src/renderers/WebGLRenderer.js +183 -109
- package/src/renderers/common/Animation.js +23 -11
- package/src/renderers/common/Attributes.js +4 -0
- package/src/renderers/common/Backend.js +2 -0
- package/src/renderers/common/Background.js +15 -5
- package/src/renderers/common/Bindings.js +23 -6
- package/src/renderers/common/ClippingContext.js +77 -85
- package/src/renderers/common/Constants.js +2 -1
- package/src/renderers/common/Geometries.js +20 -0
- package/src/renderers/common/IndirectStorageBufferAttribute.js +15 -0
- package/src/renderers/common/Lighting.js +45 -0
- package/src/renderers/common/PostProcessingUtils.js +86 -0
- package/src/renderers/common/RenderList.js +48 -17
- package/src/renderers/common/RenderLists.js +4 -2
- package/src/renderers/common/RenderObject.js +45 -28
- package/src/renderers/common/RenderObjects.js +12 -6
- package/src/renderers/common/Renderer.js +222 -77
- package/src/renderers/common/Textures.js +41 -17
- package/src/renderers/common/UniformsGroup.js +16 -4
- package/src/renderers/common/extras/PMREMGenerator.js +89 -13
- package/src/renderers/common/nodes/NodeLibrary.js +2 -15
- package/src/renderers/common/nodes/NodeStorageBuffer.js +2 -3
- package/src/renderers/common/nodes/NodeUniform.js +42 -0
- package/src/renderers/common/nodes/Nodes.js +2 -2
- package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +4 -24
- package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +2 -2
- package/src/renderers/webgl/WebGLBackground.js +20 -1
- package/src/renderers/webgl/WebGLBufferRenderer.js +2 -6
- package/src/renderers/webgl/WebGLCapabilities.js +0 -7
- package/src/renderers/webgl/WebGLGeometries.js +0 -28
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +2 -6
- package/src/renderers/webgl/WebGLProgram.js +24 -28
- package/src/renderers/webgl/WebGLPrograms.js +5 -2
- package/src/renderers/webgl/WebGLState.js +37 -1
- package/src/renderers/webgl/WebGLTextures.js +29 -12
- package/src/renderers/webgl-fallback/WebGLBackend.js +111 -37
- package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +2 -7
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +43 -12
- package/src/renderers/webgl-fallback/utils/WebGLState.js +26 -1
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +37 -9
- package/src/renderers/webgpu/WebGPUBackend.js +152 -56
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +1 -1
- package/src/renderers/webgpu/WebGPURenderer.js +1 -1
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +0 -8
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +13 -34
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +192 -92
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +12 -4
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +15 -2
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +72 -7
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +29 -9
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +29 -7
- package/src/renderers/webgpu/utils/WebGPUUtils.js +0 -1
- package/src/renderers/webxr/WebXRManager.js +4 -4
- package/src/textures/Source.js +2 -2
- package/src/textures/Texture.js +2 -2
- package/examples/jsm/cameras/CinematicCamera.js +0 -208
- package/src/nodes/display/BlendMode.js +0 -54
- package/src/nodes/display/FXAANode.js +0 -332
- package/src/nodes/utils/OscNode.js +0 -85
- package/src/nodes/utils/TimerNode.js +0 -97
- /package/examples/jsm/utils/{TextureUtils.js → WebGLTextureUtils.js} +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Group } from './Group.js';
|
|
2
|
+
|
|
3
|
+
class ClippingGroup extends Group {
|
|
4
|
+
|
|
5
|
+
constructor() {
|
|
6
|
+
|
|
7
|
+
super();
|
|
8
|
+
|
|
9
|
+
this.isClippingGroup = true;
|
|
10
|
+
this.clippingPlanes = [];
|
|
11
|
+
this.enabled = true;
|
|
12
|
+
this.clipIntersection = false;
|
|
13
|
+
this.clipShadows = false;
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { ClippingGroup };
|
package/src/objects/Skeleton.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import { Bone } from './Bone.js';
|
|
6
6
|
import { Matrix4 } from '../math/Matrix4.js';
|
|
7
7
|
import { DataTexture } from '../textures/DataTexture.js';
|
|
8
|
-
import
|
|
8
|
+
import { generateUUID } from '../math/MathUtils.js';
|
|
9
9
|
|
|
10
10
|
const _offsetMatrix = /*@__PURE__*/ new Matrix4();
|
|
11
11
|
const _identityMatrix = /*@__PURE__*/ new Matrix4();
|
|
@@ -14,7 +14,7 @@ class Skeleton {
|
|
|
14
14
|
|
|
15
15
|
constructor( bones = [], boneInverses = [] ) {
|
|
16
16
|
|
|
17
|
-
this.uuid =
|
|
17
|
+
this.uuid = generateUUID();
|
|
18
18
|
|
|
19
19
|
this.bones = bones.slice( 0 );
|
|
20
20
|
this.boneInverses = boneInverses;
|
|
@@ -17,9 +17,7 @@ import {
|
|
|
17
17
|
UnsignedInt248Type,
|
|
18
18
|
UnsignedShort4444Type,
|
|
19
19
|
UnsignedShort5551Type,
|
|
20
|
-
WebGLCoordinateSystem
|
|
21
|
-
DisplayP3ColorSpace,
|
|
22
|
-
LinearDisplayP3ColorSpace
|
|
20
|
+
WebGLCoordinateSystem
|
|
23
21
|
} from '../constants.js';
|
|
24
22
|
import { Color } from '../math/Color.js';
|
|
25
23
|
import { Frustum } from '../math/Frustum.js';
|
|
@@ -73,6 +71,7 @@ class WebGLRenderer {
|
|
|
73
71
|
preserveDrawingBuffer = false,
|
|
74
72
|
powerPreference = 'default',
|
|
75
73
|
failIfMajorPerformanceCaveat = false,
|
|
74
|
+
reverseDepthBuffer = false,
|
|
76
75
|
multiviewStereo = false,
|
|
77
76
|
} = parameters;
|
|
78
77
|
|
|
@@ -293,9 +292,13 @@ class WebGLRenderer {
|
|
|
293
292
|
|
|
294
293
|
capabilities = new WebGLCapabilities( _gl, extensions, parameters, utils );
|
|
295
294
|
|
|
296
|
-
state = new WebGLState( _gl );
|
|
295
|
+
state = new WebGLState( _gl, extensions );
|
|
297
296
|
|
|
298
|
-
if ( capabilities.reverseDepthBuffer
|
|
297
|
+
if ( capabilities.reverseDepthBuffer && reverseDepthBuffer ) {
|
|
298
|
+
|
|
299
|
+
state.buffers.depth.setReversed( true );
|
|
300
|
+
|
|
301
|
+
}
|
|
299
302
|
|
|
300
303
|
info = new WebGLInfo( _gl );
|
|
301
304
|
properties = new WebGLProperties();
|
|
@@ -600,7 +603,6 @@ class WebGLRenderer {
|
|
|
600
603
|
if ( depth ) {
|
|
601
604
|
|
|
602
605
|
bits |= _gl.DEPTH_BUFFER_BIT;
|
|
603
|
-
_gl.clearDepth( this.capabilities.reverseDepthBuffer ? 0 : 1 );
|
|
604
606
|
|
|
605
607
|
}
|
|
606
608
|
|
|
@@ -641,6 +643,7 @@ class WebGLRenderer {
|
|
|
641
643
|
canvas.removeEventListener( 'webglcontextrestored', onContextRestore, false );
|
|
642
644
|
canvas.removeEventListener( 'webglcontextcreationerror', onContextCreationError, false );
|
|
643
645
|
|
|
646
|
+
background.dispose();
|
|
644
647
|
renderLists.dispose();
|
|
645
648
|
renderStates.dispose();
|
|
646
649
|
properties.dispose();
|
|
@@ -2008,7 +2011,9 @@ class WebGLRenderer {
|
|
|
2008
2011
|
|
|
2009
2012
|
} else {
|
|
2010
2013
|
|
|
2011
|
-
|
|
2014
|
+
const reverseDepthBuffer = state.buffers.depth.getReversed();
|
|
2015
|
+
|
|
2016
|
+
if ( reverseDepthBuffer ) {
|
|
2012
2017
|
|
|
2013
2018
|
_currentProjectionMatrix.copy( camera.projectionMatrix );
|
|
2014
2019
|
|
|
@@ -2624,7 +2629,9 @@ class WebGLRenderer {
|
|
|
2624
2629
|
|
|
2625
2630
|
};
|
|
2626
2631
|
|
|
2627
|
-
|
|
2632
|
+
const _srcFramebuffer = _gl.createFramebuffer();
|
|
2633
|
+
const _dstFramebuffer = _gl.createFramebuffer();
|
|
2634
|
+
this.copyTextureToTexture = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, srcLevel = 0, dstLevel = null ) {
|
|
2628
2635
|
|
|
2629
2636
|
// support previous signature with dstPosition first
|
|
2630
2637
|
if ( srcTexture.isTexture !== true ) {
|
|
@@ -2635,26 +2642,64 @@ class WebGLRenderer {
|
|
|
2635
2642
|
dstPosition = arguments[ 0 ] || null;
|
|
2636
2643
|
srcTexture = arguments[ 1 ];
|
|
2637
2644
|
dstTexture = arguments[ 2 ];
|
|
2638
|
-
|
|
2645
|
+
dstLevel = arguments[ 3 ] || 0;
|
|
2639
2646
|
srcRegion = null;
|
|
2640
2647
|
|
|
2641
2648
|
}
|
|
2642
2649
|
|
|
2643
|
-
|
|
2644
|
-
|
|
2650
|
+
// support the previous signature with just a single dst mipmap level
|
|
2651
|
+
if ( dstLevel === null ) {
|
|
2652
|
+
|
|
2653
|
+
if ( srcLevel !== 0 ) {
|
|
2654
|
+
|
|
2655
|
+
// @deprecated, r171
|
|
2656
|
+
warnOnce( 'WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels.' );
|
|
2657
|
+
dstLevel = srcLevel;
|
|
2658
|
+
srcLevel = 0;
|
|
2659
|
+
|
|
2660
|
+
} else {
|
|
2661
|
+
|
|
2662
|
+
dstLevel = 0;
|
|
2663
|
+
|
|
2664
|
+
}
|
|
2665
|
+
|
|
2666
|
+
}
|
|
2667
|
+
|
|
2668
|
+
// gather the necessary dimensions to copy
|
|
2669
|
+
let width, height, depth, minX, minY, minZ;
|
|
2670
|
+
let dstX, dstY, dstZ;
|
|
2671
|
+
const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ dstLevel ] : srcTexture.image;
|
|
2645
2672
|
if ( srcRegion !== null ) {
|
|
2646
2673
|
|
|
2647
2674
|
width = srcRegion.max.x - srcRegion.min.x;
|
|
2648
2675
|
height = srcRegion.max.y - srcRegion.min.y;
|
|
2676
|
+
depth = srcRegion.isBox3 ? srcRegion.max.z - srcRegion.min.z : 1;
|
|
2649
2677
|
minX = srcRegion.min.x;
|
|
2650
2678
|
minY = srcRegion.min.y;
|
|
2679
|
+
minZ = srcRegion.isBox3 ? srcRegion.min.z : 0;
|
|
2651
2680
|
|
|
2652
2681
|
} else {
|
|
2653
2682
|
|
|
2654
|
-
|
|
2655
|
-
|
|
2683
|
+
const levelScale = Math.pow( 2, - srcLevel );
|
|
2684
|
+
width = Math.floor( image.width * levelScale );
|
|
2685
|
+
height = Math.floor( image.height * levelScale );
|
|
2686
|
+
if ( srcTexture.isDataArrayTexture ) {
|
|
2687
|
+
|
|
2688
|
+
depth = image.depth;
|
|
2689
|
+
|
|
2690
|
+
} else if ( srcTexture.isData3DTexture ) {
|
|
2691
|
+
|
|
2692
|
+
depth = Math.floor( image.depth * levelScale );
|
|
2693
|
+
|
|
2694
|
+
} else {
|
|
2695
|
+
|
|
2696
|
+
depth = 1;
|
|
2697
|
+
|
|
2698
|
+
}
|
|
2699
|
+
|
|
2656
2700
|
minX = 0;
|
|
2657
2701
|
minY = 0;
|
|
2702
|
+
minZ = 0;
|
|
2658
2703
|
|
|
2659
2704
|
}
|
|
2660
2705
|
|
|
@@ -2662,177 +2707,179 @@ class WebGLRenderer {
|
|
|
2662
2707
|
|
|
2663
2708
|
dstX = dstPosition.x;
|
|
2664
2709
|
dstY = dstPosition.y;
|
|
2710
|
+
dstZ = dstPosition.z;
|
|
2665
2711
|
|
|
2666
2712
|
} else {
|
|
2667
2713
|
|
|
2668
2714
|
dstX = 0;
|
|
2669
2715
|
dstY = 0;
|
|
2716
|
+
dstZ = 0;
|
|
2670
2717
|
|
|
2671
2718
|
}
|
|
2672
2719
|
|
|
2720
|
+
// Set up the destination target
|
|
2673
2721
|
const glFormat = utils.convert( dstTexture.format );
|
|
2674
2722
|
const glType = utils.convert( dstTexture.type );
|
|
2723
|
+
let glTarget;
|
|
2724
|
+
|
|
2725
|
+
if ( dstTexture.isData3DTexture ) {
|
|
2726
|
+
|
|
2727
|
+
textures.setTexture3D( dstTexture, 0 );
|
|
2728
|
+
glTarget = _gl.TEXTURE_3D;
|
|
2729
|
+
|
|
2730
|
+
} else if ( dstTexture.isDataArrayTexture || dstTexture.isCompressedArrayTexture ) {
|
|
2731
|
+
|
|
2732
|
+
textures.setTexture2DArray( dstTexture, 0 );
|
|
2733
|
+
glTarget = _gl.TEXTURE_2D_ARRAY;
|
|
2675
2734
|
|
|
2676
|
-
|
|
2735
|
+
} else {
|
|
2736
|
+
|
|
2737
|
+
textures.setTexture2D( dstTexture, 0 );
|
|
2738
|
+
glTarget = _gl.TEXTURE_2D;
|
|
2739
|
+
|
|
2740
|
+
}
|
|
2677
2741
|
|
|
2678
|
-
// As another texture upload may have changed pixelStorei
|
|
2679
|
-
// parameters, make sure they are correct for the dstTexture
|
|
2680
2742
|
_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY );
|
|
2681
2743
|
_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );
|
|
2682
2744
|
_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );
|
|
2683
2745
|
|
|
2746
|
+
// used for copying data from cpu
|
|
2684
2747
|
const currentUnpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );
|
|
2685
2748
|
const currentUnpackImageHeight = _gl.getParameter( _gl.UNPACK_IMAGE_HEIGHT );
|
|
2686
2749
|
const currentUnpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );
|
|
2687
2750
|
const currentUnpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );
|
|
2688
2751
|
const currentUnpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );
|
|
2689
2752
|
|
|
2690
|
-
const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ level ] : srcTexture.image;
|
|
2691
|
-
|
|
2692
2753
|
_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );
|
|
2693
2754
|
_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, image.height );
|
|
2694
2755
|
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, minX );
|
|
2695
2756
|
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, minY );
|
|
2757
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, minZ );
|
|
2696
2758
|
|
|
2697
|
-
|
|
2759
|
+
// set up the src texture
|
|
2760
|
+
const isSrc3D = srcTexture.isDataArrayTexture || srcTexture.isData3DTexture;
|
|
2761
|
+
const isDst3D = dstTexture.isDataArrayTexture || dstTexture.isData3DTexture;
|
|
2762
|
+
if ( srcTexture.isDepthTexture ) {
|
|
2698
2763
|
|
|
2699
|
-
|
|
2764
|
+
const srcTextureProperties = properties.get( srcTexture );
|
|
2765
|
+
const dstTextureProperties = properties.get( dstTexture );
|
|
2766
|
+
const srcRenderTargetProperties = properties.get( srcTextureProperties.__renderTarget );
|
|
2767
|
+
const dstRenderTargetProperties = properties.get( dstTextureProperties.__renderTarget );
|
|
2768
|
+
state.bindFramebuffer( _gl.READ_FRAMEBUFFER, srcRenderTargetProperties.__webglFramebuffer );
|
|
2769
|
+
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, dstRenderTargetProperties.__webglFramebuffer );
|
|
2700
2770
|
|
|
2701
|
-
|
|
2771
|
+
for ( let i = 0; i < depth; i ++ ) {
|
|
2702
2772
|
|
|
2703
|
-
|
|
2773
|
+
// if the source or destination are a 3d target then a layer needs to be bound
|
|
2774
|
+
if ( isSrc3D ) {
|
|
2704
2775
|
|
|
2705
|
-
|
|
2776
|
+
_gl.framebufferTextureLayer( _gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, properties.get( srcTexture ).__webglTexture, srcLevel, minZ + i );
|
|
2777
|
+
_gl.framebufferTextureLayer( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, properties.get( dstTexture ).__webglTexture, dstLevel, dstZ + i );
|
|
2706
2778
|
|
|
2707
|
-
|
|
2779
|
+
}
|
|
2708
2780
|
|
|
2709
|
-
_gl.
|
|
2781
|
+
_gl.blitFramebuffer( minX, minY, width, height, dstX, dstY, width, height, _gl.DEPTH_BUFFER_BIT, _gl.NEAREST );
|
|
2710
2782
|
|
|
2711
2783
|
}
|
|
2712
2784
|
|
|
2713
|
-
|
|
2785
|
+
state.bindFramebuffer( _gl.READ_FRAMEBUFFER, null );
|
|
2786
|
+
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, null );
|
|
2714
2787
|
|
|
2715
|
-
|
|
2716
|
-
_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight );
|
|
2717
|
-
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );
|
|
2718
|
-
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows );
|
|
2719
|
-
_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages );
|
|
2788
|
+
} else if ( srcLevel !== 0 || srcTexture.isRenderTargetTexture || properties.has( srcTexture ) ) {
|
|
2720
2789
|
|
|
2721
|
-
|
|
2722
|
-
|
|
2790
|
+
// get the appropriate frame buffers
|
|
2791
|
+
const srcTextureProperties = properties.get( srcTexture );
|
|
2792
|
+
const dstTextureProperties = properties.get( dstTexture );
|
|
2723
2793
|
|
|
2724
|
-
|
|
2794
|
+
// bind the frame buffer targets
|
|
2795
|
+
state.bindFramebuffer( _gl.READ_FRAMEBUFFER, _srcFramebuffer );
|
|
2796
|
+
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, _dstFramebuffer );
|
|
2725
2797
|
|
|
2726
|
-
|
|
2798
|
+
for ( let i = 0; i < depth; i ++ ) {
|
|
2727
2799
|
|
|
2728
|
-
|
|
2800
|
+
// assign the correct layers and mip maps to the frame buffers
|
|
2801
|
+
if ( isSrc3D ) {
|
|
2729
2802
|
|
|
2730
|
-
|
|
2731
|
-
if ( srcTexture.isTexture !== true ) {
|
|
2803
|
+
_gl.framebufferTextureLayer( _gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, srcTextureProperties.__webglTexture, srcLevel, minZ + i );
|
|
2732
2804
|
|
|
2733
|
-
|
|
2734
|
-
warnOnce( 'WebGLRenderer: copyTextureToTexture3D function signature has changed.' );
|
|
2805
|
+
} else {
|
|
2735
2806
|
|
|
2736
|
-
|
|
2737
|
-
dstPosition = arguments[ 1 ] || null;
|
|
2738
|
-
srcTexture = arguments[ 2 ];
|
|
2739
|
-
dstTexture = arguments[ 3 ];
|
|
2740
|
-
level = arguments[ 4 ] || 0;
|
|
2807
|
+
_gl.framebufferTexture2D( _gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, srcTextureProperties.__webglTexture, srcLevel );
|
|
2741
2808
|
|
|
2742
|
-
|
|
2809
|
+
}
|
|
2743
2810
|
|
|
2744
|
-
|
|
2745
|
-
let dstX, dstY, dstZ;
|
|
2746
|
-
const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ level ] : srcTexture.image;
|
|
2747
|
-
if ( srcRegion !== null ) {
|
|
2811
|
+
if ( isDst3D ) {
|
|
2748
2812
|
|
|
2749
|
-
|
|
2750
|
-
height = srcRegion.max.y - srcRegion.min.y;
|
|
2751
|
-
depth = srcRegion.max.z - srcRegion.min.z;
|
|
2752
|
-
minX = srcRegion.min.x;
|
|
2753
|
-
minY = srcRegion.min.y;
|
|
2754
|
-
minZ = srcRegion.min.z;
|
|
2813
|
+
_gl.framebufferTextureLayer( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, dstTextureProperties.__webglTexture, dstLevel, dstZ + i );
|
|
2755
2814
|
|
|
2756
|
-
|
|
2815
|
+
} else {
|
|
2757
2816
|
|
|
2758
|
-
|
|
2759
|
-
height = image.height;
|
|
2760
|
-
depth = image.depth;
|
|
2761
|
-
minX = 0;
|
|
2762
|
-
minY = 0;
|
|
2763
|
-
minZ = 0;
|
|
2817
|
+
_gl.framebufferTexture2D( _gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, dstTextureProperties.__webglTexture, dstLevel );
|
|
2764
2818
|
|
|
2765
|
-
|
|
2819
|
+
}
|
|
2766
2820
|
|
|
2767
|
-
|
|
2821
|
+
// copy the data using the fastest function that can achieve the copy
|
|
2822
|
+
if ( srcLevel !== 0 ) {
|
|
2768
2823
|
|
|
2769
|
-
|
|
2770
|
-
dstY = dstPosition.y;
|
|
2771
|
-
dstZ = dstPosition.z;
|
|
2824
|
+
_gl.blitFramebuffer( minX, minY, width, height, dstX, dstY, width, height, _gl.COLOR_BUFFER_BIT, _gl.NEAREST );
|
|
2772
2825
|
|
|
2773
|
-
|
|
2826
|
+
} else if ( isDst3D ) {
|
|
2774
2827
|
|
|
2775
|
-
|
|
2776
|
-
dstY = 0;
|
|
2777
|
-
dstZ = 0;
|
|
2828
|
+
_gl.copyTexSubImage3D( glTarget, dstLevel, dstX, dstY, dstZ + i, minX, minY, width, height );
|
|
2778
2829
|
|
|
2779
|
-
|
|
2830
|
+
} else {
|
|
2780
2831
|
|
|
2781
|
-
|
|
2782
|
-
const glType = utils.convert( dstTexture.type );
|
|
2783
|
-
let glTarget;
|
|
2832
|
+
_gl.copyTexSubImage2D( glTarget, dstLevel, dstX, dstY, minX, minY, width, height );
|
|
2784
2833
|
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
textures.setTexture3D( dstTexture, 0 );
|
|
2788
|
-
glTarget = _gl.TEXTURE_3D;
|
|
2834
|
+
}
|
|
2789
2835
|
|
|
2790
|
-
|
|
2836
|
+
}
|
|
2791
2837
|
|
|
2792
|
-
|
|
2793
|
-
|
|
2838
|
+
// unbind read, draw buffers
|
|
2839
|
+
state.bindFramebuffer( _gl.READ_FRAMEBUFFER, null );
|
|
2840
|
+
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, null );
|
|
2794
2841
|
|
|
2795
2842
|
} else {
|
|
2796
2843
|
|
|
2797
|
-
|
|
2798
|
-
return;
|
|
2844
|
+
if ( isDst3D ) {
|
|
2799
2845
|
|
|
2800
|
-
|
|
2846
|
+
// copy data into the 3d texture
|
|
2847
|
+
if ( srcTexture.isDataTexture || srcTexture.isData3DTexture ) {
|
|
2801
2848
|
|
|
2802
|
-
|
|
2803
|
-
_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );
|
|
2804
|
-
_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );
|
|
2849
|
+
_gl.texSubImage3D( glTarget, dstLevel, dstX, dstY, dstZ, width, height, depth, glFormat, glType, image.data );
|
|
2805
2850
|
|
|
2806
|
-
|
|
2807
|
-
const currentUnpackImageHeight = _gl.getParameter( _gl.UNPACK_IMAGE_HEIGHT );
|
|
2808
|
-
const currentUnpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );
|
|
2809
|
-
const currentUnpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );
|
|
2810
|
-
const currentUnpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );
|
|
2851
|
+
} else if ( dstTexture.isCompressedArrayTexture ) {
|
|
2811
2852
|
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, minY );
|
|
2816
|
-
_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, minZ );
|
|
2853
|
+
_gl.compressedTexSubImage3D( glTarget, dstLevel, dstX, dstY, dstZ, width, height, depth, glFormat, image.data );
|
|
2854
|
+
|
|
2855
|
+
} else {
|
|
2817
2856
|
|
|
2818
|
-
|
|
2857
|
+
_gl.texSubImage3D( glTarget, dstLevel, dstX, dstY, dstZ, width, height, depth, glFormat, glType, image );
|
|
2819
2858
|
|
|
2820
|
-
|
|
2859
|
+
}
|
|
2821
2860
|
|
|
2822
|
-
|
|
2861
|
+
} else {
|
|
2823
2862
|
|
|
2824
|
-
|
|
2863
|
+
// copy data into the 2d texture
|
|
2864
|
+
if ( srcTexture.isDataTexture ) {
|
|
2825
2865
|
|
|
2826
|
-
|
|
2866
|
+
_gl.texSubImage2D( _gl.TEXTURE_2D, dstLevel, dstX, dstY, width, height, glFormat, glType, image.data );
|
|
2827
2867
|
|
|
2828
|
-
|
|
2868
|
+
} else if ( srcTexture.isCompressedTexture ) {
|
|
2829
2869
|
|
|
2830
|
-
|
|
2870
|
+
_gl.compressedTexSubImage2D( _gl.TEXTURE_2D, dstLevel, dstX, dstY, image.width, image.height, glFormat, image.data );
|
|
2871
|
+
|
|
2872
|
+
} else {
|
|
2873
|
+
|
|
2874
|
+
_gl.texSubImage2D( _gl.TEXTURE_2D, dstLevel, dstX, dstY, width, height, glFormat, glType, image );
|
|
2875
|
+
|
|
2876
|
+
}
|
|
2831
2877
|
|
|
2832
2878
|
}
|
|
2833
2879
|
|
|
2834
2880
|
}
|
|
2835
2881
|
|
|
2882
|
+
// reset values
|
|
2836
2883
|
_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, currentUnpackRowLen );
|
|
2837
2884
|
_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight );
|
|
2838
2885
|
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );
|
|
@@ -2840,12 +2887,39 @@ class WebGLRenderer {
|
|
|
2840
2887
|
_gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages );
|
|
2841
2888
|
|
|
2842
2889
|
// Generate mipmaps only when copying level 0
|
|
2843
|
-
if (
|
|
2890
|
+
if ( dstLevel === 0 && dstTexture.generateMipmaps ) {
|
|
2891
|
+
|
|
2892
|
+
_gl.generateMipmap( glTarget );
|
|
2893
|
+
|
|
2894
|
+
}
|
|
2844
2895
|
|
|
2845
2896
|
state.unbindTexture();
|
|
2846
2897
|
|
|
2847
2898
|
};
|
|
2848
2899
|
|
|
2900
|
+
this.copyTextureToTexture3D = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0 ) {
|
|
2901
|
+
|
|
2902
|
+
// support previous signature with source box first
|
|
2903
|
+
if ( srcTexture.isTexture !== true ) {
|
|
2904
|
+
|
|
2905
|
+
// @deprecated, r165
|
|
2906
|
+
warnOnce( 'WebGLRenderer: copyTextureToTexture3D function signature has changed.' );
|
|
2907
|
+
|
|
2908
|
+
srcRegion = arguments[ 0 ] || null;
|
|
2909
|
+
dstPosition = arguments[ 1 ] || null;
|
|
2910
|
+
srcTexture = arguments[ 2 ];
|
|
2911
|
+
dstTexture = arguments[ 3 ];
|
|
2912
|
+
level = arguments[ 4 ] || 0;
|
|
2913
|
+
|
|
2914
|
+
}
|
|
2915
|
+
|
|
2916
|
+
// @deprecated, r170
|
|
2917
|
+
warnOnce( 'WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.' );
|
|
2918
|
+
|
|
2919
|
+
return this.copyTextureToTexture( srcTexture, dstTexture, srcRegion, dstPosition, level );
|
|
2920
|
+
|
|
2921
|
+
};
|
|
2922
|
+
|
|
2849
2923
|
this.initRenderTarget = function ( target ) {
|
|
2850
2924
|
|
|
2851
2925
|
if ( properties.get( target ).__webglFramebuffer === undefined ) {
|
|
@@ -2916,8 +2990,8 @@ class WebGLRenderer {
|
|
|
2916
2990
|
this._outputColorSpace = colorSpace;
|
|
2917
2991
|
|
|
2918
2992
|
const gl = this.getContext();
|
|
2919
|
-
gl.
|
|
2920
|
-
gl.unpackColorSpace = ColorManagement.
|
|
2993
|
+
gl.drawingBufferColorspace = ColorManagement._getDrawingBufferColorSpace( colorSpace );
|
|
2994
|
+
gl.unpackColorSpace = ColorManagement._getUnpackColorSpace();
|
|
2921
2995
|
|
|
2922
2996
|
}
|
|
2923
2997
|
|
|
@@ -5,18 +5,17 @@ class Animation {
|
|
|
5
5
|
this.nodes = nodes;
|
|
6
6
|
this.info = info;
|
|
7
7
|
|
|
8
|
-
this.
|
|
9
|
-
this.
|
|
10
|
-
|
|
11
|
-
this._init();
|
|
8
|
+
this._context = self;
|
|
9
|
+
this._animationLoop = null;
|
|
10
|
+
this._requestId = null;
|
|
12
11
|
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
start() {
|
|
16
15
|
|
|
17
16
|
const update = ( time, frame ) => {
|
|
18
17
|
|
|
19
|
-
this.
|
|
18
|
+
this._requestId = this._context.requestAnimationFrame( update );
|
|
20
19
|
|
|
21
20
|
if ( this.info.autoReset === true ) this.info.reset();
|
|
22
21
|
|
|
@@ -24,7 +23,7 @@ class Animation {
|
|
|
24
23
|
|
|
25
24
|
this.info.frame = this.nodes.nodeFrame.frameId;
|
|
26
25
|
|
|
27
|
-
if ( this.
|
|
26
|
+
if ( this._animationLoop !== null ) this._animationLoop( time, frame );
|
|
28
27
|
|
|
29
28
|
};
|
|
30
29
|
|
|
@@ -32,16 +31,29 @@ class Animation {
|
|
|
32
31
|
|
|
33
32
|
}
|
|
34
33
|
|
|
35
|
-
|
|
34
|
+
stop() {
|
|
35
|
+
|
|
36
|
+
this._context.cancelAnimationFrame( this._requestId );
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
this.requestId = null;
|
|
38
|
+
this._requestId = null;
|
|
39
39
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
setAnimationLoop( callback ) {
|
|
43
43
|
|
|
44
|
-
this.
|
|
44
|
+
this._animationLoop = callback;
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
setContext( context ) {
|
|
49
|
+
|
|
50
|
+
this._context = context;
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
dispose() {
|
|
55
|
+
|
|
56
|
+
this.stop();
|
|
45
57
|
|
|
46
58
|
}
|
|
47
59
|
|
|
@@ -45,6 +45,10 @@ class Attributes extends DataMap {
|
|
|
45
45
|
|
|
46
46
|
this.backend.createStorageAttribute( attribute );
|
|
47
47
|
|
|
48
|
+
} else if ( type === AttributeType.INDIRECT ) {
|
|
49
|
+
|
|
50
|
+
this.backend.createIndirectStorageAttribute( attribute );
|
|
51
|
+
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
data.version = this._getBufferAttribute( attribute ).version;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import DataMap from './DataMap.js';
|
|
2
2
|
import Color4 from './Color4.js';
|
|
3
|
-
import { vec4, context, normalWorld, backgroundBlurriness, backgroundIntensity, modelViewProjection } from '../../nodes/TSL.js';
|
|
3
|
+
import { vec4, context, normalWorld, backgroundBlurriness, backgroundIntensity, backgroundRotation, modelViewProjection } from '../../nodes/TSL.js';
|
|
4
4
|
import NodeMaterial from '../../materials/nodes/NodeMaterial.js';
|
|
5
5
|
|
|
6
6
|
import { Mesh } from '../../objects/Mesh.js';
|
|
@@ -56,7 +56,7 @@ class Background extends DataMap {
|
|
|
56
56
|
|
|
57
57
|
const backgroundMeshNode = context( vec4( backgroundNode ).mul( backgroundIntensity ), {
|
|
58
58
|
// @TODO: Add Texture2D support using node context
|
|
59
|
-
getUV: () => normalWorld,
|
|
59
|
+
getUV: () => backgroundRotation.mul( normalWorld ),
|
|
60
60
|
getTextureLevel: () => backgroundBlurriness
|
|
61
61
|
} );
|
|
62
62
|
|
|
@@ -99,7 +99,7 @@ class Background extends DataMap {
|
|
|
99
99
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
renderList.unshift( backgroundMesh, backgroundMesh.geometry, backgroundMesh.material, 0, 0, null );
|
|
102
|
+
renderList.unshift( backgroundMesh, backgroundMesh.geometry, backgroundMesh.material, 0, 0, null, null );
|
|
103
103
|
|
|
104
104
|
} else {
|
|
105
105
|
|
|
@@ -111,8 +111,6 @@ class Background extends DataMap {
|
|
|
111
111
|
|
|
112
112
|
if ( renderer.autoClear === true || forceClear === true ) {
|
|
113
113
|
|
|
114
|
-
_clearColor.multiplyScalar( _clearColor.a );
|
|
115
|
-
|
|
116
114
|
const clearColorValue = renderContext.clearColorValue;
|
|
117
115
|
|
|
118
116
|
clearColorValue.r = _clearColor.r;
|
|
@@ -120,6 +118,18 @@ class Background extends DataMap {
|
|
|
120
118
|
clearColorValue.b = _clearColor.b;
|
|
121
119
|
clearColorValue.a = _clearColor.a;
|
|
122
120
|
|
|
121
|
+
// premultiply alpha
|
|
122
|
+
|
|
123
|
+
if ( renderer.backend.isWebGLBackend === true || renderer.alpha === true ) {
|
|
124
|
+
|
|
125
|
+
clearColorValue.r *= clearColorValue.a;
|
|
126
|
+
clearColorValue.g *= clearColorValue.a;
|
|
127
|
+
clearColorValue.b *= clearColorValue.a;
|
|
128
|
+
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
//
|
|
132
|
+
|
|
123
133
|
renderContext.depthClearValue = renderer._clearDepth;
|
|
124
134
|
renderContext.stencilClearValue = renderer._clearStencil;
|
|
125
135
|
|