@plastic-software/three 0.182.0 → 0.183.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/LICENSE +1 -1
- package/build/three.cjs +11521 -10878
- package/build/three.core.js +11732 -11340
- package/build/three.core.min.js +2 -2
- package/build/three.module.js +510 -263
- package/build/three.module.min.js +2 -2
- package/build/three.tsl.js +7 -11
- package/build/three.tsl.min.js +2 -2
- package/build/three.webgpu.js +3072 -2607
- package/build/three.webgpu.min.js +2 -2
- package/build/three.webgpu.nodes.js +3071 -2607
- package/build/three.webgpu.nodes.min.js +2 -2
- package/examples/jsm/Addons.js +0 -3
- package/examples/jsm/animation/CCDIKSolver.js +2 -2
- package/examples/jsm/controls/ArcballControls.js +3 -3
- package/examples/jsm/controls/OrbitControls.js +103 -0
- package/examples/jsm/effects/AnaglyphEffect.js +102 -7
- package/examples/jsm/environments/ColorEnvironment.js +59 -0
- package/examples/jsm/environments/RoomEnvironment.js +1 -0
- package/examples/jsm/exporters/EXRExporter.js +1 -1
- package/examples/jsm/exporters/GLTFExporter.js +131 -4
- package/examples/jsm/exporters/USDZExporter.js +22 -3
- package/examples/jsm/helpers/AnimationPathHelper.js +302 -0
- package/examples/jsm/helpers/ViewHelper.js +67 -8
- package/examples/jsm/inspector/Inspector.js +21 -5
- package/examples/jsm/inspector/tabs/Console.js +39 -5
- package/examples/jsm/inspector/tabs/Parameters.js +16 -0
- package/examples/jsm/inspector/ui/Style.js +25 -1
- package/examples/jsm/libs/meshopt_decoder.module.js +6 -5
- package/examples/jsm/lines/LineMaterial.js +6 -0
- package/examples/jsm/loaders/3MFLoader.js +2 -2
- package/examples/jsm/loaders/AMFLoader.js +2 -2
- package/examples/jsm/loaders/ColladaLoader.js +24 -4026
- package/examples/jsm/loaders/EXRLoader.js +5 -5
- package/examples/jsm/loaders/FBXLoader.js +2 -2
- package/examples/jsm/loaders/GCodeLoader.js +34 -8
- package/examples/jsm/loaders/GLTFLoader.js +122 -171
- package/examples/jsm/loaders/KMZLoader.js +5 -5
- package/examples/jsm/loaders/KTX2Loader.js +5 -5
- package/examples/jsm/loaders/LWOLoader.js +7 -39
- package/examples/jsm/loaders/NRRDLoader.js +2 -2
- package/examples/jsm/loaders/PCDLoader.js +3 -2
- package/examples/jsm/loaders/USDLoader.js +100 -40
- package/examples/jsm/loaders/UltraHDRLoader.js +182 -30
- package/examples/jsm/loaders/VRMLLoader.js +77 -0
- package/examples/jsm/loaders/VTKLoader.js +37 -24
- package/examples/jsm/loaders/collada/ColladaComposer.js +2950 -0
- package/examples/jsm/loaders/collada/ColladaParser.js +1962 -0
- package/examples/jsm/loaders/usd/USDAParser.js +447 -366
- package/examples/jsm/loaders/usd/USDCParser.js +1841 -6
- package/examples/jsm/loaders/usd/USDComposer.js +4041 -0
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +2 -2
- package/examples/jsm/objects/LensflareMesh.js +1 -1
- package/examples/jsm/objects/Sky.js +76 -4
- package/examples/jsm/objects/SkyMesh.js +114 -7
- package/examples/jsm/objects/Water.js +4 -3
- package/examples/jsm/objects/Water2.js +5 -3
- package/examples/jsm/objects/WaterMesh.js +5 -7
- package/examples/jsm/physics/JoltPhysics.js +7 -5
- package/examples/jsm/physics/RapierPhysics.js +6 -4
- package/examples/jsm/postprocessing/EffectComposer.js +7 -5
- package/examples/jsm/postprocessing/RenderTransitionPass.js +1 -1
- package/examples/jsm/renderers/CSS3DRenderer.js +1 -1
- package/examples/jsm/renderers/SVGRenderer.js +2 -2
- package/examples/jsm/shaders/GTAOShader.js +19 -6
- package/examples/jsm/shaders/HalftoneShader.js +12 -1
- package/examples/jsm/shaders/PoissonDenoiseShader.js +6 -2
- package/examples/jsm/shaders/SAOShader.js +17 -4
- package/examples/jsm/shaders/SSAOShader.js +11 -1
- package/examples/jsm/shaders/SSRShader.js +6 -5
- package/examples/jsm/shaders/VignetteShader.js +1 -1
- package/examples/jsm/tsl/display/AfterImageNode.js +1 -1
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +456 -16
- package/examples/jsm/tsl/display/AnamorphicNode.js +1 -1
- package/examples/jsm/tsl/display/BilateralBlurNode.js +364 -0
- package/examples/jsm/tsl/display/BloomNode.js +5 -5
- package/examples/jsm/tsl/display/CRT.js +150 -0
- package/examples/jsm/tsl/display/DenoiseNode.js +1 -1
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +1 -1
- package/examples/jsm/tsl/display/DotScreenNode.js +1 -1
- package/examples/jsm/tsl/display/FXAANode.js +2 -2
- package/examples/jsm/tsl/display/GTAONode.js +2 -2
- package/examples/jsm/tsl/display/GaussianBlurNode.js +11 -2
- package/examples/jsm/tsl/display/GodraysNode.js +624 -0
- package/examples/jsm/tsl/display/LensflareNode.js +1 -1
- package/examples/jsm/tsl/display/Lut3DNode.js +1 -1
- package/examples/jsm/tsl/display/OutlineNode.js +3 -3
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +2 -2
- package/examples/jsm/tsl/display/PixelationPassNode.js +5 -5
- package/examples/jsm/tsl/display/RGBShiftNode.js +2 -2
- package/examples/jsm/tsl/display/RetroPassNode.js +263 -0
- package/examples/jsm/tsl/display/SMAANode.js +2 -2
- package/examples/jsm/tsl/display/SSAAPassNode.js +2 -2
- package/examples/jsm/tsl/display/SSGINode.js +2 -2
- package/examples/jsm/tsl/display/SSRNode.js +7 -7
- package/examples/jsm/tsl/display/SSSNode.js +2 -2
- package/examples/jsm/tsl/display/Shape.js +29 -0
- package/examples/jsm/tsl/display/SobelOperatorNode.js +2 -2
- package/examples/jsm/tsl/display/StereoPassNode.js +1 -2
- package/examples/jsm/tsl/display/TRAANode.js +9 -12
- package/examples/jsm/tsl/display/TransitionNode.js +1 -1
- package/examples/jsm/tsl/display/depthAwareBlend.js +80 -0
- package/examples/jsm/tsl/math/Bayer.js +40 -1
- package/examples/jsm/utils/LDrawUtils.js +1 -1
- package/package.json +11 -19
- package/src/Three.Core.js +1 -1
- package/src/Three.TSL.js +5 -9
- package/src/Three.WebGPU.Nodes.js +2 -0
- package/src/Three.WebGPU.js +3 -0
- package/src/Three.js +1 -0
- package/src/animation/AnimationAction.js +1 -1
- package/src/animation/AnimationClip.js +1 -1
- package/src/animation/AnimationMixer.js +6 -0
- package/src/animation/KeyframeTrack.js +46 -7
- package/src/animation/PropertyMixer.js +4 -4
- package/src/audio/Audio.js +1 -1
- package/src/audio/AudioListener.js +5 -3
- package/src/cameras/Camera.js +32 -2
- package/src/cameras/CubeCamera.js +20 -0
- package/src/constants.js +30 -1
- package/src/core/Clock.js +7 -0
- package/src/core/Object3D.js +56 -4
- package/src/core/RenderTarget.js +3 -4
- package/src/extras/PMREMGenerator.js +4 -8
- package/src/geometries/TorusGeometry.js +8 -3
- package/src/helpers/CameraHelper.js +3 -0
- package/src/helpers/DirectionalLightHelper.js +4 -1
- package/src/helpers/HemisphereLightHelper.js +3 -0
- package/src/helpers/PointLightHelper.js +0 -24
- package/src/helpers/SpotLightHelper.js +3 -0
- package/src/lights/LightShadow.js +15 -3
- package/src/lights/webgpu/IESSpotLight.js +2 -1
- package/src/loaders/Cache.js +28 -0
- package/src/loaders/FileLoader.js +1 -1
- package/src/loaders/ImageBitmapLoader.js +8 -3
- package/src/loaders/Loader.js +6 -0
- package/src/loaders/ObjectLoader.js +18 -1
- package/src/materials/MeshLambertMaterial.js +9 -0
- package/src/materials/MeshPhongMaterial.js +9 -0
- package/src/materials/nodes/Line2NodeMaterial.js +5 -5
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +2 -0
- package/src/materials/nodes/NodeMaterial.js +15 -24
- package/src/materials/nodes/manager/NodeMaterialObserver.js +9 -3
- package/src/math/Line3.js +3 -5
- package/src/math/MathUtils.js +10 -10
- package/src/math/Matrix4.js +35 -26
- package/src/math/Quaternion.js +3 -29
- package/src/math/Vector3.js +3 -3
- package/src/math/interpolants/BezierInterpolant.js +108 -0
- package/src/nodes/Nodes.js +87 -68
- package/src/nodes/TSL.js +2 -5
- package/src/nodes/accessors/Arrays.js +1 -1
- package/src/nodes/accessors/Bitangent.js +5 -5
- package/src/nodes/accessors/BufferAttributeNode.js +1 -1
- package/src/nodes/accessors/Camera.js +149 -28
- package/src/nodes/accessors/InstanceNode.js +105 -40
- package/src/nodes/accessors/Normal.js +9 -9
- package/src/nodes/accessors/Position.js +34 -2
- package/src/nodes/accessors/SceneProperties.js +53 -0
- package/src/nodes/accessors/SkinningNode.js +12 -24
- package/src/nodes/accessors/StorageBufferNode.js +0 -19
- package/src/nodes/accessors/StorageTextureNode.js +37 -1
- package/src/nodes/accessors/Tangent.js +3 -3
- package/src/nodes/accessors/Texture3DNode.js +6 -34
- package/src/nodes/accessors/TextureNode.js +58 -22
- package/src/nodes/accessors/UniformArrayNode.js +2 -0
- package/src/nodes/core/MRTNode.js +48 -2
- package/src/nodes/core/Node.js +29 -3
- package/src/nodes/core/NodeBuilder.js +115 -40
- package/src/nodes/core/NodeError.js +28 -0
- package/src/nodes/core/NodeUtils.js +5 -3
- package/src/nodes/core/OutputStructNode.js +12 -10
- package/src/nodes/core/ParameterNode.js +2 -1
- package/src/nodes/core/StackNode.js +9 -8
- package/src/nodes/core/StackTrace.js +139 -0
- package/src/nodes/core/StructNode.js +15 -0
- package/src/nodes/core/SubBuildNode.js +1 -1
- package/src/nodes/core/UniformNode.js +2 -1
- package/src/nodes/core/VarNode.js +1 -1
- package/src/nodes/core/VaryingNode.js +1 -18
- package/src/nodes/display/BlendModes.js +0 -64
- package/src/nodes/display/ColorAdjustment.js +17 -0
- package/src/nodes/display/ColorSpaceNode.js +3 -3
- package/src/nodes/display/NormalMapNode.js +2 -2
- package/src/nodes/display/PassNode.js +21 -2
- package/src/nodes/display/RenderOutputNode.js +3 -3
- package/src/nodes/display/ScreenNode.js +2 -1
- package/src/nodes/display/ToneMappingNode.js +1 -1
- package/src/nodes/display/ToonOutlinePassNode.js +2 -2
- package/src/nodes/display/ViewportDepthNode.js +52 -4
- package/src/nodes/display/ViewportTextureNode.js +21 -4
- package/src/nodes/fog/Fog.js +18 -35
- package/src/nodes/functions/PhysicalLightingModel.js +25 -3
- package/src/nodes/geometry/RangeNode.js +4 -2
- package/src/nodes/gpgpu/ComputeNode.js +5 -4
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +2 -1
- package/src/nodes/lighting/EnvironmentNode.js +28 -3
- package/src/nodes/lighting/PointShadowNode.js +24 -12
- package/src/nodes/lighting/ShadowFilterNode.js +15 -43
- package/src/nodes/lighting/ShadowNode.js +54 -32
- package/src/nodes/math/ConditionalNode.js +2 -2
- package/src/nodes/math/MathNode.js +3 -40
- package/src/nodes/math/OperatorNode.js +2 -1
- package/src/nodes/pmrem/PMREMUtils.js +9 -15
- package/src/nodes/tsl/TSLCore.js +13 -10
- package/src/nodes/utils/DebugNode.js +11 -11
- package/src/nodes/utils/JoinNode.js +2 -2
- package/src/nodes/utils/LoopNode.js +1 -1
- package/src/nodes/utils/MemberNode.js +1 -1
- package/src/nodes/utils/RTTNode.js +1 -1
- package/src/nodes/utils/ReflectorNode.js +2 -3
- package/src/nodes/utils/SpriteSheetUV.js +35 -0
- package/src/nodes/utils/UVUtils.js +4 -2
- package/src/objects/BatchedMesh.js +22 -12
- package/src/objects/InstancedMesh.js +11 -0
- package/src/renderers/WebGLRenderer.js +34 -60
- package/src/renderers/common/Backend.js +21 -0
- package/src/renderers/common/Background.js +7 -4
- package/src/renderers/common/BindGroup.js +1 -9
- package/src/renderers/common/Bindings.js +20 -5
- package/src/renderers/common/BlendMode.js +143 -0
- package/src/renderers/common/BundleGroup.js +1 -1
- package/src/renderers/common/CubeRenderTarget.js +50 -6
- package/src/renderers/common/Geometries.js +17 -3
- package/src/renderers/common/Lighting.js +5 -21
- package/src/renderers/common/Pipelines.js +4 -4
- package/src/renderers/common/PostProcessing.js +8 -206
- package/src/renderers/common/RenderBundles.js +2 -1
- package/src/renderers/common/RenderContext.js +16 -0
- package/src/renderers/common/RenderContexts.js +33 -56
- package/src/renderers/common/RenderLists.js +2 -1
- package/src/renderers/common/RenderObject.js +2 -3
- package/src/renderers/common/RenderObjectPipeline.js +40 -0
- package/src/renderers/common/RenderObjects.js +18 -2
- package/src/renderers/common/RenderPipeline.js +203 -17
- package/src/renderers/common/Renderer.js +207 -40
- package/src/renderers/common/Sampler.js +4 -4
- package/src/renderers/common/StorageBuffer.js +13 -1
- package/src/renderers/common/Textures.js +16 -0
- package/src/renderers/common/TimestampQueryPool.js +5 -3
- package/src/renderers/common/Uniform.js +8 -0
- package/src/renderers/common/UniformsGroup.js +60 -0
- package/src/renderers/common/XRManager.js +2 -2
- package/src/renderers/common/nodes/NodeBuilderState.js +1 -1
- package/src/renderers/common/nodes/{Nodes.js → NodeManager.js} +18 -6
- package/src/renderers/common/nodes/NodeStorageBuffer.js +13 -2
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/color_fragment.glsl.js +1 -5
- package/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.js +1 -5
- package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +1 -5
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +8 -10
- package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +4 -4
- package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +7 -11
- package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +6 -2
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +23 -1
- package/src/renderers/shaders/ShaderChunk/packing.glsl.js +20 -4
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +55 -24
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/shadow.glsl.js +1 -0
- package/src/renderers/shaders/ShaderLib.js +4 -2
- package/src/renderers/shaders/UniformsLib.js +0 -3
- package/src/renderers/webgl/WebGLBackground.js +2 -2
- package/src/renderers/webgl/WebGLBindingStates.js +99 -27
- package/src/renderers/webgl/WebGLEnvironments.js +228 -0
- package/src/renderers/webgl/WebGLGeometries.js +10 -7
- package/src/renderers/webgl/WebGLMaterials.js +12 -0
- package/src/renderers/webgl/WebGLObjects.js +3 -1
- package/src/renderers/webgl/WebGLProgram.js +2 -2
- package/src/renderers/webgl/WebGLPrograms.js +10 -4
- package/src/renderers/webgl/WebGLRenderLists.js +15 -0
- package/src/renderers/webgl/WebGLShadowMap.js +5 -4
- package/src/renderers/webgl/WebGLState.js +12 -17
- package/src/renderers/webgl-fallback/WebGLBackend.js +71 -7
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +98 -29
- package/src/renderers/webgl-fallback/utils/WebGLState.js +168 -7
- package/src/renderers/webgpu/WebGPUBackend.js +58 -9
- package/src/renderers/webgpu/WebGPURenderer.js +1 -0
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +257 -45
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +8 -19
- package/src/renderers/webgpu/utils/WebGPUConstants.js +1 -1
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +56 -31
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +152 -200
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +25 -25
- package/src/renderers/webgpu/utils/WebGPUUtils.js +10 -6
- package/src/renderers/webxr/WebXRManager.js +2 -2
- package/src/textures/Texture.js +2 -2
- package/src/utils.js +246 -3
- package/examples/jsm/materials/MeshGouraudMaterial.js +0 -433
- package/examples/jsm/materials/MeshPostProcessingMaterial.js +0 -167
- package/examples/jsm/shaders/GodRaysShader.js +0 -333
- package/src/nodes/accessors/SceneNode.js +0 -145
- package/src/nodes/code/ScriptableNode.js +0 -726
- package/src/nodes/code/ScriptableValueNode.js +0 -253
- package/src/nodes/display/PosterizeNode.js +0 -65
- package/src/nodes/utils/SpriteSheetUVNode.js +0 -90
- package/src/renderers/webgl/WebGLCubeMaps.js +0 -99
- package/src/renderers/webgl/WebGLCubeUVMaps.js +0 -134
|
@@ -31,8 +31,7 @@ import { WebGLBindingStates } from './webgl/WebGLBindingStates.js';
|
|
|
31
31
|
import { WebGLBufferRenderer } from './webgl/WebGLBufferRenderer.js';
|
|
32
32
|
import { WebGLCapabilities } from './webgl/WebGLCapabilities.js';
|
|
33
33
|
import { WebGLClipping } from './webgl/WebGLClipping.js';
|
|
34
|
-
import {
|
|
35
|
-
import { WebGLCubeUVMaps } from './webgl/WebGLCubeUVMaps.js';
|
|
34
|
+
import { WebGLEnvironments } from './webgl/WebGLEnvironments.js';
|
|
36
35
|
import { WebGLExtensions } from './webgl/WebGLExtensions.js';
|
|
37
36
|
import { WebGLGeometries } from './webgl/WebGLGeometries.js';
|
|
38
37
|
import { WebGLIndexedBufferRenderer } from './webgl/WebGLIndexedBufferRenderer.js';
|
|
@@ -149,7 +148,7 @@ class WebGLRenderer {
|
|
|
149
148
|
// public properties
|
|
150
149
|
|
|
151
150
|
/**
|
|
152
|
-
* A canvas where the renderer draws its output.This is automatically created by the renderer
|
|
151
|
+
* A canvas where the renderer draws its output. This is automatically created by the renderer
|
|
153
152
|
* in the constructor (if not provided already); you just need to add it to your page like so:
|
|
154
153
|
* ```js
|
|
155
154
|
* document.body.appendChild( renderer.domElement );
|
|
@@ -165,7 +164,7 @@ class WebGLRenderer {
|
|
|
165
164
|
* - `checkShaderErrors`: If it is `true`, defines whether material shader programs are
|
|
166
165
|
* checked for errors during compilation and linkage process. It may be useful to disable
|
|
167
166
|
* this check in production for performance gain. It is strongly recommended to keep these
|
|
168
|
-
* checks enabled during development. If the shader does not compile and link
|
|
167
|
+
* checks enabled during development. If the shader does not compile and link, it will not
|
|
169
168
|
* work and associated material will not render.
|
|
170
169
|
* - `onShaderError(gl, program, glVertexShader,glFragmentShader)`: A callback function that
|
|
171
170
|
* can be used for custom error reporting. The callback receives the WebGL context, an instance
|
|
@@ -414,7 +413,7 @@ class WebGLRenderer {
|
|
|
414
413
|
}
|
|
415
414
|
|
|
416
415
|
let extensions, capabilities, state, info;
|
|
417
|
-
let properties, textures,
|
|
416
|
+
let properties, textures, environments, attributes, geometries, objects;
|
|
418
417
|
let programCache, materials, renderLists, renderStates, clipping, shadowMap;
|
|
419
418
|
|
|
420
419
|
let background, morphtargets, bufferRenderer, indexedBufferRenderer;
|
|
@@ -441,19 +440,18 @@ class WebGLRenderer {
|
|
|
441
440
|
info = new WebGLInfo( _gl );
|
|
442
441
|
properties = new WebGLProperties();
|
|
443
442
|
textures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );
|
|
444
|
-
|
|
445
|
-
cubeuvmaps = new WebGLCubeUVMaps( _this );
|
|
443
|
+
environments = new WebGLEnvironments( _this );
|
|
446
444
|
attributes = new WebGLAttributes( _gl );
|
|
447
445
|
bindingStates = new WebGLBindingStates( _gl, attributes );
|
|
448
446
|
geometries = new WebGLGeometries( _gl, attributes, info, bindingStates );
|
|
449
|
-
objects = new WebGLObjects( _gl, geometries, attributes, info );
|
|
447
|
+
objects = new WebGLObjects( _gl, geometries, attributes, bindingStates, info );
|
|
450
448
|
morphtargets = new WebGLMorphtargets( _gl, capabilities, textures );
|
|
451
449
|
clipping = new WebGLClipping( properties );
|
|
452
|
-
programCache = new WebGLPrograms( _this,
|
|
450
|
+
programCache = new WebGLPrograms( _this, environments, extensions, capabilities, bindingStates, clipping );
|
|
453
451
|
materials = new WebGLMaterials( _this, properties );
|
|
454
452
|
renderLists = new WebGLRenderLists();
|
|
455
453
|
renderStates = new WebGLRenderStates( extensions );
|
|
456
|
-
background = new WebGLBackground( _this,
|
|
454
|
+
background = new WebGLBackground( _this, environments, state, objects, _alpha, premultipliedAlpha );
|
|
457
455
|
shadowMap = new WebGLShadowMap( _this, objects, capabilities );
|
|
458
456
|
uniformsGroups = new WebGLUniformsGroups( _gl, info, capabilities, state );
|
|
459
457
|
|
|
@@ -1010,7 +1008,11 @@ class WebGLRenderer {
|
|
|
1010
1008
|
|
|
1011
1009
|
}
|
|
1012
1010
|
|
|
1013
|
-
|
|
1011
|
+
if ( bits !== 0 ) {
|
|
1012
|
+
|
|
1013
|
+
_gl.clear( bits );
|
|
1014
|
+
|
|
1015
|
+
}
|
|
1014
1016
|
|
|
1015
1017
|
};
|
|
1016
1018
|
|
|
@@ -1055,8 +1057,7 @@ class WebGLRenderer {
|
|
|
1055
1057
|
renderLists.dispose();
|
|
1056
1058
|
renderStates.dispose();
|
|
1057
1059
|
properties.dispose();
|
|
1058
|
-
|
|
1059
|
-
cubeuvmaps.dispose();
|
|
1060
|
+
environments.dispose();
|
|
1060
1061
|
objects.dispose();
|
|
1061
1062
|
bindingStates.dispose();
|
|
1062
1063
|
uniformsGroups.dispose();
|
|
@@ -1953,7 +1954,7 @@ class WebGLRenderer {
|
|
|
1953
1954
|
generateMipmaps: true,
|
|
1954
1955
|
type: hasHalfFloatSupport ? HalfFloatType : UnsignedByteType,
|
|
1955
1956
|
minFilter: LinearMipmapLinearFilter,
|
|
1956
|
-
samples: capabilities.samples,
|
|
1957
|
+
samples: Math.max( 4, capabilities.samples ), // to avoid feedback loops, the transmission render target requires a resolve, see #26177
|
|
1957
1958
|
stencilBuffer: stencil,
|
|
1958
1959
|
resolveDepthBuffer: false,
|
|
1959
1960
|
resolveStencilBuffer: false,
|
|
@@ -2135,9 +2136,11 @@ class WebGLRenderer {
|
|
|
2135
2136
|
|
|
2136
2137
|
// always update environment and fog - changing these trigger an getProgram call, but it's possible that the program doesn't change
|
|
2137
2138
|
|
|
2138
|
-
materialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;
|
|
2139
|
+
materialProperties.environment = ( material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ) ? scene.environment : null;
|
|
2139
2140
|
materialProperties.fog = scene.fog;
|
|
2140
|
-
|
|
2141
|
+
|
|
2142
|
+
const usePMREM = material.isMeshStandardMaterial || ( material.isMeshLambertMaterial && ! material.envMap ) || ( material.isMeshPhongMaterial && ! material.envMap );
|
|
2143
|
+
materialProperties.envMap = environments.get( material.envMap || materialProperties.environment, usePMREM );
|
|
2141
2144
|
materialProperties.envMapRotation = ( materialProperties.environment !== null && material.envMap === null ) ? scene.environmentRotation : material.envMapRotation;
|
|
2142
2145
|
|
|
2143
2146
|
if ( programs === undefined ) {
|
|
@@ -2210,12 +2213,9 @@ class WebGLRenderer {
|
|
|
2210
2213
|
uniforms.pointLightShadows.value = lights.state.pointShadow;
|
|
2211
2214
|
uniforms.hemisphereLights.value = lights.state.hemi;
|
|
2212
2215
|
|
|
2213
|
-
uniforms.directionalShadowMap.value = lights.state.directionalShadowMap;
|
|
2214
2216
|
uniforms.directionalShadowMatrix.value = lights.state.directionalShadowMatrix;
|
|
2215
|
-
uniforms.spotShadowMap.value = lights.state.spotShadowMap;
|
|
2216
2217
|
uniforms.spotLightMatrix.value = lights.state.spotLightMatrix;
|
|
2217
2218
|
uniforms.spotLightMap.value = lights.state.spotLightMap;
|
|
2218
|
-
uniforms.pointShadowMap.value = lights.state.pointShadowMap;
|
|
2219
2219
|
uniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix;
|
|
2220
2220
|
// TODO (abelnation): add area lights shadow info to uniforms
|
|
2221
2221
|
|
|
@@ -2271,9 +2271,10 @@ class WebGLRenderer {
|
|
|
2271
2271
|
textures.resetTextureUnits();
|
|
2272
2272
|
|
|
2273
2273
|
const fog = scene.fog;
|
|
2274
|
-
const environment = material.isMeshStandardMaterial ? scene.environment : null;
|
|
2274
|
+
const environment = ( material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ) ? scene.environment : null;
|
|
2275
2275
|
const colorSpace = ( _currentRenderTarget === null ) ? _this.outputColorSpace : ( _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace );
|
|
2276
|
-
const
|
|
2276
|
+
const usePMREM = material.isMeshStandardMaterial || ( material.isMeshLambertMaterial && ! material.envMap ) || ( material.isMeshPhongMaterial && ! material.envMap );
|
|
2277
|
+
const envMap = environments.get( material.envMap || environment, usePMREM );
|
|
2277
2278
|
const vertexAlphas = material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4;
|
|
2278
2279
|
const vertexTangents = !! geometry.attributes.tangent && ( !! material.normalMap || material.anisotropy > 0 );
|
|
2279
2280
|
const morphTargets = !! geometry.morphAttributes.position;
|
|
@@ -2614,17 +2615,7 @@ class WebGLRenderer {
|
|
|
2614
2615
|
|
|
2615
2616
|
}
|
|
2616
2617
|
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
if ( material.isMeshGouraudMaterial && material.envMap !== null ) {
|
|
2620
|
-
|
|
2621
|
-
m_uniforms.envMap.value = envMap;
|
|
2622
|
-
|
|
2623
|
-
m_uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;
|
|
2624
|
-
|
|
2625
|
-
}
|
|
2626
|
-
|
|
2627
|
-
if ( material.isMeshStandardMaterial && material.envMap === null && scene.environment !== null ) {
|
|
2618
|
+
if ( ( material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ) && material.envMap === null && scene.environment !== null ) {
|
|
2628
2619
|
|
|
2629
2620
|
m_uniforms.envMapIntensity.value = scene.environmentIntensity;
|
|
2630
2621
|
|
|
@@ -3017,6 +3008,10 @@ class WebGLRenderer {
|
|
|
3017
3008
|
const textureFormat = texture.format;
|
|
3018
3009
|
const textureType = texture.type;
|
|
3019
3010
|
|
|
3011
|
+
// when using MRT, select the correct color buffer for the subsequent read command
|
|
3012
|
+
|
|
3013
|
+
if ( renderTarget.textures.length > 1 ) _gl.readBuffer( _gl.COLOR_ATTACHMENT0 + textureIndex );
|
|
3014
|
+
|
|
3020
3015
|
if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
|
|
3021
3016
|
|
|
3022
3017
|
error( 'WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.' );
|
|
@@ -3035,10 +3030,6 @@ class WebGLRenderer {
|
|
|
3035
3030
|
|
|
3036
3031
|
if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
|
|
3037
3032
|
|
|
3038
|
-
// when using MRT, select the correct color buffer for the subsequent read command
|
|
3039
|
-
|
|
3040
|
-
if ( renderTarget.textures.length > 1 ) _gl.readBuffer( _gl.COLOR_ATTACHMENT0 + textureIndex );
|
|
3041
|
-
|
|
3042
3033
|
_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), buffer );
|
|
3043
3034
|
|
|
3044
3035
|
}
|
|
@@ -3099,6 +3090,11 @@ class WebGLRenderer {
|
|
|
3099
3090
|
const textureFormat = texture.format;
|
|
3100
3091
|
const textureType = texture.type;
|
|
3101
3092
|
|
|
3093
|
+
// when using MRT, select the correct color buffer for the subsequent read command
|
|
3094
|
+
|
|
3095
|
+
if ( renderTarget.textures.length > 1 ) _gl.readBuffer( _gl.COLOR_ATTACHMENT0 + textureIndex );
|
|
3096
|
+
|
|
3097
|
+
|
|
3102
3098
|
if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
|
|
3103
3099
|
|
|
3104
3100
|
throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.' );
|
|
@@ -3115,10 +3111,6 @@ class WebGLRenderer {
|
|
|
3115
3111
|
_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
|
|
3116
3112
|
_gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );
|
|
3117
3113
|
|
|
3118
|
-
// when using MRT, select the correct color buffer for the subsequent read command
|
|
3119
|
-
|
|
3120
|
-
if ( renderTarget.textures.length > 1 ) _gl.readBuffer( _gl.COLOR_ATTACHMENT0 + textureIndex );
|
|
3121
|
-
|
|
3122
3114
|
_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), 0 );
|
|
3123
3115
|
|
|
3124
3116
|
// reset the frame buffer to the currently set buffer before waiting
|
|
@@ -3188,27 +3180,9 @@ class WebGLRenderer {
|
|
|
3188
3180
|
* @param {?(Box2|Box3)} [srcRegion=null] - A bounding box which describes the source region. Can be two or three-dimensional.
|
|
3189
3181
|
* @param {?(Vector2|Vector3)} [dstPosition=null] - A vector that represents the origin of the destination region. Can be two or three-dimensional.
|
|
3190
3182
|
* @param {number} [srcLevel=0] - The source mipmap level to copy.
|
|
3191
|
-
* @param {?number} [dstLevel=
|
|
3183
|
+
* @param {?number} [dstLevel=0] - The destination mipmap level.
|
|
3192
3184
|
*/
|
|
3193
|
-
this.copyTextureToTexture = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, srcLevel = 0, dstLevel =
|
|
3194
|
-
|
|
3195
|
-
// support the previous signature with just a single dst mipmap level
|
|
3196
|
-
if ( dstLevel === null ) {
|
|
3197
|
-
|
|
3198
|
-
if ( srcLevel !== 0 ) {
|
|
3199
|
-
|
|
3200
|
-
// @deprecated, r171
|
|
3201
|
-
warnOnce( 'WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels.' );
|
|
3202
|
-
dstLevel = srcLevel;
|
|
3203
|
-
srcLevel = 0;
|
|
3204
|
-
|
|
3205
|
-
} else {
|
|
3206
|
-
|
|
3207
|
-
dstLevel = 0;
|
|
3208
|
-
|
|
3209
|
-
}
|
|
3210
|
-
|
|
3211
|
-
}
|
|
3185
|
+
this.copyTextureToTexture = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, srcLevel = 0, dstLevel = 0 ) {
|
|
3212
3186
|
|
|
3213
3187
|
// gather the necessary dimensions to copy
|
|
3214
3188
|
let width, height, depth, minX, minY, minZ;
|
|
@@ -678,6 +678,27 @@ class Backend {
|
|
|
678
678
|
|
|
679
679
|
}
|
|
680
680
|
|
|
681
|
+
/**
|
|
682
|
+
* Checks if the backend has the given compatibility.
|
|
683
|
+
*
|
|
684
|
+
* @abstract
|
|
685
|
+
* @param {string} name - The compatibility.
|
|
686
|
+
* @return {boolean} Whether the backend has the given compatibility or not.
|
|
687
|
+
*/
|
|
688
|
+
hasCompatibility( /*name*/ ) {
|
|
689
|
+
|
|
690
|
+
return false;
|
|
691
|
+
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* Initializes the render target defined in the given render context.
|
|
696
|
+
*
|
|
697
|
+
* @abstract
|
|
698
|
+
* @param {RenderContext} renderContext - The render context.
|
|
699
|
+
*/
|
|
700
|
+
initRenderTarget( /*renderContext*/ ) {}
|
|
701
|
+
|
|
681
702
|
/**
|
|
682
703
|
* Sets a dictionary for the given object into the
|
|
683
704
|
* internal data structure.
|
|
@@ -107,8 +107,11 @@ class Background extends DataMap {
|
|
|
107
107
|
// compute vertex position
|
|
108
108
|
const modifiedPosition = isOrtho.select( positionLocal.mul( orthoScale ), positionLocal );
|
|
109
109
|
|
|
110
|
-
//
|
|
111
|
-
|
|
110
|
+
// by using a w component of 0, the skybox will not translate when the camera moves through the scene
|
|
111
|
+
const viewPosition = modelViewMatrix.mul( vec4( modifiedPosition, 0.0 ) );
|
|
112
|
+
|
|
113
|
+
// we force w=1.0 here to prevent the w_clip=0 divide-by-zero error for ortho cameras.
|
|
114
|
+
let viewProj = cameraProjectionMatrix.mul( vec4( viewPosition.xyz, 1.0 ) );
|
|
112
115
|
|
|
113
116
|
// force background to far plane so it does not occlude objects
|
|
114
117
|
viewProj = viewProj.setZ( viewProj.w );
|
|
@@ -200,8 +203,8 @@ class Background extends DataMap {
|
|
|
200
203
|
|
|
201
204
|
//
|
|
202
205
|
|
|
203
|
-
renderContext.depthClearValue = renderer.
|
|
204
|
-
renderContext.stencilClearValue = renderer.
|
|
206
|
+
renderContext.depthClearValue = renderer.getClearDepth();
|
|
207
|
+
renderContext.stencilClearValue = renderer.getClearStencil();
|
|
205
208
|
|
|
206
209
|
renderContext.clearColor = renderer.autoClearColor === true;
|
|
207
210
|
renderContext.clearDepth = renderer.autoClearDepth === true;
|
|
@@ -15,9 +15,8 @@ class BindGroup {
|
|
|
15
15
|
* @param {string} name - The bind group's name.
|
|
16
16
|
* @param {Array<Binding>} bindings - An array of bindings.
|
|
17
17
|
* @param {number} index - The group index.
|
|
18
|
-
* @param {Array<Binding>} bindingsReference - An array of reference bindings.
|
|
19
18
|
*/
|
|
20
|
-
constructor( name = '', bindings = [], index = 0
|
|
19
|
+
constructor( name = '', bindings = [], index = 0 ) {
|
|
21
20
|
|
|
22
21
|
/**
|
|
23
22
|
* The bind group's name.
|
|
@@ -40,13 +39,6 @@ class BindGroup {
|
|
|
40
39
|
*/
|
|
41
40
|
this.index = index;
|
|
42
41
|
|
|
43
|
-
/**
|
|
44
|
-
* An array of reference bindings.
|
|
45
|
-
*
|
|
46
|
-
* @type {Array<Binding>}
|
|
47
|
-
*/
|
|
48
|
-
this.bindingsReference = bindingsReference;
|
|
49
|
-
|
|
50
42
|
/**
|
|
51
43
|
* The group's ID.
|
|
52
44
|
*
|
|
@@ -267,8 +267,17 @@ class Bindings extends DataMap {
|
|
|
267
267
|
const attribute = binding.attribute;
|
|
268
268
|
const attributeType = attribute.isIndirectStorageBufferAttribute ? AttributeType.INDIRECT : AttributeType.STORAGE;
|
|
269
269
|
|
|
270
|
+
const bindingData = backend.get( binding );
|
|
271
|
+
|
|
270
272
|
this.attributes.update( attribute, attributeType );
|
|
271
273
|
|
|
274
|
+
if ( bindingData.attribute !== attribute ) {
|
|
275
|
+
|
|
276
|
+
bindingData.attribute = attribute;
|
|
277
|
+
|
|
278
|
+
needsBindingsUpdate = true;
|
|
279
|
+
|
|
280
|
+
}
|
|
272
281
|
|
|
273
282
|
}
|
|
274
283
|
|
|
@@ -297,7 +306,7 @@ class Bindings extends DataMap {
|
|
|
297
306
|
|
|
298
307
|
this.textures.updateTexture( texture );
|
|
299
308
|
|
|
300
|
-
// generation: update the bindings if a
|
|
309
|
+
// generation: update the bindings if the binding refers to a different texture object
|
|
301
310
|
|
|
302
311
|
if ( binding.generation !== texturesTextureData.generation ) {
|
|
303
312
|
|
|
@@ -305,10 +314,12 @@ class Bindings extends DataMap {
|
|
|
305
314
|
|
|
306
315
|
needsBindingsUpdate = true;
|
|
307
316
|
|
|
308
|
-
cacheBindings = false;
|
|
309
|
-
|
|
310
317
|
}
|
|
311
318
|
|
|
319
|
+
// keep track which bind groups refer to the current texture (this is needed for dispose)
|
|
320
|
+
|
|
321
|
+
texturesTextureData.bindGroups.add( bindGroup );
|
|
322
|
+
|
|
312
323
|
}
|
|
313
324
|
|
|
314
325
|
const textureData = backend.get( texture );
|
|
@@ -356,14 +367,18 @@ class Bindings extends DataMap {
|
|
|
356
367
|
|
|
357
368
|
needsBindingsUpdate = true;
|
|
358
369
|
|
|
359
|
-
cacheBindings = false;
|
|
360
|
-
|
|
361
370
|
}
|
|
362
371
|
|
|
363
372
|
}
|
|
364
373
|
|
|
365
374
|
}
|
|
366
375
|
|
|
376
|
+
if ( binding.isBuffer && binding.updateRanges.length > 0 ) {
|
|
377
|
+
|
|
378
|
+
binding.clearUpdateRanges();
|
|
379
|
+
|
|
380
|
+
}
|
|
381
|
+
|
|
367
382
|
}
|
|
368
383
|
|
|
369
384
|
if ( needsBindingsUpdate === true ) {
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { NormalBlending, AddEquation, SrcAlphaFactor, OneMinusSrcAlphaFactor } from '../../constants.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents blending configuration.
|
|
5
|
+
*
|
|
6
|
+
* This class encapsulates all blending-related properties that control how
|
|
7
|
+
* a material's colors are combined with the colors already in the frame buffer.
|
|
8
|
+
*/
|
|
9
|
+
class BlendMode {
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Constructs a new blending configuration.
|
|
13
|
+
*
|
|
14
|
+
* @param {(NoBlending|NormalBlending|AdditiveBlending|SubtractiveBlending|MultiplyBlending|CustomBlending|MaterialBlending)} [blending=NormalBlending] - The blending mode.
|
|
15
|
+
*/
|
|
16
|
+
constructor( blending = NormalBlending ) {
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Defines the blending type.
|
|
20
|
+
*
|
|
21
|
+
* It must be set to `CustomBlending` if custom blending properties like
|
|
22
|
+
* {@link BlendMode#blendSrc}, {@link BlendMode#blendDst} or {@link BlendMode#blendEquation}
|
|
23
|
+
* should have any effect.
|
|
24
|
+
*
|
|
25
|
+
* @type {(NoBlending|NormalBlending|AdditiveBlending|SubtractiveBlending|MultiplyBlending|CustomBlending|MaterialBlending)}
|
|
26
|
+
* @default NormalBlending
|
|
27
|
+
*/
|
|
28
|
+
this.blending = blending;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Defines the blending source factor.
|
|
32
|
+
*
|
|
33
|
+
* This determines how the source (incoming) fragment color is factored before being added
|
|
34
|
+
* to the destination (existing) fragment color in the frame buffer.
|
|
35
|
+
*
|
|
36
|
+
* @type {(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)}
|
|
37
|
+
* @default SrcAlphaFactor
|
|
38
|
+
*/
|
|
39
|
+
this.blendSrc = SrcAlphaFactor;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Defines the blending destination factor.
|
|
43
|
+
*
|
|
44
|
+
* This determines how the destination (existing) fragment color in the frame buffer
|
|
45
|
+
* is factored before being combined with the source (incoming) fragment color.
|
|
46
|
+
*
|
|
47
|
+
* @type {(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)}
|
|
48
|
+
* @default OneMinusSrcAlphaFactor
|
|
49
|
+
*/
|
|
50
|
+
this.blendDst = OneMinusSrcAlphaFactor;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Defines the blending equation.
|
|
54
|
+
*
|
|
55
|
+
* This determines how the source and destination colors are combined.
|
|
56
|
+
*
|
|
57
|
+
* @type {(AddEquation|SubtractEquation|ReverseSubtractEquation|MinEquation|MaxEquation)}
|
|
58
|
+
* @default AddEquation
|
|
59
|
+
*/
|
|
60
|
+
this.blendEquation = AddEquation;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Defines the blending source alpha factor.
|
|
64
|
+
*
|
|
65
|
+
* When set, this allows separate control of the alpha channel's source blending factor.
|
|
66
|
+
* If `null`, {@link BlendMode#blendSrc} is used for the alpha channel as well.
|
|
67
|
+
*
|
|
68
|
+
* @type {?(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)}
|
|
69
|
+
* @default null
|
|
70
|
+
*/
|
|
71
|
+
this.blendSrcAlpha = null;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Defines the blending destination alpha factor.
|
|
75
|
+
*
|
|
76
|
+
* When set, this allows separate control of the alpha channel's destination blending factor.
|
|
77
|
+
* If `null`, {@link BlendMode#blendDst} is used for the alpha channel as well.
|
|
78
|
+
*
|
|
79
|
+
* @type {?(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)}
|
|
80
|
+
* @default null
|
|
81
|
+
*/
|
|
82
|
+
this.blendDstAlpha = null;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Defines the blending equation of the alpha channel.
|
|
86
|
+
*
|
|
87
|
+
* When set, this allows separate control of the alpha channel's blending equation.
|
|
88
|
+
* If `null`, {@link BlendMode#blendEquation} is used for the alpha channel as well.
|
|
89
|
+
*
|
|
90
|
+
* @type {?(AddEquation|SubtractEquation|ReverseSubtractEquation|MinEquation|MaxEquation)}
|
|
91
|
+
* @default null
|
|
92
|
+
*/
|
|
93
|
+
this.blendEquationAlpha = null;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Defines whether to premultiply the alpha (transparency) value.
|
|
97
|
+
*
|
|
98
|
+
* If `true`, the RGB color of the texture or material is multiplied by its alpha value.
|
|
99
|
+
* This is useful for transparent textures/materials where the color data
|
|
100
|
+
* should already include the transparency information.
|
|
101
|
+
*
|
|
102
|
+
* @type {boolean}
|
|
103
|
+
* @default false
|
|
104
|
+
*/
|
|
105
|
+
this.premultiplyAlpha = false;
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Copies the blending properties from the given source to this instance.
|
|
111
|
+
*
|
|
112
|
+
* @param {BlendMode} source - The blending configuration to copy from.
|
|
113
|
+
* @return {BlendMode} A reference to this instance.
|
|
114
|
+
*/
|
|
115
|
+
copy( source ) {
|
|
116
|
+
|
|
117
|
+
this.blending = source.blending;
|
|
118
|
+
this.blendSrc = source.blendSrc;
|
|
119
|
+
this.blendDst = source.blendDst;
|
|
120
|
+
this.blendEquation = source.blendEquation;
|
|
121
|
+
this.blendSrcAlpha = source.blendSrcAlpha;
|
|
122
|
+
this.blendDstAlpha = source.blendDstAlpha;
|
|
123
|
+
this.blendEquationAlpha = source.blendEquationAlpha;
|
|
124
|
+
this.premultiplyAlpha = source.premultiplyAlpha;
|
|
125
|
+
|
|
126
|
+
return this;
|
|
127
|
+
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Returns a clone of this blending configuration.
|
|
132
|
+
*
|
|
133
|
+
* @return {BlendMode} A new Blending instance with the same properties.
|
|
134
|
+
*/
|
|
135
|
+
clone() {
|
|
136
|
+
|
|
137
|
+
return new this.constructor().copy( this );
|
|
138
|
+
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export default BlendMode;
|
|
@@ -44,7 +44,7 @@ class BundleGroup extends Group {
|
|
|
44
44
|
/**
|
|
45
45
|
* Whether the bundle is static or not. When set to `true`, the structure
|
|
46
46
|
* is assumed to be static and does not change. E.g. no new objects are
|
|
47
|
-
* added to the group
|
|
47
|
+
* added to the group.
|
|
48
48
|
*
|
|
49
49
|
* If a change is required, an update can still be forced by setting the
|
|
50
50
|
* `needsUpdate` flag to `true`.
|
|
@@ -3,22 +3,21 @@ import { texture as TSL_Texture } from '../../nodes/accessors/TextureNode.js';
|
|
|
3
3
|
import { positionWorldDirection } from '../../nodes/accessors/Position.js';
|
|
4
4
|
import NodeMaterial from '../../materials/nodes/NodeMaterial.js';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { RenderTarget } from '../../core/RenderTarget.js';
|
|
7
7
|
import { Scene } from '../../scenes/Scene.js';
|
|
8
8
|
import { CubeCamera } from '../../cameras/CubeCamera.js';
|
|
9
9
|
import { BoxGeometry } from '../../geometries/BoxGeometry.js';
|
|
10
10
|
import { Mesh } from '../../objects/Mesh.js';
|
|
11
|
+
import { CubeTexture } from '../../textures/CubeTexture.js';
|
|
11
12
|
import { BackSide, NoBlending, LinearFilter, LinearMipmapLinearFilter } from '../../constants.js';
|
|
12
13
|
|
|
13
|
-
// @TODO: Consider rename WebGLCubeRenderTarget to just CubeRenderTarget
|
|
14
|
-
|
|
15
14
|
/**
|
|
16
15
|
* This class represents a cube render target. It is a special version
|
|
17
16
|
* of `WebGLCubeRenderTarget` which is compatible with `WebGPURenderer`.
|
|
18
17
|
*
|
|
19
|
-
* @augments
|
|
18
|
+
* @augments RenderTarget
|
|
20
19
|
*/
|
|
21
|
-
class CubeRenderTarget extends
|
|
20
|
+
class CubeRenderTarget extends RenderTarget {
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
23
|
* Constructs a new cube render target.
|
|
@@ -28,7 +27,7 @@ class CubeRenderTarget extends WebGLCubeRenderTarget {
|
|
|
28
27
|
*/
|
|
29
28
|
constructor( size = 1, options = {} ) {
|
|
30
29
|
|
|
31
|
-
super( size, options );
|
|
30
|
+
super( size, size, options );
|
|
32
31
|
|
|
33
32
|
/**
|
|
34
33
|
* This flag can be used for type testing.
|
|
@@ -39,6 +38,27 @@ class CubeRenderTarget extends WebGLCubeRenderTarget {
|
|
|
39
38
|
*/
|
|
40
39
|
this.isCubeRenderTarget = true;
|
|
41
40
|
|
|
41
|
+
const image = { width: size, height: size, depth: 1 };
|
|
42
|
+
const images = [ image, image, image, image, image, image ];
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Overwritten with a different texture type.
|
|
46
|
+
*
|
|
47
|
+
* @type {DataArrayTexture}
|
|
48
|
+
*/
|
|
49
|
+
this.texture = new CubeTexture( images );
|
|
50
|
+
this._setTextureOptions( options );
|
|
51
|
+
|
|
52
|
+
// By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)
|
|
53
|
+
// in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words,
|
|
54
|
+
// in a left-handed coordinate system. By continuing this convention, preexisting cube maps continued to render correctly.
|
|
55
|
+
|
|
56
|
+
// three.js uses a right-handed coordinate system. So environment maps used in three.js appear to have px and nx swapped
|
|
57
|
+
// and the flag isRenderTargetTexture controls this conversion. The flip is not required when using WebGLCubeRenderTarget.texture
|
|
58
|
+
// as a cube texture (this is detected when isRenderTargetTexture is set to true for cube textures).
|
|
59
|
+
|
|
60
|
+
this.texture.isRenderTargetTexture = true;
|
|
61
|
+
|
|
42
62
|
}
|
|
43
63
|
|
|
44
64
|
/**
|
|
@@ -98,6 +118,30 @@ class CubeRenderTarget extends WebGLCubeRenderTarget {
|
|
|
98
118
|
|
|
99
119
|
}
|
|
100
120
|
|
|
121
|
+
/**
|
|
122
|
+
* Clears this cube render target.
|
|
123
|
+
*
|
|
124
|
+
* @param {Renderer} renderer - The renderer.
|
|
125
|
+
* @param {boolean} [color=true] - Whether the color buffer should be cleared or not.
|
|
126
|
+
* @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not.
|
|
127
|
+
* @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not.
|
|
128
|
+
*/
|
|
129
|
+
clear( renderer, color = true, depth = true, stencil = true ) {
|
|
130
|
+
|
|
131
|
+
const currentRenderTarget = renderer.getRenderTarget();
|
|
132
|
+
|
|
133
|
+
for ( let i = 0; i < 6; i ++ ) {
|
|
134
|
+
|
|
135
|
+
renderer.setRenderTarget( this, i );
|
|
136
|
+
|
|
137
|
+
renderer.clear( color, depth, stencil );
|
|
138
|
+
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
renderer.setRenderTarget( currentRenderTarget );
|
|
142
|
+
|
|
143
|
+
}
|
|
144
|
+
|
|
101
145
|
}
|
|
102
146
|
|
|
103
147
|
export default CubeRenderTarget;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import DataMap from './DataMap.js';
|
|
2
2
|
import { AttributeType } from './Constants.js';
|
|
3
|
-
import { arrayNeedsUint32 } from '../../utils.js';
|
|
4
3
|
|
|
5
4
|
import { Uint16BufferAttribute, Uint32BufferAttribute } from '../../core/BufferAttribute.js';
|
|
6
5
|
|
|
@@ -18,6 +17,20 @@ function getWireframeVersion( geometry ) {
|
|
|
18
17
|
|
|
19
18
|
}
|
|
20
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Returns the wireframe ID for the given geometry.
|
|
22
|
+
*
|
|
23
|
+
* @private
|
|
24
|
+
* @function
|
|
25
|
+
* @param {BufferGeometry} geometry - The geometry.
|
|
26
|
+
* @return {number} The ID.
|
|
27
|
+
*/
|
|
28
|
+
function getWireframeId( geometry ) {
|
|
29
|
+
|
|
30
|
+
return ( geometry.index !== null ) ? geometry.index.id : geometry.attributes.position.id;
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
21
34
|
/**
|
|
22
35
|
* Returns a wireframe index attribute for the given geometry.
|
|
23
36
|
*
|
|
@@ -63,8 +76,9 @@ function getWireframeIndex( geometry ) {
|
|
|
63
76
|
|
|
64
77
|
}
|
|
65
78
|
|
|
66
|
-
const attribute = new (
|
|
79
|
+
const attribute = new ( geometryPosition.count >= 65535 ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 );
|
|
67
80
|
attribute.version = getWireframeVersion( geometry );
|
|
81
|
+
attribute.__id = getWireframeId( geometry );
|
|
68
82
|
|
|
69
83
|
return attribute;
|
|
70
84
|
|
|
@@ -347,7 +361,7 @@ class Geometries extends DataMap {
|
|
|
347
361
|
|
|
348
362
|
wireframes.set( geometry, wireframeAttribute );
|
|
349
363
|
|
|
350
|
-
} else if ( wireframeAttribute.version !== getWireframeVersion( geometry ) ) {
|
|
364
|
+
} else if ( wireframeAttribute.version !== getWireframeVersion( geometry ) || wireframeAttribute.__id !== getWireframeId( geometry ) ) {
|
|
351
365
|
|
|
352
366
|
this.attributes.delete( wireframeAttribute );
|
|
353
367
|
|