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
|
@@ -1520,19 +1520,19 @@ class LDrawPartsGeometryCache {
|
|
|
1520
1520
|
const group = info.group;
|
|
1521
1521
|
if ( info.faces.length > 0 ) {
|
|
1522
1522
|
|
|
1523
|
-
group.add( createObject( info.faces, 3, false, info.totalFaces ) );
|
|
1523
|
+
group.add( createObject( this.loader, info.faces, 3, false, info.totalFaces ) );
|
|
1524
1524
|
|
|
1525
1525
|
}
|
|
1526
1526
|
|
|
1527
1527
|
if ( info.lineSegments.length > 0 ) {
|
|
1528
1528
|
|
|
1529
|
-
group.add( createObject( info.lineSegments, 2 ) );
|
|
1529
|
+
group.add( createObject( this.loader, info.lineSegments, 2 ) );
|
|
1530
1530
|
|
|
1531
1531
|
}
|
|
1532
1532
|
|
|
1533
1533
|
if ( info.conditionalSegments.length > 0 ) {
|
|
1534
1534
|
|
|
1535
|
-
group.add( createObject( info.conditionalSegments, 2, true ) );
|
|
1535
|
+
group.add( createObject( this.loader, info.conditionalSegments, 2, true ) );
|
|
1536
1536
|
|
|
1537
1537
|
}
|
|
1538
1538
|
|
|
@@ -1640,7 +1640,7 @@ function sortByMaterial( a, b ) {
|
|
|
1640
1640
|
|
|
1641
1641
|
}
|
|
1642
1642
|
|
|
1643
|
-
function createObject( elements, elementSize, isConditionalSegments = false, totalElements = null ) {
|
|
1643
|
+
function createObject( loader, elements, elementSize, isConditionalSegments = false, totalElements = null ) {
|
|
1644
1644
|
|
|
1645
1645
|
// Creates a LineSegments (elementSize = 2) or a Mesh (elementSize = 3 )
|
|
1646
1646
|
// With per face / segment material, implemented with mesh groups and materials array
|
|
@@ -1759,11 +1759,13 @@ function createObject( elements, elementSize, isConditionalSegments = false, tot
|
|
|
1759
1759
|
|
|
1760
1760
|
if ( isConditionalSegments ) {
|
|
1761
1761
|
|
|
1762
|
-
|
|
1762
|
+
const edgeMaterial = loader.edgeMaterialCache.get( material );
|
|
1763
|
+
|
|
1764
|
+
materials.push( loader.conditionalEdgeMaterialCache.get( edgeMaterial ) );
|
|
1763
1765
|
|
|
1764
1766
|
} else {
|
|
1765
1767
|
|
|
1766
|
-
materials.push(
|
|
1768
|
+
materials.push( loader.edgeMaterialCache.get( material ) );
|
|
1767
1769
|
|
|
1768
1770
|
}
|
|
1769
1771
|
|
|
@@ -1886,6 +1888,8 @@ class LDrawLoader extends Loader {
|
|
|
1886
1888
|
// Array of THREE.Material
|
|
1887
1889
|
this.materials = [];
|
|
1888
1890
|
this.materialLibrary = {};
|
|
1891
|
+
this.edgeMaterialCache = new WeakMap();
|
|
1892
|
+
this.conditionalEdgeMaterialCache = new WeakMap();
|
|
1889
1893
|
|
|
1890
1894
|
// This also allows to handle the embedded text files ("0 FILE" lines)
|
|
1891
1895
|
this.partsCache = new LDrawPartsGeometryCache( this );
|
|
@@ -1906,8 +1910,8 @@ class LDrawLoader extends Loader {
|
|
|
1906
1910
|
this.missingColorMaterial = new MeshStandardMaterial( { name: Loader.DEFAULT_MATERIAL_NAME, color: 0xFF00FF, roughness: 0.3, metalness: 0 } );
|
|
1907
1911
|
this.missingEdgeColorMaterial = new LineBasicMaterial( { name: Loader.DEFAULT_MATERIAL_NAME, color: 0xFF00FF } );
|
|
1908
1912
|
this.missingConditionalEdgeColorMaterial = new LDrawConditionalLineMaterial( { name: Loader.DEFAULT_MATERIAL_NAME, fog: true, color: 0xFF00FF } );
|
|
1909
|
-
this.
|
|
1910
|
-
this.
|
|
1913
|
+
this.edgeMaterialCache.set( this.missingColorMaterial, this.missingEdgeColorMaterial );
|
|
1914
|
+
this.conditionalEdgeMaterialCache.set( this.missingEdgeColorMaterial, this.missingConditionalEdgeColorMaterial );
|
|
1911
1915
|
|
|
1912
1916
|
}
|
|
1913
1917
|
|
|
@@ -2126,11 +2130,11 @@ class LDrawLoader extends Loader {
|
|
|
2126
2130
|
|
|
2127
2131
|
if ( c.isLineSegments ) {
|
|
2128
2132
|
|
|
2129
|
-
material =
|
|
2133
|
+
material = loader.edgeMaterialCache.get( material );
|
|
2130
2134
|
|
|
2131
2135
|
if ( c.isConditionalLine ) {
|
|
2132
2136
|
|
|
2133
|
-
material =
|
|
2137
|
+
material = loader.conditionalEdgeMaterialCache.get( material );
|
|
2134
2138
|
|
|
2135
2139
|
}
|
|
2136
2140
|
|
|
@@ -2151,7 +2155,7 @@ class LDrawLoader extends Loader {
|
|
|
2151
2155
|
getMainEdgeMaterial() {
|
|
2152
2156
|
|
|
2153
2157
|
const mat = this.getMaterial( MAIN_EDGE_COLOUR_CODE );
|
|
2154
|
-
return mat ?
|
|
2158
|
+
return mat ? this.edgeMaterialCache.get( mat ) : null;
|
|
2155
2159
|
|
|
2156
2160
|
}
|
|
2157
2161
|
|
|
@@ -2236,7 +2240,7 @@ class LDrawLoader extends Loader {
|
|
|
2236
2240
|
}
|
|
2237
2241
|
|
|
2238
2242
|
// Get the edge material for this triangle material
|
|
2239
|
-
edgeMaterial =
|
|
2243
|
+
edgeMaterial = this.edgeMaterialCache.get( edgeMaterial );
|
|
2240
2244
|
|
|
2241
2245
|
}
|
|
2242
2246
|
|
|
@@ -2380,7 +2384,7 @@ class LDrawLoader extends Loader {
|
|
|
2380
2384
|
edgeMaterial.name = name + ' - Edge';
|
|
2381
2385
|
|
|
2382
2386
|
// This is the material used for conditional edges
|
|
2383
|
-
|
|
2387
|
+
const conditionalEdgeMaterial = new LDrawConditionalLineMaterial( {
|
|
2384
2388
|
|
|
2385
2389
|
fog: true,
|
|
2386
2390
|
transparent: isTransparent,
|
|
@@ -2389,15 +2393,17 @@ class LDrawLoader extends Loader {
|
|
|
2389
2393
|
opacity: alpha,
|
|
2390
2394
|
|
|
2391
2395
|
} );
|
|
2392
|
-
|
|
2393
|
-
|
|
2396
|
+
conditionalEdgeMaterial.userData.code = code;
|
|
2397
|
+
conditionalEdgeMaterial.name = name + ' - Conditional Edge';
|
|
2398
|
+
|
|
2399
|
+
this.conditionalEdgeMaterialCache.set( edgeMaterial, conditionalEdgeMaterial );
|
|
2394
2400
|
|
|
2395
2401
|
}
|
|
2396
2402
|
|
|
2397
2403
|
material.userData.code = code;
|
|
2398
2404
|
material.name = name;
|
|
2399
2405
|
|
|
2400
|
-
|
|
2406
|
+
this.edgeMaterialCache.set( material, edgeMaterial );
|
|
2401
2407
|
|
|
2402
2408
|
this.addMaterial( material );
|
|
2403
2409
|
|
|
@@ -4,14 +4,16 @@ import {
|
|
|
4
4
|
ClampToEdgeWrapping,
|
|
5
5
|
FileLoader,
|
|
6
6
|
Group,
|
|
7
|
+
NoColorSpace,
|
|
7
8
|
Loader,
|
|
8
9
|
Mesh,
|
|
9
|
-
|
|
10
|
+
MeshPhysicalMaterial,
|
|
10
11
|
MirroredRepeatWrapping,
|
|
11
12
|
RepeatWrapping,
|
|
12
13
|
SRGBColorSpace,
|
|
13
14
|
TextureLoader,
|
|
14
15
|
Object3D,
|
|
16
|
+
Vector2
|
|
15
17
|
} from 'three';
|
|
16
18
|
|
|
17
19
|
import * as fflate from '../libs/fflate.module.js';
|
|
@@ -178,7 +180,14 @@ class USDZLoader extends Loader {
|
|
|
178
180
|
|
|
179
181
|
}
|
|
180
182
|
|
|
181
|
-
if ( filename.endsWith( 'usd' ) ) {
|
|
183
|
+
if ( filename.endsWith( 'usd' ) || filename.endsWith( 'usda' ) ) {
|
|
184
|
+
|
|
185
|
+
if ( isCrateFile( zip[ filename ] ) ) {
|
|
186
|
+
|
|
187
|
+
console.warn( 'THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.' );
|
|
188
|
+
continue;
|
|
189
|
+
|
|
190
|
+
}
|
|
182
191
|
|
|
183
192
|
const text = fflate.strFromU8( zip[ filename ] );
|
|
184
193
|
data[ filename ] = parser.parse( text );
|
|
@@ -191,18 +200,56 @@ class USDZLoader extends Loader {
|
|
|
191
200
|
|
|
192
201
|
}
|
|
193
202
|
|
|
203
|
+
function isCrateFile( buffer ) {
|
|
204
|
+
|
|
205
|
+
// Check if this a crate file. First 7 bytes of a crate file are "PXR-USDC".
|
|
206
|
+
const fileHeader = buffer.slice( 0, 7 );
|
|
207
|
+
const crateHeader = new Uint8Array( [ 0x50, 0x58, 0x52, 0x2D, 0x55, 0x53, 0x44, 0x43 ] );
|
|
208
|
+
|
|
209
|
+
// If this is not a crate file, we assume it is a plain USDA file.
|
|
210
|
+
return fileHeader.every( ( value, index ) => value === crateHeader[ index ] );
|
|
211
|
+
|
|
212
|
+
}
|
|
213
|
+
|
|
194
214
|
function findUSD( zip ) {
|
|
195
215
|
|
|
196
|
-
|
|
216
|
+
if ( zip.length < 1 ) return undefined;
|
|
217
|
+
|
|
218
|
+
const firstFileName = Object.keys( zip )[ 0 ];
|
|
219
|
+
let isCrate = false;
|
|
220
|
+
|
|
221
|
+
// As per the USD specification, the first entry in the zip archive is used as the main file ("UsdStage").
|
|
222
|
+
// ASCII files can end in either .usda or .usd.
|
|
223
|
+
// See https://openusd.org/release/spec_usdz.html#layout
|
|
224
|
+
if ( firstFileName.endsWith( 'usda' ) ) return zip[ firstFileName ];
|
|
225
|
+
|
|
226
|
+
if ( firstFileName.endsWith( 'usdc' ) ) {
|
|
227
|
+
|
|
228
|
+
isCrate = true;
|
|
197
229
|
|
|
198
|
-
|
|
230
|
+
} else if ( firstFileName.endsWith( 'usd' ) ) {
|
|
199
231
|
|
|
200
|
-
|
|
232
|
+
// If this is not a crate file, we assume it is a plain USDA file.
|
|
233
|
+
if ( ! isCrateFile( zip[ firstFileName ] ) ) {
|
|
234
|
+
|
|
235
|
+
return zip[ firstFileName ];
|
|
236
|
+
|
|
237
|
+
} else {
|
|
238
|
+
|
|
239
|
+
isCrate = true;
|
|
201
240
|
|
|
202
241
|
}
|
|
203
242
|
|
|
204
243
|
}
|
|
205
244
|
|
|
245
|
+
if ( isCrate ) {
|
|
246
|
+
|
|
247
|
+
console.warn( 'THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.' );
|
|
248
|
+
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return undefined;
|
|
252
|
+
|
|
206
253
|
}
|
|
207
254
|
|
|
208
255
|
const zip = fflate.unzipSync( new Uint8Array( buffer ) );
|
|
@@ -252,9 +299,11 @@ class USDZLoader extends Loader {
|
|
|
252
299
|
|
|
253
300
|
function findGeometry( data, id ) {
|
|
254
301
|
|
|
302
|
+
if ( ! data ) return undefined;
|
|
303
|
+
|
|
255
304
|
if ( id !== undefined ) {
|
|
256
305
|
|
|
257
|
-
const def = `def "${id}"`;
|
|
306
|
+
const def = `def Mesh "${id}"`;
|
|
258
307
|
|
|
259
308
|
if ( def in data ) {
|
|
260
309
|
|
|
@@ -280,9 +329,9 @@ class USDZLoader extends Loader {
|
|
|
280
329
|
|
|
281
330
|
// Move st to Mesh
|
|
282
331
|
|
|
283
|
-
if ( '
|
|
332
|
+
if ( 'texCoord2f[] primvars:st' in data ) {
|
|
284
333
|
|
|
285
|
-
object[ '
|
|
334
|
+
object[ 'texCoord2f[] primvars:st' ] = data[ 'texCoord2f[] primvars:st' ];
|
|
286
335
|
|
|
287
336
|
}
|
|
288
337
|
|
|
@@ -320,7 +369,7 @@ class USDZLoader extends Loader {
|
|
|
320
369
|
if ( 'int[] faceVertexIndices' in data ) {
|
|
321
370
|
|
|
322
371
|
const indices = JSON.parse( data[ 'int[] faceVertexIndices' ] );
|
|
323
|
-
geometry.setIndex(
|
|
372
|
+
geometry.setIndex( indices );
|
|
324
373
|
|
|
325
374
|
}
|
|
326
375
|
|
|
@@ -441,9 +490,33 @@ class USDZLoader extends Loader {
|
|
|
441
490
|
|
|
442
491
|
}
|
|
443
492
|
|
|
493
|
+
function setTextureParams( map, data_value ) {
|
|
494
|
+
|
|
495
|
+
// rotation, scale and translation
|
|
496
|
+
|
|
497
|
+
if ( data_value[ 'float inputs:rotation' ] ) {
|
|
498
|
+
|
|
499
|
+
map.rotation = parseFloat( data_value[ 'float inputs:rotation' ] );
|
|
500
|
+
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
if ( data_value[ 'float2 inputs:scale' ] ) {
|
|
504
|
+
|
|
505
|
+
map.repeat = new Vector2().fromArray( JSON.parse( '[' + data_value[ 'float2 inputs:scale' ].replace( /[()]*/g, '' ) + ']' ) );
|
|
506
|
+
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
if ( data_value[ 'float2 inputs:translation' ] ) {
|
|
510
|
+
|
|
511
|
+
map.offset = new Vector2().fromArray( JSON.parse( '[' + data_value[ 'float2 inputs:translation' ].replace( /[()]*/g, '' ) + ']' ) );
|
|
512
|
+
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
}
|
|
516
|
+
|
|
444
517
|
function buildMaterial( data ) {
|
|
445
518
|
|
|
446
|
-
const material = new
|
|
519
|
+
const material = new MeshPhysicalMaterial();
|
|
447
520
|
|
|
448
521
|
if ( data !== undefined ) {
|
|
449
522
|
|
|
@@ -459,6 +532,12 @@ class USDZLoader extends Loader {
|
|
|
459
532
|
material.map = buildTexture( sampler );
|
|
460
533
|
material.map.colorSpace = SRGBColorSpace;
|
|
461
534
|
|
|
535
|
+
if ( 'def Shader "Transform2d_diffuse"' in data ) {
|
|
536
|
+
|
|
537
|
+
setTextureParams( material.map, data[ 'def Shader "Transform2d_diffuse"' ] );
|
|
538
|
+
|
|
539
|
+
}
|
|
540
|
+
|
|
462
541
|
} else if ( 'color3f inputs:diffuseColor' in surface ) {
|
|
463
542
|
|
|
464
543
|
const color = surface[ 'color3f inputs:diffuseColor' ].replace( /[()]*/g, '' );
|
|
@@ -466,27 +545,150 @@ class USDZLoader extends Loader {
|
|
|
466
545
|
|
|
467
546
|
}
|
|
468
547
|
|
|
548
|
+
if ( 'color3f inputs:emissiveColor.connect' in surface ) {
|
|
549
|
+
|
|
550
|
+
const path = surface[ 'color3f inputs:emissiveColor.connect' ];
|
|
551
|
+
const sampler = findTexture( root, /(\w+).output/.exec( path )[ 1 ] );
|
|
552
|
+
|
|
553
|
+
material.emissiveMap = buildTexture( sampler );
|
|
554
|
+
material.emissiveMap.colorSpace = SRGBColorSpace;
|
|
555
|
+
material.emissive.set( 0xffffff );
|
|
556
|
+
|
|
557
|
+
if ( 'def Shader "Transform2d_emissive"' in data ) {
|
|
558
|
+
|
|
559
|
+
setTextureParams( material.emissiveMap, data[ 'def Shader "Transform2d_emissive"' ] );
|
|
560
|
+
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
} else if ( 'color3f inputs:emissiveColor' in surface ) {
|
|
564
|
+
|
|
565
|
+
const color = surface[ 'color3f inputs:emissiveColor' ].replace( /[()]*/g, '' );
|
|
566
|
+
material.emissive.fromArray( JSON.parse( '[' + color + ']' ) );
|
|
567
|
+
|
|
568
|
+
}
|
|
569
|
+
|
|
469
570
|
if ( 'normal3f inputs:normal.connect' in surface ) {
|
|
470
571
|
|
|
471
572
|
const path = surface[ 'normal3f inputs:normal.connect' ];
|
|
472
573
|
const sampler = findTexture( root, /(\w+).output/.exec( path )[ 1 ] );
|
|
473
574
|
|
|
474
575
|
material.normalMap = buildTexture( sampler );
|
|
576
|
+
material.normalMap.colorSpace = NoColorSpace;
|
|
577
|
+
|
|
578
|
+
if ( 'def Shader "Transform2d_normal"' in data ) {
|
|
579
|
+
|
|
580
|
+
setTextureParams( material.normalMap, data[ 'def Shader "Transform2d_normal"' ] );
|
|
581
|
+
|
|
582
|
+
}
|
|
475
583
|
|
|
476
584
|
}
|
|
477
585
|
|
|
478
|
-
if ( 'float inputs:roughness' in surface ) {
|
|
586
|
+
if ( 'float inputs:roughness.connect' in surface ) {
|
|
587
|
+
|
|
588
|
+
const path = surface[ 'float inputs:roughness.connect' ];
|
|
589
|
+
const sampler = findTexture( root, /(\w+).output/.exec( path )[ 1 ] );
|
|
590
|
+
|
|
591
|
+
material.roughness = 1.0;
|
|
592
|
+
material.roughnessMap = buildTexture( sampler );
|
|
593
|
+
material.roughnessMap.colorSpace = NoColorSpace;
|
|
594
|
+
|
|
595
|
+
if ( 'def Shader "Transform2d_roughness"' in data ) {
|
|
596
|
+
|
|
597
|
+
setTextureParams( material.roughnessMap, data[ 'def Shader "Transform2d_roughness"' ] );
|
|
598
|
+
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
} else if ( 'float inputs:roughness' in surface ) {
|
|
479
602
|
|
|
480
603
|
material.roughness = parseFloat( surface[ 'float inputs:roughness' ] );
|
|
481
604
|
|
|
482
605
|
}
|
|
483
606
|
|
|
484
|
-
if ( 'float inputs:metallic' in surface ) {
|
|
607
|
+
if ( 'float inputs:metallic.connect' in surface ) {
|
|
608
|
+
|
|
609
|
+
const path = surface[ 'float inputs:metallic.connect' ];
|
|
610
|
+
const sampler = findTexture( root, /(\w+).output/.exec( path )[ 1 ] );
|
|
611
|
+
|
|
612
|
+
material.metalness = 1.0;
|
|
613
|
+
material.metalnessMap = buildTexture( sampler );
|
|
614
|
+
material.metalnessMap.colorSpace = NoColorSpace;
|
|
615
|
+
|
|
616
|
+
if ( 'def Shader "Transform2d_metallic"' in data ) {
|
|
617
|
+
|
|
618
|
+
setTextureParams( material.metalnessMap, data[ 'def Shader "Transform2d_metallic"' ] );
|
|
619
|
+
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
} else if ( 'float inputs:metallic' in surface ) {
|
|
485
623
|
|
|
486
624
|
material.metalness = parseFloat( surface[ 'float inputs:metallic' ] );
|
|
487
625
|
|
|
488
626
|
}
|
|
489
627
|
|
|
628
|
+
if ( 'float inputs:clearcoat.connect' in surface ) {
|
|
629
|
+
|
|
630
|
+
const path = surface[ 'float inputs:clearcoat.connect' ];
|
|
631
|
+
const sampler = findTexture( root, /(\w+).output/.exec( path )[ 1 ] );
|
|
632
|
+
|
|
633
|
+
material.clearcoat = 1.0;
|
|
634
|
+
material.clearcoatMap = buildTexture( sampler );
|
|
635
|
+
material.clearcoatMap.colorSpace = NoColorSpace;
|
|
636
|
+
|
|
637
|
+
if ( 'def Shader "Transform2d_clearcoat"' in data ) {
|
|
638
|
+
|
|
639
|
+
setTextureParams( material.clearcoatMap, data[ 'def Shader "Transform2d_clearcoat"' ] );
|
|
640
|
+
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
} else if ( 'float inputs:clearcoat' in surface ) {
|
|
644
|
+
|
|
645
|
+
material.clearcoat = parseFloat( surface[ 'float inputs:clearcoat' ] );
|
|
646
|
+
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
if ( 'float inputs:clearcoatRoughness.connect' in surface ) {
|
|
650
|
+
|
|
651
|
+
const path = surface[ 'float inputs:clearcoatRoughness.connect' ];
|
|
652
|
+
const sampler = findTexture( root, /(\w+).output/.exec( path )[ 1 ] );
|
|
653
|
+
|
|
654
|
+
material.clearcoatRoughness = 1.0;
|
|
655
|
+
material.clearcoatRoughnessMap = buildTexture( sampler );
|
|
656
|
+
material.clearcoatRoughnessMap.colorSpace = NoColorSpace;
|
|
657
|
+
|
|
658
|
+
if ( 'def Shader "Transform2d_clearcoatRoughness"' in data ) {
|
|
659
|
+
|
|
660
|
+
setTextureParams( material.clearcoatRoughnessMap, data[ 'def Shader "Transform2d_clearcoatRoughness"' ] );
|
|
661
|
+
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
} else if ( 'float inputs:clearcoatRoughness' in surface ) {
|
|
665
|
+
|
|
666
|
+
material.clearcoatRoughness = parseFloat( surface[ 'float inputs:clearcoatRoughness' ] );
|
|
667
|
+
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
if ( 'float inputs:ior' in surface ) {
|
|
671
|
+
|
|
672
|
+
material.ior = parseFloat( surface[ 'float inputs:ior' ] );
|
|
673
|
+
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
if ( 'float inputs:occlusion.connect' in surface ) {
|
|
677
|
+
|
|
678
|
+
const path = surface[ 'float inputs:occlusion.connect' ];
|
|
679
|
+
const sampler = findTexture( root, /(\w+).output/.exec( path )[ 1 ] );
|
|
680
|
+
|
|
681
|
+
material.aoMap = buildTexture( sampler );
|
|
682
|
+
material.aoMap.colorSpace = NoColorSpace;
|
|
683
|
+
|
|
684
|
+
if ( 'def Shader "Transform2d_occlusion"' in data ) {
|
|
685
|
+
|
|
686
|
+
setTextureParams( material.aoMap, data[ 'def Shader "Transform2d_occlusion"' ] );
|
|
687
|
+
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
}
|
|
691
|
+
|
|
490
692
|
}
|
|
491
693
|
|
|
492
694
|
if ( 'def Shader "diffuseColor_texture"' in data ) {
|
|
@@ -503,6 +705,7 @@ class USDZLoader extends Loader {
|
|
|
503
705
|
const sampler = data[ 'def Shader "normal_texture"' ];
|
|
504
706
|
|
|
505
707
|
material.normalMap = buildTexture( sampler );
|
|
708
|
+
material.normalMap.colorSpace = NoColorSpace;
|
|
506
709
|
|
|
507
710
|
}
|
|
508
711
|
|
|
@@ -74,15 +74,11 @@ const GouraudShader = {
|
|
|
74
74
|
|
|
75
75
|
vec3 diffuse = vec3( 1.0 );
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );
|
|
77
|
+
vec3 geometryPosition = mvPosition.xyz;
|
|
78
|
+
vec3 geometryNormal = normalize( transformedNormal );
|
|
79
|
+
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );
|
|
81
80
|
|
|
82
|
-
|
|
83
|
-
backGeometry.position = geometry.position;
|
|
84
|
-
backGeometry.normal = -geometry.normal;
|
|
85
|
-
backGeometry.viewDir = geometry.viewDir;
|
|
81
|
+
vec3 backGeometryNormal = - geometryNormal;
|
|
86
82
|
|
|
87
83
|
vLightFront = vec3( 0.0 );
|
|
88
84
|
vIndirectFront = vec3( 0.0 );
|
|
@@ -97,13 +93,21 @@ const GouraudShader = {
|
|
|
97
93
|
|
|
98
94
|
vIndirectFront += getAmbientLightIrradiance( ambientLightColor );
|
|
99
95
|
|
|
100
|
-
|
|
96
|
+
#if defined( USE_LIGHT_PROBES )
|
|
97
|
+
|
|
98
|
+
vIndirectFront += getLightProbeIrradiance( lightProbe, geometryNormal );
|
|
99
|
+
|
|
100
|
+
#endif
|
|
101
101
|
|
|
102
102
|
#ifdef DOUBLE_SIDED
|
|
103
103
|
|
|
104
104
|
vIndirectBack += getAmbientLightIrradiance( ambientLightColor );
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
#if defined( USE_LIGHT_PROBES )
|
|
107
|
+
|
|
108
|
+
vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometryNormal );
|
|
109
|
+
|
|
110
|
+
#endif
|
|
107
111
|
|
|
108
112
|
#endif
|
|
109
113
|
|
|
@@ -112,9 +116,9 @@ const GouraudShader = {
|
|
|
112
116
|
#pragma unroll_loop_start
|
|
113
117
|
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
|
|
114
118
|
|
|
115
|
-
getPointLightInfo( pointLights[ i ],
|
|
119
|
+
getPointLightInfo( pointLights[ i ], geometryPosition, directLight );
|
|
116
120
|
|
|
117
|
-
dotNL = dot(
|
|
121
|
+
dotNL = dot( geometryNormal, directLight.direction );
|
|
118
122
|
directLightColor_Diffuse = directLight.color;
|
|
119
123
|
|
|
120
124
|
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
|
|
@@ -135,9 +139,9 @@ const GouraudShader = {
|
|
|
135
139
|
#pragma unroll_loop_start
|
|
136
140
|
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
|
|
137
141
|
|
|
138
|
-
getSpotLightInfo( spotLights[ i ],
|
|
142
|
+
getSpotLightInfo( spotLights[ i ], geometryPosition, directLight );
|
|
139
143
|
|
|
140
|
-
dotNL = dot(
|
|
144
|
+
dotNL = dot( geometryNormal, directLight.direction );
|
|
141
145
|
directLightColor_Diffuse = directLight.color;
|
|
142
146
|
|
|
143
147
|
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
|
|
@@ -157,9 +161,9 @@ const GouraudShader = {
|
|
|
157
161
|
#pragma unroll_loop_start
|
|
158
162
|
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
|
|
159
163
|
|
|
160
|
-
getDirectionalLightInfo( directionalLights[ i ],
|
|
164
|
+
getDirectionalLightInfo( directionalLights[ i ], directLight );
|
|
161
165
|
|
|
162
|
-
dotNL = dot(
|
|
166
|
+
dotNL = dot( geometryNormal, directLight.direction );
|
|
163
167
|
directLightColor_Diffuse = directLight.color;
|
|
164
168
|
|
|
165
169
|
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
|
|
@@ -180,11 +184,11 @@ const GouraudShader = {
|
|
|
180
184
|
#pragma unroll_loop_start
|
|
181
185
|
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
|
|
182
186
|
|
|
183
|
-
vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ],
|
|
187
|
+
vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
|
|
184
188
|
|
|
185
189
|
#ifdef DOUBLE_SIDED
|
|
186
190
|
|
|
187
|
-
vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ],
|
|
191
|
+
vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometryNormal );
|
|
188
192
|
|
|
189
193
|
#endif
|
|
190
194
|
|
|
@@ -54,6 +54,7 @@ export { default as OscNode, oscSine, oscSquare, oscTriangle, oscSawtooth } from
|
|
|
54
54
|
export { default as PackingNode, directionToColor, colorToDirection } from './utils/PackingNode.js';
|
|
55
55
|
export { default as RemapNode, remap, remapClamp } from './utils/RemapNode.js';
|
|
56
56
|
export { default as RotateUVNode, rotateUV } from './utils/RotateUVNode.js';
|
|
57
|
+
export { default as SetNode } from './utils/SetNode.js';
|
|
57
58
|
export { default as SpecularMIPLevelNode, specularMIPLevel } from './utils/SpecularMIPLevelNode.js';
|
|
58
59
|
export { default as SplitNode } from './utils/SplitNode.js';
|
|
59
60
|
export { default as SpriteSheetUVNode, spritesheetUV } from './utils/SpriteSheetUVNode.js';
|
|
@@ -71,6 +72,7 @@ export { default as CameraNode, cameraProjectionMatrix, cameraViewMatrix, camera
|
|
|
71
72
|
export { default as CubeTextureNode, cubeTexture } from './accessors/CubeTextureNode.js';
|
|
72
73
|
export { default as ExtendedMaterialNode, materialNormal } from './accessors/ExtendedMaterialNode.js';
|
|
73
74
|
export { default as InstanceNode, instance } from './accessors/InstanceNode.js';
|
|
75
|
+
export { default as LineMaterialNode, materialLineDashSize, materialLineDashOffset, materialLineGapSize, materialLineScale, materialLineWidth } from './accessors/LineMaterialNode.js';
|
|
74
76
|
export { default as MaterialNode, materialAlphaTest, materialColor, materialShininess, materialEmissive, materialOpacity, materialSpecularColor, materialReflectivity, materialRoughness, materialMetalness, materialRotation, materialSheen, materialSheenRoughness } from './accessors/MaterialNode.js';
|
|
75
77
|
export { default as MaterialReferenceNode, materialReference } from './accessors/MaterialReferenceNode.js';
|
|
76
78
|
export { default as MorphNode, morph } from './accessors/MorphNode.js';
|
|
@@ -94,13 +96,14 @@ export { default as UserDataNode, userData } from './accessors/UserDataNode.js';
|
|
|
94
96
|
|
|
95
97
|
// display
|
|
96
98
|
export { default as BlendModeNode, burn, dodge, overlay, screen } from './display/BlendModeNode.js';
|
|
99
|
+
export { default as BumpMapNode, bumpMap } from './display/BumpMapNode.js';
|
|
97
100
|
export { default as ColorAdjustmentNode, saturation, vibrance, hue, lumaCoeffs, luminance } from './display/ColorAdjustmentNode.js';
|
|
98
101
|
export { default as ColorSpaceNode, linearToColorSpace, colorSpaceToLinear, linearTosRGB, sRGBToLinear } from './display/ColorSpaceNode.js';
|
|
99
102
|
export { default as FrontFacingNode, frontFacing, faceDirection } from './display/FrontFacingNode.js';
|
|
100
103
|
export { default as NormalMapNode, normalMap, TBNViewMatrix } from './display/NormalMapNode.js';
|
|
101
104
|
export { default as PosterizeNode, posterize } from './display/PosterizeNode.js';
|
|
102
105
|
export { default as ToneMappingNode, toneMapping } from './display/ToneMappingNode.js';
|
|
103
|
-
export { default as ViewportNode, viewportCoordinate, viewportResolution, viewportTopLeft, viewportBottomLeft, viewportTopRight, viewportBottomRight } from './display/ViewportNode.js';
|
|
106
|
+
export { default as ViewportNode, viewport, viewportCoordinate, viewportResolution, viewportTopLeft, viewportBottomLeft, viewportTopRight, viewportBottomRight } from './display/ViewportNode.js';
|
|
104
107
|
export { default as ViewportTextureNode, viewportTexture, viewportMipTexture } from './display/ViewportTextureNode.js';
|
|
105
108
|
export { default as ViewportSharedTextureNode, viewportSharedTexture } from './display/ViewportSharedTextureNode.js';
|
|
106
109
|
export { default as ViewportDepthTextureNode, viewportDepthTexture } from './display/ViewportDepthTextureNode.js';
|
|
@@ -163,6 +166,7 @@ export { default as BRDF_Lambert } from './functions/BSDF/BRDF_Lambert.js';
|
|
|
163
166
|
export { default as D_GGX } from './functions/BSDF/D_GGX.js';
|
|
164
167
|
export { default as DFGApprox } from './functions/BSDF/DFGApprox.js';
|
|
165
168
|
export { default as F_Schlick } from './functions/BSDF/F_Schlick.js';
|
|
169
|
+
export { default as Schlick_to_F0 } from './functions/BSDF/Schlick_to_F0.js';
|
|
166
170
|
export { default as V_GGX_SmithCorrelated } from './functions/BSDF/V_GGX_SmithCorrelated.js';
|
|
167
171
|
|
|
168
172
|
export { getDistanceAttenuation } from './lighting/LightUtils.js';
|
|
@@ -86,4 +86,4 @@ export const bitangentWorld = nodeImmutable( BitangentNode, BitangentNode.WORLD
|
|
|
86
86
|
export const transformedBitangentView = normalize( transformedNormalView.cross( transformedTangentView ).mul( tangentGeometry.w ) );
|
|
87
87
|
export const transformedBitangentWorld = normalize( transformedBitangentView.transformDirection( cameraViewMatrix ) );
|
|
88
88
|
|
|
89
|
-
addNodeClass( BitangentNode );
|
|
89
|
+
addNodeClass( 'BitangentNode', BitangentNode );
|
|
@@ -43,7 +43,7 @@ class BufferAttributeNode extends InputNode {
|
|
|
43
43
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
setup( builder ) {
|
|
47
47
|
|
|
48
48
|
if ( this.attribute !== null ) return;
|
|
49
49
|
|
|
@@ -122,4 +122,4 @@ export const instancedDynamicBufferAttribute = ( array, type, stride, offset ) =
|
|
|
122
122
|
|
|
123
123
|
addNodeElement( 'toAttribute', ( bufferNode ) => bufferAttribute( bufferNode.value ) );
|
|
124
124
|
|
|
125
|
-
addNodeClass( BufferAttributeNode );
|
|
125
|
+
addNodeClass( 'BufferAttributeNode', BufferAttributeNode );
|
|
@@ -95,4 +95,4 @@ export const cameraNormalMatrix = nodeImmutable( CameraNode, CameraNode.NORMAL_M
|
|
|
95
95
|
export const cameraWorldMatrix = nodeImmutable( CameraNode, CameraNode.WORLD_MATRIX );
|
|
96
96
|
export const cameraPosition = nodeImmutable( CameraNode, CameraNode.POSITION );
|
|
97
97
|
|
|
98
|
-
addNodeClass( CameraNode );
|
|
98
|
+
addNodeClass( 'CameraNode', CameraNode );
|
|
@@ -97,7 +97,7 @@ class CubeTextureNode extends TextureNode {
|
|
|
97
97
|
|
|
98
98
|
if ( builder.needsColorSpaceToLinear( this.value ) ) {
|
|
99
99
|
|
|
100
|
-
snippet = colorSpaceToLinear( expression( snippet, nodeType ), this.value.colorSpace ).
|
|
100
|
+
snippet = colorSpaceToLinear( expression( snippet, nodeType ), this.value.colorSpace ).setup( builder ).build( builder, nodeType );
|
|
101
101
|
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -115,4 +115,4 @@ export const cubeTexture = nodeProxy( CubeTextureNode );
|
|
|
115
115
|
|
|
116
116
|
addNodeElement( 'cubeTexture', cubeTexture );
|
|
117
117
|
|
|
118
|
-
addNodeClass( CubeTextureNode );
|
|
118
|
+
addNodeClass( 'CubeTextureNode', CubeTextureNode );
|