super-three 0.156.0 → 0.157.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 +753 -277
- package/build/three.js +753 -277
- package/build/three.min.js +2 -2
- package/build/three.module.js +750 -276
- package/build/three.module.min.js +1 -1
- package/examples/jsm/capabilities/WebGL.js +17 -0
- package/examples/jsm/controls/DragControls.js +3 -2
- package/examples/jsm/csm/CSMShader.js +25 -21
- package/examples/jsm/exporters/EXRExporter.js +102 -24
- package/examples/jsm/exporters/GLTFExporter.js +1 -1
- package/examples/jsm/libs/rhino3dm/rhino3dm.js +8726 -4
- package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +8737 -4
- package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
- package/examples/jsm/lights/LightProbeGenerator.js +37 -3
- package/examples/jsm/lines/LineMaterial.js +90 -156
- package/examples/jsm/loaders/3DMLoader.js +378 -104
- package/examples/jsm/loaders/GLTFLoader.js +1 -1
- package/examples/jsm/loaders/LDrawLoader.js +22 -16
- package/examples/jsm/loaders/RGBELoader.js +1 -1
- package/examples/jsm/loaders/USDZLoader.js +215 -12
- package/examples/jsm/materials/MeshGouraudMaterial.js +22 -18
- package/examples/jsm/nodes/Nodes.js +5 -1
- package/examples/jsm/nodes/accessors/BitangentNode.js +1 -1
- package/examples/jsm/nodes/accessors/BufferAttributeNode.js +2 -2
- package/examples/jsm/nodes/accessors/BufferNode.js +1 -1
- package/examples/jsm/nodes/accessors/CameraNode.js +1 -1
- package/examples/jsm/nodes/accessors/CubeTextureNode.js +2 -2
- package/examples/jsm/nodes/accessors/ExtendedMaterialNode.js +6 -5
- package/examples/jsm/nodes/accessors/InstanceNode.js +2 -2
- package/examples/jsm/nodes/accessors/LineMaterialNode.js +7 -9
- package/examples/jsm/nodes/accessors/MaterialNode.js +34 -46
- package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +9 -9
- package/examples/jsm/nodes/accessors/ModelNode.js +1 -1
- package/examples/jsm/nodes/accessors/ModelViewProjectionNode.js +5 -4
- package/examples/jsm/nodes/accessors/MorphNode.js +4 -4
- package/examples/jsm/nodes/accessors/NormalNode.js +1 -1
- package/examples/jsm/nodes/accessors/Object3DNode.js +1 -1
- package/examples/jsm/nodes/accessors/PointUVNode.js +1 -1
- package/examples/jsm/nodes/accessors/PositionNode.js +1 -1
- package/examples/jsm/nodes/accessors/ReferenceNode.js +13 -7
- package/examples/jsm/nodes/accessors/ReflectVectorNode.js +2 -2
- package/examples/jsm/nodes/accessors/SceneNode.js +2 -2
- package/examples/jsm/nodes/accessors/SkinningNode.js +2 -2
- package/examples/jsm/nodes/accessors/StorageBufferNode.js +1 -1
- package/examples/jsm/nodes/accessors/TangentNode.js +1 -1
- package/examples/jsm/nodes/accessors/TextureBicubicNode.js +2 -2
- package/examples/jsm/nodes/accessors/TextureNode.js +12 -6
- package/examples/jsm/nodes/accessors/TextureSizeNode.js +2 -2
- package/examples/jsm/nodes/accessors/TextureStoreNode.js +1 -1
- package/examples/jsm/nodes/accessors/UVNode.js +1 -1
- package/examples/jsm/nodes/accessors/UserDataNode.js +2 -2
- package/examples/jsm/nodes/code/CodeNode.js +1 -1
- package/examples/jsm/nodes/code/ExpressionNode.js +1 -1
- package/examples/jsm/nodes/code/FunctionCallNode.js +1 -1
- package/examples/jsm/nodes/code/FunctionNode.js +18 -7
- package/examples/jsm/nodes/code/ScriptableNode.js +2 -2
- package/examples/jsm/nodes/code/ScriptableValueNode.js +2 -2
- package/examples/jsm/nodes/core/ArrayUniformNode.js +1 -1
- package/examples/jsm/nodes/core/AttributeNode.js +1 -1
- package/examples/jsm/nodes/core/BypassNode.js +1 -1
- package/examples/jsm/nodes/core/CacheNode.js +1 -1
- package/examples/jsm/nodes/core/ConstNode.js +1 -1
- package/examples/jsm/nodes/core/ContextNode.js +2 -2
- package/examples/jsm/nodes/core/IndexNode.js +1 -1
- package/examples/jsm/nodes/core/InputNode.js +1 -1
- package/examples/jsm/nodes/core/Node.js +28 -13
- package/examples/jsm/nodes/core/NodeBuilder.js +3 -17
- package/examples/jsm/nodes/core/NodeFrame.js +37 -14
- package/examples/jsm/nodes/core/OutputStructNode.js +8 -4
- package/examples/jsm/nodes/core/PropertyNode.js +3 -3
- package/examples/jsm/nodes/core/StackNode.js +1 -1
- package/examples/jsm/nodes/core/StructTypeNode.js +1 -1
- package/examples/jsm/nodes/core/TempNode.js +1 -1
- package/examples/jsm/nodes/core/UniformNode.js +3 -1
- package/examples/jsm/nodes/core/VarNode.js +1 -1
- package/examples/jsm/nodes/core/VaryingNode.js +1 -1
- package/examples/jsm/nodes/core/constants.js +1 -1
- package/examples/jsm/nodes/display/BlendModeNode.js +2 -2
- package/examples/jsm/nodes/display/BumpMapNode.js +2 -2
- package/examples/jsm/nodes/display/ColorAdjustmentNode.js +2 -2
- package/examples/jsm/nodes/display/ColorSpaceNode.js +2 -2
- package/examples/jsm/nodes/display/FrontFacingNode.js +1 -1
- package/examples/jsm/nodes/display/NormalMapNode.js +2 -2
- package/examples/jsm/nodes/display/PosterizeNode.js +2 -2
- package/examples/jsm/nodes/display/ToneMappingNode.js +2 -2
- package/examples/jsm/nodes/display/ViewportDepthNode.js +2 -2
- package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +1 -1
- package/examples/jsm/nodes/display/ViewportNode.js +2 -2
- package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +1 -1
- package/examples/jsm/nodes/display/ViewportTextureNode.js +1 -1
- package/examples/jsm/nodes/fog/FogExp2Node.js +2 -2
- package/examples/jsm/nodes/fog/FogNode.js +2 -2
- package/examples/jsm/nodes/fog/FogRangeNode.js +2 -2
- package/examples/jsm/nodes/geometry/RangeNode.js +2 -2
- package/examples/jsm/nodes/gpgpu/ComputeNode.js +1 -1
- package/examples/jsm/nodes/lighting/AONode.js +2 -2
- package/examples/jsm/nodes/lighting/AmbientLightNode.js +3 -3
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +4 -4
- package/examples/jsm/nodes/lighting/DirectionalLightNode.js +4 -4
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +2 -2
- package/examples/jsm/nodes/lighting/HemisphereLightNode.js +3 -3
- package/examples/jsm/nodes/lighting/IESSpotLightNode.js +2 -2
- package/examples/jsm/nodes/lighting/LightNode.js +2 -2
- package/examples/jsm/nodes/lighting/LightingContextNode.js +3 -3
- package/examples/jsm/nodes/lighting/LightingNode.js +1 -1
- package/examples/jsm/nodes/lighting/LightsNode.js +4 -4
- package/examples/jsm/nodes/lighting/PointLightNode.js +3 -3
- package/examples/jsm/nodes/lighting/SpotLightNode.js +4 -4
- package/examples/jsm/nodes/materials/Line2NodeMaterial.js +449 -0
- package/examples/jsm/nodes/materials/LineBasicNodeMaterial.js +1 -1
- package/examples/jsm/nodes/materials/LineDashedNodeMaterial.js +2 -2
- package/examples/jsm/nodes/materials/Materials.js +1 -0
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +1 -1
- package/examples/jsm/nodes/materials/MeshLambertNodeMaterial.js +2 -2
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +2 -2
- package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +3 -3
- package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +6 -6
- package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +3 -3
- package/examples/jsm/nodes/materials/NodeMaterial.js +27 -26
- package/examples/jsm/nodes/materials/PointsNodeMaterial.js +1 -1
- package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +2 -2
- package/examples/jsm/nodes/math/CondNode.js +1 -1
- package/examples/jsm/nodes/math/HashNode.js +8 -9
- package/examples/jsm/nodes/math/MathNode.js +2 -2
- package/examples/jsm/nodes/math/OperatorNode.js +1 -1
- package/examples/jsm/nodes/procedural/CheckerNode.js +3 -3
- package/examples/jsm/nodes/shadernode/ShaderNode.js +81 -28
- package/examples/jsm/nodes/utils/ArrayElementNode.js +1 -1
- package/examples/jsm/nodes/utils/ConvertNode.js +1 -1
- package/examples/jsm/nodes/utils/DiscardNode.js +1 -1
- package/examples/jsm/nodes/utils/EquirectUVNode.js +2 -2
- package/examples/jsm/nodes/utils/JoinNode.js +1 -1
- package/examples/jsm/nodes/utils/LoopNode.js +11 -11
- package/examples/jsm/nodes/utils/MatcapUVNode.js +2 -2
- package/examples/jsm/nodes/utils/MaxMipLevelNode.js +1 -1
- package/examples/jsm/nodes/utils/OscNode.js +2 -2
- package/examples/jsm/nodes/utils/PackingNode.js +2 -2
- package/examples/jsm/nodes/utils/RemapNode.js +2 -2
- package/examples/jsm/nodes/utils/RotateUVNode.js +2 -2
- package/examples/jsm/nodes/utils/SetNode.js +62 -0
- package/examples/jsm/nodes/utils/SpecularMIPLevelNode.js +2 -2
- package/examples/jsm/nodes/utils/SplitNode.js +1 -1
- package/examples/jsm/nodes/utils/SpriteSheetUVNode.js +2 -2
- package/examples/jsm/nodes/utils/TimerNode.js +2 -2
- package/examples/jsm/nodes/utils/TriplanarTexturesNode.js +2 -2
- package/examples/jsm/objects/Sky.js +1 -3
- package/examples/jsm/postprocessing/OutputPass.js +3 -2
- package/examples/jsm/renderers/common/Background.js +2 -2
- package/examples/jsm/renderers/common/Bindings.js +3 -5
- package/examples/jsm/renderers/common/Pipelines.js +7 -7
- package/examples/jsm/renderers/common/RenderContext.js +3 -0
- package/examples/jsm/renderers/common/RenderObject.js +40 -16
- package/examples/jsm/renderers/common/RenderObjects.js +8 -14
- package/examples/jsm/renderers/common/Renderer.js +40 -13
- package/examples/jsm/renderers/common/SampledTexture.js +4 -2
- package/examples/jsm/renderers/common/StorageTexture.js +19 -0
- package/examples/jsm/renderers/common/Textures.js +14 -9
- package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +35 -0
- package/examples/jsm/renderers/common/nodes/NodeSampledTexture.js +20 -10
- package/examples/jsm/renderers/common/nodes/NodeSampler.js +0 -6
- package/examples/jsm/renderers/common/nodes/Nodes.js +51 -24
- package/examples/jsm/renderers/webgl/WebGLBackend.js +100 -5
- package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +92 -6
- package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +13 -0
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +3 -3
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.js +14 -2
- package/examples/jsm/renderers/webgpu/WebGPUBackend.js +5 -5
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +6 -3
- package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +5 -5
- package/examples/jsm/renderers/webgpu/utils/WebGPUTexturePassUtils.js +285 -0
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +197 -167
- package/examples/jsm/shaders/GammaCorrectionShader.js +1 -1
- package/examples/jsm/shaders/MMDToonShader.js +4 -4
- package/examples/jsm/shaders/OutputShader.js +2 -2
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +6 -6
- package/examples/jsm/utils/BufferGeometryUtils.js +6 -4
- package/package.json +1 -1
- package/src/Three.js +0 -2
- package/src/animation/AnimationUtils.js +3 -20
- package/src/animation/KeyframeTrack.js +8 -8
- package/src/cameras/Camera.js +1 -5
- package/src/cameras/CubeCamera.js +14 -8
- package/src/constants.js +7 -1
- package/src/core/RenderTarget.js +16 -7
- package/src/extras/core/CurvePath.js +4 -1
- package/src/loaders/MaterialLoader.js +1 -1
- package/src/loaders/ObjectLoader.js +6 -0
- package/src/materials/Material.js +8 -8
- package/src/math/Color.js +1 -5
- package/src/math/ColorManagement.js +82 -60
- package/src/objects/Sprite.js +2 -2
- package/src/renderers/WebGLMultiviewRenderTarget.js +35 -0
- package/src/renderers/WebGLRenderer.js +78 -22
- package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +35 -2
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -9
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +19 -15
- package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +4 -4
- package/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.js +3 -3
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +11 -6
- package/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.js +4 -4
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +16 -16
- package/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.js +3 -3
- package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +1 -1
- package/src/renderers/shaders/UniformsUtils.js +2 -2
- package/src/renderers/webgl/WebGLBackground.js +5 -4
- package/src/renderers/webgl/WebGLLights.js +14 -3
- package/src/renderers/webgl/WebGLMultiview.js +100 -0
- package/src/renderers/webgl/WebGLProgram.js +84 -5
- package/src/renderers/webgl/WebGLPrograms.js +11 -2
- package/src/renderers/webgl/WebGLTextures.js +214 -26
- package/src/renderers/webgl/WebGLUtils.js +21 -23
- package/src/renderers/webxr/WebXRManager.js +36 -12
- package/src/scenes/Fog.js +1 -0
- package/src/scenes/FogExp2.js +1 -0
- package/src/textures/Source.js +2 -2
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureMipmapUtils.js +0 -163
- package/src/lights/AmbientLightProbe.js +0 -21
- package/src/lights/HemisphereLightProbe.js +0 -30
|
@@ -30,6 +30,23 @@ class WebGL {
|
|
|
30
30
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
static isColorSpaceAvailable( colorSpace ) {
|
|
34
|
+
|
|
35
|
+
try {
|
|
36
|
+
|
|
37
|
+
const canvas = document.createElement( 'canvas' );
|
|
38
|
+
const ctx = window.WebGL2RenderingContext && canvas.getContext( 'webgl2' );
|
|
39
|
+
ctx.drawingBufferColorSpace = colorSpace;
|
|
40
|
+
return ctx.drawingBufferColorSpace === colorSpace; // deepscan-disable-line SAME_OPERAND_VALUE
|
|
41
|
+
|
|
42
|
+
} catch ( e ) {
|
|
43
|
+
|
|
44
|
+
return false;
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
33
50
|
static getWebGLErrorMessage() {
|
|
34
51
|
|
|
35
52
|
return this.getErrorMessage( 1 );
|
|
@@ -99,7 +99,7 @@ class DragControls extends EventDispatcher {
|
|
|
99
99
|
_intersections.length = 0;
|
|
100
100
|
|
|
101
101
|
_raycaster.setFromCamera( _pointer, _camera );
|
|
102
|
-
_raycaster.intersectObjects( _objects,
|
|
102
|
+
_raycaster.intersectObjects( _objects, scope.recursive, _intersections );
|
|
103
103
|
|
|
104
104
|
if ( _intersections.length > 0 ) {
|
|
105
105
|
|
|
@@ -151,7 +151,7 @@ class DragControls extends EventDispatcher {
|
|
|
151
151
|
_intersections.length = 0;
|
|
152
152
|
|
|
153
153
|
_raycaster.setFromCamera( _pointer, _camera );
|
|
154
|
-
_raycaster.intersectObjects( _objects,
|
|
154
|
+
_raycaster.intersectObjects( _objects, scope.recursive, _intersections );
|
|
155
155
|
|
|
156
156
|
if ( _intersections.length > 0 ) {
|
|
157
157
|
|
|
@@ -205,6 +205,7 @@ class DragControls extends EventDispatcher {
|
|
|
205
205
|
// API
|
|
206
206
|
|
|
207
207
|
this.enabled = true;
|
|
208
|
+
this.recursive = true;
|
|
208
209
|
this.transformGroup = false;
|
|
209
210
|
|
|
210
211
|
this.activate = activate;
|
|
@@ -2,20 +2,20 @@ import { ShaderChunk } from 'three';
|
|
|
2
2
|
|
|
3
3
|
const CSMShader = {
|
|
4
4
|
lights_fragment_begin: /* glsl */`
|
|
5
|
-
|
|
5
|
+
vec3 geometryPosition = - vViewPosition;
|
|
6
|
+
vec3 geometryNormal = normal;
|
|
7
|
+
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
geometry.normal = normal;
|
|
9
|
-
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
|
9
|
+
vec3 geometryClearcoatNormal;
|
|
10
10
|
|
|
11
11
|
#ifdef USE_CLEARCOAT
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
geometryClearcoatNormal = clearcoatNormal;
|
|
14
14
|
|
|
15
15
|
#endif
|
|
16
16
|
|
|
17
17
|
#ifdef USE_IRIDESCENCE
|
|
18
|
-
float dotNVi = saturate( dot( normal,
|
|
18
|
+
float dotNVi = saturate( dot( normal, geometryViewDir ) );
|
|
19
19
|
if ( material.iridescenceThickness == 0.0 ) {
|
|
20
20
|
material.iridescence = 0.0;
|
|
21
21
|
} else {
|
|
@@ -42,14 +42,14 @@ IncidentLight directLight;
|
|
|
42
42
|
|
|
43
43
|
pointLight = pointLights[ i ];
|
|
44
44
|
|
|
45
|
-
getPointLightInfo( pointLight,
|
|
45
|
+
getPointLightInfo( pointLight, geometryPosition, directLight );
|
|
46
46
|
|
|
47
47
|
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
|
|
48
48
|
pointLightShadow = pointLightShadows[ i ];
|
|
49
49
|
directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
|
|
50
50
|
#endif
|
|
51
51
|
|
|
52
|
-
RE_Direct( directLight,
|
|
52
|
+
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
53
53
|
|
|
54
54
|
}
|
|
55
55
|
#pragma unroll_loop_end
|
|
@@ -72,7 +72,7 @@ IncidentLight directLight;
|
|
|
72
72
|
|
|
73
73
|
spotLight = spotLights[ i ];
|
|
74
74
|
|
|
75
|
-
getSpotLightInfo( spotLight,
|
|
75
|
+
getSpotLightInfo( spotLight, geometryPosition, directLight );
|
|
76
76
|
|
|
77
77
|
// spot lights are ordered [shadows with maps, shadows without maps, maps without shadows, none]
|
|
78
78
|
#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
|
|
@@ -96,7 +96,7 @@ IncidentLight directLight;
|
|
|
96
96
|
|
|
97
97
|
#endif
|
|
98
98
|
|
|
99
|
-
RE_Direct( directLight,
|
|
99
|
+
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
100
100
|
|
|
101
101
|
}
|
|
102
102
|
#pragma unroll_loop_end
|
|
@@ -123,7 +123,7 @@ IncidentLight directLight;
|
|
|
123
123
|
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
|
|
124
124
|
|
|
125
125
|
directionalLight = directionalLights[ i ];
|
|
126
|
-
getDirectionalLightInfo( directionalLight,
|
|
126
|
+
getDirectionalLightInfo( directionalLight, directLight );
|
|
127
127
|
|
|
128
128
|
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
|
|
129
129
|
// NOTE: Depth gets larger away from the camera.
|
|
@@ -147,7 +147,7 @@ IncidentLight directLight;
|
|
|
147
147
|
directLight.color = mix( prevColor, directLight.color, shouldFadeLastCascade ? ratio : 1.0 );
|
|
148
148
|
|
|
149
149
|
ReflectedLight prevLight = reflectedLight;
|
|
150
|
-
RE_Direct( directLight,
|
|
150
|
+
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
151
151
|
|
|
152
152
|
bool shouldBlend = UNROLLED_LOOP_INDEX != CSM_CASCADES - 1 || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 && linearDepth < cascadeCenter;
|
|
153
153
|
float blendRatio = shouldBlend ? ratio : 1.0;
|
|
@@ -168,14 +168,14 @@ IncidentLight directLight;
|
|
|
168
168
|
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
|
|
169
169
|
|
|
170
170
|
directionalLight = directionalLights[ i ];
|
|
171
|
-
getDirectionalLightInfo( directionalLight,
|
|
171
|
+
getDirectionalLightInfo( directionalLight, directLight );
|
|
172
172
|
|
|
173
173
|
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
|
|
174
174
|
|
|
175
175
|
directionalLightShadow = directionalLightShadows[ i ];
|
|
176
176
|
if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y) directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
|
177
177
|
|
|
178
|
-
if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && (linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1)) RE_Direct( directLight,
|
|
178
|
+
if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && (linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1)) RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
179
179
|
|
|
180
180
|
#endif
|
|
181
181
|
|
|
@@ -192,9 +192,9 @@ IncidentLight directLight;
|
|
|
192
192
|
|
|
193
193
|
directionalLight = directionalLights[ i ];
|
|
194
194
|
|
|
195
|
-
getDirectionalLightInfo( directionalLight,
|
|
195
|
+
getDirectionalLightInfo( directionalLight, directLight );
|
|
196
196
|
|
|
197
|
-
RE_Direct( directLight,
|
|
197
|
+
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
198
198
|
|
|
199
199
|
}
|
|
200
200
|
#pragma unroll_loop_end
|
|
@@ -216,14 +216,14 @@ IncidentLight directLight;
|
|
|
216
216
|
|
|
217
217
|
directionalLight = directionalLights[ i ];
|
|
218
218
|
|
|
219
|
-
getDirectionalLightInfo( directionalLight,
|
|
219
|
+
getDirectionalLightInfo( directionalLight, directLight );
|
|
220
220
|
|
|
221
221
|
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
|
|
222
222
|
directionalLightShadow = directionalLightShadows[ i ];
|
|
223
223
|
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
|
224
224
|
#endif
|
|
225
225
|
|
|
226
|
-
RE_Direct( directLight,
|
|
226
|
+
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
227
227
|
|
|
228
228
|
}
|
|
229
229
|
#pragma unroll_loop_end
|
|
@@ -238,7 +238,7 @@ IncidentLight directLight;
|
|
|
238
238
|
for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
|
|
239
239
|
|
|
240
240
|
rectAreaLight = rectAreaLights[ i ];
|
|
241
|
-
RE_Direct_RectArea( rectAreaLight,
|
|
241
|
+
RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
242
242
|
|
|
243
243
|
}
|
|
244
244
|
#pragma unroll_loop_end
|
|
@@ -251,14 +251,18 @@ IncidentLight directLight;
|
|
|
251
251
|
|
|
252
252
|
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
|
|
253
253
|
|
|
254
|
-
|
|
254
|
+
#if defined( USE_LIGHT_PROBES )
|
|
255
|
+
|
|
256
|
+
irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
|
|
257
|
+
|
|
258
|
+
#endif
|
|
255
259
|
|
|
256
260
|
#if ( NUM_HEMI_LIGHTS > 0 )
|
|
257
261
|
|
|
258
262
|
#pragma unroll_loop_start
|
|
259
263
|
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
|
|
260
264
|
|
|
261
|
-
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ],
|
|
265
|
+
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
|
|
262
266
|
|
|
263
267
|
}
|
|
264
268
|
#pragma unroll_loop_end
|
|
@@ -21,61 +21,107 @@ const ZIP_COMPRESSION = 3;
|
|
|
21
21
|
|
|
22
22
|
class EXRExporter {
|
|
23
23
|
|
|
24
|
-
parse(
|
|
24
|
+
parse( arg1, arg2, arg3 ) {
|
|
25
25
|
|
|
26
|
-
if ( !
|
|
26
|
+
if ( ! arg1 || ! ( arg1.isWebGLRenderer || arg1.isDataTexture ) ) {
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
dataBuffer = getPixelData( renderer, renderTarget, info ),
|
|
30
|
-
rawContentBuffer = reorganizeDataBuffer( dataBuffer, info ),
|
|
31
|
-
chunks = compressData( rawContentBuffer, info );
|
|
28
|
+
throw Error( 'EXRExporter.parse: Unsupported first parameter, expected instance of WebGLRenderer or DataTexture.' );
|
|
32
29
|
|
|
33
|
-
|
|
30
|
+
} else if ( arg1.isWebGLRenderer ) {
|
|
34
31
|
|
|
35
|
-
|
|
32
|
+
const renderer = arg1, renderTarget = arg2, options = arg3;
|
|
36
33
|
|
|
37
|
-
|
|
34
|
+
supportedRTT( renderTarget );
|
|
35
|
+
|
|
36
|
+
const info = buildInfoRTT( renderTarget, options ),
|
|
37
|
+
dataBuffer = getPixelData( renderer, renderTarget, info ),
|
|
38
|
+
rawContentBuffer = reorganizeDataBuffer( dataBuffer, info ),
|
|
39
|
+
chunks = compressData( rawContentBuffer, info );
|
|
40
|
+
|
|
41
|
+
return fillData( chunks, info );
|
|
38
42
|
|
|
39
|
-
|
|
43
|
+
} else if ( arg1.isDataTexture ) {
|
|
40
44
|
|
|
41
|
-
|
|
45
|
+
const texture = arg1, options = arg2;
|
|
42
46
|
|
|
43
|
-
|
|
47
|
+
supportedDT( texture );
|
|
44
48
|
|
|
45
|
-
|
|
49
|
+
const info = buildInfoDT( texture, options ),
|
|
50
|
+
dataBuffer = texture.image.data,
|
|
51
|
+
rawContentBuffer = reorganizeDataBuffer( dataBuffer, info ),
|
|
52
|
+
chunks = compressData( rawContentBuffer, info );
|
|
53
|
+
|
|
54
|
+
return fillData( chunks, info );
|
|
55
|
+
|
|
56
|
+
}
|
|
46
57
|
|
|
47
58
|
}
|
|
48
59
|
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function supportedRTT( renderTarget ) {
|
|
63
|
+
|
|
49
64
|
if ( ! renderTarget || ! renderTarget.isWebGLRenderTarget ) {
|
|
50
65
|
|
|
51
|
-
|
|
66
|
+
throw Error( 'EXRExporter.parse: Unsupported second parameter, expected instance of WebGLRenderTarget.' );
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if ( renderTarget.isWebGLCubeRenderTarget || renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {
|
|
52
71
|
|
|
53
|
-
|
|
72
|
+
throw Error( 'EXRExporter.parse: Unsupported render target type, expected instance of WebGLRenderTarget.' );
|
|
54
73
|
|
|
55
74
|
}
|
|
56
75
|
|
|
57
76
|
if ( renderTarget.texture.type !== FloatType && renderTarget.texture.type !== HalfFloatType ) {
|
|
58
77
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return false;
|
|
78
|
+
throw Error( 'EXRExporter.parse: Unsupported WebGLRenderTarget texture type.' );
|
|
62
79
|
|
|
63
80
|
}
|
|
64
81
|
|
|
65
82
|
if ( renderTarget.texture.format !== RGBAFormat ) {
|
|
66
83
|
|
|
67
|
-
|
|
84
|
+
throw Error( 'EXRExporter.parse: Unsupported WebGLRenderTarget texture format, expected RGBAFormat.' );
|
|
85
|
+
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function supportedDT( texture ) {
|
|
91
|
+
|
|
92
|
+
if ( texture.type !== FloatType && texture.type !== HalfFloatType ) {
|
|
93
|
+
|
|
94
|
+
throw Error( 'EXRExporter.parse: Unsupported DataTexture texture type.' );
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if ( texture.format !== RGBAFormat ) {
|
|
99
|
+
|
|
100
|
+
throw Error( 'EXRExporter.parse: Unsupported DataTexture texture format, expected RGBAFormat.' );
|
|
101
|
+
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if ( ! texture.image.data ) {
|
|
105
|
+
|
|
106
|
+
throw Error( 'EXRExporter.parse: Invalid DataTexture image data.' );
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if ( texture.type === FloatType && texture.image.data.constructor.name !== 'Float32Array' ) {
|
|
68
111
|
|
|
69
|
-
|
|
112
|
+
throw Error( 'EXRExporter.parse: DataTexture image data doesn\'t match type, expected \'Float32Array\'.' );
|
|
70
113
|
|
|
71
114
|
}
|
|
72
115
|
|
|
116
|
+
if ( texture.type === HalfFloatType && texture.image.data.constructor.name !== 'Uint16Array' ) {
|
|
73
117
|
|
|
74
|
-
|
|
118
|
+
throw Error( 'EXRExporter.parse: DataTexture image data doesn\'t match type, expected \'Uint16Array\'.' );
|
|
119
|
+
|
|
120
|
+
}
|
|
75
121
|
|
|
76
122
|
}
|
|
77
123
|
|
|
78
|
-
function
|
|
124
|
+
function buildInfoRTT( renderTarget, options = {} ) {
|
|
79
125
|
|
|
80
126
|
const compressionSizes = {
|
|
81
127
|
0: 1,
|
|
@@ -87,7 +133,6 @@ function buildInfo( renderTarget, options = {} ) {
|
|
|
87
133
|
HEIGHT = renderTarget.height,
|
|
88
134
|
TYPE = renderTarget.texture.type,
|
|
89
135
|
FORMAT = renderTarget.texture.format,
|
|
90
|
-
COLOR_SPACE = renderTarget.texture.colorSpace,
|
|
91
136
|
COMPRESSION = ( options.compression !== undefined ) ? options.compression : ZIP_COMPRESSION,
|
|
92
137
|
EXPORTER_TYPE = ( options.type !== undefined ) ? options.type : HalfFloatType,
|
|
93
138
|
OUT_TYPE = ( EXPORTER_TYPE === FloatType ) ? 2 : 1,
|
|
@@ -99,7 +144,40 @@ function buildInfo( renderTarget, options = {} ) {
|
|
|
99
144
|
height: HEIGHT,
|
|
100
145
|
type: TYPE,
|
|
101
146
|
format: FORMAT,
|
|
102
|
-
|
|
147
|
+
compression: COMPRESSION,
|
|
148
|
+
blockLines: COMPRESSION_SIZE,
|
|
149
|
+
dataType: OUT_TYPE,
|
|
150
|
+
dataSize: 2 * OUT_TYPE,
|
|
151
|
+
numBlocks: Math.ceil( HEIGHT / COMPRESSION_SIZE ),
|
|
152
|
+
numInputChannels: 4,
|
|
153
|
+
numOutputChannels: NUM_CHANNELS,
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function buildInfoDT( texture, options = {} ) {
|
|
159
|
+
|
|
160
|
+
const compressionSizes = {
|
|
161
|
+
0: 1,
|
|
162
|
+
2: 1,
|
|
163
|
+
3: 16
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const WIDTH = texture.image.width,
|
|
167
|
+
HEIGHT = texture.image.height,
|
|
168
|
+
TYPE = texture.type,
|
|
169
|
+
FORMAT = texture.format,
|
|
170
|
+
COMPRESSION = ( options.compression !== undefined ) ? options.compression : ZIP_COMPRESSION,
|
|
171
|
+
EXPORTER_TYPE = ( options.type !== undefined ) ? options.type : HalfFloatType,
|
|
172
|
+
OUT_TYPE = ( EXPORTER_TYPE === FloatType ) ? 2 : 1,
|
|
173
|
+
COMPRESSION_SIZE = compressionSizes[ COMPRESSION ],
|
|
174
|
+
NUM_CHANNELS = 4;
|
|
175
|
+
|
|
176
|
+
return {
|
|
177
|
+
width: WIDTH,
|
|
178
|
+
height: HEIGHT,
|
|
179
|
+
type: TYPE,
|
|
180
|
+
format: FORMAT,
|
|
103
181
|
compression: COMPRESSION,
|
|
104
182
|
blockLines: COMPRESSION_SIZE,
|
|
105
183
|
dataType: OUT_TYPE,
|
|
@@ -2438,7 +2438,7 @@ class GLTFLightExtension {
|
|
|
2438
2438
|
if ( light.distance > 0 ) lightDef.range = light.distance;
|
|
2439
2439
|
|
|
2440
2440
|
lightDef.spot = {};
|
|
2441
|
-
lightDef.spot.innerConeAngle = (
|
|
2441
|
+
lightDef.spot.innerConeAngle = ( 1.0 - light.penumbra ) * light.angle;
|
|
2442
2442
|
lightDef.spot.outerConeAngle = light.angle;
|
|
2443
2443
|
|
|
2444
2444
|
}
|