diff --git a/build/three.core.js b/build/three.core.js index 7a5c71f5e01a74..ce0ce4330b7d19 100644 --- a/build/three.core.js +++ b/build/three.core.js @@ -1715,6 +1715,18 @@ const Compatibility = { TEXTURE_COMPARE: 'depthTextureCompare' }; +/** + * Represents the refresh types of render objects. + * + * @type {ConstantsRenderObjectRefreshType} + * @constant + */ +const RenderObjectRefreshType = { + NONE: 0, + SHARED: 1, + FULL: 2 +}; + /** * This type represents mouse buttons and interaction types in context of controls. * @@ -1765,6 +1777,15 @@ const Compatibility = { * @property {string} EITHER - Flat interpolation using either vertex. */ +/** + * Represents the refresh types of render objects. + * + * @typedef {Object} ConstantsRenderObjectRefreshType + * @property {number} NONE - No refresh required. + * @property {number} SHARED - Only shared uniform buffers require an update. + * @property {number} FULL - The render object requires a full refresh. + */ + /** * Checks if an array contains values that require Uint32 representation. * @@ -26210,7 +26231,7 @@ class FrustumArray { /** * Copies the values of the given frustum array to this instance. * - * @param {FrustumArray} frustumArray - The frustum array to copy. + * @param {FrustumArray} source - The frustum array to copy. * @return {FrustumArray} A reference to this frustum array. */ copy( source ) { @@ -60430,4 +60451,4 @@ if ( typeof window !== 'undefined' ) { } -export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CineonToneMapping, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, ColorManagement, Compatibility, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, ConstantAlphaFactor, ConstantColorFactor, Controls, CubeCamera, CubeDepthTexture, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry, Cylindrical, Data3DTexture, DataArrayTexture, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExternalTexture, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, FrustumArray, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HTMLTexture, HalfFloatType, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialBlending, MaterialLoader, MathUtils, Matrix2, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoNormalPacking, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NormalGAPacking, NormalRGPacking, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, Path, PerspectiveCamera, Plane, PlaneGeometry, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, R11_EAC_Format, RAD2DEG, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RG11_EAC_Format, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBDepthPacking, RGBFormat, RGBIntegerFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGDepthPacking, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderTarget, RenderTarget3D, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, ReversedDepthFuncs, RingGeometry, SIGNED_R11_EAC_Format, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SIGNED_RG11_EAC_Format, SRGBColorSpace, SRGBTransfer, Scene, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry, Texture, TextureLoader, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsUtils, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLRenderTarget, WebGPUCoordinateSystem, WebXRController, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, cloneUniforms, createCanvasElement, createElementNS, error, getByteLength, getConsoleFunction, getUnlitUniformColorSpace, isTypedArray, log, mergeUniforms, probeAsync, setConsoleFunction, warn, warnOnce, yieldToMain }; +export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CineonToneMapping, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, ColorManagement, Compatibility, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, ConstantAlphaFactor, ConstantColorFactor, Controls, CubeCamera, CubeDepthTexture, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry, Cylindrical, Data3DTexture, DataArrayTexture, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExternalTexture, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, FrustumArray, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HTMLTexture, HalfFloatType, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialBlending, MaterialLoader, MathUtils, Matrix2, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoNormalPacking, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NormalGAPacking, NormalRGPacking, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, Path, PerspectiveCamera, Plane, PlaneGeometry, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, R11_EAC_Format, RAD2DEG, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RG11_EAC_Format, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBDepthPacking, RGBFormat, RGBIntegerFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGDepthPacking, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderObjectRefreshType, RenderTarget, RenderTarget3D, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, ReversedDepthFuncs, RingGeometry, SIGNED_R11_EAC_Format, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SIGNED_RG11_EAC_Format, SRGBColorSpace, SRGBTransfer, Scene, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry, Texture, TextureLoader, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsUtils, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLRenderTarget, WebGPUCoordinateSystem, WebXRController, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, cloneUniforms, createCanvasElement, createElementNS, error, getByteLength, getConsoleFunction, getUnlitUniformColorSpace, isTypedArray, log, mergeUniforms, probeAsync, setConsoleFunction, warn, warnOnce, yieldToMain }; diff --git a/build/three.module.js b/build/three.module.js index 4618de7be13afe..15315555085096 100644 --- a/build/three.module.js +++ b/build/three.module.js @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT */ import { Matrix3, Vector2, Color, Vector3, mergeUniforms, CubeUVReflectionMapping, Mesh, BoxGeometry, ShaderMaterial, BackSide, cloneUniforms, Matrix4, ColorManagement, SRGBTransfer, PlaneGeometry, FrontSide, getUnlitUniformColorSpace, IntType, warn, HalfFloatType, UnsignedByteType, FloatType, RGBAFormat, Plane, CubeReflectionMapping, CubeRefractionMapping, BufferGeometry, OrthographicCamera, PerspectiveCamera, NoToneMapping, MeshBasicMaterial, NoBlending, WebGLRenderTarget, BufferAttribute, LinearSRGBColorSpace, LinearFilter, CubeTexture, LinearMipmapLinearFilter, CubeCamera, EquirectangularReflectionMapping, EquirectangularRefractionMapping, warnOnce, Uint32BufferAttribute, Uint16BufferAttribute, error, DataArrayTexture, Vector4, Float32BufferAttribute, RawShaderMaterial, CustomToneMapping, NeutralToneMapping, AgXToneMapping, ACESFilmicToneMapping, CineonToneMapping, ReinhardToneMapping, LinearToneMapping, Data3DTexture, GreaterEqualCompare, LessEqualCompare, DepthTexture, Texture, GLSL3, VSMShadowMap, PCFShadowMap, AddOperation, MixOperation, MultiplyOperation, LinearTransfer, UniformsUtils, DoubleSide, NormalBlending, TangentSpaceNormalMap, ObjectSpaceNormalMap, Layers, RGFormat, RG11_EAC_Format, RED_GREEN_RGTC2_Format, MeshDepthMaterial, MeshDistanceMaterial, PCFSoftShadowMap, DepthFormat, NearestFilter, CubeDepthTexture, UnsignedIntType, Frustum, LessEqualDepth, ReverseSubtractEquation, SubtractEquation, AddEquation, OneMinusConstantAlphaFactor, ConstantAlphaFactor, OneMinusConstantColorFactor, ConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, DstAlphaFactor, DstColorFactor, SrcAlphaSaturateFactor, SrcAlphaFactor, SrcColorFactor, OneFactor, ZeroFactor, NotEqualDepth, GreaterDepth, GreaterEqualDepth, EqualDepth, LessDepth, AlwaysDepth, NeverDepth, CullFaceNone, CullFaceBack, CullFaceFront, CustomBlending, MultiplyBlending, SubtractiveBlending, AdditiveBlending, ReversedDepthFuncs, MinEquation, MaxEquation, MirroredRepeatWrapping, ClampToEdgeWrapping, RepeatWrapping, LinearMipmapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NotEqualCompare, GreaterCompare, EqualCompare, LessCompare, AlwaysCompare, NeverCompare, NoColorSpace, DepthStencilFormat, getByteLength, UnsignedInt248Type, UnsignedShortType, createElementNS, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedInt5999Type, UnsignedInt101111Type, ByteType, ShortType, AlphaFormat, RGBFormat, RedFormat, RedIntegerFormat, RGIntegerFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, R11_EAC_Format, SIGNED_R11_EAC_Format, SIGNED_RG11_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, SIGNED_RED_GREEN_RGTC2_Format, ExternalTexture, EventDispatcher, ArrayCamera, WebXRController, RAD2DEG, DataTexture, createCanvasElement, SRGBColorSpace, REVISION, log, WebGLCoordinateSystem, probeAsync } from './three.core.js'; -export { AdditiveAnimationBlendMode, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BasicDepthPacking, BasicShadowMap, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxHelper, BufferGeometryLoader, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CircleGeometry, Clock, ColorKeyframeTrack, Compatibility, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, Controls, CubeTextureLoader, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceFrontBack, Curve, CurvePath, CylinderGeometry, Cylindrical, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualStencilFunc, Euler, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Fog, FogExp2, FramebufferTexture, FrustumArray, GLBufferAttribute, GLSL1, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HTMLTexture, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialBlending, MaterialLoader, MathUtils, Matrix2, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NeverStencilFunc, NoNormalPacking, NormalAnimationBlendMode, NormalGAPacking, NormalRGPacking, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, OctahedronGeometry, Path, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RGBADepthPacking, RGBDepthPacking, RGBIntegerFormat, RGDepthPacking, Ray, Raycaster, RectAreaLight, RenderTarget, RenderTarget3D, ReplaceStencilOp, RingGeometry, Scene, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, TOUCH, TetrahedronGeometry, TextureLoader, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroSlopeEnding, ZeroStencilOp, getConsoleFunction, setConsoleFunction } from './three.core.js'; +export { AdditiveAnimationBlendMode, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BasicDepthPacking, BasicShadowMap, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxHelper, BufferGeometryLoader, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CircleGeometry, Clock, ColorKeyframeTrack, Compatibility, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, Controls, CubeTextureLoader, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceFrontBack, Curve, CurvePath, CylinderGeometry, Cylindrical, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualStencilFunc, Euler, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Fog, FogExp2, FramebufferTexture, FrustumArray, GLBufferAttribute, GLSL1, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HTMLTexture, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialBlending, MaterialLoader, MathUtils, Matrix2, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NeverStencilFunc, NoNormalPacking, NormalAnimationBlendMode, NormalGAPacking, NormalRGPacking, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, OctahedronGeometry, Path, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RGBADepthPacking, RGBDepthPacking, RGBIntegerFormat, RGDepthPacking, Ray, Raycaster, RectAreaLight, RenderObjectRefreshType, RenderTarget, RenderTarget3D, ReplaceStencilOp, RingGeometry, Scene, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, TOUCH, TetrahedronGeometry, TextureLoader, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroSlopeEnding, ZeroStencilOp, getConsoleFunction, setConsoleFunction } from './three.core.js'; function WebGLAnimation() { diff --git a/build/three.webgpu.js b/build/three.webgpu.js index d77665149cbeed..b355f8870290c2 100644 --- a/build/three.webgpu.js +++ b/build/three.webgpu.js @@ -3,7 +3,7 @@ * Copyright 2010-2026 Three.js Authors * SPDX-License-Identifier: MIT */ -import { Color, Vector2, Vector3, Vector4, Matrix2, Matrix3, Matrix4, UnsignedIntType, IntType, error, RedFormat, RedIntegerFormat, DepthFormat, DepthStencilFormat, AlphaFormat, RGFormat, RGIntegerFormat, RGBFormat, RGBIntegerFormat, EventDispatcher, MathUtils, warn, WebGLCoordinateSystem, WebGPUCoordinateSystem, ColorManagement, SRGBTransfer, NoToneMapping, StaticDrawUsage, InterleavedBufferAttribute, InterleavedBuffer, DynamicDrawUsage, NoColorSpace, log as log$1, warnOnce, Texture, Compatibility, LessCompare, LessEqualCompare, GreaterCompare, GreaterEqualCompare, NearestFilter, Sphere, BackSide, DoubleSide, CubeTexture, CubeReflectionMapping, CubeRefractionMapping, TangentSpaceNormalMap, NoNormalPacking, NormalRGPacking, NormalGAPacking, ObjectSpaceNormalMap, RED_GREEN_RGTC2_Format, RG11_EAC_Format, InstancedBufferAttribute, InstancedInterleavedBuffer, DataTexture, DataArrayTexture, FloatType, FramebufferTexture, LinearMipmapLinearFilter, DepthTexture, Material, LineBasicMaterial, LineDashedMaterial, NoBlending, MeshNormalMaterial, SRGBColorSpace, RenderTarget, BoxGeometry, Mesh, Scene, LinearFilter, CubeCamera, EquirectangularReflectionMapping, EquirectangularRefractionMapping, AddOperation, MixOperation, MultiplyOperation, MeshBasicMaterial, MeshLambertMaterial, MeshPhongMaterial, HalfFloatType, ClampToEdgeWrapping, BufferGeometry, OrthographicCamera, PerspectiveCamera, LinearSRGBColorSpace, RGBAFormat, CubeUVReflectionMapping, BufferAttribute, MeshStandardMaterial, MeshPhysicalMaterial, MeshToonMaterial, MeshMatcapMaterial, SpriteMaterial, PointsMaterial, ShadowMaterial, Uint32BufferAttribute, Uint16BufferAttribute, ByteType, UnsignedByteType, ShortType, UnsignedShortType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedInt101111Type, NormalBlending, SrcAlphaFactor, OneMinusSrcAlphaFactor, AddEquation, MaterialBlending, Object3D, LinearMipMapLinearFilter, Plane, Float32BufferAttribute, UVMapping, PCFShadowMap, VSMShadowMap, BasicShadowMap, CubeDepthTexture, SphereGeometry, LinearMipmapNearestFilter, NearestMipmapLinearFilter, Float16BufferAttribute, yieldToMain, REVISION, ArrayCamera, PlaneGeometry, FrontSide, CustomBlending, ZeroFactor, CylinderGeometry, Quaternion, WebXRController, RAD2DEG, PCFSoftShadowMap, FrustumArray, Frustum, RGBAIntegerFormat, TimestampQuery, createCanvasElement, MaxEquation, MinEquation, ReverseSubtractEquation, SubtractEquation, OneMinusConstantAlphaFactor, ConstantAlphaFactor, OneMinusConstantColorFactor, ConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcColorFactor, DstAlphaFactor, DstColorFactor, SrcAlphaSaturateFactor, SrcColorFactor, OneFactor, CullFaceNone, CullFaceBack, CullFaceFront, MultiplyBlending, SubtractiveBlending, AdditiveBlending, NotEqualDepth, GreaterDepth, GreaterEqualDepth, EqualDepth, LessEqualDepth, LessDepth, AlwaysDepth, NeverDepth, ReversedDepthFuncs, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, R11_EAC_Format, SIGNED_R11_EAC_Format, SIGNED_RG11_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, SIGNED_RED_GREEN_RGTC2_Format, MirroredRepeatWrapping, RepeatWrapping, NearestMipmapNearestFilter, NotEqualCompare, EqualCompare, AlwaysCompare, NeverCompare, LinearTransfer, getByteLength, isTypedArray, NotEqualStencilFunc, GreaterStencilFunc, GreaterEqualStencilFunc, EqualStencilFunc, LessEqualStencilFunc, LessStencilFunc, AlwaysStencilFunc, NeverStencilFunc, DecrementWrapStencilOp, IncrementWrapStencilOp, DecrementStencilOp, IncrementStencilOp, InvertStencilOp, ReplaceStencilOp, ZeroStencilOp, KeepStencilOp, SpotLight, PointLight, DirectionalLight, RectAreaLight, AmbientLight, HemisphereLight, LightProbe, LinearToneMapping, ReinhardToneMapping, CineonToneMapping, ACESFilmicToneMapping, AgXToneMapping, NeutralToneMapping, Group, Loader, FileLoader, MaterialLoader, ObjectLoader } from './three.core.js'; +import { DynamicDrawUsage, RenderObjectRefreshType, Color, Vector2, Vector3, Vector4, Matrix2, Matrix3, Matrix4, UnsignedIntType, IntType, error, RedFormat, RedIntegerFormat, DepthFormat, DepthStencilFormat, AlphaFormat, RGFormat, RGIntegerFormat, RGBFormat, RGBIntegerFormat, EventDispatcher, MathUtils, warn, WebGLCoordinateSystem, WebGPUCoordinateSystem, ColorManagement, SRGBTransfer, NoToneMapping, StaticDrawUsage, InterleavedBufferAttribute, InterleavedBuffer, NoColorSpace, log as log$1, warnOnce, Texture, Compatibility, LessCompare, LessEqualCompare, GreaterCompare, GreaterEqualCompare, NearestFilter, Sphere, BackSide, DoubleSide, CubeTexture, CubeReflectionMapping, CubeRefractionMapping, TangentSpaceNormalMap, NoNormalPacking, NormalRGPacking, NormalGAPacking, ObjectSpaceNormalMap, RED_GREEN_RGTC2_Format, RG11_EAC_Format, InstancedBufferAttribute, InstancedInterleavedBuffer, DataTexture, DataArrayTexture, FloatType, FramebufferTexture, LinearMipmapLinearFilter, DepthTexture, Material, LineBasicMaterial, LineDashedMaterial, NoBlending, MeshNormalMaterial, SRGBColorSpace, RenderTarget, BoxGeometry, Mesh, Scene, LinearFilter, CubeCamera, EquirectangularReflectionMapping, EquirectangularRefractionMapping, AddOperation, MixOperation, MultiplyOperation, MeshBasicMaterial, MeshLambertMaterial, MeshPhongMaterial, HalfFloatType, ClampToEdgeWrapping, BufferGeometry, OrthographicCamera, PerspectiveCamera, LinearSRGBColorSpace, RGBAFormat, CubeUVReflectionMapping, BufferAttribute, MeshStandardMaterial, MeshPhysicalMaterial, MeshToonMaterial, MeshMatcapMaterial, SpriteMaterial, PointsMaterial, ShadowMaterial, Uint32BufferAttribute, Uint16BufferAttribute, ByteType, UnsignedByteType, ShortType, UnsignedShortType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedInt101111Type, NormalBlending, SrcAlphaFactor, OneMinusSrcAlphaFactor, AddEquation, MaterialBlending, Object3D, LinearMipMapLinearFilter, Plane, Float32BufferAttribute, UVMapping, PCFShadowMap, VSMShadowMap, BasicShadowMap, CubeDepthTexture, SphereGeometry, LinearMipmapNearestFilter, NearestMipmapLinearFilter, Float16BufferAttribute, yieldToMain, REVISION, ArrayCamera, PlaneGeometry, FrontSide, CustomBlending, ZeroFactor, CylinderGeometry, Quaternion, WebXRController, RAD2DEG, PCFSoftShadowMap, FrustumArray, Frustum, RGBAIntegerFormat, TimestampQuery, createCanvasElement, MaxEquation, MinEquation, ReverseSubtractEquation, SubtractEquation, OneMinusConstantAlphaFactor, ConstantAlphaFactor, OneMinusConstantColorFactor, ConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcColorFactor, DstAlphaFactor, DstColorFactor, SrcAlphaSaturateFactor, SrcColorFactor, OneFactor, CullFaceNone, CullFaceBack, CullFaceFront, MultiplyBlending, SubtractiveBlending, AdditiveBlending, NotEqualDepth, GreaterDepth, GreaterEqualDepth, EqualDepth, LessEqualDepth, LessDepth, AlwaysDepth, NeverDepth, ReversedDepthFuncs, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, R11_EAC_Format, SIGNED_R11_EAC_Format, SIGNED_RG11_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, SIGNED_RED_GREEN_RGTC2_Format, MirroredRepeatWrapping, RepeatWrapping, NearestMipmapNearestFilter, NotEqualCompare, EqualCompare, AlwaysCompare, NeverCompare, LinearTransfer, getByteLength, isTypedArray, NotEqualStencilFunc, GreaterStencilFunc, GreaterEqualStencilFunc, EqualStencilFunc, LessEqualStencilFunc, LessStencilFunc, AlwaysStencilFunc, NeverStencilFunc, DecrementWrapStencilOp, IncrementWrapStencilOp, DecrementStencilOp, IncrementStencilOp, InvertStencilOp, ReplaceStencilOp, ZeroStencilOp, KeepStencilOp, SpotLight, PointLight, DirectionalLight, RectAreaLight, AmbientLight, HemisphereLight, LightProbe, LinearToneMapping, ReinhardToneMapping, CineonToneMapping, ACESFilmicToneMapping, AgXToneMapping, NeutralToneMapping, Group, Loader, FileLoader, MaterialLoader, ObjectLoader } from './three.core.js'; export { AdditiveAnimationBlendMode, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BasicDepthPacking, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxHelper, BufferGeometryLoader, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CircleGeometry, Clock, ColorKeyframeTrack, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, Controls, CubeTextureLoader, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceFrontBack, Curve, CurvePath, CustomToneMapping, Cylindrical, Data3DTexture, DataTextureLoader, DataUtils, DefaultLoadingManager, DetachedBindMode, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DynamicCopyUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, Euler, ExternalTexture, ExtrudeGeometry, Fog, FogExp2, GLBufferAttribute, GLSL1, GLSL3, GridHelper, HTMLTexture, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, InstancedBufferGeometry, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, KeyframeTrack, LOD, LatheGeometry, Layers, Light, Line, Line3, LineCurve, LineCurve3, LineLoop, LineSegments, LinearInterpolant, LinearMipMapNearestFilter, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, MeshDepthMaterial, MeshDistanceMaterial, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NormalAnimationBlendMode, NumberKeyframeTrack, OctahedronGeometry, Path, PlaneHelper, PointLightHelper, Points, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RGBADepthPacking, RGBDepthPacking, RGDepthPacking, RawShaderMaterial, Ray, Raycaster, RenderTarget3D, RingGeometry, ShaderMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, Skeleton, SkeletonHelper, SkinnedMesh, Source, Spherical, SphericalHarmonics3, SplineCurve, SpotLightHelper, Sprite, StaticCopyUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, TOUCH, TetrahedronGeometry, TextureLoader, TextureUtils, Timer, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLRenderTarget, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroSlopeEnding, getConsoleFunction, setConsoleFunction } from './three.core.js'; const refreshUniforms = [ @@ -17,28 +17,36 @@ const refreshUniforms = [ 'attenuationColor', 'attenuationDistance', 'bumpMap', + 'bumpScale', 'clearcoat', 'clearcoatMap', 'clearcoatNormalMap', 'clearcoatNormalScale', 'clearcoatRoughness', 'color', + 'dashOffset', + 'dashSize', 'dispersion', + 'displacementBias', 'displacementMap', + 'displacementScale', 'emissive', 'emissiveIntensity', 'emissiveMap', 'envMap', 'envMapIntensity', 'envMapRotation', + 'gapSize', 'gradientMap', 'ior', 'iridescence', 'iridescenceIOR', 'iridescenceMap', + 'iridescenceThickness', 'iridescenceThicknessMap', 'lightMap', 'lightMapIntensity', + 'linewidth', 'map', 'matcap', 'metalness', @@ -46,20 +54,26 @@ const refreshUniforms = [ 'normalMap', 'normalScale', 'opacity', + 'reflectivity', 'retroreflectivity', + 'rotation', 'roughness', 'roughnessMap', + 'scale', 'sheen', 'sheenColor', 'sheenColorMap', + 'sheenRoughness', 'sheenRoughnessMap', 'shininess', + 'size', 'specular', 'specularColor', 'specularColorMap', 'specularIntensity', 'specularIntensityMap', 'specularMap', + 'steps', 'thickness', 'transmission', 'transmissionMap' @@ -166,6 +180,20 @@ class NodeMaterialObserver { } + /** + * Returns `true` if the given 3D object uses instance buffers with dynamic draw usage. + * Such buffers must be uploaded once per render so the render object requires a full refresh. + * + * @param {Object3D} object - The 3D object. + * @return {boolean} Whether the given 3D object uses instance buffers with dynamic draw usage or not. + */ + hasDynamicInstancing( object ) { + + return object.isInstancedMesh === true && ( object.instanceMatrix.usage === DynamicDrawUsage || + ( object.instanceColor !== null && object.instanceColor.usage === DynamicDrawUsage ) ); + + } + /** * Returns `true` if the current rendering produces motion vectors. * @@ -213,6 +241,22 @@ class NodeMaterialObserver { } + if ( object.isInstancedMesh === true ) { + + data.instanceMatrixVersion = object.instanceMatrix.version; + data.instanceColorVersion = object.instanceColor !== null ? object.instanceColor.version : null; + data.morphTextureVersion = object.morphTexture !== null ? object.morphTexture.version : null; + + } + + if ( object.isBatchedMesh === true ) { + + data.matricesTextureVersion = object._matricesTexture.version; + data.colorsTextureVersion = object._colorsTexture !== null ? object._colorsTexture.version : null; + data.indirectTextureVersion = object._indirectTexture.version; + + } + if ( renderObject.bundle !== null ) { data.version = renderObject.bundle.version; @@ -607,6 +651,47 @@ class NodeMaterialObserver { } + // instancing + + if ( object.isInstancedMesh === true ) { + + const instanceColorVersion = object.instanceColor !== null ? object.instanceColor.version : null; + const morphTextureVersion = object.morphTexture !== null ? object.morphTexture.version : null; + + if ( renderObjectData.instanceMatrixVersion !== object.instanceMatrix.version || + renderObjectData.instanceColorVersion !== instanceColorVersion || + renderObjectData.morphTextureVersion !== morphTextureVersion ) { + + renderObjectData.instanceMatrixVersion = object.instanceMatrix.version; + renderObjectData.instanceColorVersion = instanceColorVersion; + renderObjectData.morphTextureVersion = morphTextureVersion; + + return false; + + } + + } + + // batching + + if ( object.isBatchedMesh === true ) { + + const colorsTextureVersion = object._colorsTexture !== null ? object._colorsTexture.version : null; + + if ( renderObjectData.matricesTextureVersion !== object._matricesTexture.version || + renderObjectData.colorsTextureVersion !== colorsTextureVersion || + renderObjectData.indirectTextureVersion !== object._indirectTexture.version ) { + + renderObjectData.matricesTextureVersion = object._matricesTexture.version; + renderObjectData.colorsTextureVersion = colorsTextureVersion; + renderObjectData.indirectTextureVersion = object._indirectTexture.version; + + return false; + + } + + } + // lights if ( renderObjectData.lights ) { @@ -729,16 +814,16 @@ class NodeMaterialObserver { * * @param {RenderObject} renderObject - The render object. * @param {NodeFrame} nodeFrame - The current node frame. - * @return {boolean} Whether the given render object requires a refresh or not. + * @return {number} The refresh type, see {@link RenderObjectRefreshType}. */ needsRefresh( renderObject, nodeFrame ) { - if ( this.hasNode || this.hasAnimation || this.firstInitialization( renderObject ) || this.needsVelocity( nodeFrame.renderer ) ) - return true; + if ( this.hasNode || this.hasAnimation || this.hasDynamicInstancing( renderObject.object ) || this.firstInitialization( renderObject ) || this.needsVelocity( nodeFrame.renderer ) ) + return RenderObjectRefreshType.FULL; const { renderId } = nodeFrame; - let force = false; + let refreshType = RenderObjectRefreshType.NONE; // shared UBOs are potentially never updated when objects don't change. Below block // make sure these UBOs are updated at least once. @@ -747,9 +832,9 @@ class NodeMaterialObserver { this.renderId = renderId; - // no early out here. instead, force the render object to use the equals() code path so its internal cache state gets synched + // no early out here. instead, use the equals() code path below so the internal cache state gets synched - force = true; + refreshType = RenderObjectRefreshType.SHARED; } @@ -757,12 +842,17 @@ class NodeMaterialObserver { const isBundle = renderObject.bundle !== null && renderObject.bundle.static === true && this.getRenderObjectData( renderObject ).version === renderObject.bundle.version; if ( isStatic || isBundle ) - return force; + return refreshType; const lightsData = this.getLights( renderObject.lightsNode, renderId ); - const notEqual = this.equals( renderObject, lightsData, renderId ) !== true; - return ( force || notEqual ); + if ( this.equals( renderObject, lightsData, renderId ) === false ) { + + refreshType = RenderObjectRefreshType.FULL; + + } + + return refreshType; } @@ -14154,15 +14244,15 @@ class ScreenNode extends Node { if ( scope === ScreenNode.SIZE ) { - output = uniform( _screenSizeVec || ( _screenSizeVec = new Vector2() ) ); + output = uniform( _screenSizeVec || ( _screenSizeVec = new Vector2() ) ).setGroup( renderGroup ); } else if ( scope === ScreenNode.VIEWPORT ) { - output = uniform( _viewportVec || ( _viewportVec = new Vector4() ) ); + output = uniform( _viewportVec || ( _viewportVec = new Vector4() ) ).setGroup( renderGroup ); } else if ( scope === ScreenNode.DPR ) { - output = uniform( 1 ); + output = uniform( 1 ).setGroup( renderGroup ); } else { @@ -18629,10 +18719,10 @@ const instance = /*@__PURE__*/ Fn( ( [ matrices, colors = null ], builder ) => { } - // Synchronization of dynamic buffer updates per frame + // Synchronization of dynamic buffer updates per frame. if ( interleavedMatrix !== null || interleavedColor !== null ) { - OnFrameUpdate( () => { + OnBeforeFrameUpdate( () => { if ( interleavedMatrix !== null && interleavedMatrix.version !== matrices.version ) { @@ -24082,7 +24172,7 @@ class PhongLightingModel extends BasicLightingModel { } /** - * Implements the direct lighting. The specular portion is optional an can be controlled + * Implements the direct lighting. The specular portion is optional and can be controlled * with the {@link PhongLightingModel#specular} flag. * * @param {Object} lightData - The light data. @@ -29120,7 +29210,7 @@ class PointsNodeMaterial extends SpriteNodeMaterial { } -const scale = /*@__PURE__*/ uniform( 1 ).onFrameUpdate( function ( { renderer } ) { +const scale = /*@__PURE__*/ uniform( 1 ).setGroup( renderGroup ).onRenderUpdate( function ( { renderer } ) { const size = renderer.getSize( _size$4 ); // logical units @@ -33005,6 +33095,43 @@ class Bindings extends DataMap { } + /** + * Updates only the shared uniform buffers of the given render object. + * + * @param {RenderObject} renderObject - The render object. + */ + updateSharedForRender( renderObject ) { + + const bindings = this.getForRender( renderObject ); + + for ( const bindGroup of bindings ) { + + for ( const binding of bindGroup.bindings ) { + + if ( binding.isNodeUniformsGroup === true && binding.groupNode.shared === true ) { + + const updatedGroup = this.nodes.updateGroup( binding ); + + if ( updatedGroup === false ) continue; + + const updated = binding.update(); + + if ( updated ) { + + this.backend.updateBinding( binding ); + + } + + if ( binding.updateRanges.length > 0 ) binding.clearUpdateRanges(); + + } + + } + + } + + } + /** * Deletes the bindings for the given compute node. * @@ -56844,10 +56971,10 @@ class NodeManager extends DataMap { } /** - * Returns `true` if the given render object requires a refresh. + * Returns the refresh type of the given render object. * * @param {RenderObject} renderObject - The render object. - * @return {boolean} Whether the given render object requires a refresh or not. + * @return {number} The refresh type, see `RenderObjectRefreshType`. */ needsRefresh( renderObject ) { @@ -58726,13 +58853,15 @@ class XRManager extends EventDispatcher { // Apply ToneMapping and OutputColorSpace directly in the material shader - contextNode = currentContextNode.context( { + contextNode = context( { getOutput: ( outputNode ) => { return renderOutput( outputNode, renderer.toneMapping, renderer.outputColorSpace ); - } + }, + + ... currentContextNode.getFlowContextData() } ); @@ -61351,7 +61480,9 @@ class Renderer { const renderObject = renderObjects[ i ]; - if ( this._nodes.needsRefresh( renderObject ) ) { + const refreshType = this._nodes.needsRefresh( renderObject ); + + if ( refreshType === RenderObjectRefreshType.FULL ) { this._nodes.updateBefore( renderObject ); @@ -61361,6 +61492,15 @@ class Renderer { this._nodes.updateAfter( renderObject ); + } else if ( refreshType === RenderObjectRefreshType.SHARED ) { + + this._nodes.updateBefore( renderObject ); + + this._nodes.updateForRender( renderObject ); + this._bindings.updateSharedForRender( renderObject ); + + this._nodes.updateAfter( renderObject ); + } } @@ -63762,9 +63902,9 @@ class Renderer { // - const needsRefresh = this._nodes.needsRefresh( renderObject ); + const refreshType = this._nodes.needsRefresh( renderObject ); - if ( needsRefresh ) { + if ( refreshType === RenderObjectRefreshType.FULL ) { this._nodes.updateBefore( renderObject ); @@ -63773,6 +63913,13 @@ class Renderer { this._nodes.updateForRender( renderObject ); this._bindings.updateForRender( renderObject ); + } else if ( refreshType === RenderObjectRefreshType.SHARED ) { + + this._nodes.updateBefore( renderObject ); + + this._nodes.updateForRender( renderObject ); + this._bindings.updateSharedForRender( renderObject ); + } this._pipelines.updateForRender( renderObject ); @@ -63783,7 +63930,7 @@ class Renderer { this.backend.draw( renderObject, this.info ); - if ( needsRefresh ) this._nodes.updateAfter( renderObject ); + if ( refreshType !== RenderObjectRefreshType.NONE ) this._nodes.updateAfter( renderObject ); } @@ -69518,7 +69665,7 @@ class WebGLState { /** * Returns the value for the given parameter. * - * @param {number} name - The paramter to get the value for. + * @param {number} name - The parameter to get the value for. * @return {any} The value for the given parameter. */ getParameter( name ) { @@ -88867,6 +89014,46 @@ class RenderPipeline { } + /** + * Updates the context data. + * + * @private + */ + _updateContext() { + + const toneMapping = this._toneMapping; + const outputColorSpace = this._outputColorSpace; + + const contextData = { + renderPipeline: this, + renderPipelineState: { + viewOffsetOwner: null + }, + onBeforePipelineCallbacks: [], + onAfterPipelineCallbacks: [] + }; + + let outputNode = this.outputNode; + + if ( this.outputColorTransform === true ) { + + outputNode = renderOutput( outputNode, toneMapping, outputColorSpace ); + + } else { + + contextData.toneMapping = toneMapping; + contextData.outputColorSpace = outputColorSpace; + + } + + this._contextData = contextData; + + this._quadMesh.material.contextNode = context( contextData ); + this._quadMesh.material.fragmentNode = outputNode; + this._quadMesh.material.needsUpdate = true; + + } + /** * Updates the state of the module. * @@ -88890,36 +89077,7 @@ class RenderPipeline { if ( this.needsUpdate === true ) { - const toneMapping = this._toneMapping; - const outputColorSpace = this._outputColorSpace; - - const contextData = { - renderPipeline: this, - renderPipelineState: { - viewOffsetOwner: null - }, - onBeforePipelineCallbacks: [], - onAfterPipelineCallbacks: [] - }; - - let outputNode = this.outputNode; - - if ( this.outputColorTransform === true ) { - - outputNode = renderOutput( outputNode, toneMapping, outputColorSpace ); - - } else { - - contextData.toneMapping = toneMapping; - contextData.outputColorSpace = outputColorSpace; - - } - - this._contextData = contextData; - - this._quadMesh.material.contextNode = context( contextData ); - this._quadMesh.material.fragmentNode = outputNode; - this._quadMesh.material.needsUpdate = true; + this._updateContext(); this.needsUpdate = false; @@ -88948,6 +89106,233 @@ class RenderPipeline { } +/** + * An alternative render pipeline that applies output processing directly in + * material shaders. This avoids the intermediate framebuffer and output pass + * used by {@link Renderer}, but changes blending and is not compatible with + * materials that sample the framebuffer, such as transmissive materials. + * + * ```js + * const renderPipeline = new DirectRenderPipeline( renderer ); + * renderPipeline.render( scene, camera ); + * ``` + * + * Note: This module can only be used with `WebGPURenderer`. + * + * @augments RenderPipeline + */ +class DirectRenderPipeline extends RenderPipeline { + + /** + * Constructs a direct render pipeline. + * + * @param {Renderer} renderer - A reference to the renderer. + * @param {Node} outputNode - An optional output node. + */ + constructor( renderer, outputNode = output ) { + + super( renderer, outputNode ); + + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + this.isDirectRenderPipeline = true; + + /** + * The context node used to apply output processing in material shaders. + * + * @private + * @type {?ContextNode} + * @default null + */ + this._contextNode = null; + + /** + * The renderer context node wrapped by this pipeline. + * + * @private + * @type {?ContextNode} + * @default null + */ + this._rendererContextNode = null; + + /** + * Cached node representations of solid scene backgrounds. + * + * @private + * @type {WeakMap} + */ + this._backgroundNodes = new WeakMap(); + + } + + /** + * Renders the scene with output processing applied directly in material shaders. + * + * @param {Object3D} scene - The scene or object to render. + * @param {Camera} camera - The camera. + */ + render( scene, camera ) { + + const renderer = this.renderer; + + this._update(); + + const backgroundNode = this._getBackgroundNode( scene ); + const currentBackgroundNode = backgroundNode !== null ? scene.backgroundNode : null; + const currentContextNode = renderer.contextNode; + const outputRenderTarget = renderer.getOutputRenderTarget(); + const useDirectXRRenderTarget = outputRenderTarget !== null && renderer.xr.isPresenting === true && + renderer.backend.isWebGPUBackend === true && renderer.isOutputTarget === true; + + let samples; + let depthBuffer; + let toneMapping; + let outputColorSpace; + + if ( backgroundNode !== null ) scene.backgroundNode = backgroundNode; + + renderer.contextNode = this._contextNode; + + if ( useDirectXRRenderTarget ) { + + samples = outputRenderTarget.samples; + depthBuffer = outputRenderTarget.depthBuffer; + + outputRenderTarget.samples = renderer.samples; + outputRenderTarget.depthBuffer = true; + + } + + try { + + for ( const callback of this._contextData.onBeforePipelineCallbacks ) callback(); + + toneMapping = renderer.toneMapping; + outputColorSpace = renderer.outputColorSpace; + + renderer.toneMapping = NoToneMapping; + renderer.outputColorSpace = ColorManagement.workingColorSpace; + + if ( renderer.xr.enabled ) { + + renderer.xr.renderLayers(); + + } + + renderer.render( scene, camera ); + + } finally { + + if ( toneMapping !== undefined ) renderer.toneMapping = toneMapping; + if ( outputColorSpace !== undefined ) renderer.outputColorSpace = outputColorSpace; + + if ( backgroundNode !== null && scene.backgroundNode === backgroundNode ) scene.backgroundNode = currentBackgroundNode; + + if ( renderer.contextNode === this._contextNode ) renderer.contextNode = currentContextNode; + + if ( useDirectXRRenderTarget ) { + + outputRenderTarget.samples = samples; + outputRenderTarget.depthBuffer = depthBuffer; + + } + + for ( const callback of this._contextData.onAfterPipelineCallbacks ) callback(); + + } + + } + + /** + * Returns a node representation of a solid scene background so it receives + * the same inline output processing as material fragments. + * + * @private + * @param {Object3D} scene - The scene or object to render. + * @return {?UniformNode} The background node. + */ + _getBackgroundNode( scene ) { + + if ( scene.isScene !== true || scene.backgroundNode != null || scene.background?.isColor !== true ) return null; + + const environmentBlendMode = this.renderer.xr.getEnvironmentBlendMode(); + + if ( environmentBlendMode === 'additive' || environmentBlendMode === 'alpha-blend' ) return null; + + let backgroundNode = this._backgroundNodes.get( scene.background ); + + if ( backgroundNode === undefined ) { + + backgroundNode = uniform( scene.background ); + this._backgroundNodes.set( scene.background, backgroundNode ); + + } + + return backgroundNode; + + } + + /** + * Updates the state of the module. + * + * @private + */ + _update() { + + if ( this._rendererContextNode !== this.renderer.contextNode ) { + + this._rendererContextNode = this.renderer.contextNode; + this.needsUpdate = true; + + } + + super._update(); + + } + + /** + * Updates the context used to process material output directly. + * + * @private + */ + _updateContext() { + + super._updateContext(); + + const pipelineOutputNode = this.outputNode; + const toneMapping = this._toneMapping; + const outputColorSpace = this._outputColorSpace; + const outputColorTransform = this.outputColorTransform; + + this._contextNode = this._rendererContextNode.context( { + + ...this._contextData, + + getOutput: ( materialOutputNode, builder ) => { + + const renderer = builder.renderer; + const renderTarget = renderer.getRenderTarget(); + + if ( renderer.isOutputTarget === false && renderTarget?._hasExternalTextures !== true ) return materialOutputNode; + + output.assign( materialOutputNode ); + + return outputColorTransform === true ? + renderOutput( pipelineOutputNode, toneMapping, outputColorSpace ) : + pipelineOutputNode; + + } + } ); + + } + +} + /** * @deprecated since r183. Use {@link RenderPipeline} instead. PostProcessing has been renamed to RenderPipeline. * @@ -89913,4 +90298,4 @@ class ClippingGroup extends Group { } -export { ACESFilmicToneMapping, AONode, AddEquation, AddOperation, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AmbientLightNode, AnalyticLightNode, ArrayCamera, ArrayElementNode, ArrayNode, AssignNode, AtomicFunctionNode, AttributeNode, BackSide, Backend, BarrierNode, BasicEnvironmentNode, BasicLightMapNode, BasicNodeLibrary, BasicShadowMap, BitcastNode, BitcountNode, BlendMode, BoxGeometry, BufferAttribute, BufferAttributeNode, BufferGeometry, BufferNode, BuiltinNode, BumpMapNode, BundleGroup, BypassNode, ByteType, CanvasTarget, CineonToneMapping, ClampToEdgeWrapping, ClippingGroup, ClippingNode, CodeNode, Color, ColorManagement, ColorSpaceNode, Compatibility, ComputeBuiltinNode, ComputeNode, ConditionalNode, ConstNode, ConstantAlphaFactor, ConstantColorFactor, ContextNode, ConvertNode, CubeCamera, CubeDepthTexture, CubeMapNode, CubeReflectionMapping, CubeRefractionMapping, CubeRenderTarget, CubeTexture, CubeTextureNode, CubeUVReflectionMapping, CullFaceBack, CullFaceFront, CullFaceNone, CustomBlending, CylinderGeometry, DataArrayTexture, DataTexture, DebugNode, DecrementStencilOp, DecrementWrapStencilOp, DepthFormat, DepthStencilFormat, DepthTexture, DirectionalLight, DirectionalLightNode, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicDrawUsage, EnvironmentNode, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, EventDispatcher, EventNode, ExpressionNode, FileLoader, FlipNode, Float16BufferAttribute, Float32BufferAttribute, FloatType, FramebufferTexture, FrontFacingNode, FrontSide, Frustum, FrustumArray, FunctionCallNode, FunctionNode, FunctionOverloadingNode, GLSLNodeBuilder, GLSLNodeParser, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, Group, HalfFloatType, HemisphereLight, HemisphereLightNode, IESSpotLight, IESSpotLightNode, IncrementStencilOp, IncrementWrapStencilOp, IndexNode, IndirectStorageBufferAttribute, InputNode, InspectorBase, InspectorNode, InstancedBufferAttribute, InstancedInterleavedBuffer, IntType, InterleavedBuffer, InterleavedBufferAttribute, InvertStencilOp, IrradianceNode, IsolateNode, JoinNode, KeepStencilOp, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, LightProbe, LightProbeNode, Lighting, LightingContextNode, LightingModel, LightingNode, LightsNode, Line2NodeMaterial, LineBasicMaterial, LineBasicNodeMaterial, LineDashedMaterial, LineDashedNodeMaterial, LinearFilter, LinearMipMapLinearFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoopNode, MRTNode, Material, MaterialBlending, MaterialLoader, MaterialNode, MaterialReferenceNode, MathNode, MathUtils, Matrix2, Matrix3, Matrix4, MaxEquation, MaxMipLevelNode, MemberNode, Mesh, MeshBasicMaterial, MeshBasicNodeMaterial, MeshLambertMaterial, MeshLambertNodeMaterial, MeshMatcapMaterial, MeshMatcapNodeMaterial, MeshNormalMaterial, MeshNormalNodeMaterial, MeshPhongMaterial, MeshPhongNodeMaterial, MeshPhysicalMaterial, MeshPhysicalNodeMaterial, MeshSSSNodeMaterial, MeshStandardMaterial, MeshStandardNodeMaterial, MeshToonMaterial, MeshToonNodeMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, ModelNode, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoNormalPacking, NoToneMapping, Node, NodeAccess, NodeAttribute, NodeBuilder, NodeCache, NodeCode, NodeError, NodeFrame, NodeFunctionInput, NodeLoader, NodeMaterial, NodeMaterialLoader, NodeMaterialObserver, NodeObjectLoader, NodeShaderStage, NodeType, NodeUniform, NodeUpdateType, NodeUtils, NodeVar, NodeVarying, NormalBlending, NormalGAPacking, NormalMapNode, NormalRGPacking, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, Object3D, Object3DNode, ObjectLoader, ObjectSpaceNormalMap, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OperatorNode, OrthographicCamera, OutputStructNode, OverrideContextNode, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, PMREMNode, PackFloatNode, ParameterNode, PassNode, PerspectiveCamera, PhongLightingModel, PhysicalLightingModel, Plane, PlaneGeometry, PointLight, PointLightNode, PointShadowNode, PointUVNode, PointsMaterial, PointsNodeMaterial, PostProcessing, ProjectorLight, ProjectorLightNode, PropertyNode, QuadMesh, Quaternion, R11_EAC_Format, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RG11_EAC_Format, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGBIntegerFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RTTNode, RangeNode, ReadbackBuffer, RectAreaLight, RectAreaLightNode, RedFormat, RedIntegerFormat, ReferenceBaseNode, ReferenceNode, ReflectorNode, ReinhardToneMapping, RenderOutputNode, RenderPipeline, RenderTarget, Renderer, RendererReferenceNode, RendererUtils, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RotateNode, SIGNED_R11_EAC_Format, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SIGNED_RG11_EAC_Format, SRGBColorSpace, SRGBTransfer, SampleNode, Scene, ScreenNode, SetNode, ShadowBaseNode, ShadowMaterial, ShadowNode, ShadowNodeMaterial, ShortType, Sphere, SphereGeometry, SplitNode, SpotLight, SpotLightNode, SpriteMaterial, SpriteNodeMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StackNode, StackTrace, StandardNodeLibrary, StaticDrawUsage, Storage3DTexture, StorageArrayElementNode, StorageArrayTexture, StorageBufferAttribute, StorageBufferNode, StorageInstancedBufferAttribute, StorageTexture, StorageTexture3DNode, StorageTextureNode, StructNode, StructTypeNode, SubBuildNode, SubgroupFunctionNode, SubtractEquation, SubtractiveBlending, TSL, TangentSpaceNormalMap, TempNode, Texture, Texture3DNode, TextureNode, TextureSizeNode, TimestampQuery, ToneMappingNode, ToonOutlinePassNode, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, UniformArrayNode, UniformGroupNode, UniformNode, UnpackFloatNode, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, UserDataNode, VSMShadowMap, VarNode, VaryingNode, Vector2, Vector3, Vector4, VelocityNode, VertexColorNode, ViewportDepthNode, ViewportDepthTextureNode, ViewportSharedTextureNode, ViewportTextureNode, VolumeNodeMaterial, WGSLNodeBuilder, WebGLBackend, WebGLCapabilities, WebGLCoordinateSystem, WebGPUBackend, WebGPUCoordinateSystem, WebGPURenderer, WebXRController, WorkgroupInfoNode, ZeroFactor, ZeroStencilOp, createCanvasElement, defaultBuildStages, defaultShaderStages, error, log$1 as log, shaderStages, vectorComponents, warn, warnOnce }; +export { ACESFilmicToneMapping, AONode, AddEquation, AddOperation, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AmbientLightNode, AnalyticLightNode, ArrayCamera, ArrayElementNode, ArrayNode, AssignNode, AtomicFunctionNode, AttributeNode, BackSide, Backend, BarrierNode, BasicEnvironmentNode, BasicLightMapNode, BasicNodeLibrary, BasicShadowMap, BitcastNode, BitcountNode, BlendMode, BoxGeometry, BufferAttribute, BufferAttributeNode, BufferGeometry, BufferNode, BuiltinNode, BumpMapNode, BundleGroup, BypassNode, ByteType, CanvasTarget, CineonToneMapping, ClampToEdgeWrapping, ClippingGroup, ClippingNode, CodeNode, Color, ColorManagement, ColorSpaceNode, Compatibility, ComputeBuiltinNode, ComputeNode, ConditionalNode, ConstNode, ConstantAlphaFactor, ConstantColorFactor, ContextNode, ConvertNode, CubeCamera, CubeDepthTexture, CubeMapNode, CubeReflectionMapping, CubeRefractionMapping, CubeRenderTarget, CubeTexture, CubeTextureNode, CubeUVReflectionMapping, CullFaceBack, CullFaceFront, CullFaceNone, CustomBlending, CylinderGeometry, DataArrayTexture, DataTexture, DebugNode, DecrementStencilOp, DecrementWrapStencilOp, DepthFormat, DepthStencilFormat, DepthTexture, DirectRenderPipeline, DirectionalLight, DirectionalLightNode, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicDrawUsage, EnvironmentNode, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, EventDispatcher, EventNode, ExpressionNode, FileLoader, FlipNode, Float16BufferAttribute, Float32BufferAttribute, FloatType, FramebufferTexture, FrontFacingNode, FrontSide, Frustum, FrustumArray, FunctionCallNode, FunctionNode, FunctionOverloadingNode, GLSLNodeBuilder, GLSLNodeParser, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, Group, HalfFloatType, HemisphereLight, HemisphereLightNode, IESSpotLight, IESSpotLightNode, IncrementStencilOp, IncrementWrapStencilOp, IndexNode, IndirectStorageBufferAttribute, InputNode, InspectorBase, InspectorNode, InstancedBufferAttribute, InstancedInterleavedBuffer, IntType, InterleavedBuffer, InterleavedBufferAttribute, InvertStencilOp, IrradianceNode, IsolateNode, JoinNode, KeepStencilOp, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, LightProbe, LightProbeNode, Lighting, LightingContextNode, LightingModel, LightingNode, LightsNode, Line2NodeMaterial, LineBasicMaterial, LineBasicNodeMaterial, LineDashedMaterial, LineDashedNodeMaterial, LinearFilter, LinearMipMapLinearFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoopNode, MRTNode, Material, MaterialBlending, MaterialLoader, MaterialNode, MaterialReferenceNode, MathNode, MathUtils, Matrix2, Matrix3, Matrix4, MaxEquation, MaxMipLevelNode, MemberNode, Mesh, MeshBasicMaterial, MeshBasicNodeMaterial, MeshLambertMaterial, MeshLambertNodeMaterial, MeshMatcapMaterial, MeshMatcapNodeMaterial, MeshNormalMaterial, MeshNormalNodeMaterial, MeshPhongMaterial, MeshPhongNodeMaterial, MeshPhysicalMaterial, MeshPhysicalNodeMaterial, MeshSSSNodeMaterial, MeshStandardMaterial, MeshStandardNodeMaterial, MeshToonMaterial, MeshToonNodeMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, ModelNode, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoNormalPacking, NoToneMapping, Node, NodeAccess, NodeAttribute, NodeBuilder, NodeCache, NodeCode, NodeError, NodeFrame, NodeFunctionInput, NodeLoader, NodeMaterial, NodeMaterialLoader, NodeMaterialObserver, NodeObjectLoader, NodeShaderStage, NodeType, NodeUniform, NodeUpdateType, NodeUtils, NodeVar, NodeVarying, NormalBlending, NormalGAPacking, NormalMapNode, NormalRGPacking, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, Object3D, Object3DNode, ObjectLoader, ObjectSpaceNormalMap, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OperatorNode, OrthographicCamera, OutputStructNode, OverrideContextNode, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, PMREMNode, PackFloatNode, ParameterNode, PassNode, PerspectiveCamera, PhongLightingModel, PhysicalLightingModel, Plane, PlaneGeometry, PointLight, PointLightNode, PointShadowNode, PointUVNode, PointsMaterial, PointsNodeMaterial, PostProcessing, ProjectorLight, ProjectorLightNode, PropertyNode, QuadMesh, Quaternion, R11_EAC_Format, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RG11_EAC_Format, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGBIntegerFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RTTNode, RangeNode, ReadbackBuffer, RectAreaLight, RectAreaLightNode, RedFormat, RedIntegerFormat, ReferenceBaseNode, ReferenceNode, ReflectorNode, ReinhardToneMapping, RenderObjectRefreshType, RenderOutputNode, RenderPipeline, RenderTarget, Renderer, RendererReferenceNode, RendererUtils, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RotateNode, SIGNED_R11_EAC_Format, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SIGNED_RG11_EAC_Format, SRGBColorSpace, SRGBTransfer, SampleNode, Scene, ScreenNode, SetNode, ShadowBaseNode, ShadowMaterial, ShadowNode, ShadowNodeMaterial, ShortType, Sphere, SphereGeometry, SplitNode, SpotLight, SpotLightNode, SpriteMaterial, SpriteNodeMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StackNode, StackTrace, StandardNodeLibrary, StaticDrawUsage, Storage3DTexture, StorageArrayElementNode, StorageArrayTexture, StorageBufferAttribute, StorageBufferNode, StorageInstancedBufferAttribute, StorageTexture, StorageTexture3DNode, StorageTextureNode, StructNode, StructTypeNode, SubBuildNode, SubgroupFunctionNode, SubtractEquation, SubtractiveBlending, TSL, TangentSpaceNormalMap, TempNode, Texture, Texture3DNode, TextureNode, TextureSizeNode, TimestampQuery, ToneMappingNode, ToonOutlinePassNode, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, UniformArrayNode, UniformGroupNode, UniformNode, UnpackFloatNode, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, UserDataNode, VSMShadowMap, VarNode, VaryingNode, Vector2, Vector3, Vector4, VelocityNode, VertexColorNode, ViewportDepthNode, ViewportDepthTextureNode, ViewportSharedTextureNode, ViewportTextureNode, VolumeNodeMaterial, WGSLNodeBuilder, WebGLBackend, WebGLCapabilities, WebGLCoordinateSystem, WebGPUBackend, WebGPUCoordinateSystem, WebGPURenderer, WebXRController, WorkgroupInfoNode, ZeroFactor, ZeroStencilOp, createCanvasElement, defaultBuildStages, defaultShaderStages, error, log$1 as log, shaderStages, vectorComponents, warn, warnOnce }; diff --git a/build/three.webgpu.nodes.js b/build/three.webgpu.nodes.js index ed7a708140ac8c..45a97d57d8bd11 100644 --- a/build/three.webgpu.nodes.js +++ b/build/three.webgpu.nodes.js @@ -3,7 +3,7 @@ * Copyright 2010-2026 Three.js Authors * SPDX-License-Identifier: MIT */ -import { Color, Vector2, Vector3, Vector4, Matrix2, Matrix3, Matrix4, UnsignedIntType, IntType, error, RedFormat, RedIntegerFormat, DepthFormat, DepthStencilFormat, AlphaFormat, RGFormat, RGIntegerFormat, RGBFormat, RGBIntegerFormat, EventDispatcher, MathUtils, warn, WebGLCoordinateSystem, WebGPUCoordinateSystem, ColorManagement, SRGBTransfer, NoToneMapping, StaticDrawUsage, InterleavedBufferAttribute, InterleavedBuffer, DynamicDrawUsage, NoColorSpace, log as log$1, warnOnce, Texture, Compatibility, LessCompare, LessEqualCompare, GreaterCompare, GreaterEqualCompare, NearestFilter, Sphere, BackSide, DoubleSide, CubeTexture, CubeReflectionMapping, CubeRefractionMapping, TangentSpaceNormalMap, NoNormalPacking, NormalRGPacking, NormalGAPacking, ObjectSpaceNormalMap, RED_GREEN_RGTC2_Format, RG11_EAC_Format, InstancedBufferAttribute, InstancedInterleavedBuffer, DataTexture, DataArrayTexture, FloatType, FramebufferTexture, LinearMipmapLinearFilter, DepthTexture, Material, LineBasicMaterial, LineDashedMaterial, NoBlending, MeshNormalMaterial, SRGBColorSpace, RenderTarget, BoxGeometry, Mesh, Scene, LinearFilter, CubeCamera, EquirectangularReflectionMapping, EquirectangularRefractionMapping, AddOperation, MixOperation, MultiplyOperation, MeshBasicMaterial, MeshLambertMaterial, MeshPhongMaterial, HalfFloatType, ClampToEdgeWrapping, BufferGeometry, OrthographicCamera, PerspectiveCamera, LinearSRGBColorSpace, RGBAFormat, CubeUVReflectionMapping, BufferAttribute, MeshStandardMaterial, MeshPhysicalMaterial, MeshToonMaterial, MeshMatcapMaterial, SpriteMaterial, PointsMaterial, ShadowMaterial, Uint32BufferAttribute, Uint16BufferAttribute, ByteType, UnsignedByteType, ShortType, UnsignedShortType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedInt101111Type, NormalBlending, SrcAlphaFactor, OneMinusSrcAlphaFactor, AddEquation, MaterialBlending, Object3D, LinearMipMapLinearFilter, Plane, Float32BufferAttribute, UVMapping, PCFShadowMap, VSMShadowMap, BasicShadowMap, CubeDepthTexture, SphereGeometry, LinearMipmapNearestFilter, NearestMipmapLinearFilter, Float16BufferAttribute, yieldToMain, REVISION, ArrayCamera, PlaneGeometry, FrontSide, CustomBlending, ZeroFactor, CylinderGeometry, Quaternion, WebXRController, RAD2DEG, PCFSoftShadowMap, FrustumArray, Frustum, RGBAIntegerFormat, TimestampQuery, createCanvasElement, MaxEquation, MinEquation, ReverseSubtractEquation, SubtractEquation, OneMinusConstantAlphaFactor, ConstantAlphaFactor, OneMinusConstantColorFactor, ConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcColorFactor, DstAlphaFactor, DstColorFactor, SrcAlphaSaturateFactor, SrcColorFactor, OneFactor, CullFaceNone, CullFaceBack, CullFaceFront, MultiplyBlending, SubtractiveBlending, AdditiveBlending, NotEqualDepth, GreaterDepth, GreaterEqualDepth, EqualDepth, LessEqualDepth, LessDepth, AlwaysDepth, NeverDepth, ReversedDepthFuncs, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, R11_EAC_Format, SIGNED_R11_EAC_Format, SIGNED_RG11_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, SIGNED_RED_GREEN_RGTC2_Format, MirroredRepeatWrapping, RepeatWrapping, NearestMipmapNearestFilter, NotEqualCompare, EqualCompare, AlwaysCompare, NeverCompare, LinearTransfer, getByteLength, isTypedArray, NotEqualStencilFunc, GreaterStencilFunc, GreaterEqualStencilFunc, EqualStencilFunc, LessEqualStencilFunc, LessStencilFunc, AlwaysStencilFunc, NeverStencilFunc, DecrementWrapStencilOp, IncrementWrapStencilOp, DecrementStencilOp, IncrementStencilOp, InvertStencilOp, ReplaceStencilOp, ZeroStencilOp, KeepStencilOp, SpotLight, PointLight, DirectionalLight, RectAreaLight, AmbientLight, HemisphereLight, LightProbe, LinearToneMapping, ReinhardToneMapping, CineonToneMapping, ACESFilmicToneMapping, AgXToneMapping, NeutralToneMapping, Group, Loader, FileLoader, MaterialLoader, ObjectLoader } from './three.core.js'; +import { DynamicDrawUsage, RenderObjectRefreshType, Color, Vector2, Vector3, Vector4, Matrix2, Matrix3, Matrix4, UnsignedIntType, IntType, error, RedFormat, RedIntegerFormat, DepthFormat, DepthStencilFormat, AlphaFormat, RGFormat, RGIntegerFormat, RGBFormat, RGBIntegerFormat, EventDispatcher, MathUtils, warn, WebGLCoordinateSystem, WebGPUCoordinateSystem, ColorManagement, SRGBTransfer, NoToneMapping, StaticDrawUsage, InterleavedBufferAttribute, InterleavedBuffer, NoColorSpace, log as log$1, warnOnce, Texture, Compatibility, LessCompare, LessEqualCompare, GreaterCompare, GreaterEqualCompare, NearestFilter, Sphere, BackSide, DoubleSide, CubeTexture, CubeReflectionMapping, CubeRefractionMapping, TangentSpaceNormalMap, NoNormalPacking, NormalRGPacking, NormalGAPacking, ObjectSpaceNormalMap, RED_GREEN_RGTC2_Format, RG11_EAC_Format, InstancedBufferAttribute, InstancedInterleavedBuffer, DataTexture, DataArrayTexture, FloatType, FramebufferTexture, LinearMipmapLinearFilter, DepthTexture, Material, LineBasicMaterial, LineDashedMaterial, NoBlending, MeshNormalMaterial, SRGBColorSpace, RenderTarget, BoxGeometry, Mesh, Scene, LinearFilter, CubeCamera, EquirectangularReflectionMapping, EquirectangularRefractionMapping, AddOperation, MixOperation, MultiplyOperation, MeshBasicMaterial, MeshLambertMaterial, MeshPhongMaterial, HalfFloatType, ClampToEdgeWrapping, BufferGeometry, OrthographicCamera, PerspectiveCamera, LinearSRGBColorSpace, RGBAFormat, CubeUVReflectionMapping, BufferAttribute, MeshStandardMaterial, MeshPhysicalMaterial, MeshToonMaterial, MeshMatcapMaterial, SpriteMaterial, PointsMaterial, ShadowMaterial, Uint32BufferAttribute, Uint16BufferAttribute, ByteType, UnsignedByteType, ShortType, UnsignedShortType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedInt101111Type, NormalBlending, SrcAlphaFactor, OneMinusSrcAlphaFactor, AddEquation, MaterialBlending, Object3D, LinearMipMapLinearFilter, Plane, Float32BufferAttribute, UVMapping, PCFShadowMap, VSMShadowMap, BasicShadowMap, CubeDepthTexture, SphereGeometry, LinearMipmapNearestFilter, NearestMipmapLinearFilter, Float16BufferAttribute, yieldToMain, REVISION, ArrayCamera, PlaneGeometry, FrontSide, CustomBlending, ZeroFactor, CylinderGeometry, Quaternion, WebXRController, RAD2DEG, PCFSoftShadowMap, FrustumArray, Frustum, RGBAIntegerFormat, TimestampQuery, createCanvasElement, MaxEquation, MinEquation, ReverseSubtractEquation, SubtractEquation, OneMinusConstantAlphaFactor, ConstantAlphaFactor, OneMinusConstantColorFactor, ConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcColorFactor, DstAlphaFactor, DstColorFactor, SrcAlphaSaturateFactor, SrcColorFactor, OneFactor, CullFaceNone, CullFaceBack, CullFaceFront, MultiplyBlending, SubtractiveBlending, AdditiveBlending, NotEqualDepth, GreaterDepth, GreaterEqualDepth, EqualDepth, LessEqualDepth, LessDepth, AlwaysDepth, NeverDepth, ReversedDepthFuncs, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, R11_EAC_Format, SIGNED_R11_EAC_Format, SIGNED_RG11_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, SIGNED_RED_GREEN_RGTC2_Format, MirroredRepeatWrapping, RepeatWrapping, NearestMipmapNearestFilter, NotEqualCompare, EqualCompare, AlwaysCompare, NeverCompare, LinearTransfer, getByteLength, isTypedArray, NotEqualStencilFunc, GreaterStencilFunc, GreaterEqualStencilFunc, EqualStencilFunc, LessEqualStencilFunc, LessStencilFunc, AlwaysStencilFunc, NeverStencilFunc, DecrementWrapStencilOp, IncrementWrapStencilOp, DecrementStencilOp, IncrementStencilOp, InvertStencilOp, ReplaceStencilOp, ZeroStencilOp, KeepStencilOp, SpotLight, PointLight, DirectionalLight, RectAreaLight, AmbientLight, HemisphereLight, LightProbe, LinearToneMapping, ReinhardToneMapping, CineonToneMapping, ACESFilmicToneMapping, AgXToneMapping, NeutralToneMapping, Group, Loader, FileLoader, MaterialLoader, ObjectLoader } from './three.core.js'; export { AdditiveAnimationBlendMode, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BasicDepthPacking, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxHelper, BufferGeometryLoader, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CircleGeometry, Clock, ColorKeyframeTrack, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, Controls, CubeTextureLoader, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceFrontBack, Curve, CurvePath, CustomToneMapping, Cylindrical, Data3DTexture, DataTextureLoader, DataUtils, DefaultLoadingManager, DetachedBindMode, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DynamicCopyUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, Euler, ExternalTexture, ExtrudeGeometry, Fog, FogExp2, GLBufferAttribute, GLSL1, GLSL3, GridHelper, HTMLTexture, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, InstancedBufferGeometry, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, KeyframeTrack, LOD, LatheGeometry, Layers, Light, Line, Line3, LineCurve, LineCurve3, LineLoop, LineSegments, LinearInterpolant, LinearMipMapNearestFilter, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, MeshDepthMaterial, MeshDistanceMaterial, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NormalAnimationBlendMode, NumberKeyframeTrack, OctahedronGeometry, Path, PlaneHelper, PointLightHelper, Points, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RGBADepthPacking, RGBDepthPacking, RGDepthPacking, RawShaderMaterial, Ray, Raycaster, RenderTarget3D, RingGeometry, ShaderMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, Skeleton, SkeletonHelper, SkinnedMesh, Source, Spherical, SphericalHarmonics3, SplineCurve, SpotLightHelper, Sprite, StaticCopyUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, TOUCH, TetrahedronGeometry, TextureLoader, TextureUtils, Timer, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLRenderTarget, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroSlopeEnding, getConsoleFunction, setConsoleFunction } from './three.core.js'; const refreshUniforms = [ @@ -17,28 +17,36 @@ const refreshUniforms = [ 'attenuationColor', 'attenuationDistance', 'bumpMap', + 'bumpScale', 'clearcoat', 'clearcoatMap', 'clearcoatNormalMap', 'clearcoatNormalScale', 'clearcoatRoughness', 'color', + 'dashOffset', + 'dashSize', 'dispersion', + 'displacementBias', 'displacementMap', + 'displacementScale', 'emissive', 'emissiveIntensity', 'emissiveMap', 'envMap', 'envMapIntensity', 'envMapRotation', + 'gapSize', 'gradientMap', 'ior', 'iridescence', 'iridescenceIOR', 'iridescenceMap', + 'iridescenceThickness', 'iridescenceThicknessMap', 'lightMap', 'lightMapIntensity', + 'linewidth', 'map', 'matcap', 'metalness', @@ -46,20 +54,26 @@ const refreshUniforms = [ 'normalMap', 'normalScale', 'opacity', + 'reflectivity', 'retroreflectivity', + 'rotation', 'roughness', 'roughnessMap', + 'scale', 'sheen', 'sheenColor', 'sheenColorMap', + 'sheenRoughness', 'sheenRoughnessMap', 'shininess', + 'size', 'specular', 'specularColor', 'specularColorMap', 'specularIntensity', 'specularIntensityMap', 'specularMap', + 'steps', 'thickness', 'transmission', 'transmissionMap' @@ -166,6 +180,20 @@ class NodeMaterialObserver { } + /** + * Returns `true` if the given 3D object uses instance buffers with dynamic draw usage. + * Such buffers must be uploaded once per render so the render object requires a full refresh. + * + * @param {Object3D} object - The 3D object. + * @return {boolean} Whether the given 3D object uses instance buffers with dynamic draw usage or not. + */ + hasDynamicInstancing( object ) { + + return object.isInstancedMesh === true && ( object.instanceMatrix.usage === DynamicDrawUsage || + ( object.instanceColor !== null && object.instanceColor.usage === DynamicDrawUsage ) ); + + } + /** * Returns `true` if the current rendering produces motion vectors. * @@ -213,6 +241,22 @@ class NodeMaterialObserver { } + if ( object.isInstancedMesh === true ) { + + data.instanceMatrixVersion = object.instanceMatrix.version; + data.instanceColorVersion = object.instanceColor !== null ? object.instanceColor.version : null; + data.morphTextureVersion = object.morphTexture !== null ? object.morphTexture.version : null; + + } + + if ( object.isBatchedMesh === true ) { + + data.matricesTextureVersion = object._matricesTexture.version; + data.colorsTextureVersion = object._colorsTexture !== null ? object._colorsTexture.version : null; + data.indirectTextureVersion = object._indirectTexture.version; + + } + if ( renderObject.bundle !== null ) { data.version = renderObject.bundle.version; @@ -607,6 +651,47 @@ class NodeMaterialObserver { } + // instancing + + if ( object.isInstancedMesh === true ) { + + const instanceColorVersion = object.instanceColor !== null ? object.instanceColor.version : null; + const morphTextureVersion = object.morphTexture !== null ? object.morphTexture.version : null; + + if ( renderObjectData.instanceMatrixVersion !== object.instanceMatrix.version || + renderObjectData.instanceColorVersion !== instanceColorVersion || + renderObjectData.morphTextureVersion !== morphTextureVersion ) { + + renderObjectData.instanceMatrixVersion = object.instanceMatrix.version; + renderObjectData.instanceColorVersion = instanceColorVersion; + renderObjectData.morphTextureVersion = morphTextureVersion; + + return false; + + } + + } + + // batching + + if ( object.isBatchedMesh === true ) { + + const colorsTextureVersion = object._colorsTexture !== null ? object._colorsTexture.version : null; + + if ( renderObjectData.matricesTextureVersion !== object._matricesTexture.version || + renderObjectData.colorsTextureVersion !== colorsTextureVersion || + renderObjectData.indirectTextureVersion !== object._indirectTexture.version ) { + + renderObjectData.matricesTextureVersion = object._matricesTexture.version; + renderObjectData.colorsTextureVersion = colorsTextureVersion; + renderObjectData.indirectTextureVersion = object._indirectTexture.version; + + return false; + + } + + } + // lights if ( renderObjectData.lights ) { @@ -729,16 +814,16 @@ class NodeMaterialObserver { * * @param {RenderObject} renderObject - The render object. * @param {NodeFrame} nodeFrame - The current node frame. - * @return {boolean} Whether the given render object requires a refresh or not. + * @return {number} The refresh type, see {@link RenderObjectRefreshType}. */ needsRefresh( renderObject, nodeFrame ) { - if ( this.hasNode || this.hasAnimation || this.firstInitialization( renderObject ) || this.needsVelocity( nodeFrame.renderer ) ) - return true; + if ( this.hasNode || this.hasAnimation || this.hasDynamicInstancing( renderObject.object ) || this.firstInitialization( renderObject ) || this.needsVelocity( nodeFrame.renderer ) ) + return RenderObjectRefreshType.FULL; const { renderId } = nodeFrame; - let force = false; + let refreshType = RenderObjectRefreshType.NONE; // shared UBOs are potentially never updated when objects don't change. Below block // make sure these UBOs are updated at least once. @@ -747,9 +832,9 @@ class NodeMaterialObserver { this.renderId = renderId; - // no early out here. instead, force the render object to use the equals() code path so its internal cache state gets synched + // no early out here. instead, use the equals() code path below so the internal cache state gets synched - force = true; + refreshType = RenderObjectRefreshType.SHARED; } @@ -757,12 +842,17 @@ class NodeMaterialObserver { const isBundle = renderObject.bundle !== null && renderObject.bundle.static === true && this.getRenderObjectData( renderObject ).version === renderObject.bundle.version; if ( isStatic || isBundle ) - return force; + return refreshType; const lightsData = this.getLights( renderObject.lightsNode, renderId ); - const notEqual = this.equals( renderObject, lightsData, renderId ) !== true; - return ( force || notEqual ); + if ( this.equals( renderObject, lightsData, renderId ) === false ) { + + refreshType = RenderObjectRefreshType.FULL; + + } + + return refreshType; } @@ -14154,15 +14244,15 @@ class ScreenNode extends Node { if ( scope === ScreenNode.SIZE ) { - output = uniform( _screenSizeVec || ( _screenSizeVec = new Vector2() ) ); + output = uniform( _screenSizeVec || ( _screenSizeVec = new Vector2() ) ).setGroup( renderGroup ); } else if ( scope === ScreenNode.VIEWPORT ) { - output = uniform( _viewportVec || ( _viewportVec = new Vector4() ) ); + output = uniform( _viewportVec || ( _viewportVec = new Vector4() ) ).setGroup( renderGroup ); } else if ( scope === ScreenNode.DPR ) { - output = uniform( 1 ); + output = uniform( 1 ).setGroup( renderGroup ); } else { @@ -18629,10 +18719,10 @@ const instance = /*@__PURE__*/ Fn( ( [ matrices, colors = null ], builder ) => { } - // Synchronization of dynamic buffer updates per frame + // Synchronization of dynamic buffer updates per frame. if ( interleavedMatrix !== null || interleavedColor !== null ) { - OnFrameUpdate( () => { + OnBeforeFrameUpdate( () => { if ( interleavedMatrix !== null && interleavedMatrix.version !== matrices.version ) { @@ -24082,7 +24172,7 @@ class PhongLightingModel extends BasicLightingModel { } /** - * Implements the direct lighting. The specular portion is optional an can be controlled + * Implements the direct lighting. The specular portion is optional and can be controlled * with the {@link PhongLightingModel#specular} flag. * * @param {Object} lightData - The light data. @@ -29120,7 +29210,7 @@ class PointsNodeMaterial extends SpriteNodeMaterial { } -const scale = /*@__PURE__*/ uniform( 1 ).onFrameUpdate( function ( { renderer } ) { +const scale = /*@__PURE__*/ uniform( 1 ).setGroup( renderGroup ).onRenderUpdate( function ( { renderer } ) { const size = renderer.getSize( _size$4 ); // logical units @@ -33005,6 +33095,43 @@ class Bindings extends DataMap { } + /** + * Updates only the shared uniform buffers of the given render object. + * + * @param {RenderObject} renderObject - The render object. + */ + updateSharedForRender( renderObject ) { + + const bindings = this.getForRender( renderObject ); + + for ( const bindGroup of bindings ) { + + for ( const binding of bindGroup.bindings ) { + + if ( binding.isNodeUniformsGroup === true && binding.groupNode.shared === true ) { + + const updatedGroup = this.nodes.updateGroup( binding ); + + if ( updatedGroup === false ) continue; + + const updated = binding.update(); + + if ( updated ) { + + this.backend.updateBinding( binding ); + + } + + if ( binding.updateRanges.length > 0 ) binding.clearUpdateRanges(); + + } + + } + + } + + } + /** * Deletes the bindings for the given compute node. * @@ -56844,10 +56971,10 @@ class NodeManager extends DataMap { } /** - * Returns `true` if the given render object requires a refresh. + * Returns the refresh type of the given render object. * * @param {RenderObject} renderObject - The render object. - * @return {boolean} Whether the given render object requires a refresh or not. + * @return {number} The refresh type, see `RenderObjectRefreshType`. */ needsRefresh( renderObject ) { @@ -58726,13 +58853,15 @@ class XRManager extends EventDispatcher { // Apply ToneMapping and OutputColorSpace directly in the material shader - contextNode = currentContextNode.context( { + contextNode = context( { getOutput: ( outputNode ) => { return renderOutput( outputNode, renderer.toneMapping, renderer.outputColorSpace ); - } + }, + + ... currentContextNode.getFlowContextData() } ); @@ -61351,7 +61480,9 @@ class Renderer { const renderObject = renderObjects[ i ]; - if ( this._nodes.needsRefresh( renderObject ) ) { + const refreshType = this._nodes.needsRefresh( renderObject ); + + if ( refreshType === RenderObjectRefreshType.FULL ) { this._nodes.updateBefore( renderObject ); @@ -61361,6 +61492,15 @@ class Renderer { this._nodes.updateAfter( renderObject ); + } else if ( refreshType === RenderObjectRefreshType.SHARED ) { + + this._nodes.updateBefore( renderObject ); + + this._nodes.updateForRender( renderObject ); + this._bindings.updateSharedForRender( renderObject ); + + this._nodes.updateAfter( renderObject ); + } } @@ -63762,9 +63902,9 @@ class Renderer { // - const needsRefresh = this._nodes.needsRefresh( renderObject ); + const refreshType = this._nodes.needsRefresh( renderObject ); - if ( needsRefresh ) { + if ( refreshType === RenderObjectRefreshType.FULL ) { this._nodes.updateBefore( renderObject ); @@ -63773,6 +63913,13 @@ class Renderer { this._nodes.updateForRender( renderObject ); this._bindings.updateForRender( renderObject ); + } else if ( refreshType === RenderObjectRefreshType.SHARED ) { + + this._nodes.updateBefore( renderObject ); + + this._nodes.updateForRender( renderObject ); + this._bindings.updateSharedForRender( renderObject ); + } this._pipelines.updateForRender( renderObject ); @@ -63783,7 +63930,7 @@ class Renderer { this.backend.draw( renderObject, this.info ); - if ( needsRefresh ) this._nodes.updateAfter( renderObject ); + if ( refreshType !== RenderObjectRefreshType.NONE ) this._nodes.updateAfter( renderObject ); } @@ -69518,7 +69665,7 @@ class WebGLState { /** * Returns the value for the given parameter. * - * @param {number} name - The paramter to get the value for. + * @param {number} name - The parameter to get the value for. * @return {any} The value for the given parameter. */ getParameter( name ) { @@ -88814,6 +88961,46 @@ class RenderPipeline { } + /** + * Updates the context data. + * + * @private + */ + _updateContext() { + + const toneMapping = this._toneMapping; + const outputColorSpace = this._outputColorSpace; + + const contextData = { + renderPipeline: this, + renderPipelineState: { + viewOffsetOwner: null + }, + onBeforePipelineCallbacks: [], + onAfterPipelineCallbacks: [] + }; + + let outputNode = this.outputNode; + + if ( this.outputColorTransform === true ) { + + outputNode = renderOutput( outputNode, toneMapping, outputColorSpace ); + + } else { + + contextData.toneMapping = toneMapping; + contextData.outputColorSpace = outputColorSpace; + + } + + this._contextData = contextData; + + this._quadMesh.material.contextNode = context( contextData ); + this._quadMesh.material.fragmentNode = outputNode; + this._quadMesh.material.needsUpdate = true; + + } + /** * Updates the state of the module. * @@ -88837,36 +89024,7 @@ class RenderPipeline { if ( this.needsUpdate === true ) { - const toneMapping = this._toneMapping; - const outputColorSpace = this._outputColorSpace; - - const contextData = { - renderPipeline: this, - renderPipelineState: { - viewOffsetOwner: null - }, - onBeforePipelineCallbacks: [], - onAfterPipelineCallbacks: [] - }; - - let outputNode = this.outputNode; - - if ( this.outputColorTransform === true ) { - - outputNode = renderOutput( outputNode, toneMapping, outputColorSpace ); - - } else { - - contextData.toneMapping = toneMapping; - contextData.outputColorSpace = outputColorSpace; - - } - - this._contextData = contextData; - - this._quadMesh.material.contextNode = context( contextData ); - this._quadMesh.material.fragmentNode = outputNode; - this._quadMesh.material.needsUpdate = true; + this._updateContext(); this.needsUpdate = false; @@ -88895,6 +89053,233 @@ class RenderPipeline { } +/** + * An alternative render pipeline that applies output processing directly in + * material shaders. This avoids the intermediate framebuffer and output pass + * used by {@link Renderer}, but changes blending and is not compatible with + * materials that sample the framebuffer, such as transmissive materials. + * + * ```js + * const renderPipeline = new DirectRenderPipeline( renderer ); + * renderPipeline.render( scene, camera ); + * ``` + * + * Note: This module can only be used with `WebGPURenderer`. + * + * @augments RenderPipeline + */ +class DirectRenderPipeline extends RenderPipeline { + + /** + * Constructs a direct render pipeline. + * + * @param {Renderer} renderer - A reference to the renderer. + * @param {Node} outputNode - An optional output node. + */ + constructor( renderer, outputNode = output ) { + + super( renderer, outputNode ); + + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + this.isDirectRenderPipeline = true; + + /** + * The context node used to apply output processing in material shaders. + * + * @private + * @type {?ContextNode} + * @default null + */ + this._contextNode = null; + + /** + * The renderer context node wrapped by this pipeline. + * + * @private + * @type {?ContextNode} + * @default null + */ + this._rendererContextNode = null; + + /** + * Cached node representations of solid scene backgrounds. + * + * @private + * @type {WeakMap} + */ + this._backgroundNodes = new WeakMap(); + + } + + /** + * Renders the scene with output processing applied directly in material shaders. + * + * @param {Object3D} scene - The scene or object to render. + * @param {Camera} camera - The camera. + */ + render( scene, camera ) { + + const renderer = this.renderer; + + this._update(); + + const backgroundNode = this._getBackgroundNode( scene ); + const currentBackgroundNode = backgroundNode !== null ? scene.backgroundNode : null; + const currentContextNode = renderer.contextNode; + const outputRenderTarget = renderer.getOutputRenderTarget(); + const useDirectXRRenderTarget = outputRenderTarget !== null && renderer.xr.isPresenting === true && + renderer.backend.isWebGPUBackend === true && renderer.isOutputTarget === true; + + let samples; + let depthBuffer; + let toneMapping; + let outputColorSpace; + + if ( backgroundNode !== null ) scene.backgroundNode = backgroundNode; + + renderer.contextNode = this._contextNode; + + if ( useDirectXRRenderTarget ) { + + samples = outputRenderTarget.samples; + depthBuffer = outputRenderTarget.depthBuffer; + + outputRenderTarget.samples = renderer.samples; + outputRenderTarget.depthBuffer = true; + + } + + try { + + for ( const callback of this._contextData.onBeforePipelineCallbacks ) callback(); + + toneMapping = renderer.toneMapping; + outputColorSpace = renderer.outputColorSpace; + + renderer.toneMapping = NoToneMapping; + renderer.outputColorSpace = ColorManagement.workingColorSpace; + + if ( renderer.xr.enabled ) { + + renderer.xr.renderLayers(); + + } + + renderer.render( scene, camera ); + + } finally { + + if ( toneMapping !== undefined ) renderer.toneMapping = toneMapping; + if ( outputColorSpace !== undefined ) renderer.outputColorSpace = outputColorSpace; + + if ( backgroundNode !== null && scene.backgroundNode === backgroundNode ) scene.backgroundNode = currentBackgroundNode; + + if ( renderer.contextNode === this._contextNode ) renderer.contextNode = currentContextNode; + + if ( useDirectXRRenderTarget ) { + + outputRenderTarget.samples = samples; + outputRenderTarget.depthBuffer = depthBuffer; + + } + + for ( const callback of this._contextData.onAfterPipelineCallbacks ) callback(); + + } + + } + + /** + * Returns a node representation of a solid scene background so it receives + * the same inline output processing as material fragments. + * + * @private + * @param {Object3D} scene - The scene or object to render. + * @return {?UniformNode} The background node. + */ + _getBackgroundNode( scene ) { + + if ( scene.isScene !== true || scene.backgroundNode != null || scene.background?.isColor !== true ) return null; + + const environmentBlendMode = this.renderer.xr.getEnvironmentBlendMode(); + + if ( environmentBlendMode === 'additive' || environmentBlendMode === 'alpha-blend' ) return null; + + let backgroundNode = this._backgroundNodes.get( scene.background ); + + if ( backgroundNode === undefined ) { + + backgroundNode = uniform( scene.background ); + this._backgroundNodes.set( scene.background, backgroundNode ); + + } + + return backgroundNode; + + } + + /** + * Updates the state of the module. + * + * @private + */ + _update() { + + if ( this._rendererContextNode !== this.renderer.contextNode ) { + + this._rendererContextNode = this.renderer.contextNode; + this.needsUpdate = true; + + } + + super._update(); + + } + + /** + * Updates the context used to process material output directly. + * + * @private + */ + _updateContext() { + + super._updateContext(); + + const pipelineOutputNode = this.outputNode; + const toneMapping = this._toneMapping; + const outputColorSpace = this._outputColorSpace; + const outputColorTransform = this.outputColorTransform; + + this._contextNode = this._rendererContextNode.context( { + + ...this._contextData, + + getOutput: ( materialOutputNode, builder ) => { + + const renderer = builder.renderer; + const renderTarget = renderer.getRenderTarget(); + + if ( renderer.isOutputTarget === false && renderTarget?._hasExternalTextures !== true ) return materialOutputNode; + + output.assign( materialOutputNode ); + + return outputColorTransform === true ? + renderOutput( pipelineOutputNode, toneMapping, outputColorSpace ) : + pipelineOutputNode; + + } + } ); + + } + +} + /** * @deprecated since r183. Use {@link RenderPipeline} instead. PostProcessing has been renamed to RenderPipeline. * @@ -89631,4 +90016,4 @@ class ClippingGroup extends Group { } -export { ACESFilmicToneMapping, AONode, AddEquation, AddOperation, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AmbientLightNode, AnalyticLightNode, ArrayCamera, ArrayElementNode, ArrayNode, AssignNode, AtomicFunctionNode, AttributeNode, BackSide, BarrierNode, BasicEnvironmentNode, BasicLightMapNode, BasicShadowMap, BitcastNode, BitcountNode, BlendMode, BoxGeometry, BufferAttribute, BufferAttributeNode, BufferGeometry, BufferNode, BuiltinNode, BumpMapNode, BundleGroup, BypassNode, ByteType, CanvasTarget, CineonToneMapping, ClampToEdgeWrapping, ClippingGroup, ClippingNode, CodeNode, Color, ColorManagement, ColorSpaceNode, Compatibility, ComputeBuiltinNode, ComputeNode, ConditionalNode, ConstNode, ConstantAlphaFactor, ConstantColorFactor, ContextNode, ConvertNode, CubeCamera, CubeDepthTexture, CubeMapNode, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureNode, CubeUVReflectionMapping, CullFaceBack, CullFaceFront, CullFaceNone, CustomBlending, CylinderGeometry, DataArrayTexture, DataTexture, DebugNode, DecrementStencilOp, DecrementWrapStencilOp, DepthFormat, DepthStencilFormat, DepthTexture, DirectionalLight, DirectionalLightNode, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicDrawUsage, EnvironmentNode, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, EventDispatcher, EventNode, ExpressionNode, FileLoader, FlipNode, Float16BufferAttribute, Float32BufferAttribute, FloatType, FramebufferTexture, FrontFacingNode, FrontSide, Frustum, FrustumArray, FunctionCallNode, FunctionNode, FunctionOverloadingNode, GLSLNodeParser, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, Group, HalfFloatType, HemisphereLight, HemisphereLightNode, IESSpotLight, IESSpotLightNode, IncrementStencilOp, IncrementWrapStencilOp, IndexNode, IndirectStorageBufferAttribute, InputNode, InspectorBase, InspectorNode, InstancedBufferAttribute, InstancedInterleavedBuffer, IntType, InterleavedBuffer, InterleavedBufferAttribute, InvertStencilOp, IrradianceNode, IsolateNode, JoinNode, KeepStencilOp, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, LightProbe, LightProbeNode, Lighting, LightingContextNode, LightingModel, LightingNode, LightsNode, Line2NodeMaterial, LineBasicMaterial, LineBasicNodeMaterial, LineDashedMaterial, LineDashedNodeMaterial, LinearFilter, LinearMipMapLinearFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoopNode, MRTNode, Material, MaterialBlending, MaterialLoader, MaterialNode, MaterialReferenceNode, MathNode, MathUtils, Matrix2, Matrix3, Matrix4, MaxEquation, MaxMipLevelNode, MemberNode, Mesh, MeshBasicMaterial, MeshBasicNodeMaterial, MeshLambertMaterial, MeshLambertNodeMaterial, MeshMatcapMaterial, MeshMatcapNodeMaterial, MeshNormalMaterial, MeshNormalNodeMaterial, MeshPhongMaterial, MeshPhongNodeMaterial, MeshPhysicalMaterial, MeshPhysicalNodeMaterial, MeshSSSNodeMaterial, MeshStandardMaterial, MeshStandardNodeMaterial, MeshToonMaterial, MeshToonNodeMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, ModelNode, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoNormalPacking, NoToneMapping, Node, NodeAccess, NodeAttribute, NodeBuilder, NodeCache, NodeCode, NodeError, NodeFrame, NodeFunctionInput, NodeLoader, NodeMaterial, NodeMaterialLoader, NodeMaterialObserver, NodeObjectLoader, NodeShaderStage, NodeType, NodeUniform, NodeUpdateType, NodeUtils, NodeVar, NodeVarying, NormalBlending, NormalGAPacking, NormalMapNode, NormalRGPacking, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, Object3D, Object3DNode, ObjectLoader, ObjectSpaceNormalMap, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OperatorNode, OrthographicCamera, OutputStructNode, OverrideContextNode, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, PMREMNode, PackFloatNode, ParameterNode, PassNode, PerspectiveCamera, PhongLightingModel, PhysicalLightingModel, Plane, PlaneGeometry, PointLight, PointLightNode, PointShadowNode, PointUVNode, PointsMaterial, PointsNodeMaterial, PostProcessing, ProjectorLight, ProjectorLightNode, PropertyNode, QuadMesh, Quaternion, R11_EAC_Format, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RG11_EAC_Format, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGBIntegerFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RTTNode, RangeNode, ReadbackBuffer, RectAreaLight, RectAreaLightNode, RedFormat, RedIntegerFormat, ReferenceBaseNode, ReferenceNode, ReflectorNode, ReinhardToneMapping, RenderOutputNode, RenderPipeline, RenderTarget, RendererReferenceNode, RendererUtils, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RotateNode, SIGNED_R11_EAC_Format, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SIGNED_RG11_EAC_Format, SRGBColorSpace, SRGBTransfer, SampleNode, Scene, ScreenNode, SetNode, ShadowBaseNode, ShadowMaterial, ShadowNode, ShadowNodeMaterial, ShortType, Sphere, SphereGeometry, SplitNode, SpotLight, SpotLightNode, SpriteMaterial, SpriteNodeMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StackNode, StackTrace, StaticDrawUsage, StorageArrayElementNode, StorageBufferAttribute, StorageBufferNode, StorageInstancedBufferAttribute, StorageTexture, StorageTexture3DNode, StorageTextureNode, StructNode, StructTypeNode, SubBuildNode, SubgroupFunctionNode, SubtractEquation, SubtractiveBlending, TSL, TangentSpaceNormalMap, TempNode, Texture, Texture3DNode, TextureNode, TextureSizeNode, TimestampQuery, ToneMappingNode, ToonOutlinePassNode, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, UniformArrayNode, UniformGroupNode, UniformNode, UnpackFloatNode, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, UserDataNode, VSMShadowMap, VarNode, VaryingNode, Vector2, Vector3, Vector4, VelocityNode, VertexColorNode, ViewportDepthNode, ViewportDepthTextureNode, ViewportSharedTextureNode, ViewportTextureNode, VolumeNodeMaterial, WebGLBackend, WebGLCoordinateSystem, WebGPUBackend, WebGPUCoordinateSystem, WebGPURenderer, WebXRController, WorkgroupInfoNode, ZeroFactor, ZeroStencilOp, createCanvasElement, defaultBuildStages, defaultShaderStages, error, log$1 as log, shaderStages, vectorComponents, warn, warnOnce }; +export { ACESFilmicToneMapping, AONode, AddEquation, AddOperation, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AmbientLightNode, AnalyticLightNode, ArrayCamera, ArrayElementNode, ArrayNode, AssignNode, AtomicFunctionNode, AttributeNode, BackSide, BarrierNode, BasicEnvironmentNode, BasicLightMapNode, BasicShadowMap, BitcastNode, BitcountNode, BlendMode, BoxGeometry, BufferAttribute, BufferAttributeNode, BufferGeometry, BufferNode, BuiltinNode, BumpMapNode, BundleGroup, BypassNode, ByteType, CanvasTarget, CineonToneMapping, ClampToEdgeWrapping, ClippingGroup, ClippingNode, CodeNode, Color, ColorManagement, ColorSpaceNode, Compatibility, ComputeBuiltinNode, ComputeNode, ConditionalNode, ConstNode, ConstantAlphaFactor, ConstantColorFactor, ContextNode, ConvertNode, CubeCamera, CubeDepthTexture, CubeMapNode, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureNode, CubeUVReflectionMapping, CullFaceBack, CullFaceFront, CullFaceNone, CustomBlending, CylinderGeometry, DataArrayTexture, DataTexture, DebugNode, DecrementStencilOp, DecrementWrapStencilOp, DepthFormat, DepthStencilFormat, DepthTexture, DirectRenderPipeline, DirectionalLight, DirectionalLightNode, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicDrawUsage, EnvironmentNode, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, EventDispatcher, EventNode, ExpressionNode, FileLoader, FlipNode, Float16BufferAttribute, Float32BufferAttribute, FloatType, FramebufferTexture, FrontFacingNode, FrontSide, Frustum, FrustumArray, FunctionCallNode, FunctionNode, FunctionOverloadingNode, GLSLNodeParser, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, Group, HalfFloatType, HemisphereLight, HemisphereLightNode, IESSpotLight, IESSpotLightNode, IncrementStencilOp, IncrementWrapStencilOp, IndexNode, IndirectStorageBufferAttribute, InputNode, InspectorBase, InspectorNode, InstancedBufferAttribute, InstancedInterleavedBuffer, IntType, InterleavedBuffer, InterleavedBufferAttribute, InvertStencilOp, IrradianceNode, IsolateNode, JoinNode, KeepStencilOp, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, LightProbe, LightProbeNode, Lighting, LightingContextNode, LightingModel, LightingNode, LightsNode, Line2NodeMaterial, LineBasicMaterial, LineBasicNodeMaterial, LineDashedMaterial, LineDashedNodeMaterial, LinearFilter, LinearMipMapLinearFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoopNode, MRTNode, Material, MaterialBlending, MaterialLoader, MaterialNode, MaterialReferenceNode, MathNode, MathUtils, Matrix2, Matrix3, Matrix4, MaxEquation, MaxMipLevelNode, MemberNode, Mesh, MeshBasicMaterial, MeshBasicNodeMaterial, MeshLambertMaterial, MeshLambertNodeMaterial, MeshMatcapMaterial, MeshMatcapNodeMaterial, MeshNormalMaterial, MeshNormalNodeMaterial, MeshPhongMaterial, MeshPhongNodeMaterial, MeshPhysicalMaterial, MeshPhysicalNodeMaterial, MeshSSSNodeMaterial, MeshStandardMaterial, MeshStandardNodeMaterial, MeshToonMaterial, MeshToonNodeMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, ModelNode, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoNormalPacking, NoToneMapping, Node, NodeAccess, NodeAttribute, NodeBuilder, NodeCache, NodeCode, NodeError, NodeFrame, NodeFunctionInput, NodeLoader, NodeMaterial, NodeMaterialLoader, NodeMaterialObserver, NodeObjectLoader, NodeShaderStage, NodeType, NodeUniform, NodeUpdateType, NodeUtils, NodeVar, NodeVarying, NormalBlending, NormalGAPacking, NormalMapNode, NormalRGPacking, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, Object3D, Object3DNode, ObjectLoader, ObjectSpaceNormalMap, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OperatorNode, OrthographicCamera, OutputStructNode, OverrideContextNode, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, PMREMNode, PackFloatNode, ParameterNode, PassNode, PerspectiveCamera, PhongLightingModel, PhysicalLightingModel, Plane, PlaneGeometry, PointLight, PointLightNode, PointShadowNode, PointUVNode, PointsMaterial, PointsNodeMaterial, PostProcessing, ProjectorLight, ProjectorLightNode, PropertyNode, QuadMesh, Quaternion, R11_EAC_Format, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RG11_EAC_Format, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGBIntegerFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RTTNode, RangeNode, ReadbackBuffer, RectAreaLight, RectAreaLightNode, RedFormat, RedIntegerFormat, ReferenceBaseNode, ReferenceNode, ReflectorNode, ReinhardToneMapping, RenderObjectRefreshType, RenderOutputNode, RenderPipeline, RenderTarget, RendererReferenceNode, RendererUtils, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RotateNode, SIGNED_R11_EAC_Format, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SIGNED_RG11_EAC_Format, SRGBColorSpace, SRGBTransfer, SampleNode, Scene, ScreenNode, SetNode, ShadowBaseNode, ShadowMaterial, ShadowNode, ShadowNodeMaterial, ShortType, Sphere, SphereGeometry, SplitNode, SpotLight, SpotLightNode, SpriteMaterial, SpriteNodeMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StackNode, StackTrace, StaticDrawUsage, StorageArrayElementNode, StorageBufferAttribute, StorageBufferNode, StorageInstancedBufferAttribute, StorageTexture, StorageTexture3DNode, StorageTextureNode, StructNode, StructTypeNode, SubBuildNode, SubgroupFunctionNode, SubtractEquation, SubtractiveBlending, TSL, TangentSpaceNormalMap, TempNode, Texture, Texture3DNode, TextureNode, TextureSizeNode, TimestampQuery, ToneMappingNode, ToonOutlinePassNode, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, UniformArrayNode, UniformGroupNode, UniformNode, UnpackFloatNode, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, UserDataNode, VSMShadowMap, VarNode, VaryingNode, Vector2, Vector3, Vector4, VelocityNode, VertexColorNode, ViewportDepthNode, ViewportDepthTextureNode, ViewportSharedTextureNode, ViewportTextureNode, VolumeNodeMaterial, WebGLBackend, WebGLCoordinateSystem, WebGPUBackend, WebGPUCoordinateSystem, WebGPURenderer, WebXRController, WorkgroupInfoNode, ZeroFactor, ZeroStencilOp, createCanvasElement, defaultBuildStages, defaultShaderStages, error, log$1 as log, shaderStages, vectorComponents, warn, warnOnce }; diff --git a/editor/js/Loader.js b/editor/js/Loader.js index 7b62f314e339da..3c2f3615acdc76 100644 --- a/editor/js/Loader.js +++ b/editor/js/Loader.js @@ -186,7 +186,7 @@ function Loader( editor ) { const { Rhino3dmLoader } = await import( 'three/addons/loaders/3DMLoader.js' ); const loader = new Rhino3dmLoader(); - loader.setLibraryPath( '../examples/jsm/libs/rhino3dm/' ); + loader.setLibraryPath( 'https://cdn.jsdelivr.net/npm/rhino3dm@8.32.1/' ); loader.parse( contents, function ( object ) { object.name = filename; diff --git a/examples/jsm/loaders/3DMLoader.js b/examples/jsm/loaders/3DMLoader.js index 0d7ba8c36d18ad..b1978b742d936a 100644 --- a/examples/jsm/loaders/3DMLoader.js +++ b/examples/jsm/loaders/3DMLoader.js @@ -1,4 +1,6 @@ import { + BufferAttribute, + BufferGeometry, BufferGeometryLoader, CanvasTexture, ClampToEdgeWrapping, @@ -30,6 +32,7 @@ import { import { EXRLoader } from '../loaders/EXRLoader.js'; const _taskCache = new WeakMap(); +const _bufferGeometryLoader = new BufferGeometryLoader(); /** * A loader for Rhinoceros 3D files and objects. @@ -38,11 +41,11 @@ const _taskCache = new WeakMap(); * animate, and translate NURBS curves, surfaces, breps, extrusions, point clouds, * as well as polygon meshes and SubD objects. `rhino3dm.js` is compiled to WebAssembly * from the open source geometry library `openNURBS`. The loader currently uses - * `rhino3dm.js 8.4.0`. + * `rhino3dm.js 8.32.1`. * * ```js * const loader = new Rhino3dmLoader(); - * loader.setLibraryPath( 'https://cdn.jsdelivr.net/npm/rhino3dm@8.17.0/' ); + * loader.setLibraryPath( 'https://cdn.jsdelivr.net/npm/rhino3dm@8.32.1/' ); * * const object = await loader.loadAsync( 'models/3dm/Rhino_Logo.3dm' ); * scene.add( object ); @@ -77,6 +80,10 @@ class Rhino3dmLoader extends Loader { this.workerSourceURL = ''; this.workerConfig = {}; + // Number of global subdivisions applied to SubD objects before meshing. Higher + // values increase smoothness at the cost of (potentially very large) vertex counts. + this.subdivisionLevel = 3; + this.materials = []; this.warnings = []; @@ -112,6 +119,22 @@ class Rhino3dmLoader extends Loader { } + /** + * Sets the number of global subdivisions applied to SubD objects before they are + * meshed for display. The default is `3`. Large models with many SubD objects may + * benefit from a lower value to keep vertex counts manageable. + * + * @param {number} level - The subdivision level. + * @return {Rhino3dmLoader} A reference to this loader. + */ + setSubdivisionLevel( level ) { + + this.subdivisionLevel = level; + + return this; + + } + /** * Starts loading from the given URL and passes the loaded 3DM asset * to the `onLoad()` callback. @@ -189,9 +212,7 @@ class Rhino3dmLoader extends Loader { worker._callbacks[ taskID ] = { resolve, reject }; - worker.postMessage( { type: 'decode', id: taskID, buffer }, [ buffer ] ); - - // this.debug(); + worker.postMessage( { type: 'decode', id: taskID, buffer, subdivisionLevel: this.subdivisionLevel }, [ buffer ] ); } ); @@ -213,7 +234,6 @@ class Rhino3dmLoader extends Loader { this._releaseTask( worker, taskID ); - //this.debug(); } @@ -241,14 +261,24 @@ class Rhino3dmLoader extends Loader { */ parse( data, onLoad, onError ) { - this.decodeObjects( data, '' ) - .then( result => { + this.parseAsync( data ).then( onLoad ).catch( onError ); - result.userData.warnings = this.warnings; - onLoad( result ); + } - } ) - .catch( e => onError( e ) ); + /** + * Parses the given 3DM data and returns a Promise that resolves with the loaded asset. + * + * @param {ArrayBuffer} data - The raw 3DM asset data as an array buffer. + * @return {Promise} A Promise that resolves with the decoded 3D object. + */ + parseAsync( data ) { + + return this.decodeObjects( data, '' ).then( result => { + + result.userData.warnings = this.warnings; + return result; + + } ); } @@ -304,19 +334,18 @@ class Rhino3dmLoader extends Loader { } - //console.log(material) const mat = new MeshPhysicalMaterial( { color: new Color( material.diffuseColor.r / 255.0, material.diffuseColor.g / 255.0, material.diffuseColor.b / 255.0 ), - emissive: new Color( material.emissionColor.r, material.emissionColor.g, material.emissionColor.b ), + emissive: new Color( material.emissionColor.r / 255.0, material.emissionColor.g / 255.0, material.emissionColor.b / 255.0 ), flatShading: material.disableLighting, ior: material.indexOfRefraction, name: material.name, reflectivity: material.reflectivity, opacity: 1.0 - material.transparency, side: DoubleSide, - specularColor: material.specularColor, + specularColor: new Color( material.specularColor.r / 255.0, material.specularColor.g / 255.0, material.specularColor.b / 255.0 ), transparent: material.transparency > 0 ? true : false } ); @@ -333,20 +362,18 @@ class Rhino3dmLoader extends Loader { mat.clearcoat = pbr.clearcoat; mat.clearcoatRoughness = pbr.clearcoatRoughness; mat.metalness = pbr.metallic; - mat.transmission = 1 - pbr.opacity; mat.roughness = pbr.roughness; mat.sheen = pbr.sheen; mat.specularIntensity = pbr.specular; mat.thickness = pbr.subsurface; - } - - if ( material.pbrSupported && material.pbr.opacity === 0 && material.transparency === 1 ) { - - //some compromises - - mat.opacity = 0.2; - mat.transmission = 1.00; + // Rhino PBR Opacity is coverage/alpha, not glass transmission, and is + // 1 = opaque (glTF/Disney convention, matching three.js mat.opacity — unlike + // the legacy Material.transparency used above, which is 0 = opaque). Map it + // straight to opacity so it behaves as pure alpha; leave mat.transmission at + // its default (0) rather than deriving glass from opacity. (RH3DM-190) + mat.opacity = pbr.opacity; + mat.transparent = pbr.opacity < 1.0; } @@ -360,7 +387,6 @@ class Rhino3dmLoader extends Loader { const map = textureLoader.load( texture.image ); - //console.log(texture.type ) switch ( texture.type ) { @@ -531,7 +557,6 @@ class Rhino3dmLoader extends Loader { object.userData[ 'settings' ] = data.settings; object.userData.settings[ 'renderSettings' ] = data.renderSettings; object.userData[ 'objectType' ] = 'File3dm'; - object.userData[ 'materials' ] = null; object.name = this.url; @@ -677,15 +702,38 @@ class Rhino3dmLoader extends Loader { } - object.userData[ 'materials' ] = this.materials; object.name = ''; return object; } - _createObject( obj, mat ) { + /** + * Builds a BufferGeometry from a worker payload. Meshes decoded via the fast path + * arrive as transferable typed arrays (`format: 'buffers'`) and are assembled directly; + * everything else falls back to the three.js BufferGeometry JSON produced by + * `toThreejsJSON()` (older rhino3dm, point clouds, curves, …). + */ + _geometryFromData( data ) { + + if ( data && data.format === 'buffers' ) { + + const geometry = new BufferGeometry(); + + if ( data.position && data.position.length ) geometry.setAttribute( 'position', new BufferAttribute( data.position, 3 ) ); + if ( data.normal && data.normal.length ) geometry.setAttribute( 'normal', new BufferAttribute( data.normal, 3 ) ); + if ( data.uv && data.uv.length ) geometry.setAttribute( 'uv', new BufferAttribute( data.uv, 2 ) ); + if ( data.color && data.color.length ) geometry.setAttribute( 'color', new BufferAttribute( data.color, 3 ) ); + if ( data.index && data.index.length ) geometry.setIndex( new BufferAttribute( data.index, 1 ) ); + + return geometry; - const loader = new BufferGeometryLoader(); + } + + return _bufferGeometryLoader.parse( data ); + + } + + _createObject( obj, mat ) { const attributes = obj.attributes; @@ -696,7 +744,7 @@ class Rhino3dmLoader extends Loader { case 'Point': case 'PointSet': - geometry = loader.parse( obj.geometry ); + geometry = this._geometryFromData( obj.geometry ); if ( geometry.hasAttribute( 'color' ) ) { @@ -731,7 +779,7 @@ class Rhino3dmLoader extends Loader { if ( obj.geometry === null ) return; - geometry = loader.parse( obj.geometry ); + geometry = this._geometryFromData( obj.geometry ); if ( mat === null ) { @@ -765,7 +813,7 @@ class Rhino3dmLoader extends Loader { case 'Curve': - geometry = loader.parse( obj.geometry ); + geometry = this._geometryFromData( obj.geometry ); _color = attributes.drawColor; color = new Color( _color.r / 255.0, _color.g / 255.0, _color.b / 255.0 ); @@ -1088,16 +1136,20 @@ function Rhino3dmWorker() { taskID = message.id; const buffer = message.buffer; + const subdivisionLevel = message.subdivisionLevel; libraryPending.then( () => { try { - const data = decodeObjects( rhino, buffer ); - self.postMessage( { type: 'decode', id: message.id, data } ); + const data = decodeObjects( rhino, buffer, subdivisionLevel ); + // Transfer the mesh typed arrays (fast path) instead of structure-cloning + // them across the worker boundary. + self.postMessage( { type: 'decode', id: message.id, data }, collectTransferables( data ) ); } catch ( error ) { - self.postMessage( { type: 'error', id: message.id, error } ); + // Error objects don't always survive structured clone with their stack intact. + self.postMessage( { type: 'error', id: message.id, error: { message: error.message, stack: error.stack } } ); } @@ -1109,7 +1161,59 @@ function Rhino3dmWorker() { }; - function decodeObjects( rhino, buffer ) { + // Converts a rhino3dm mesh or point cloud to a Three.js payload. When the wasm build + // supports toThreejsBuffers (rhino3dm >= 8.32.1 for point clouds, >= 8.32 for meshes), + // returns transferable typed arrays tagged `format: 'buffers'`; otherwise falls back to + // the element-by-element BufferGeometry JSON. + function meshToThreejs( geom ) { + + if ( typeof geom.toThreejsBuffers === 'function' ) { + + const b = geom.toThreejsBuffers( false ); + const g = { format: 'buffers', position: b.position }; + if ( b.normal ) g.normal = b.normal; // meshes always have normals; point clouds may not + if ( b.index ) g.index = b.index; // meshes only (point clouds are non-indexed) + if ( b.uv ) g.uv = b.uv; + if ( b.color ) g.color = b.color; + return g; + + } + + return geom.toThreejsJSON(); + + } + + // Gathers the ArrayBuffers backing every fast-path mesh so postMessage can transfer + // (move) them to the main thread instead of copying. + function collectTransferables( data ) { + + const transfer = new Set(); + + if ( data && data.objects ) { + + for ( const obj of data.objects ) { + + const g = obj.geometry; + + if ( g && g.format === 'buffers' ) { + + for ( const key of [ 'position', 'normal', 'uv', 'color', 'index' ] ) { + + if ( g[ key ] && g[ key ].buffer ) transfer.add( g[ key ].buffer ); + + } + + } + + } + + } + + return Array.from( transfer ); + + } + + function decodeObjects( rhino, buffer, subdivisionLevel ) { const arr = new Uint8Array( buffer ); const doc = rhino.File3dm.fromByteArray( arr ); @@ -1131,7 +1235,7 @@ function Rhino3dmWorker() { const _object = objs.get( i ); - const object = extractObjectData( _object, doc ); + const object = extractObjectData( _object, doc, subdivisionLevel ); _object.delete(); @@ -1144,7 +1248,6 @@ function Rhino3dmWorker() { } // Handle instance definitions - // console.log( `Instance Definitions Count: ${doc.instanceDefinitions().count()}` ); for ( let i = 0; i < doc.instanceDefinitions().count; i ++ ) { @@ -1276,15 +1379,11 @@ function Rhino3dmWorker() { //TODO: Handle other document stuff like dimstyles, instance definitions, bitmaps etc. // Handle dimstyles - // console.log( `Dimstyle Count: ${doc.dimstyles().count()}` ); // Handle bitmaps - // console.log( `Bitmap Count: ${doc.bitmaps().count()}` ); // Handle strings - // console.log( `Document Strings Count: ${doc.strings().count()}` ); // Note: doc.strings().documentUserTextCount() counts any doc.strings defined in a section - // console.log( `Document User Text Count: ${doc.strings().documentUserTextCount()}` ); const strings_count = doc.strings().count; @@ -1437,7 +1536,7 @@ function Rhino3dmWorker() { } - function extractObjectData( object, doc ) { + function extractObjectData( object, doc, subdivisionLevel ) { const _geometry = object.geometry(); const _attributes = object.attributes(); @@ -1507,7 +1606,7 @@ function Rhino3dmWorker() { case rhino.ObjectType.PointSet: case rhino.ObjectType.Mesh: - geometry = _geometry.toThreejsJSON(); + geometry = meshToThreejs( _geometry ); break; @@ -1535,7 +1634,7 @@ function Rhino3dmWorker() { if ( mesh.faces().count > 0 ) { mesh.compact(); - geometry = mesh.toThreejsJSON(); + geometry = meshToThreejs( mesh ); faces.delete(); } @@ -1550,7 +1649,7 @@ function Rhino3dmWorker() { if ( mesh ) { - geometry = mesh.toThreejsJSON(); + geometry = meshToThreejs( mesh ); mesh.delete(); } @@ -1592,11 +1691,11 @@ function Rhino3dmWorker() { case rhino.ObjectType.SubD: // TODO: precalculate resulting vertices and faces and warn on excessive results - _geometry.subdivide( 3 ); + _geometry.subdivide( subdivisionLevel ); mesh = rhino.Mesh.createFromSubDControlNet( _geometry, false ); if ( mesh ) { - geometry = mesh.toThreejsJSON(); + geometry = meshToThreejs( mesh ); mesh.delete(); } @@ -1706,7 +1805,6 @@ function Rhino3dmWorker() { } else { // these are functions that could be called to extract more data. - //console.log( `${property}: ${object[ property ].constructor.name}` ); } diff --git a/examples/screenshots/webgl_loader_3dm.jpg b/examples/screenshots/webgl_loader_3dm.jpg index d6e56aa0717aa4..454ff58ba99678 100644 Binary files a/examples/screenshots/webgl_loader_3dm.jpg and b/examples/screenshots/webgl_loader_3dm.jpg differ diff --git a/examples/webgl_loader_3dm.html b/examples/webgl_loader_3dm.html index 3e927a73f3a787..21a01bef1d1df8 100644 --- a/examples/webgl_loader_3dm.html +++ b/examples/webgl_loader_3dm.html @@ -79,7 +79,7 @@ scene.add( directionalLight ); const loader = new Rhino3dmLoader(); - loader.setLibraryPath( 'https://cdn.jsdelivr.net/npm/rhino3dm@8.17.0/' ); + loader.setLibraryPath( 'https://cdn.jsdelivr.net/npm/rhino3dm@8.32.1/' ); loader.load( 'models/3dm/Rhino_Logo.3dm', function ( object ) { scene.add( object );