super-three 0.167.0 → 0.168.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +165 -44
- package/build/three.module.js +165 -45
- package/build/three.module.min.js +1 -1
- package/build/three.webgpu.js +23600 -21931
- package/build/three.webgpu.min.js +1 -1
- package/examples/jsm/Addons.js +3 -1
- package/examples/jsm/animation/AnimationClipCreator.js +1 -1
- package/examples/jsm/capabilities/WebGL.js +27 -21
- package/examples/jsm/controls/ArcballControls.js +174 -158
- package/examples/jsm/controls/DragControls.js +260 -132
- package/examples/jsm/controls/FirstPersonControls.js +175 -163
- package/examples/jsm/controls/FlyControls.js +194 -188
- package/examples/jsm/controls/OrbitControls.js +777 -786
- package/examples/jsm/controls/PointerLockControls.js +24 -15
- package/examples/jsm/controls/TrackballControls.js +453 -452
- package/examples/jsm/effects/AnaglyphEffect.js +6 -13
- package/examples/jsm/effects/ParallaxBarrierEffect.js +17 -11
- package/examples/jsm/effects/StereoEffect.js +6 -1
- package/examples/jsm/environments/RoomEnvironment.js +1 -1
- package/examples/jsm/exporters/GLTFExporter.js +6 -1
- package/examples/jsm/exporters/USDZExporter.js +29 -8
- package/examples/jsm/helpers/LightProbeHelper.js +42 -43
- package/examples/jsm/loaders/KTX2Loader.js +19 -7
- package/examples/jsm/loaders/MaterialXLoader.js +11 -4
- package/examples/jsm/loaders/PCDLoader.js +9 -9
- package/examples/jsm/objects/SkyMesh.js +188 -0
- package/examples/jsm/objects/Water2Mesh.js +159 -0
- package/examples/jsm/objects/WaterMesh.js +102 -0
- package/examples/jsm/physics/RapierPhysics.js +20 -0
- package/examples/jsm/postprocessing/OutlinePass.js +31 -46
- package/examples/jsm/postprocessing/SSAARenderPass.js +3 -1
- package/examples/jsm/shaders/BleachBypassShader.js +1 -2
- package/examples/jsm/shaders/OutputShader.js +1 -1
- package/examples/jsm/transpiler/TSLEncoder.js +8 -8
- package/examples/jsm/utils/TextureUtils.js +1 -1
- package/package.json +2 -1
- package/src/Three.WebGPU.js +6 -0
- package/src/Three.js +1 -0
- package/src/constants.js +1 -1
- package/src/extras/Controls.js +32 -0
- package/src/loaders/ObjectLoader.js +3 -3
- package/src/{nodes/loaders → loaders/nodes}/NodeLoader.js +4 -4
- package/src/{nodes/loaders → loaders/nodes}/NodeMaterialLoader.js +1 -2
- package/src/materials/Material.js +4 -7
- package/src/{nodes/materials → materials/nodes}/InstancedPointsNodeMaterial.js +33 -24
- package/src/{nodes/materials → materials/nodes}/Line2NodeMaterial.js +34 -37
- package/src/{nodes/materials → materials/nodes}/LineBasicNodeMaterial.js +3 -4
- package/src/{nodes/materials → materials/nodes}/LineDashedNodeMaterial.js +7 -9
- package/src/{nodes/materials → materials/nodes}/MeshBasicNodeMaterial.js +11 -11
- package/src/{nodes/materials → materials/nodes}/MeshLambertNodeMaterial.js +5 -5
- package/src/{nodes/materials → materials/nodes}/MeshMatcapNodeMaterial.js +8 -8
- package/src/materials/nodes/MeshNormalNodeMaterial.js +40 -0
- package/src/{nodes/materials → materials/nodes}/MeshPhongNodeMaterial.js +9 -8
- package/src/{nodes/materials → materials/nodes}/MeshPhysicalNodeMaterial.js +18 -17
- package/src/{nodes/materials → materials/nodes}/MeshSSSNodeMaterial.js +6 -6
- package/src/{nodes/materials → materials/nodes}/MeshStandardNodeMaterial.js +17 -11
- package/src/{nodes/materials → materials/nodes}/MeshToonNodeMaterial.js +4 -4
- package/src/{nodes/materials → materials/nodes}/NodeMaterial.js +67 -86
- package/src/{nodes/materials/Materials.js → materials/nodes/NodeMaterials.js} +1 -1
- package/src/{nodes/materials → materials/nodes}/PointsNodeMaterial.js +3 -4
- package/src/{nodes/materials → materials/nodes}/ShadowNodeMaterial.js +4 -4
- package/src/{nodes/materials → materials/nodes}/SpriteNodeMaterial.js +11 -11
- package/src/{nodes/materials → materials/nodes}/VolumeNodeMaterial.js +14 -16
- package/src/nodes/Nodes.js +103 -159
- package/src/nodes/TSL.js +176 -0
- package/src/nodes/accessors/AccessorsUtils.js +8 -8
- package/src/nodes/accessors/BatchNode.js +48 -20
- package/src/nodes/accessors/{BitangentNode.js → Bitangent.js} +9 -9
- package/src/nodes/accessors/BufferAttributeNode.js +5 -5
- package/src/nodes/accessors/BufferNode.js +4 -4
- package/src/nodes/accessors/{CameraNode.js → Camera.js} +10 -10
- package/src/nodes/accessors/ClippingNode.js +16 -14
- package/src/nodes/accessors/CubeTextureNode.js +5 -7
- package/src/nodes/accessors/InstanceNode.js +17 -13
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +4 -4
- package/src/nodes/accessors/MaterialNode.js +52 -55
- package/src/nodes/accessors/MaterialProperties.js +3 -0
- package/src/nodes/accessors/MaterialReferenceNode.js +6 -4
- package/src/nodes/accessors/ModelNode.js +11 -11
- package/src/nodes/accessors/ModelViewProjectionNode.js +6 -7
- package/src/nodes/accessors/MorphNode.js +12 -12
- package/src/nodes/accessors/Normal.js +62 -0
- package/src/nodes/accessors/Object3DNode.js +10 -10
- package/src/nodes/accessors/PointUVNode.js +4 -4
- package/src/nodes/accessors/Position.js +10 -0
- package/src/nodes/accessors/ReferenceBaseNode.js +143 -0
- package/src/nodes/accessors/ReferenceNode.js +13 -7
- package/src/nodes/accessors/ReflectVector.js +10 -0
- package/src/nodes/accessors/RendererReferenceNode.js +6 -6
- package/src/nodes/accessors/SceneNode.js +5 -6
- package/src/nodes/accessors/SkinningNode.js +84 -21
- package/src/nodes/accessors/StorageBufferNode.js +4 -5
- package/src/nodes/accessors/StorageTextureNode.js +5 -5
- package/src/nodes/accessors/Tangent.js +22 -0
- package/src/nodes/accessors/Texture3DNode.js +11 -11
- package/src/nodes/accessors/{TextureBicubicNode.js → TextureBicubic.js} +3 -32
- package/src/nodes/accessors/TextureNode.js +16 -21
- package/src/nodes/accessors/TextureSizeNode.js +4 -6
- package/src/nodes/accessors/{UniformsNode.js → UniformArrayNode.js} +17 -8
- package/src/nodes/accessors/UserDataNode.js +4 -4
- package/src/nodes/accessors/VelocityNode.js +83 -0
- package/src/nodes/accessors/VertexColorNode.js +4 -4
- package/src/nodes/code/CodeNode.js +5 -5
- package/src/nodes/code/ExpressionNode.js +4 -4
- package/src/nodes/code/FunctionCallNode.js +5 -5
- package/src/nodes/code/FunctionNode.js +5 -23
- package/src/nodes/code/ScriptableNode.js +4 -6
- package/src/nodes/code/ScriptableValueNode.js +4 -6
- package/src/nodes/core/AssignNode.js +5 -5
- package/src/nodes/core/AttributeNode.js +7 -20
- package/src/nodes/core/BypassNode.js +5 -5
- package/src/nodes/core/CacheNode.js +5 -5
- package/src/nodes/core/ConstNode.js +2 -2
- package/src/nodes/core/ContextNode.js +17 -11
- package/src/nodes/core/IndexNode.js +12 -7
- package/src/nodes/core/InputNode.js +2 -2
- package/src/nodes/core/MRTNode.js +12 -6
- package/src/nodes/core/Node.js +39 -19
- package/src/nodes/core/NodeBuilder.js +46 -33
- package/src/nodes/core/NodeUtils.js +1 -0
- package/src/nodes/core/OutputStructNode.js +4 -4
- package/src/nodes/core/ParameterNode.js +4 -4
- package/src/nodes/core/PropertyNode.js +32 -32
- package/src/nodes/core/StackNode.js +26 -10
- package/src/nodes/core/StructTypeNode.js +2 -2
- package/src/nodes/core/TempNode.js +2 -2
- package/src/nodes/core/UniformGroupNode.js +8 -9
- package/src/nodes/core/UniformNode.js +4 -4
- package/src/nodes/core/VarNode.js +6 -6
- package/src/nodes/core/VaryingNode.js +5 -5
- package/src/nodes/display/AfterImageNode.js +9 -9
- package/src/nodes/display/AnaglyphPassNode.js +61 -0
- package/src/nodes/display/AnamorphicNode.js +11 -11
- package/src/nodes/display/BleachBypass.js +26 -0
- package/src/nodes/display/BlendMode.js +54 -0
- package/src/nodes/display/BloomNode.js +21 -19
- package/src/nodes/display/BumpMapNode.js +7 -12
- package/src/nodes/display/ColorAdjustment.js +46 -0
- package/src/nodes/display/ColorSpaceFunctions.js +38 -0
- package/src/nodes/display/ColorSpaceNode.js +40 -63
- package/src/nodes/display/DenoiseNode.js +20 -17
- package/src/nodes/display/DepthOfFieldNode.js +8 -6
- package/src/nodes/display/DotScreenNode.js +10 -22
- package/src/nodes/display/FXAANode.js +17 -15
- package/src/nodes/display/FilmNode.js +7 -6
- package/src/nodes/display/FrontFacingNode.js +5 -5
- package/src/nodes/display/GTAONode.js +19 -15
- package/src/nodes/display/GaussianBlurNode.js +11 -8
- package/src/nodes/display/Lut3DNode.js +6 -5
- package/src/nodes/display/MotionBlur.js +25 -0
- package/src/nodes/display/NormalMapNode.js +8 -10
- package/src/nodes/display/ParallaxBarrierPassNode.js +55 -0
- package/src/nodes/display/PassNode.js +84 -8
- package/src/nodes/display/PixelationPassNode.js +12 -7
- package/src/nodes/display/PosterizeNode.js +4 -6
- package/src/nodes/display/RGBShiftNode.js +8 -7
- package/src/nodes/display/RenderOutputNode.js +9 -9
- package/src/nodes/display/SSAAPassNode.js +284 -0
- package/src/nodes/display/Sepia.js +17 -0
- package/src/nodes/display/SobelOperatorNode.js +9 -7
- package/src/nodes/display/StereoCompositePassNode.js +107 -0
- package/src/nodes/display/StereoPassNode.js +80 -0
- package/src/nodes/display/ToneMappingFunctions.js +190 -0
- package/src/nodes/display/ToneMappingNode.js +12 -173
- package/src/nodes/display/TransitionNode.js +9 -8
- package/src/nodes/display/ViewportDepthNode.js +30 -29
- package/src/nodes/display/ViewportDepthTextureNode.js +6 -8
- package/src/nodes/display/ViewportNode.js +26 -25
- package/src/nodes/display/ViewportSharedTextureNode.js +6 -8
- package/src/nodes/display/ViewportTextureNode.js +7 -10
- package/src/nodes/fog/FogExp2Node.js +4 -6
- package/src/nodes/fog/FogNode.js +5 -7
- package/src/nodes/fog/FogRangeNode.js +4 -6
- package/src/nodes/functions/BSDF/BRDF_GGX.js +4 -4
- package/src/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +6 -6
- package/src/nodes/functions/BSDF/DFGApprox.js +2 -2
- package/src/nodes/functions/BSDF/D_GGX.js +2 -2
- package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +3 -3
- package/src/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
- package/src/nodes/functions/BSDF/F_Schlick.js +2 -2
- package/src/nodes/functions/BSDF/LTC.js +6 -6
- package/src/nodes/functions/BSDF/Schlick_to_F0.js +2 -2
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +2 -2
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +2 -2
- package/src/nodes/functions/BasicLightingModel.js +1 -1
- package/src/nodes/functions/PhongLightingModel.js +5 -5
- package/src/nodes/functions/PhysicalLightingModel.js +32 -31
- package/src/nodes/functions/ShadowMaskModel.js +1 -1
- package/src/nodes/functions/ToonLightingModel.js +3 -3
- package/src/nodes/functions/material/getGeometryRoughness.js +4 -4
- package/src/nodes/functions/material/getRoughness.js +2 -2
- package/src/nodes/geometry/RangeNode.js +4 -4
- package/src/nodes/gpgpu/ComputeNode.js +5 -5
- package/src/nodes/lighting/AONode.js +2 -2
- package/src/nodes/lighting/AmbientLightNode.js +2 -7
- package/src/nodes/lighting/AnalyticLightNode.js +34 -13
- package/src/nodes/lighting/BasicEnvironmentNode.js +4 -3
- package/src/nodes/lighting/BasicLightMapNode.js +3 -3
- package/src/nodes/lighting/DirectionalLightNode.js +2 -7
- package/src/nodes/lighting/EnvironmentNode.js +20 -19
- package/src/nodes/lighting/HemisphereLightNode.js +3 -7
- package/src/nodes/lighting/IESSpotLightNode.js +3 -8
- package/src/nodes/lighting/IrradianceNode.js +2 -2
- package/src/nodes/lighting/LightNode.js +5 -5
- package/src/nodes/lighting/LightProbeNode.js +76 -0
- package/src/nodes/lighting/LightUtils.js +3 -3
- package/src/nodes/lighting/LightingContextNode.js +15 -17
- package/src/nodes/lighting/LightingNode.js +2 -2
- package/src/nodes/lighting/LightsNode.js +94 -76
- package/src/nodes/lighting/PointLightNode.js +3 -8
- package/src/nodes/lighting/RectAreaLightNode.js +2 -6
- package/src/nodes/lighting/SpotLightNode.js +3 -8
- package/src/nodes/materialx/MaterialXNodes.js +2 -2
- package/src/nodes/materialx/lib/mx_hsv.js +36 -31
- package/src/nodes/materialx/lib/mx_noise.js +96 -96
- package/src/nodes/materialx/lib/mx_transform_color.js +2 -2
- package/src/nodes/math/{CondNode.js → ConditionalNode.js} +18 -7
- package/src/nodes/math/Hash.js +13 -0
- package/src/nodes/math/MathNode.js +124 -124
- package/src/nodes/math/MathUtils.js +0 -7
- package/src/nodes/math/OperatorNode.js +94 -52
- package/src/nodes/math/TriNoise3D.js +19 -29
- package/src/nodes/pmrem/PMREMNode.js +58 -15
- package/src/nodes/pmrem/PMREMUtils.js +46 -46
- package/src/nodes/procedural/Checker.js +14 -0
- package/src/nodes/tsl/TSLBase.js +30 -0
- package/src/nodes/{shadernode/ShaderNode.js → tsl/TSLCore.js} +105 -97
- package/src/nodes/utils/ArrayElementNode.js +2 -2
- package/src/nodes/utils/ConvertNode.js +2 -2
- package/src/nodes/utils/CubeMapNode.js +157 -0
- package/src/nodes/utils/Discard.js +8 -0
- package/src/nodes/utils/EquirectUVNode.js +5 -5
- package/src/nodes/utils/FlipNode.js +65 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +5 -5
- package/src/nodes/utils/JoinNode.js +2 -2
- package/src/nodes/utils/LoopNode.js +12 -6
- package/src/nodes/utils/MatcapUVNode.js +6 -6
- package/src/nodes/utils/MaxMipLevelNode.js +4 -4
- package/src/nodes/utils/OscNode.js +7 -7
- package/src/nodes/utils/Packing.js +4 -0
- package/src/nodes/utils/RTTNode.js +8 -8
- package/src/nodes/utils/ReflectorNode.js +8 -3
- package/src/nodes/utils/RemapNode.js +7 -7
- package/src/nodes/utils/RotateNode.js +4 -12
- package/src/nodes/utils/SetNode.js +2 -2
- package/src/nodes/utils/SplitNode.js +2 -2
- package/src/nodes/utils/SpriteSheetUVNode.js +5 -5
- package/src/nodes/utils/SpriteUtils.js +47 -0
- package/src/nodes/utils/StorageArrayElementNode.js +4 -6
- package/src/nodes/utils/TimerNode.js +5 -5
- package/src/nodes/utils/TriplanarTexturesNode.js +7 -9
- package/src/nodes/utils/UVUtils.js +19 -0
- package/src/nodes/utils/ViewportUtils.js +14 -0
- package/src/objects/BatchedMesh.js +2 -3
- package/src/renderers/WebGLRenderer.js +24 -0
- package/src/renderers/common/Backend.js +2 -2
- package/src/renderers/common/Background.js +3 -1
- package/src/renderers/common/BindGroup.js +3 -1
- package/src/renderers/common/Bindings.js +13 -15
- package/src/renderers/common/ClippingContext.js +14 -5
- package/src/renderers/common/CubeRenderTarget.js +9 -3
- package/src/renderers/common/PostProcessing.js +4 -1
- package/src/renderers/common/QuadMesh.js +2 -0
- package/src/renderers/common/RenderContext.js +24 -0
- package/src/renderers/common/RenderList.js +1 -1
- package/src/renderers/common/RenderObject.js +2 -2
- package/src/renderers/common/Renderer.js +75 -49
- package/src/renderers/common/SampledTexture.js +12 -3
- package/src/renderers/common/StandardRenderer.js +18 -0
- package/src/renderers/common/Textures.js +8 -12
- package/src/renderers/common/extras/PMREMGenerator.js +12 -13
- package/src/renderers/common/nodes/NodeBuilderState.js +1 -1
- package/src/renderers/common/nodes/NodeLibrary.js +118 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +2 -2
- package/src/renderers/common/nodes/Nodes.js +36 -9
- package/src/renderers/common/nodes/StandardNodeLibrary.js +105 -0
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +2 -2
- package/src/renderers/webgl/WebGLProgram.js +1 -1
- package/src/renderers/webgl/WebGLProperties.js +7 -0
- package/src/renderers/webgl/WebGLTextures.js +61 -4
- package/src/renderers/webgl-fallback/WebGLBackend.js +88 -68
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +57 -9
- package/src/renderers/webgl-fallback/utils/WebGLState.js +21 -0
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +28 -21
- package/src/renderers/webgpu/WebGPUBackend.js +86 -68
- package/src/renderers/webgpu/WebGPURenderer.js +8 -8
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +99 -63
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +45 -21
- package/src/renderers/webgpu/utils/WebGPUConstants.js +2 -1
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +6 -15
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +62 -5
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +36 -21
- package/src/renderers/webgpu/utils/WebGPUUtils.js +18 -1
- package/src/renderers/webxr/WebXRManager.js +32 -25
- package/examples/jsm/loaders/LogLuvLoader.js +0 -606
- package/src/nodes/accessors/NormalNode.js +0 -14
- package/src/nodes/accessors/PositionNode.js +0 -10
- package/src/nodes/accessors/ReflectVectorNode.js +0 -10
- package/src/nodes/accessors/TangentNode.js +0 -23
- package/src/nodes/core/NodeKeywords.js +0 -80
- package/src/nodes/display/BlendModeNode.js +0 -128
- package/src/nodes/display/ColorAdjustmentNode.js +0 -104
- package/src/nodes/materials/MeshNormalNodeMaterial.js +0 -40
- package/src/nodes/math/HashNode.js +0 -34
- package/src/nodes/procedural/CheckerNode.js +0 -42
- package/src/nodes/utils/DiscardNode.js +0 -28
- package/src/nodes/utils/PackingNode.js +0 -55
- package/src/nodes/utils/RotateUVNode.js +0 -35
- /package/src/{nodes/loaders → loaders/nodes}/NodeObjectLoader.js +0 -0
- /package/src/nodes/accessors/{UVNode.js → UV.js} +0 -0
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import { TBNViewMatrix } from '../accessors/AccessorsUtils.js';
|
|
8
|
-
import PhysicalLightingModel from '../functions/PhysicalLightingModel.js';
|
|
1
|
+
import { clearcoat, clearcoatRoughness, sheen, sheenRoughness, iridescence, iridescenceIOR, iridescenceThickness, specularColor, specularF90, diffuseColor, metalness, roughness, anisotropy, alphaT, anisotropyT, anisotropyB, ior, transmission, thickness, attenuationDistance, attenuationColor, dispersion } from '../../nodes/core/PropertyNode.js';
|
|
2
|
+
import { materialClearcoat, materialClearcoatRoughness, materialClearcoatNormal, materialSheen, materialSheenRoughness, materialIridescence, materialIridescenceIOR, materialIridescenceThickness, materialSpecularIntensity, materialSpecularColor, materialAnisotropy, materialIOR, materialTransmission, materialThickness, materialAttenuationDistance, materialAttenuationColor, materialDispersion } from '../../nodes/accessors/MaterialNode.js';
|
|
3
|
+
import { float, vec2, vec3, If } from '../../nodes/tsl/TSLBase.js';
|
|
4
|
+
import getRoughness from '../../nodes/functions/material/getRoughness.js';
|
|
5
|
+
import { TBNViewMatrix } from '../../nodes/accessors/AccessorsUtils.js';
|
|
6
|
+
import PhysicalLightingModel from '../../nodes/functions/PhysicalLightingModel.js';
|
|
9
7
|
import MeshStandardNodeMaterial from './MeshStandardNodeMaterial.js';
|
|
10
|
-
import { mix, pow2, min } from '
|
|
8
|
+
import { mix, pow2, min } from '../../nodes/math/MathNode.js';
|
|
11
9
|
|
|
12
|
-
import { MeshPhysicalMaterial } from '
|
|
10
|
+
import { MeshPhysicalMaterial } from '../MeshPhysicalMaterial.js';
|
|
11
|
+
import { registerNodeMaterial } from './NodeMaterial.js';
|
|
13
12
|
|
|
14
13
|
const _defaultValues = /*@__PURE__*/ new MeshPhysicalMaterial();
|
|
15
14
|
|
|
@@ -156,7 +155,7 @@ class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
|
|
|
156
155
|
|
|
157
156
|
anisotropyV.assign( vec2( 1.0, 0.0 ) );
|
|
158
157
|
|
|
159
|
-
} ).
|
|
158
|
+
} ).Else( () => {
|
|
160
159
|
|
|
161
160
|
anisotropyV.divAssign( vec2( anisotropy ) );
|
|
162
161
|
anisotropy.assign( anisotropy.saturate() );
|
|
@@ -197,15 +196,17 @@ class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
|
|
|
197
196
|
|
|
198
197
|
}
|
|
199
198
|
|
|
200
|
-
|
|
199
|
+
setupClearcoatNormal() {
|
|
201
200
|
|
|
202
|
-
|
|
201
|
+
return this.clearcoatNormalNode ? vec3( this.clearcoatNormalNode ) : materialClearcoatNormal;
|
|
203
202
|
|
|
204
|
-
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
setup( builder ) {
|
|
205
206
|
|
|
206
|
-
|
|
207
|
+
builder.context.setupClearcoatNormal = () => this.setupClearcoatNormal( builder );
|
|
207
208
|
|
|
208
|
-
|
|
209
|
+
super.setup( builder );
|
|
209
210
|
|
|
210
211
|
}
|
|
211
212
|
|
|
@@ -241,4 +242,4 @@ class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
|
|
|
241
242
|
|
|
242
243
|
export default MeshPhysicalNodeMaterial;
|
|
243
244
|
|
|
244
|
-
|
|
245
|
+
MeshPhysicalNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshPhysical', MeshPhysicalNodeMaterial );
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { addNodeMaterial } from './NodeMaterial.js';
|
|
2
|
-
import { transformedNormalView } from '../accessors/NormalNode.js';
|
|
3
|
-
import { positionViewDirection } from '../accessors/PositionNode.js';
|
|
4
|
-
import PhysicalLightingModel from '../functions/PhysicalLightingModel.js';
|
|
5
1
|
import MeshPhysicalNodeMaterial from './MeshPhysicalNodeMaterial.js';
|
|
6
|
-
import
|
|
2
|
+
import PhysicalLightingModel from '../../nodes/functions/PhysicalLightingModel.js';
|
|
3
|
+
import { transformedNormalView } from '../../nodes/accessors/Normal.js';
|
|
4
|
+
import { positionViewDirection } from '../../nodes/accessors/Position.js';
|
|
5
|
+
import { float, vec3 } from '../../nodes/tsl/TSLBase.js';
|
|
6
|
+
import { registerNodeMaterial } from './NodeMaterial.js';
|
|
7
7
|
|
|
8
8
|
class SSSLightingModel extends PhysicalLightingModel {
|
|
9
9
|
|
|
@@ -81,4 +81,4 @@ class MeshSSSNodeMaterial extends MeshPhysicalNodeMaterial {
|
|
|
81
81
|
|
|
82
82
|
export default MeshSSSNodeMaterial;
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
MeshSSSNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshSSS', MeshSSSNodeMaterial );
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import NodeMaterial, {
|
|
2
|
-
import { diffuseColor, metalness, roughness, specularColor, specularF90 } from '
|
|
3
|
-
import { mix } from '
|
|
4
|
-
import { materialRoughness, materialMetalness } from '
|
|
5
|
-
import getRoughness from '
|
|
6
|
-
import PhysicalLightingModel from '
|
|
7
|
-
import EnvironmentNode from '
|
|
8
|
-
import { float, vec3, vec4 } from '
|
|
1
|
+
import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
|
|
2
|
+
import { diffuseColor, metalness, roughness, specularColor, specularF90 } from '../../nodes/core/PropertyNode.js';
|
|
3
|
+
import { mix } from '../../nodes/math/MathNode.js';
|
|
4
|
+
import { materialRoughness, materialMetalness } from '../../nodes/accessors/MaterialNode.js';
|
|
5
|
+
import getRoughness from '../../nodes/functions/material/getRoughness.js';
|
|
6
|
+
import PhysicalLightingModel from '../../nodes/functions/PhysicalLightingModel.js';
|
|
7
|
+
import EnvironmentNode from '../../nodes/lighting/EnvironmentNode.js';
|
|
8
|
+
import { float, vec3, vec4 } from '../../nodes/tsl/TSLBase.js';
|
|
9
9
|
|
|
10
|
-
import { MeshStandardMaterial } from '
|
|
10
|
+
import { MeshStandardMaterial } from '../MeshStandardMaterial.js';
|
|
11
11
|
|
|
12
12
|
const _defaultValues = /*@__PURE__*/ new MeshStandardMaterial();
|
|
13
13
|
|
|
@@ -34,7 +34,13 @@ class MeshStandardNodeMaterial extends NodeMaterial {
|
|
|
34
34
|
|
|
35
35
|
setupEnvironment( builder ) {
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
let envNode = super.setupEnvironment( builder );
|
|
38
|
+
|
|
39
|
+
if ( envNode === null && builder.environmentNode ) {
|
|
40
|
+
|
|
41
|
+
envNode = builder.environmentNode;
|
|
42
|
+
|
|
43
|
+
}
|
|
38
44
|
|
|
39
45
|
return envNode ? new EnvironmentNode( envNode ) : null;
|
|
40
46
|
|
|
@@ -95,4 +101,4 @@ class MeshStandardNodeMaterial extends NodeMaterial {
|
|
|
95
101
|
|
|
96
102
|
export default MeshStandardNodeMaterial;
|
|
97
103
|
|
|
98
|
-
|
|
104
|
+
MeshStandardNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshStandard', MeshStandardNodeMaterial );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import NodeMaterial, {
|
|
2
|
-
import ToonLightingModel from '
|
|
1
|
+
import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
|
|
2
|
+
import ToonLightingModel from '../../nodes/functions/ToonLightingModel.js';
|
|
3
3
|
|
|
4
|
-
import { MeshToonMaterial } from '
|
|
4
|
+
import { MeshToonMaterial } from '../MeshToonMaterial.js';
|
|
5
5
|
|
|
6
6
|
const _defaultValues = /*@__PURE__*/ new MeshToonMaterial();
|
|
7
7
|
|
|
@@ -31,4 +31,4 @@ class MeshToonNodeMaterial extends NodeMaterial {
|
|
|
31
31
|
|
|
32
32
|
export default MeshToonNodeMaterial;
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
MeshToonNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshToon', MeshToonNodeMaterial );
|
|
@@ -1,30 +1,27 @@
|
|
|
1
|
-
import { Material } from '
|
|
1
|
+
import { Material } from '../Material.js';
|
|
2
2
|
import { NormalBlending } from '../../constants.js';
|
|
3
3
|
|
|
4
|
-
import { getNodeChildren, getCacheKey } from '
|
|
5
|
-
import { attribute } from '
|
|
6
|
-
import { output, diffuseColor, emissive, varyingProperty } from '
|
|
7
|
-
import { materialAlphaTest, materialColor, materialOpacity, materialEmissive, materialNormal, materialLightMap, materialAOMap } from '
|
|
8
|
-
import { modelViewProjection } from '
|
|
9
|
-
import {
|
|
10
|
-
import { instance } from '
|
|
11
|
-
import { batch } from '
|
|
12
|
-
import { materialReference } from '
|
|
13
|
-
import { positionLocal
|
|
14
|
-
import { skinningReference } from '
|
|
15
|
-
import { morphReference } from '
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
21
|
-
import
|
|
22
|
-
import {
|
|
23
|
-
import
|
|
24
|
-
import {
|
|
25
|
-
import { cameraLogDepth } from '../accessors/CameraNode.js';
|
|
26
|
-
import { clipping, clippingAlpha } from '../accessors/ClippingNode.js';
|
|
27
|
-
import { faceDirection } from '../display/FrontFacingNode.js';
|
|
4
|
+
import { getNodeChildren, getCacheKey } from '../../nodes/core/NodeUtils.js';
|
|
5
|
+
import { attribute } from '../../nodes/core/AttributeNode.js';
|
|
6
|
+
import { output, diffuseColor, emissive, varyingProperty } from '../../nodes/core/PropertyNode.js';
|
|
7
|
+
import { materialAlphaTest, materialColor, materialOpacity, materialEmissive, materialNormal, materialLightMap, materialAOMap } from '../../nodes/accessors/MaterialNode.js';
|
|
8
|
+
import { modelViewProjection } from '../../nodes/accessors/ModelViewProjectionNode.js';
|
|
9
|
+
import { normalLocal } from '../../nodes/accessors/Normal.js';
|
|
10
|
+
import { instance } from '../../nodes/accessors/InstanceNode.js';
|
|
11
|
+
import { batch } from '../../nodes/accessors/BatchNode.js';
|
|
12
|
+
import { materialReference } from '../../nodes/accessors/MaterialReferenceNode.js';
|
|
13
|
+
import { positionLocal } from '../../nodes/accessors/Position.js';
|
|
14
|
+
import { skinningReference } from '../../nodes/accessors/SkinningNode.js';
|
|
15
|
+
import { morphReference } from '../../nodes/accessors/MorphNode.js';
|
|
16
|
+
import { lights } from '../../nodes/lighting/LightsNode.js';
|
|
17
|
+
import { mix } from '../../nodes/math/MathNode.js';
|
|
18
|
+
import { float, vec3, vec4 } from '../../nodes/tsl/TSLBase.js';
|
|
19
|
+
import AONode from '../../nodes/lighting/AONode.js';
|
|
20
|
+
import { lightingContext } from '../../nodes/lighting/LightingContextNode.js';
|
|
21
|
+
import IrradianceNode from '../../nodes/lighting/IrradianceNode.js';
|
|
22
|
+
import { depth } from '../../nodes/display/ViewportDepthNode.js';
|
|
23
|
+
import { cameraLogDepth } from '../../nodes/accessors/Camera.js';
|
|
24
|
+
import { clipping, clippingAlpha } from '../../nodes/accessors/ClippingNode.js';
|
|
28
25
|
|
|
29
26
|
const NodeMaterials = new Map();
|
|
30
27
|
|
|
@@ -42,7 +39,6 @@ class NodeMaterial extends Material {
|
|
|
42
39
|
|
|
43
40
|
this.fog = true;
|
|
44
41
|
this.lights = false;
|
|
45
|
-
this.normals = true;
|
|
46
42
|
|
|
47
43
|
this.lightsNode = null;
|
|
48
44
|
this.envNode = null;
|
|
@@ -83,6 +79,8 @@ class NodeMaterial extends Material {
|
|
|
83
79
|
|
|
84
80
|
setup( builder ) {
|
|
85
81
|
|
|
82
|
+
builder.context.setupNormal = () => this.setupNormal( builder );
|
|
83
|
+
|
|
86
84
|
// < VERTEX STAGE >
|
|
87
85
|
|
|
88
86
|
builder.addStack();
|
|
@@ -103,8 +101,6 @@ class NodeMaterial extends Material {
|
|
|
103
101
|
|
|
104
102
|
if ( this.fragmentNode === null ) {
|
|
105
103
|
|
|
106
|
-
if ( this.normals === true ) this.setupNormal( builder );
|
|
107
|
-
|
|
108
104
|
this.setupDiffuseColor( builder );
|
|
109
105
|
this.setupVariants( builder );
|
|
110
106
|
|
|
@@ -208,11 +204,21 @@ class NodeMaterial extends Material {
|
|
|
208
204
|
|
|
209
205
|
let depthNode = this.depthNode;
|
|
210
206
|
|
|
211
|
-
if ( depthNode === null
|
|
207
|
+
if ( depthNode === null ) {
|
|
208
|
+
|
|
209
|
+
const mrt = renderer.getMRT();
|
|
210
|
+
|
|
211
|
+
if ( mrt && mrt.has( 'depth' ) ) {
|
|
212
|
+
|
|
213
|
+
depthNode = mrt.get( 'depth' );
|
|
214
|
+
|
|
215
|
+
} else if ( renderer.logarithmicDepthBuffer === true ) {
|
|
212
216
|
|
|
213
|
-
|
|
217
|
+
const fragDepth = modelViewProjection().w.add( 1 );
|
|
214
218
|
|
|
215
|
-
|
|
219
|
+
depthNode = fragDepth.log2().mul( cameraLogDepth ).mul( 0.5 );
|
|
220
|
+
|
|
221
|
+
}
|
|
216
222
|
|
|
217
223
|
}
|
|
218
224
|
|
|
@@ -304,6 +310,15 @@ class NodeMaterial extends Material {
|
|
|
304
310
|
|
|
305
311
|
}
|
|
306
312
|
|
|
313
|
+
if ( object.isBatchedMesh && object._colorsTexture ) {
|
|
314
|
+
|
|
315
|
+
const batchColor = varyingProperty( 'vec3', 'vBatchColor' );
|
|
316
|
+
|
|
317
|
+
colorNode = batchColor.mul( colorNode );
|
|
318
|
+
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
|
|
307
322
|
// COLOR
|
|
308
323
|
|
|
309
324
|
diffuseColor.assign( colorNode );
|
|
@@ -337,7 +352,6 @@ class NodeMaterial extends Material {
|
|
|
337
352
|
|
|
338
353
|
}
|
|
339
354
|
|
|
340
|
-
|
|
341
355
|
setupOutgoingLight() {
|
|
342
356
|
|
|
343
357
|
return ( this.lights === true ) ? vec3( 0 ) : diffuseColor.rgb;
|
|
@@ -346,25 +360,11 @@ class NodeMaterial extends Material {
|
|
|
346
360
|
|
|
347
361
|
setupNormal() {
|
|
348
362
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
if ( this.flatShading === true ) {
|
|
352
|
-
|
|
353
|
-
const normalNode = positionView.dFdx().cross( positionView.dFdy() ).normalize();
|
|
354
|
-
|
|
355
|
-
transformedNormalView.assign( normalNode.mul( faceDirection ) );
|
|
356
|
-
|
|
357
|
-
} else {
|
|
358
|
-
|
|
359
|
-
const normalNode = this.normalNode ? vec3( this.normalNode ) : materialNormal;
|
|
360
|
-
|
|
361
|
-
transformedNormalView.assign( normalNode.mul( faceDirection ) );
|
|
362
|
-
|
|
363
|
-
}
|
|
363
|
+
return this.normalNode ? vec3( this.normalNode ) : materialNormal;
|
|
364
364
|
|
|
365
365
|
}
|
|
366
366
|
|
|
367
|
-
setupEnvironment( builder ) {
|
|
367
|
+
setupEnvironment( /*builder*/ ) {
|
|
368
368
|
|
|
369
369
|
let node = null;
|
|
370
370
|
|
|
@@ -374,11 +374,7 @@ class NodeMaterial extends Material {
|
|
|
374
374
|
|
|
375
375
|
} else if ( this.envMap ) {
|
|
376
376
|
|
|
377
|
-
node = this.envMap.isCubeTexture ?
|
|
378
|
-
|
|
379
|
-
} else if ( builder.environmentNode ) {
|
|
380
|
-
|
|
381
|
-
node = builder.environmentNode;
|
|
377
|
+
node = this.envMap.isCubeTexture ? materialReference( 'envMap', 'cubeTexture' ) : materialReference( 'envMap', 'texture' );
|
|
382
378
|
|
|
383
379
|
}
|
|
384
380
|
|
|
@@ -434,7 +430,7 @@ class NodeMaterial extends Material {
|
|
|
434
430
|
|
|
435
431
|
if ( materialLightsNode.length > 0 ) {
|
|
436
432
|
|
|
437
|
-
lightsN =
|
|
433
|
+
lightsN = lights( [ ...lightsN.getLights(), ...materialLightsNode ] );
|
|
438
434
|
|
|
439
435
|
}
|
|
440
436
|
|
|
@@ -461,7 +457,7 @@ class NodeMaterial extends Material {
|
|
|
461
457
|
|
|
462
458
|
let outgoingLightNode = this.setupOutgoingLight( builder );
|
|
463
459
|
|
|
464
|
-
if ( lightsNode && lightsNode.
|
|
460
|
+
if ( lightsNode && lightsNode.getScope().getLights().length > 0 ) {
|
|
465
461
|
|
|
466
462
|
const lightingModel = this.setupLightingModel( builder );
|
|
467
463
|
|
|
@@ -624,50 +620,37 @@ class NodeMaterial extends Material {
|
|
|
624
620
|
|
|
625
621
|
}
|
|
626
622
|
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
if ( material.isNodeMaterial === true ) { // is already a node material
|
|
630
|
-
|
|
631
|
-
return material;
|
|
632
|
-
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
const type = material.type.replace( 'Material', 'NodeMaterial' );
|
|
636
|
-
|
|
637
|
-
const nodeMaterial = createNodeMaterialFromType( type );
|
|
623
|
+
}
|
|
638
624
|
|
|
639
|
-
|
|
625
|
+
export default NodeMaterial;
|
|
640
626
|
|
|
641
|
-
|
|
627
|
+
NodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( '', NodeMaterial );
|
|
642
628
|
|
|
643
|
-
|
|
629
|
+
export function registerNodeMaterial( type, nodeMaterialClass ) {
|
|
644
630
|
|
|
645
|
-
|
|
631
|
+
const suffix = 'NodeMaterial';
|
|
632
|
+
const nodeMaterialType = type + suffix;
|
|
646
633
|
|
|
647
|
-
|
|
634
|
+
if ( typeof nodeMaterialClass !== 'function' ) throw new Error( `THREE.Node: NodeMaterial class "${ type }" is not a class.` );
|
|
648
635
|
|
|
649
|
-
|
|
636
|
+
if ( NodeMaterials.has( nodeMaterialType ) ) {
|
|
650
637
|
|
|
651
|
-
|
|
638
|
+
console.warn( `THREE.Node: Redefinition of NodeMaterial class "${ nodeMaterialType }".` );
|
|
639
|
+
return;
|
|
652
640
|
|
|
653
641
|
}
|
|
654
642
|
|
|
655
|
-
|
|
643
|
+
if ( type.slice( - suffix.length ) === suffix ) {
|
|
656
644
|
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
export function addNodeMaterial( type, nodeMaterial ) {
|
|
660
|
-
|
|
661
|
-
if ( typeof nodeMaterial !== 'function' || ! type ) throw new Error( `Node material ${ type } is not a class` );
|
|
662
|
-
if ( NodeMaterials.has( type ) ) {
|
|
663
|
-
|
|
664
|
-
console.warn( `Redefinition of node material ${ type }` );
|
|
645
|
+
console.warn( `THREE.NodeMaterial: NodeMaterial class ${ nodeMaterialType } should not have '${ suffix }' suffix.` );
|
|
665
646
|
return;
|
|
666
647
|
|
|
667
648
|
}
|
|
668
649
|
|
|
669
|
-
NodeMaterials.set(
|
|
670
|
-
|
|
650
|
+
NodeMaterials.set( nodeMaterialType, nodeMaterialClass );
|
|
651
|
+
nodeMaterialClass.type = nodeMaterialType;
|
|
652
|
+
|
|
653
|
+
return nodeMaterialType;
|
|
671
654
|
|
|
672
655
|
}
|
|
673
656
|
|
|
@@ -682,5 +665,3 @@ export function createNodeMaterialFromType( type ) {
|
|
|
682
665
|
}
|
|
683
666
|
|
|
684
667
|
}
|
|
685
|
-
|
|
686
|
-
addNodeMaterial( 'NodeMaterial', NodeMaterial );
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @TODO: We can simplify "export { default as SomeNode, other, exports } from '...'" to just "export * from '...'" if we will use only named exports
|
|
2
2
|
|
|
3
|
-
export { default as NodeMaterial
|
|
3
|
+
export { default as NodeMaterial } from './NodeMaterial.js';
|
|
4
4
|
export { default as InstancedPointsNodeMaterial } from './InstancedPointsNodeMaterial.js';
|
|
5
5
|
export { default as LineBasicNodeMaterial } from './LineBasicNodeMaterial.js';
|
|
6
6
|
export { default as LineDashedNodeMaterial } from './LineDashedNodeMaterial.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import NodeMaterial, {
|
|
1
|
+
import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
|
|
2
2
|
|
|
3
|
-
import { PointsMaterial } from '
|
|
3
|
+
import { PointsMaterial } from '../PointsMaterial.js';
|
|
4
4
|
|
|
5
5
|
const _defaultValues = /*@__PURE__*/ new PointsMaterial();
|
|
6
6
|
|
|
@@ -13,7 +13,6 @@ class PointsNodeMaterial extends NodeMaterial {
|
|
|
13
13
|
this.isPointsNodeMaterial = true;
|
|
14
14
|
|
|
15
15
|
this.lights = false;
|
|
16
|
-
this.normals = false;
|
|
17
16
|
this.transparent = true;
|
|
18
17
|
|
|
19
18
|
this.sizeNode = null;
|
|
@@ -36,4 +35,4 @@ class PointsNodeMaterial extends NodeMaterial {
|
|
|
36
35
|
|
|
37
36
|
export default PointsNodeMaterial;
|
|
38
37
|
|
|
39
|
-
|
|
38
|
+
PointsNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'Points', PointsNodeMaterial );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import NodeMaterial, {
|
|
2
|
-
import ShadowMaskModel from '
|
|
1
|
+
import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
|
|
2
|
+
import ShadowMaskModel from '../../nodes/functions/ShadowMaskModel.js';
|
|
3
3
|
|
|
4
|
-
import { ShadowMaterial } from '
|
|
4
|
+
import { ShadowMaterial } from '../ShadowMaterial.js';
|
|
5
5
|
|
|
6
6
|
const _defaultValues = /*@__PURE__*/ new ShadowMaterial();
|
|
7
7
|
|
|
@@ -31,4 +31,4 @@ class ShadowNodeMaterial extends NodeMaterial {
|
|
|
31
31
|
|
|
32
32
|
export default ShadowNodeMaterial;
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
ShadowNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'Shadow', ShadowNodeMaterial );
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import NodeMaterial, {
|
|
2
|
-
import { uniform } from '
|
|
3
|
-
import { cameraProjectionMatrix } from '
|
|
4
|
-
import { materialRotation } from '
|
|
5
|
-
import { modelViewMatrix, modelWorldMatrix } from '
|
|
6
|
-
import { positionLocal } from '
|
|
7
|
-
import {
|
|
1
|
+
import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
|
|
2
|
+
import { uniform } from '../../nodes/core/UniformNode.js';
|
|
3
|
+
import { cameraProjectionMatrix } from '../../nodes/accessors/Camera.js';
|
|
4
|
+
import { materialRotation } from '../../nodes/accessors/MaterialNode.js';
|
|
5
|
+
import { modelViewMatrix, modelWorldMatrix } from '../../nodes/accessors/ModelNode.js';
|
|
6
|
+
import { positionLocal } from '../../nodes/accessors/Position.js';
|
|
7
|
+
import { rotate } from '../../nodes/utils/RotateNode.js';
|
|
8
|
+
import { float, vec2, vec3, vec4 } from '../../nodes/tsl/TSLBase.js';
|
|
8
9
|
|
|
9
|
-
import { SpriteMaterial } from '
|
|
10
|
+
import { SpriteMaterial } from '../SpriteMaterial.js';
|
|
10
11
|
|
|
11
12
|
const _defaultValues = /*@__PURE__*/ new SpriteMaterial();
|
|
12
13
|
|
|
@@ -19,7 +20,6 @@ class SpriteNodeMaterial extends NodeMaterial {
|
|
|
19
20
|
this.isSpriteNodeMaterial = true;
|
|
20
21
|
|
|
21
22
|
this.lights = false;
|
|
22
|
-
this.normals = false;
|
|
23
23
|
|
|
24
24
|
this.positionNode = null;
|
|
25
25
|
this.rotationNode = null;
|
|
@@ -61,7 +61,7 @@ class SpriteNodeMaterial extends NodeMaterial {
|
|
|
61
61
|
|
|
62
62
|
const rotation = float( rotationNode || materialRotation );
|
|
63
63
|
|
|
64
|
-
const rotatedPosition =
|
|
64
|
+
const rotatedPosition = rotate( alignedPosition, rotation );
|
|
65
65
|
|
|
66
66
|
mvPosition = vec4( mvPosition.xy.add( rotatedPosition ), mvPosition.zw );
|
|
67
67
|
|
|
@@ -87,4 +87,4 @@ class SpriteNodeMaterial extends NodeMaterial {
|
|
|
87
87
|
|
|
88
88
|
export default SpriteNodeMaterial;
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
SpriteNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'Sprite', SpriteNodeMaterial );
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import NodeMaterial, {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { texture3D } from '../accessors/Texture3DNode.js';
|
|
1
|
+
import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
|
|
2
|
+
import { property } from '../../nodes/core/PropertyNode.js';
|
|
3
|
+
import { materialReference } from '../../nodes/accessors/MaterialReferenceNode.js';
|
|
4
|
+
import { modelWorldMatrixInverse } from '../../nodes/accessors/ModelNode.js';
|
|
5
|
+
import { cameraPosition } from '../../nodes/accessors/Camera.js';
|
|
6
|
+
import { positionGeometry } from '../../nodes/accessors/Position.js';
|
|
7
|
+
import { Fn, varying, vec2, vec3, vec4 } from '../../nodes/tsl/TSLBase.js';
|
|
8
|
+
import { min, max } from '../../nodes/math/MathNode.js';
|
|
9
|
+
import { Loop, Break } from '../../nodes/utils/LoopNode.js';
|
|
10
|
+
import { texture3D } from '../../nodes/accessors/Texture3DNode.js';
|
|
12
11
|
|
|
13
12
|
class VolumeNodeMaterial extends NodeMaterial {
|
|
14
13
|
|
|
@@ -16,7 +15,6 @@ class VolumeNodeMaterial extends NodeMaterial {
|
|
|
16
15
|
|
|
17
16
|
super();
|
|
18
17
|
|
|
19
|
-
this.normals = false;
|
|
20
18
|
this.lights = false;
|
|
21
19
|
this.isVolumeNodeMaterial = true;
|
|
22
20
|
this.testNode = null;
|
|
@@ -29,7 +27,7 @@ class VolumeNodeMaterial extends NodeMaterial {
|
|
|
29
27
|
|
|
30
28
|
const map = texture3D( this.map, null, 0 );
|
|
31
29
|
|
|
32
|
-
const hitBox =
|
|
30
|
+
const hitBox = Fn( ( { orig, dir } ) => {
|
|
33
31
|
|
|
34
32
|
const box_min = vec3( - 0.5 );
|
|
35
33
|
const box_max = vec3( 0.5 );
|
|
@@ -49,7 +47,7 @@ class VolumeNodeMaterial extends NodeMaterial {
|
|
|
49
47
|
|
|
50
48
|
} );
|
|
51
49
|
|
|
52
|
-
this.fragmentNode =
|
|
50
|
+
this.fragmentNode = Fn( () => {
|
|
53
51
|
|
|
54
52
|
const vOrigin = varying( vec3( modelWorldMatrixInverse.mul( vec4( cameraPosition, 1.0 ) ) ) );
|
|
55
53
|
const vDirection = varying( positionGeometry.sub( vOrigin ) );
|
|
@@ -69,7 +67,7 @@ class VolumeNodeMaterial extends NodeMaterial {
|
|
|
69
67
|
|
|
70
68
|
const ac = property( 'vec4', 'ac' ).assign( vec4( materialReference( 'base', 'color' ), 0.0 ) );
|
|
71
69
|
|
|
72
|
-
|
|
70
|
+
Loop( { type: 'float', start: bounds.x, end: bounds.y, update: '+= delta' }, () => {
|
|
73
71
|
|
|
74
72
|
const d = property( 'float', 'd' ).assign( map.uv( p.add( 0.5 ) ).r );
|
|
75
73
|
|
|
@@ -103,4 +101,4 @@ class VolumeNodeMaterial extends NodeMaterial {
|
|
|
103
101
|
|
|
104
102
|
export default VolumeNodeMaterial;
|
|
105
103
|
|
|
106
|
-
|
|
104
|
+
VolumeNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'Volume', VolumeNodeMaterial );
|