pptx-react-viewer 1.1.3 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1099 -384
- package/dist/index.mjs +1099 -385
- package/dist/pptx-viewer.css +1 -1
- package/dist/viewer/index.js +1117 -390
- package/dist/viewer/index.mjs +1117 -391
- package/node_modules/emf-converter/dist/index.d.mts +2 -2
- package/node_modules/emf-converter/dist/index.d.ts +2 -2
- package/node_modules/emf-converter/dist/index.js +91 -33
- package/node_modules/emf-converter/dist/index.mjs +91 -33
- package/node_modules/emf-converter/package.json +2 -2
- package/node_modules/mtx-decompressor/dist/index.js +39 -9
- package/node_modules/mtx-decompressor/dist/index.mjs +39 -9
- package/node_modules/mtx-decompressor/package.json +2 -2
- package/node_modules/pptx-viewer-core/dist/{SvgExporter-BMjoxMDV.d.ts → SvgExporter-0TxiiorD.d.ts} +1 -1
- package/node_modules/pptx-viewer-core/dist/{SvgExporter-z6AbXRQg.d.mts → SvgExporter-BQ4KbRO9.d.mts} +1 -1
- package/node_modules/pptx-viewer-core/dist/cli/index.d.mts +2 -2
- package/node_modules/pptx-viewer-core/dist/cli/index.d.ts +2 -2
- package/node_modules/pptx-viewer-core/dist/cli/index.js +0 -0
- package/node_modules/pptx-viewer-core/dist/cli/index.mjs +0 -0
- package/node_modules/pptx-viewer-core/dist/converter/index.d.mts +3 -3
- package/node_modules/pptx-viewer-core/dist/converter/index.d.ts +3 -3
- package/node_modules/pptx-viewer-core/dist/converter/index.js +0 -0
- package/node_modules/pptx-viewer-core/dist/converter/index.mjs +0 -0
- package/node_modules/pptx-viewer-core/dist/index.d.mts +786 -54
- package/node_modules/pptx-viewer-core/dist/index.d.ts +786 -54
- package/node_modules/pptx-viewer-core/dist/index.js +3589 -630
- package/node_modules/pptx-viewer-core/dist/index.mjs +3575 -630
- package/node_modules/pptx-viewer-core/dist/{presentation-CchuDGfU.d.mts → presentation-ArhfImJ5.d.mts} +225 -8
- package/node_modules/pptx-viewer-core/dist/{presentation-CchuDGfU.d.ts → presentation-ArhfImJ5.d.ts} +225 -8
- package/node_modules/pptx-viewer-core/dist/{signature-inspection-status-BcJSdOvb.d.mts → signature-inspection-status-BCUpfCQh.d.mts} +13 -2
- package/node_modules/pptx-viewer-core/dist/{signature-inspection-status-BcJSdOvb.d.ts → signature-inspection-status-BCUpfCQh.d.ts} +13 -2
- package/node_modules/pptx-viewer-core/dist/signature-node/index.d.mts +2 -2
- package/node_modules/pptx-viewer-core/dist/signature-node/index.d.ts +2 -2
- package/node_modules/pptx-viewer-core/dist/signature-node/index.js +17 -3
- package/node_modules/pptx-viewer-core/dist/signature-node/index.mjs +16 -4
- package/node_modules/pptx-viewer-core/dist/{text-operations-CeukUztU.d.mts → text-operations-CLj-sJyk.d.mts} +1 -1
- package/node_modules/pptx-viewer-core/dist/{text-operations-e7JxgI5l.d.ts → text-operations-rhJV-A_W.d.ts} +1 -1
- package/node_modules/pptx-viewer-core/package.json +5 -5
- package/package.json +22 -20
package/dist/viewer/index.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as React10 from 'react';
|
|
2
|
-
import React10__default, { createContext, useState, useEffect, useMemo, Suspense, useCallback, forwardRef, useRef, useSyncExternalStore, useImperativeHandle, useContext, useLayoutEffect } from 'react';
|
|
2
|
+
import React10__default, { createContext, useState, useEffect, useMemo, Suspense, useCallback, forwardRef, useRef, useSyncExternalStore, useImperativeHandle, useContext, useLayoutEffect, useDeferredValue } from 'react';
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import * as ReactDOM from 'react-dom/client';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
7
|
import { LuMessageSquare, LuEyeOff, LuSettings, LuX, LuCast, LuShieldCheck, LuPlus, LuPanelLeftClose, LuStickyNote, LuMonitor, LuColumns2, LuPresentation, LuMinus, LuClock, LuDownload, LuTrash2, LuCheck, LuLock, LuEye, LuFileText, LuType, LuLoader, LuShieldAlert, LuSignature, LuInfo, LuTriangleAlert, LuPrinter, LuPenTool, LuWifi, LuWifiOff, LuUsers, LuCopy, LuMonitorOff, LuChevronLeft, LuChevronRight, LuPlay, LuPause, LuPanelLeft, LuUndo, LuRedo, LuSearch, LuShare2, LuPanelRight, LuFolderOpen, LuVideo, LuImage, LuClipboardPaste, LuScissors, LuPaintbrush, LuChevronDown, LuSquare, LuDatabase, LuLayers, LuAArrowUp, LuAArrowDown, LuRemoveFormatting, LuHighlighter, LuList, LuListOrdered, LuIndentDecrease, LuIndentIncrease, LuChevronUp, LuPalette, LuPencil, LuPaintBucket, LuSparkles, LuCaptions, LuSpellCheck, LuGitCompare, LuPipette, LuCaseSensitive, LuReplace, LuTimer, LuMousePointer2, LuEraser, LuGripVertical, LuUpload, LuBold, LuItalic, LuUnderline, LuStrikethrough, LuLink, LuGrid2X2, LuCopyPlus, LuEllipsis, LuCircle, LuMoveRight, LuTriangle, LuDiamond, LuAlignLeft, LuAlignCenter, LuAlignRight, LuAlignJustify, LuSpline, LuSettings2, LuMove, LuRadio, LuArrowDown, LuArrowUp, LuArrowRight, LuArrowLeft, LuReply, LuRotateCw, LuBookmark } from 'react-icons/lu';
|
|
8
8
|
import { hasShapeProperties, hasTextProperties, SWITCHABLE_LAYOUT_TYPES, isCalloutShape, getCalloutLeaderLineGeometry, buildCalloutLeaderLineSvgPath, getCalloutViewBoxBounds, isInkElement, getLinkedTextBoxSegments, isImageLikeElement, getSubstituteFontFamily, PptxHandler, EncryptedFileError, guidePxToEmu, guideEmuToPx, THEME_COLOR_SCHEME_KEYS, hslToRgb, PRESET_COLOR_MAP, elementActionToPptxAction, mergeShapes, SvgExporter, applyDrawingColorTransforms as applyDrawingColorTransforms$1, getPresetShapeClipPath, svgPathToPolygons, polygonsToSvgPath, EMU_PER_PX as EMU_PER_PX$1, chartDataChangeType, chartDataUpdatePoint, chartDataAddCategory, chartDataRemoveCategory, chartDataAddSeries, chartDataRemoveSeries, getOleObjectTypeLabel, pptxActionToElementAction, hasNonTrivialOverride, COLOR_MAP_ALIAS_KEYS, DEFAULT_COLOR_MAP, addSmartArtNodeAsChild, updateSmartArtNodeText, removeSmartArtNode, switchSmartArtLayout, applyThemeToData, THEME_PRESETS } from 'pptx-viewer-core';
|
|
9
|
+
import DOMPurify from 'dompurify';
|
|
9
10
|
import { useTranslation } from 'react-i18next';
|
|
10
11
|
import html2canvasPro from 'html2canvas-pro';
|
|
11
12
|
import JSZip from 'jszip';
|
|
@@ -64,7 +65,7 @@ var init_extends = __esm({
|
|
|
64
65
|
}
|
|
65
66
|
});
|
|
66
67
|
|
|
67
|
-
// ../../node_modules/.bun/three@0.
|
|
68
|
+
// ../../node_modules/.bun/three@0.184.0/node_modules/three/build/three.core.js
|
|
68
69
|
function arrayNeedsUint32(array) {
|
|
69
70
|
for (let i3 = array.length - 1; i3 >= 0; --i3) {
|
|
70
71
|
if (array[i3] >= 65535) return true;
|
|
@@ -1232,7 +1233,7 @@ function cloneUniforms(src) {
|
|
|
1232
1233
|
dst[u2] = {};
|
|
1233
1234
|
for (const p3 in src[u2]) {
|
|
1234
1235
|
const property = src[u2][p3];
|
|
1235
|
-
if (
|
|
1236
|
+
if (isThreeObject(property)) {
|
|
1236
1237
|
if (property.isRenderTargetTexture) {
|
|
1237
1238
|
warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().");
|
|
1238
1239
|
dst[u2][p3] = null;
|
|
@@ -1240,7 +1241,15 @@ function cloneUniforms(src) {
|
|
|
1240
1241
|
dst[u2][p3] = property.clone();
|
|
1241
1242
|
}
|
|
1242
1243
|
} else if (Array.isArray(property)) {
|
|
1243
|
-
|
|
1244
|
+
if (isThreeObject(property[0])) {
|
|
1245
|
+
const clonedProperty = [];
|
|
1246
|
+
for (let i3 = 0, l2 = property.length; i3 < l2; i3++) {
|
|
1247
|
+
clonedProperty[i3] = property[i3].clone();
|
|
1248
|
+
}
|
|
1249
|
+
dst[u2][p3] = clonedProperty;
|
|
1250
|
+
} else {
|
|
1251
|
+
dst[u2][p3] = property.slice();
|
|
1252
|
+
}
|
|
1244
1253
|
} else {
|
|
1245
1254
|
dst[u2][p3] = property;
|
|
1246
1255
|
}
|
|
@@ -1251,13 +1260,16 @@ function cloneUniforms(src) {
|
|
|
1251
1260
|
function mergeUniforms(uniforms) {
|
|
1252
1261
|
const merged = {};
|
|
1253
1262
|
for (let u2 = 0; u2 < uniforms.length; u2++) {
|
|
1254
|
-
const
|
|
1255
|
-
for (const p3 in
|
|
1256
|
-
merged[p3] =
|
|
1263
|
+
const tmp3 = cloneUniforms(uniforms[u2]);
|
|
1264
|
+
for (const p3 in tmp3) {
|
|
1265
|
+
merged[p3] = tmp3[p3];
|
|
1257
1266
|
}
|
|
1258
1267
|
}
|
|
1259
1268
|
return merged;
|
|
1260
1269
|
}
|
|
1270
|
+
function isThreeObject(property) {
|
|
1271
|
+
return property && (property.isColor || property.isMatrix3 || property.isMatrix4 || property.isVector2 || property.isVector3 || property.isVector4 || property.isTexture || property.isQuaternion);
|
|
1272
|
+
}
|
|
1261
1273
|
function cloneUniformsGroups(src) {
|
|
1262
1274
|
const dst = [];
|
|
1263
1275
|
for (let u2 = 0; u2 < src.length; u2++) {
|
|
@@ -1680,10 +1692,10 @@ function getTextureTypeByteLength(type) {
|
|
|
1680
1692
|
}
|
|
1681
1693
|
throw new Error(`Unknown texture type ${type}.`);
|
|
1682
1694
|
}
|
|
1683
|
-
var REVISION, MOUSE, TOUCH, CullFaceNone, CullFaceBack, CullFaceFront, CullFaceFrontBack, BasicShadowMap, PCFShadowMap, PCFSoftShadowMap, VSMShadowMap, FrontSide, BackSide, DoubleSide, NoBlending, NormalBlending, AdditiveBlending, SubtractiveBlending, MultiplyBlending, CustomBlending, MaterialBlending, AddEquation, SubtractEquation, ReverseSubtractEquation, MinEquation, MaxEquation, ZeroFactor, OneFactor, SrcColorFactor, OneMinusSrcColorFactor, SrcAlphaFactor, OneMinusSrcAlphaFactor, DstAlphaFactor, OneMinusDstAlphaFactor, DstColorFactor, OneMinusDstColorFactor, SrcAlphaSaturateFactor, ConstantColorFactor, OneMinusConstantColorFactor, ConstantAlphaFactor, OneMinusConstantAlphaFactor, NeverDepth, AlwaysDepth, LessDepth, LessEqualDepth, EqualDepth, GreaterEqualDepth, GreaterDepth, NotEqualDepth, MultiplyOperation, MixOperation, AddOperation, NoToneMapping, LinearToneMapping, ReinhardToneMapping, CineonToneMapping, ACESFilmicToneMapping, CustomToneMapping, AgXToneMapping, NeutralToneMapping, AttachedBindMode, DetachedBindMode, UVMapping, CubeReflectionMapping, CubeRefractionMapping, EquirectangularReflectionMapping, EquirectangularRefractionMapping, CubeUVReflectionMapping, RepeatWrapping, ClampToEdgeWrapping, MirroredRepeatWrapping, NearestFilter, NearestMipmapNearestFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipMapLinearFilter, LinearFilter, LinearMipmapNearestFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipMapLinearFilter, UnsignedByteType, ByteType, ShortType, UnsignedShortType, IntType, UnsignedIntType, FloatType, HalfFloatType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedInt101111Type, AlphaFormat, RGBFormat, RGBAFormat, DepthFormat, DepthStencilFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBIntegerFormat, 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, RG11_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, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, LoopOnce, LoopRepeat, LoopPingPong, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolateBezier, ZeroCurvatureEnding, ZeroSlopeEnding, WrapAroundEnding, NormalAnimationBlendMode, AdditiveAnimationBlendMode, TrianglesDrawMode, TriangleStripDrawMode, TriangleFanDrawMode, BasicDepthPacking, RGBADepthPacking, RGBDepthPacking, RGDepthPacking, TangentSpaceNormalMap, ObjectSpaceNormalMap, NoColorSpace, SRGBColorSpace, LinearSRGBColorSpace, LinearTransfer, SRGBTransfer, NoNormalPacking, NormalRGPacking, NormalGAPacking, ZeroStencilOp, KeepStencilOp, ReplaceStencilOp, IncrementStencilOp, DecrementStencilOp, IncrementWrapStencilOp, DecrementWrapStencilOp, InvertStencilOp, NeverStencilFunc, LessStencilFunc, EqualStencilFunc, LessEqualStencilFunc, GreaterStencilFunc, NotEqualStencilFunc, GreaterEqualStencilFunc, AlwaysStencilFunc, NeverCompare, LessCompare, EqualCompare, LessEqualCompare, GreaterCompare, NotEqualCompare, GreaterEqualCompare, AlwaysCompare, StaticDrawUsage, DynamicDrawUsage, StreamDrawUsage, StaticReadUsage, DynamicReadUsage, StreamReadUsage, StaticCopyUsage, DynamicCopyUsage, StreamCopyUsage, GLSL1, GLSL3, WebGLCoordinateSystem, WebGPUCoordinateSystem, TimestampQuery, InterpolationSamplingType, InterpolationSamplingMode, Compatibility, TYPED_ARRAYS, _cache, _setConsoleFunction, ReversedDepthFuncs, EventDispatcher, _lut, _seed, DEG2RAD, RAD2DEG, MathUtils, Vector2, Quaternion, Vector3, _vector$c, _quaternion$5, Matrix3, _m3, LINEAR_REC709_TO_XYZ, XYZ_TO_LINEAR_REC709, ColorManagement, _canvas, ImageUtils, _sourceId, Source, _textureId, _tempVec3, Texture, Vector4, RenderTarget, WebGLRenderTarget, DataArrayTexture, WebGLArrayRenderTarget, Data3DTexture, WebGL3DRenderTarget, Matrix4, _v1$7, _m1$2, _zero, _one, _x, _y, _z, _matrix$2, _quaternion$4, Euler, Layers, _object3DId, _v1$6, _q1, _m1$1, _target, _position$4, _scale$3, _quaternion$3, _xAxis, _yAxis, _zAxis, _addedEvent, _removedEvent, _childaddedEvent, _childremovedEvent, Object3D, Group, _moveEvent, WebXRController, _colorKeywords, _hslA, _hslB, Color, _color, FogExp2, Fog, Scene, _v0$2, _v1$5, _v2$4, _v3$2, _vab, _vac, _vbc, _vap, _vbp, _vcp, _v40, _v41, _v42, Triangle, Box3, _points, _vector$b, _box$4, _v0$1, _v1$4, _v2$3, _f0, _f1, _f2, _center, _extents, _triangleNormal, _testAxis, _tables, DataUtils, _vector$a, _vector2$1, _id$2, BufferAttribute, Int8BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Int16BufferAttribute, Uint16BufferAttribute, Int32BufferAttribute, Uint32BufferAttribute, Float16BufferAttribute, Float32BufferAttribute, _box$3, _v1$3, _v2$2, Sphere, _id$1, _m1, _obj, _offset, _box$2, _boxMorphTargets, _vector$9, BufferGeometry, InterleavedBuffer, _vector$8, InterleavedBufferAttribute, _materialId, Material, SpriteMaterial, _geometry, _intersectPoint, _worldScale, _mvPosition, _alignedPosition, _rotatedPosition, _viewWorldMatrix, _vA$1, _vB$1, _vC$1, _uvA, _uvB, _uvC, Sprite, _v1$2, _v2$1, LOD, _vector$7, _segCenter, _segDir, _diff, _edge1, _edge2, _normal$1, Ray, MeshBasicMaterial, _inverseMatrix$3, _ray$3, _sphere$6, _sphereHitAt, _vA, _vB, _vC, _tempA, _morphA, _intersectionPoint, _intersectionPointWorld, Mesh, _basePosition, _skinIndex, _skinWeight, _vector3, _matrix4, _vertex, _sphere$5, _inverseMatrix$2, _ray$2, SkinnedMesh, Bone, DataTexture, _offsetMatrix, _identityMatrix, Skeleton, InstancedBufferAttribute, _instanceLocalMatrix, _instanceWorldMatrix, _instanceIntersects, _box3, _identity, _mesh$1, _sphere$4, InstancedMesh, _vector1, _vector2, _normalMatrix, Plane, _sphere$3, _defaultSpriteCenter, _vector$6, Frustum, _projScreenMatrix$1, _frustum$1, FrustumArray, MultiDrawRenderList, _matrix$1, _whiteColor, _frustum, _frustumArray, _box$1, _sphere$2, _vector$5, _forward$1, _temp, _renderList, _mesh, _batchIntersects, BatchedMesh, LineBasicMaterial, _vStart, _vEnd, _inverseMatrix$1, _ray$1, _sphere$1, _intersectPointOnRay, _intersectPointOnSegment, Line, _start, _end, LineSegments, LineLoop, PointsMaterial, _inverseMatrix, _ray, _sphere, _position$3, Points, VideoTexture, VideoFrameTexture, FramebufferTexture, CompressedTexture, CompressedArrayTexture, CompressedCubeTexture, CubeTexture, CanvasTexture, DepthTexture, CubeDepthTexture, ExternalTexture, BoxGeometry, CapsuleGeometry, CircleGeometry, CylinderGeometry, ConeGeometry, PolyhedronGeometry, DodecahedronGeometry, _v0, _v1$1, _normal, _triangle, EdgesGeometry, Curve, EllipseCurve, ArcCurve, tmp, px, py, pz, CatmullRomCurve3, CubicBezierCurve, CubicBezierCurve3, LineCurve, LineCurve3, QuadraticBezierCurve, QuadraticBezierCurve3, SplineCurve, Curves, CurvePath, Path, Shape, Earcut, ShapeUtils, ExtrudeGeometry, WorldUVGenerator, IcosahedronGeometry, LatheGeometry, OctahedronGeometry, PlaneGeometry, RingGeometry, ShapeGeometry, SphereGeometry, TetrahedronGeometry, TorusGeometry, TorusKnotGeometry, TubeGeometry, WireframeGeometry, Geometries, ShadowMaterial, UniformsUtils, default_vertex, default_fragment, ShaderMaterial, RawShaderMaterial, MeshStandardMaterial, MeshPhysicalMaterial, MeshPhongMaterial, MeshToonMaterial, MeshNormalMaterial, MeshLambertMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshMatcapMaterial, LineDashedMaterial, AnimationUtils, Interpolant, CubicInterpolant, LinearInterpolant, DiscreteInterpolant, BezierInterpolant, KeyframeTrack, BooleanKeyframeTrack, ColorKeyframeTrack, NumberKeyframeTrack, QuaternionLinearInterpolant, QuaternionKeyframeTrack, StringKeyframeTrack, VectorKeyframeTrack, AnimationClip, Cache, LoadingManager, DefaultLoadingManager, Loader, loading, HttpError, FileLoader, AnimationLoader, CompressedTextureLoader, _loading, ImageLoader, CubeTextureLoader, DataTextureLoader, TextureLoader, Light, HemisphereLight, _projScreenMatrix, _lightPositionWorld, _lookTarget, LightShadow, _position$2, _quaternion$2, _scale$2, Camera, _v3$1, _minTarget, _maxTarget, PerspectiveCamera, SpotLightShadow, SpotLight, PointLightShadow, PointLight, OrthographicCamera, DirectionalLightShadow, DirectionalLight, AmbientLight, RectAreaLight, SphericalHarmonics3, LightProbe, MaterialLoader, LoaderUtils, InstancedBufferGeometry, BufferGeometryLoader, ObjectLoader, TEXTURE_MAPPING, TEXTURE_WRAPPING, TEXTURE_FILTER, _errorMap, ImageBitmapLoader, _context, AudioContext, AudioLoader, _eyeRight, _eyeLeft, _projectionMatrix, StereoCamera, fov, aspect, CubeCamera, ArrayCamera, Timer, _position$1, _quaternion$1, _scale$1, _forward, _up, AudioListener, Audio2, _position, _quaternion, _scale, _orientation, PositionalAudio, AudioAnalyser, PropertyMixer, _RESERVED_CHARS_RE, _reservedRe, _wordChar, _wordCharOrDot, _directoryRe, _nodeRe, _objectRe, _propertyRe, _trackRe, _supportedObjectNames, Composite, PropertyBinding, AnimationObjectGroup, AnimationAction, _controlInterpolantsResultBuffer, AnimationMixer, RenderTarget3D, Uniform, _id, UniformsGroup, InstancedInterleavedBuffer, GLBufferAttribute, _matrix, Raycaster, Clock, Spherical, Cylindrical, Matrix2, _vector$4, Box2, _startP, _startEnd, _d1, _d2, _r, _c1, _c2, Line3, _vector$3, SpotLightHelper, _vector$2, _boneMatrix, _matrixWorldInv, SkeletonHelper, PointLightHelper, _vector$1, _color1, _color2, HemisphereLightHelper, GridHelper, PolarGridHelper, _v1, _v2, _v3, DirectionalLightHelper, _vector, _camera, CameraHelper, _box, BoxHelper, Box3Helper, PlaneHelper, _axis, _lineGeometry, _coneGeometry, ArrowHelper, AxesHelper, ShapePath, Controls, TextureUtils;
|
|
1695
|
+
var REVISION, MOUSE, TOUCH, CullFaceNone, CullFaceBack, CullFaceFront, CullFaceFrontBack, BasicShadowMap, PCFShadowMap, PCFSoftShadowMap, VSMShadowMap, FrontSide, BackSide, DoubleSide, NoBlending, NormalBlending, AdditiveBlending, SubtractiveBlending, MultiplyBlending, CustomBlending, MaterialBlending, AddEquation, SubtractEquation, ReverseSubtractEquation, MinEquation, MaxEquation, ZeroFactor, OneFactor, SrcColorFactor, OneMinusSrcColorFactor, SrcAlphaFactor, OneMinusSrcAlphaFactor, DstAlphaFactor, OneMinusDstAlphaFactor, DstColorFactor, OneMinusDstColorFactor, SrcAlphaSaturateFactor, ConstantColorFactor, OneMinusConstantColorFactor, ConstantAlphaFactor, OneMinusConstantAlphaFactor, NeverDepth, AlwaysDepth, LessDepth, LessEqualDepth, EqualDepth, GreaterEqualDepth, GreaterDepth, NotEqualDepth, MultiplyOperation, MixOperation, AddOperation, NoToneMapping, LinearToneMapping, ReinhardToneMapping, CineonToneMapping, ACESFilmicToneMapping, CustomToneMapping, AgXToneMapping, NeutralToneMapping, AttachedBindMode, DetachedBindMode, UVMapping, CubeReflectionMapping, CubeRefractionMapping, EquirectangularReflectionMapping, EquirectangularRefractionMapping, CubeUVReflectionMapping, RepeatWrapping, ClampToEdgeWrapping, MirroredRepeatWrapping, NearestFilter, NearestMipmapNearestFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipMapLinearFilter, LinearFilter, LinearMipmapNearestFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipMapLinearFilter, UnsignedByteType, ByteType, ShortType, UnsignedShortType, IntType, UnsignedIntType, FloatType, HalfFloatType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedInt101111Type, AlphaFormat, RGBFormat, RGBAFormat, DepthFormat, DepthStencilFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBIntegerFormat, 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, RG11_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, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, LoopOnce, LoopRepeat, LoopPingPong, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolateBezier, ZeroCurvatureEnding, ZeroSlopeEnding, WrapAroundEnding, NormalAnimationBlendMode, AdditiveAnimationBlendMode, TrianglesDrawMode, TriangleStripDrawMode, TriangleFanDrawMode, BasicDepthPacking, RGBADepthPacking, RGBDepthPacking, RGDepthPacking, TangentSpaceNormalMap, ObjectSpaceNormalMap, NoColorSpace, SRGBColorSpace, LinearSRGBColorSpace, LinearTransfer, SRGBTransfer, NoNormalPacking, NormalRGPacking, NormalGAPacking, ZeroStencilOp, KeepStencilOp, ReplaceStencilOp, IncrementStencilOp, DecrementStencilOp, IncrementWrapStencilOp, DecrementWrapStencilOp, InvertStencilOp, NeverStencilFunc, LessStencilFunc, EqualStencilFunc, LessEqualStencilFunc, GreaterStencilFunc, NotEqualStencilFunc, GreaterEqualStencilFunc, AlwaysStencilFunc, NeverCompare, LessCompare, EqualCompare, LessEqualCompare, GreaterCompare, NotEqualCompare, GreaterEqualCompare, AlwaysCompare, StaticDrawUsage, DynamicDrawUsage, StreamDrawUsage, StaticReadUsage, DynamicReadUsage, StreamReadUsage, StaticCopyUsage, DynamicCopyUsage, StreamCopyUsage, GLSL1, GLSL3, WebGLCoordinateSystem, WebGPUCoordinateSystem, TimestampQuery, InterpolationSamplingType, InterpolationSamplingMode, Compatibility, TYPED_ARRAYS, _cache, _setConsoleFunction, ReversedDepthFuncs, EventDispatcher, _lut, _seed, DEG2RAD, RAD2DEG, MathUtils, Vector2, Quaternion, Vector3, _vector$c, _quaternion$5, Matrix3, _m3, LINEAR_REC709_TO_XYZ, XYZ_TO_LINEAR_REC709, ColorManagement, _canvas, ImageUtils, _sourceId, Source, _textureId, _tempVec3, Texture, Vector4, RenderTarget, WebGLRenderTarget, DataArrayTexture, WebGLArrayRenderTarget, Data3DTexture, WebGL3DRenderTarget, Matrix4, _v1$7, _m1$2, _zero, _one, _x, _y, _z, _matrix$2, _quaternion$4, Euler, Layers, _object3DId, _v1$6, _q1, _m1$1, _target, _position$4, _scale$3, _quaternion$3, _xAxis, _yAxis, _zAxis, _addedEvent, _removedEvent, _childaddedEvent, _childremovedEvent, Object3D, Group, _moveEvent, WebXRController, _colorKeywords, _hslA, _hslB, Color, _color, FogExp2, Fog, Scene, _v0$2, _v1$5, _v2$4, _v3$2, _vab, _vac, _vbc, _vap, _vbp, _vcp, _v40, _v41, _v42, Triangle, Box3, _points, _vector$b, _box$4, _v0$1, _v1$4, _v2$3, _f0, _f1, _f2, _center, _extents, _triangleNormal, _testAxis, _tables, DataUtils, _vector$a, _vector2$1, _id$2, BufferAttribute, Int8BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Int16BufferAttribute, Uint16BufferAttribute, Int32BufferAttribute, Uint32BufferAttribute, Float16BufferAttribute, Float32BufferAttribute, _box$3, _v1$3, _v2$2, Sphere, _id$1, _m1, _obj, _offset, _box$2, _boxMorphTargets, _vector$9, BufferGeometry, InterleavedBuffer, _vector$8, InterleavedBufferAttribute, _materialId, Material, SpriteMaterial, _geometry, _intersectPoint, _worldScale, _mvPosition, _alignedPosition, _rotatedPosition, _viewWorldMatrix, _vA$1, _vB$1, _vC$1, _uvA, _uvB, _uvC, Sprite, _v1$2, _v2$1, LOD, _vector$7, _segCenter, _segDir, _diff, _edge1, _edge2, _normal$1, Ray, MeshBasicMaterial, _inverseMatrix$3, _ray$3, _sphere$6, _sphereHitAt, _vA, _vB, _vC, _tempA, _morphA, _intersectionPoint, _intersectionPointWorld, Mesh, _baseVector, _skinIndex, _skinWeight, _vector4, _matrix4, _vertex, _sphere$5, _inverseMatrix$2, _ray$2, SkinnedMesh, Bone, DataTexture, _offsetMatrix, _identityMatrix, Skeleton, InstancedBufferAttribute, _instanceLocalMatrix, _instanceWorldMatrix, _instanceIntersects, _box3, _identity, _mesh$1, _sphere$4, InstancedMesh, _vector1, _vector2, _normalMatrix, Plane, _sphere$3, _defaultSpriteCenter, _vector$6, Frustum, _projScreenMatrix$1, _frustum$1, FrustumArray, MultiDrawRenderList, _matrix$1, _whiteColor, _frustum, _frustumArray, _box$1, _sphere$2, _vector$5, _forward$1, _temp, _renderList, _mesh, _batchIntersects, BatchedMesh, LineBasicMaterial, _vStart, _vEnd, _inverseMatrix$1, _ray$1, _sphere$1, _intersectPointOnRay, _intersectPointOnSegment, Line, _start, _end, LineSegments, LineLoop, PointsMaterial, _inverseMatrix, _ray, _sphere, _position$3, Points, VideoTexture, VideoFrameTexture, FramebufferTexture, CompressedTexture, CompressedArrayTexture, CompressedCubeTexture, CubeTexture, CanvasTexture, HTMLTexture, DepthTexture, CubeDepthTexture, ExternalTexture, BoxGeometry, CapsuleGeometry, CircleGeometry, CylinderGeometry, ConeGeometry, PolyhedronGeometry, DodecahedronGeometry, _v0, _v1$1, _normal, _triangle, EdgesGeometry, Curve, EllipseCurve, ArcCurve, tmp, tmp2, px, py, pz, CatmullRomCurve3, CubicBezierCurve, CubicBezierCurve3, LineCurve, LineCurve3, QuadraticBezierCurve, QuadraticBezierCurve3, SplineCurve, Curves, CurvePath, Path, Shape, Earcut, ShapeUtils, ExtrudeGeometry, WorldUVGenerator, IcosahedronGeometry, LatheGeometry, OctahedronGeometry, PlaneGeometry, RingGeometry, ShapeGeometry, SphereGeometry, TetrahedronGeometry, TorusGeometry, TorusKnotGeometry, TubeGeometry, WireframeGeometry, Geometries, ShadowMaterial, UniformsUtils, default_vertex, default_fragment, ShaderMaterial, RawShaderMaterial, MeshStandardMaterial, MeshPhysicalMaterial, MeshPhongMaterial, MeshToonMaterial, MeshNormalMaterial, MeshLambertMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshMatcapMaterial, LineDashedMaterial, AnimationUtils, Interpolant, CubicInterpolant, LinearInterpolant, DiscreteInterpolant, BezierInterpolant, KeyframeTrack, BooleanKeyframeTrack, ColorKeyframeTrack, NumberKeyframeTrack, QuaternionLinearInterpolant, QuaternionKeyframeTrack, StringKeyframeTrack, VectorKeyframeTrack, AnimationClip, Cache, LoadingManager, DefaultLoadingManager, Loader, loading, HttpError, FileLoader, AnimationLoader, CompressedTextureLoader, _loading, ImageLoader, CubeTextureLoader, DataTextureLoader, TextureLoader, Light, HemisphereLight, _projScreenMatrix, _lightPositionWorld, _lookTarget, LightShadow, _position$2, _quaternion$2, _scale$2, Camera, _v3$1, _minTarget, _maxTarget, PerspectiveCamera, SpotLightShadow, SpotLight, PointLightShadow, PointLight, OrthographicCamera, DirectionalLightShadow, DirectionalLight, AmbientLight, RectAreaLight, SphericalHarmonics3, LightProbe, MaterialLoader, LoaderUtils, InstancedBufferGeometry, BufferGeometryLoader, _customGeometries, ObjectLoader, TEXTURE_MAPPING, TEXTURE_WRAPPING, TEXTURE_FILTER, _errorMap, ImageBitmapLoader, _context, AudioContext, AudioLoader, _eyeRight, _eyeLeft, _projectionMatrix, StereoCamera, fov, aspect, CubeCamera, ArrayCamera, Timer, _position$1, _quaternion$1, _scale$1, _forward, _up, AudioListener, Audio2, _position, _quaternion, _scale, _orientation, PositionalAudio, AudioAnalyser, PropertyMixer, _RESERVED_CHARS_RE, _reservedRe, _wordChar, _wordCharOrDot, _directoryRe, _nodeRe, _objectRe, _propertyRe, _trackRe, _supportedObjectNames, Composite, PropertyBinding, AnimationObjectGroup, AnimationAction, _controlInterpolantsResultBuffer, AnimationMixer, RenderTarget3D, Uniform, _id, UniformsGroup, InstancedInterleavedBuffer, GLBufferAttribute, _matrix, Raycaster, Clock, Spherical, Cylindrical, Matrix2, _vector$4, Box2, _startP, _startEnd, _d1, _d2, _r, _c1, _c2, Line3, _vector$3, SpotLightHelper, _vector$2, _boneMatrix, _matrixWorldInv, SkeletonHelper, PointLightHelper, _vector$1, _color1, _color2, HemisphereLightHelper, GridHelper, PolarGridHelper, _v1, _v2, _v3, DirectionalLightHelper, _vector, _camera, CameraHelper, _box, BoxHelper, Box3Helper, PlaneHelper, _axis, _lineGeometry, _coneGeometry, ArrowHelper, AxesHelper, ShapePath, Controls, TextureUtils;
|
|
1684
1696
|
var init_three_core = __esm({
|
|
1685
|
-
"../../node_modules/.bun/three@0.
|
|
1686
|
-
REVISION = "
|
|
1697
|
+
"../../node_modules/.bun/three@0.184.0/node_modules/three/build/three.core.js"() {
|
|
1698
|
+
REVISION = "184";
|
|
1687
1699
|
MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
1688
1700
|
TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
1689
1701
|
CullFaceNone = 0;
|
|
@@ -2246,6 +2258,9 @@ var init_three_core = __esm({
|
|
|
2246
2258
|
denormalize
|
|
2247
2259
|
};
|
|
2248
2260
|
Vector2 = class _Vector2 {
|
|
2261
|
+
static {
|
|
2262
|
+
_Vector2.prototype.isVector2 = true;
|
|
2263
|
+
}
|
|
2249
2264
|
/**
|
|
2250
2265
|
* Constructs a new 2D vector.
|
|
2251
2266
|
*
|
|
@@ -2253,7 +2268,6 @@ var init_three_core = __esm({
|
|
|
2253
2268
|
* @param {number} [y=0] - The y value of this vector.
|
|
2254
2269
|
*/
|
|
2255
2270
|
constructor(x2 = 0, y = 0) {
|
|
2256
|
-
_Vector2.prototype.isVector2 = true;
|
|
2257
2271
|
this.x = x2;
|
|
2258
2272
|
this.y = y;
|
|
2259
2273
|
}
|
|
@@ -3471,6 +3485,9 @@ var init_three_core = __esm({
|
|
|
3471
3485
|
}
|
|
3472
3486
|
};
|
|
3473
3487
|
Vector3 = class _Vector3 {
|
|
3488
|
+
static {
|
|
3489
|
+
_Vector3.prototype.isVector3 = true;
|
|
3490
|
+
}
|
|
3474
3491
|
/**
|
|
3475
3492
|
* Constructs a new 3D vector.
|
|
3476
3493
|
*
|
|
@@ -3479,7 +3496,6 @@ var init_three_core = __esm({
|
|
|
3479
3496
|
* @param {number} [z=0] - The z value of this vector.
|
|
3480
3497
|
*/
|
|
3481
3498
|
constructor(x2 = 0, y = 0, z = 0) {
|
|
3482
|
-
_Vector3.prototype.isVector3 = true;
|
|
3483
3499
|
this.x = x2;
|
|
3484
3500
|
this.y = y;
|
|
3485
3501
|
this.z = z;
|
|
@@ -4377,6 +4393,9 @@ var init_three_core = __esm({
|
|
|
4377
4393
|
_vector$c = /* @__PURE__ */ new Vector3();
|
|
4378
4394
|
_quaternion$5 = /* @__PURE__ */ new Quaternion();
|
|
4379
4395
|
Matrix3 = class _Matrix3 {
|
|
4396
|
+
static {
|
|
4397
|
+
_Matrix3.prototype.isMatrix3 = true;
|
|
4398
|
+
}
|
|
4380
4399
|
/**
|
|
4381
4400
|
* Constructs a new 3x3 matrix. The arguments are supposed to be
|
|
4382
4401
|
* in row-major order. If no arguments are provided, the constructor
|
|
@@ -4393,7 +4412,6 @@ var init_three_core = __esm({
|
|
|
4393
4412
|
* @param {number} [n33] - 3-3 matrix element.
|
|
4394
4413
|
*/
|
|
4395
4414
|
constructor(n11, n12, n13, n21, n22, n23, n31, n32, n33) {
|
|
4396
|
-
_Matrix3.prototype.isMatrix3 = true;
|
|
4397
4415
|
this.elements = [
|
|
4398
4416
|
1,
|
|
4399
4417
|
0,
|
|
@@ -4615,17 +4633,17 @@ var init_three_core = __esm({
|
|
|
4615
4633
|
* @return {Matrix3} A reference to this matrix.
|
|
4616
4634
|
*/
|
|
4617
4635
|
transpose() {
|
|
4618
|
-
let
|
|
4636
|
+
let tmp3;
|
|
4619
4637
|
const m2 = this.elements;
|
|
4620
|
-
|
|
4638
|
+
tmp3 = m2[1];
|
|
4621
4639
|
m2[1] = m2[3];
|
|
4622
|
-
m2[3] =
|
|
4623
|
-
|
|
4640
|
+
m2[3] = tmp3;
|
|
4641
|
+
tmp3 = m2[2];
|
|
4624
4642
|
m2[2] = m2[6];
|
|
4625
|
-
m2[6] =
|
|
4626
|
-
|
|
4643
|
+
m2[6] = tmp3;
|
|
4644
|
+
tmp3 = m2[5];
|
|
4627
4645
|
m2[5] = m2[7];
|
|
4628
|
-
m2[7] =
|
|
4646
|
+
m2[7] = tmp3;
|
|
4629
4647
|
return this;
|
|
4630
4648
|
}
|
|
4631
4649
|
/**
|
|
@@ -4975,7 +4993,7 @@ var init_three_core = __esm({
|
|
|
4975
4993
|
if (typeof HTMLVideoElement !== "undefined" && data instanceof HTMLVideoElement) {
|
|
4976
4994
|
target.set(data.videoWidth, data.videoHeight, 0);
|
|
4977
4995
|
} else if (typeof VideoFrame !== "undefined" && data instanceof VideoFrame) {
|
|
4978
|
-
target.set(data.
|
|
4996
|
+
target.set(data.displayWidth, data.displayHeight, 0);
|
|
4979
4997
|
} else if (data !== null) {
|
|
4980
4998
|
target.set(data.width, data.height, data.depth || 0);
|
|
4981
4999
|
} else {
|
|
@@ -5088,6 +5106,7 @@ var init_three_core = __esm({
|
|
|
5088
5106
|
this.isRenderTargetTexture = false;
|
|
5089
5107
|
this.isArrayTexture = image && image.depth && image.depth > 1 ? true : false;
|
|
5090
5108
|
this.pmremVersion = 0;
|
|
5109
|
+
this.normalized = false;
|
|
5091
5110
|
}
|
|
5092
5111
|
/**
|
|
5093
5112
|
* The width of the texture in pixels.
|
|
@@ -5115,11 +5134,11 @@ var init_three_core = __esm({
|
|
|
5115
5134
|
get image() {
|
|
5116
5135
|
return this.source.data;
|
|
5117
5136
|
}
|
|
5118
|
-
set image(value
|
|
5137
|
+
set image(value) {
|
|
5119
5138
|
this.source.data = value;
|
|
5120
5139
|
}
|
|
5121
5140
|
/**
|
|
5122
|
-
* Updates the texture transformation matrix from the
|
|
5141
|
+
* Updates the texture transformation matrix from the properties {@link Texture#offset},
|
|
5123
5142
|
* {@link Texture#repeat}, {@link Texture#rotation}, and {@link Texture#center}.
|
|
5124
5143
|
*/
|
|
5125
5144
|
updateMatrix() {
|
|
@@ -5168,6 +5187,7 @@ var init_three_core = __esm({
|
|
|
5168
5187
|
this.format = source.format;
|
|
5169
5188
|
this.internalFormat = source.internalFormat;
|
|
5170
5189
|
this.type = source.type;
|
|
5190
|
+
this.normalized = source.normalized;
|
|
5171
5191
|
this.offset.copy(source.offset);
|
|
5172
5192
|
this.repeat.copy(source.repeat);
|
|
5173
5193
|
this.center.copy(source.center);
|
|
@@ -5244,6 +5264,7 @@ var init_three_core = __esm({
|
|
|
5244
5264
|
format: this.format,
|
|
5245
5265
|
internalFormat: this.internalFormat,
|
|
5246
5266
|
type: this.type,
|
|
5267
|
+
normalized: this.normalized,
|
|
5247
5268
|
colorSpace: this.colorSpace,
|
|
5248
5269
|
minFilter: this.minFilter,
|
|
5249
5270
|
magFilter: this.magFilter,
|
|
@@ -5349,6 +5370,9 @@ var init_three_core = __esm({
|
|
|
5349
5370
|
Texture.DEFAULT_MAPPING = UVMapping;
|
|
5350
5371
|
Texture.DEFAULT_ANISOTROPY = 1;
|
|
5351
5372
|
Vector4 = class _Vector4 {
|
|
5373
|
+
static {
|
|
5374
|
+
_Vector4.prototype.isVector4 = true;
|
|
5375
|
+
}
|
|
5352
5376
|
/**
|
|
5353
5377
|
* Constructs a new 4D vector.
|
|
5354
5378
|
*
|
|
@@ -5358,7 +5382,6 @@ var init_three_core = __esm({
|
|
|
5358
5382
|
* @param {number} [w=1] - The w value of this vector.
|
|
5359
5383
|
*/
|
|
5360
5384
|
constructor(x2 = 0, y = 0, z = 0, w = 1) {
|
|
5361
|
-
_Vector4.prototype.isVector4 = true;
|
|
5362
5385
|
this.x = x2;
|
|
5363
5386
|
this.y = y;
|
|
5364
5387
|
this.z = z;
|
|
@@ -6266,6 +6289,7 @@ var init_three_core = __esm({
|
|
|
6266
6289
|
this.resolveStencilBuffer = source.resolveStencilBuffer;
|
|
6267
6290
|
if (source.depthTexture !== null) this.depthTexture = source.depthTexture.clone();
|
|
6268
6291
|
this.samples = source.samples;
|
|
6292
|
+
this.multiview = source.multiview;
|
|
6269
6293
|
return this;
|
|
6270
6294
|
}
|
|
6271
6295
|
/**
|
|
@@ -6389,6 +6413,9 @@ var init_three_core = __esm({
|
|
|
6389
6413
|
}
|
|
6390
6414
|
};
|
|
6391
6415
|
Matrix4 = class _Matrix4 {
|
|
6416
|
+
static {
|
|
6417
|
+
_Matrix4.prototype.isMatrix4 = true;
|
|
6418
|
+
}
|
|
6392
6419
|
/**
|
|
6393
6420
|
* Constructs a new 4x4 matrix. The arguments are supposed to be
|
|
6394
6421
|
* in row-major order. If no arguments are provided, the constructor
|
|
@@ -6412,7 +6439,6 @@ var init_three_core = __esm({
|
|
|
6412
6439
|
* @param {number} [n44] - 4-4 matrix element.
|
|
6413
6440
|
*/
|
|
6414
6441
|
constructor(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) {
|
|
6415
|
-
_Matrix4.prototype.isMatrix4 = true;
|
|
6416
6442
|
this.elements = [
|
|
6417
6443
|
1,
|
|
6418
6444
|
0,
|
|
@@ -6917,25 +6943,25 @@ var init_three_core = __esm({
|
|
|
6917
6943
|
*/
|
|
6918
6944
|
transpose() {
|
|
6919
6945
|
const te = this.elements;
|
|
6920
|
-
let
|
|
6921
|
-
|
|
6946
|
+
let tmp3;
|
|
6947
|
+
tmp3 = te[1];
|
|
6922
6948
|
te[1] = te[4];
|
|
6923
|
-
te[4] =
|
|
6924
|
-
|
|
6949
|
+
te[4] = tmp3;
|
|
6950
|
+
tmp3 = te[2];
|
|
6925
6951
|
te[2] = te[8];
|
|
6926
|
-
te[8] =
|
|
6927
|
-
|
|
6952
|
+
te[8] = tmp3;
|
|
6953
|
+
tmp3 = te[6];
|
|
6928
6954
|
te[6] = te[9];
|
|
6929
|
-
te[9] =
|
|
6930
|
-
|
|
6955
|
+
te[9] = tmp3;
|
|
6956
|
+
tmp3 = te[3];
|
|
6931
6957
|
te[3] = te[12];
|
|
6932
|
-
te[12] =
|
|
6933
|
-
|
|
6958
|
+
te[12] = tmp3;
|
|
6959
|
+
tmp3 = te[7];
|
|
6934
6960
|
te[7] = te[13];
|
|
6935
|
-
te[13] =
|
|
6936
|
-
|
|
6961
|
+
te[13] = tmp3;
|
|
6962
|
+
tmp3 = te[11];
|
|
6937
6963
|
te[11] = te[14];
|
|
6938
|
-
te[14] =
|
|
6964
|
+
te[14] = tmp3;
|
|
6939
6965
|
return this;
|
|
6940
6966
|
}
|
|
6941
6967
|
/**
|
|
@@ -8775,9 +8801,7 @@ var init_three_core = __esm({
|
|
|
8775
8801
|
this.rotation.order = source.rotation.order;
|
|
8776
8802
|
this.quaternion.copy(source.quaternion);
|
|
8777
8803
|
this.scale.copy(source.scale);
|
|
8778
|
-
|
|
8779
|
-
this.pivot = source.pivot.clone();
|
|
8780
|
-
}
|
|
8804
|
+
this.pivot = source.pivot !== null ? source.pivot.clone() : null;
|
|
8781
8805
|
this.matrix.copy(source.matrix);
|
|
8782
8806
|
this.matrixWorld.copy(source.matrixWorld);
|
|
8783
8807
|
this.matrixAutoUpdate = source.matrixAutoUpdate;
|
|
@@ -8867,6 +8891,7 @@ var init_three_core = __esm({
|
|
|
8867
8891
|
this._grip.linearVelocity = new Vector3();
|
|
8868
8892
|
this._grip.hasAngularVelocity = false;
|
|
8869
8893
|
this._grip.angularVelocity = new Vector3();
|
|
8894
|
+
this._grip.eventsEnabled = false;
|
|
8870
8895
|
}
|
|
8871
8896
|
return this._grip;
|
|
8872
8897
|
}
|
|
@@ -8996,6 +9021,13 @@ var init_three_core = __esm({
|
|
|
8996
9021
|
} else {
|
|
8997
9022
|
grip.hasAngularVelocity = false;
|
|
8998
9023
|
}
|
|
9024
|
+
if (grip.eventsEnabled) {
|
|
9025
|
+
grip.dispatchEvent({
|
|
9026
|
+
type: "gripUpdated",
|
|
9027
|
+
data: inputSource,
|
|
9028
|
+
target: this
|
|
9029
|
+
});
|
|
9030
|
+
}
|
|
8999
9031
|
}
|
|
9000
9032
|
}
|
|
9001
9033
|
}
|
|
@@ -10075,7 +10107,7 @@ var init_three_core = __esm({
|
|
|
10075
10107
|
static isFrontFacing(a2, b2, c2, direction) {
|
|
10076
10108
|
_v0$2.subVectors(c2, b2);
|
|
10077
10109
|
_v1$5.subVectors(a2, b2);
|
|
10078
|
-
return _v0$2.cross(_v1$5).dot(direction) < 0
|
|
10110
|
+
return _v0$2.cross(_v1$5).dot(direction) < 0;
|
|
10079
10111
|
}
|
|
10080
10112
|
/**
|
|
10081
10113
|
* Sets the triangle's vertices by copying the given values.
|
|
@@ -10846,7 +10878,7 @@ var init_three_core = __esm({
|
|
|
10846
10878
|
_vector$a = /* @__PURE__ */ new Vector3();
|
|
10847
10879
|
_vector2$1 = /* @__PURE__ */ new Vector2();
|
|
10848
10880
|
_id$2 = 0;
|
|
10849
|
-
BufferAttribute = class {
|
|
10881
|
+
BufferAttribute = class extends EventDispatcher {
|
|
10850
10882
|
/**
|
|
10851
10883
|
* Constructs a new buffer attribute.
|
|
10852
10884
|
*
|
|
@@ -10855,6 +10887,7 @@ var init_three_core = __esm({
|
|
|
10855
10887
|
* @param {boolean} [normalized=false] - Whether the data are normalized or not.
|
|
10856
10888
|
*/
|
|
10857
10889
|
constructor(array, itemSize, normalized = false) {
|
|
10890
|
+
super();
|
|
10858
10891
|
if (Array.isArray(array)) {
|
|
10859
10892
|
throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");
|
|
10860
10893
|
}
|
|
@@ -11251,6 +11284,12 @@ var init_three_core = __esm({
|
|
|
11251
11284
|
if (this.usage !== StaticDrawUsage) data.usage = this.usage;
|
|
11252
11285
|
return data;
|
|
11253
11286
|
}
|
|
11287
|
+
/**
|
|
11288
|
+
* Disposes of the buffer attribute. Available only in {@link WebGPURenderer}.
|
|
11289
|
+
*/
|
|
11290
|
+
dispose() {
|
|
11291
|
+
this.dispatchEvent({ type: "dispose" });
|
|
11292
|
+
}
|
|
11254
11293
|
};
|
|
11255
11294
|
Int8BufferAttribute = class extends BufferAttribute {
|
|
11256
11295
|
/**
|
|
@@ -12192,18 +12231,18 @@ var init_three_core = __esm({
|
|
|
12192
12231
|
);
|
|
12193
12232
|
}
|
|
12194
12233
|
}
|
|
12195
|
-
const
|
|
12234
|
+
const tmp3 = new Vector3(), tmp22 = new Vector3();
|
|
12196
12235
|
const n = new Vector3(), n2 = new Vector3();
|
|
12197
12236
|
function handleVertex(v) {
|
|
12198
12237
|
n.fromBufferAttribute(normalAttribute, v);
|
|
12199
12238
|
n2.copy(n);
|
|
12200
12239
|
const t2 = tan1[v];
|
|
12201
|
-
|
|
12202
|
-
|
|
12240
|
+
tmp3.copy(t2);
|
|
12241
|
+
tmp3.sub(n.multiplyScalar(n.dot(t2))).normalize();
|
|
12203
12242
|
tmp22.crossVectors(n2, t2);
|
|
12204
12243
|
const test = tmp22.dot(tan2[v]);
|
|
12205
12244
|
const w = test < 0 ? -1 : 1;
|
|
12206
|
-
tangentAttribute.setXYZW(v,
|
|
12245
|
+
tangentAttribute.setXYZW(v, tmp3.x, tmp3.y, tmp3.z, w);
|
|
12207
12246
|
}
|
|
12208
12247
|
for (let i3 = 0, il = groups.length; i3 < il; ++i3) {
|
|
12209
12248
|
const group = groups[i3];
|
|
@@ -14354,10 +14393,10 @@ var init_three_core = __esm({
|
|
|
14354
14393
|
}
|
|
14355
14394
|
}
|
|
14356
14395
|
};
|
|
14357
|
-
|
|
14396
|
+
_baseVector = /* @__PURE__ */ new Vector4();
|
|
14358
14397
|
_skinIndex = /* @__PURE__ */ new Vector4();
|
|
14359
14398
|
_skinWeight = /* @__PURE__ */ new Vector4();
|
|
14360
|
-
|
|
14399
|
+
_vector4 = /* @__PURE__ */ new Vector4();
|
|
14361
14400
|
_matrix4 = /* @__PURE__ */ new Matrix4();
|
|
14362
14401
|
_vertex = /* @__PURE__ */ new Vector3();
|
|
14363
14402
|
_sphere$5 = /* @__PURE__ */ new Sphere();
|
|
@@ -14499,28 +14538,37 @@ var init_three_core = __esm({
|
|
|
14499
14538
|
}
|
|
14500
14539
|
/**
|
|
14501
14540
|
* Applies the bone transform associated with the given index to the given
|
|
14502
|
-
*
|
|
14541
|
+
* vector. Can be used to transform positions or direction vectors by providing
|
|
14542
|
+
* a Vector4 with 1 or 0 in the w component respectively. Returns the updated vector.
|
|
14503
14543
|
*
|
|
14504
14544
|
* @param {number} index - The vertex index.
|
|
14505
|
-
* @param {Vector3} target - The target object that is used to store the method's result.
|
|
14506
|
-
*
|
|
14507
|
-
* @return {Vector3} The updated vertex position.
|
|
14545
|
+
* @param {Vector3|Vector4} target - The target object that is used to store the method's result.
|
|
14546
|
+
* @return {Vector3|Vector4} The updated vertex attribute data.
|
|
14508
14547
|
*/
|
|
14509
14548
|
applyBoneTransform(index, target) {
|
|
14510
14549
|
const skeleton = this.skeleton;
|
|
14511
14550
|
const geometry = this.geometry;
|
|
14512
14551
|
_skinIndex.fromBufferAttribute(geometry.attributes.skinIndex, index);
|
|
14513
14552
|
_skinWeight.fromBufferAttribute(geometry.attributes.skinWeight, index);
|
|
14514
|
-
|
|
14515
|
-
|
|
14553
|
+
if (target.isVector4) {
|
|
14554
|
+
_baseVector.copy(target);
|
|
14555
|
+
target.set(0, 0, 0, 0);
|
|
14556
|
+
} else {
|
|
14557
|
+
_baseVector.set(...target, 1);
|
|
14558
|
+
target.set(0, 0, 0);
|
|
14559
|
+
}
|
|
14560
|
+
_baseVector.applyMatrix4(this.bindMatrix);
|
|
14516
14561
|
for (let i3 = 0; i3 < 4; i3++) {
|
|
14517
14562
|
const weight = _skinWeight.getComponent(i3);
|
|
14518
14563
|
if (weight !== 0) {
|
|
14519
14564
|
const boneIndex = _skinIndex.getComponent(i3);
|
|
14520
14565
|
_matrix4.multiplyMatrices(skeleton.bones[boneIndex].matrixWorld, skeleton.boneInverses[boneIndex]);
|
|
14521
|
-
target.addScaledVector(
|
|
14566
|
+
target.addScaledVector(_vector4.copy(_baseVector).applyMatrix4(_matrix4), weight);
|
|
14522
14567
|
}
|
|
14523
14568
|
}
|
|
14569
|
+
if (target.isVector4) {
|
|
14570
|
+
target.w = _baseVector.w;
|
|
14571
|
+
}
|
|
14524
14572
|
return target.applyMatrix4(this.bindMatrixInverse);
|
|
14525
14573
|
}
|
|
14526
14574
|
};
|
|
@@ -14868,18 +14916,24 @@ var init_three_core = __esm({
|
|
|
14868
14916
|
*
|
|
14869
14917
|
* @param {number} index - The instance index.
|
|
14870
14918
|
* @param {Color} color - The target object that is used to store the method's result.
|
|
14919
|
+
* @return {Color} A reference to the target color.
|
|
14871
14920
|
*/
|
|
14872
14921
|
getColorAt(index, color) {
|
|
14873
|
-
|
|
14922
|
+
if (this.instanceColor === null) {
|
|
14923
|
+
return color.setRGB(1, 1, 1);
|
|
14924
|
+
} else {
|
|
14925
|
+
return color.fromArray(this.instanceColor.array, index * 3);
|
|
14926
|
+
}
|
|
14874
14927
|
}
|
|
14875
14928
|
/**
|
|
14876
14929
|
* Gets the local transformation matrix of the defined instance.
|
|
14877
14930
|
*
|
|
14878
14931
|
* @param {number} index - The instance index.
|
|
14879
14932
|
* @param {Matrix4} matrix - The target object that is used to store the method's result.
|
|
14933
|
+
* @return {Matrix4} A reference to the target matrix.
|
|
14880
14934
|
*/
|
|
14881
14935
|
getMatrixAt(index, matrix) {
|
|
14882
|
-
matrix.fromArray(this.instanceMatrix.array, index * 16);
|
|
14936
|
+
return matrix.fromArray(this.instanceMatrix.array, index * 16);
|
|
14883
14937
|
}
|
|
14884
14938
|
/**
|
|
14885
14939
|
* Gets the morph target weights of the defined instance.
|
|
@@ -14926,22 +14980,26 @@ var init_three_core = __esm({
|
|
|
14926
14980
|
*
|
|
14927
14981
|
* @param {number} index - The instance index.
|
|
14928
14982
|
* @param {Color} color - The instance color.
|
|
14983
|
+
* @return {InstancedMesh} A reference to this instanced mesh.
|
|
14929
14984
|
*/
|
|
14930
14985
|
setColorAt(index, color) {
|
|
14931
14986
|
if (this.instanceColor === null) {
|
|
14932
14987
|
this.instanceColor = new InstancedBufferAttribute(new Float32Array(this.instanceMatrix.count * 3).fill(1), 3);
|
|
14933
14988
|
}
|
|
14934
14989
|
color.toArray(this.instanceColor.array, index * 3);
|
|
14990
|
+
return this;
|
|
14935
14991
|
}
|
|
14936
14992
|
/**
|
|
14937
14993
|
* Sets the given local transformation matrix to the defined instance. Make sure you set the `needsUpdate` flag of
|
|
14938
|
-
* {@link InstancedMesh#instanceMatrix} to `true` after updating all the
|
|
14994
|
+
* {@link InstancedMesh#instanceMatrix} to `true` after updating all the matrices.
|
|
14939
14995
|
*
|
|
14940
14996
|
* @param {number} index - The instance index.
|
|
14941
14997
|
* @param {Matrix4} matrix - The local transformation.
|
|
14998
|
+
* @return {InstancedMesh} A reference to this instanced mesh.
|
|
14942
14999
|
*/
|
|
14943
15000
|
setMatrixAt(index, matrix) {
|
|
14944
15001
|
matrix.toArray(this.instanceMatrix.array, index * 16);
|
|
15002
|
+
return this;
|
|
14945
15003
|
}
|
|
14946
15004
|
/**
|
|
14947
15005
|
* Sets the morph target weights to the defined instance. Make sure you set the `needsUpdate` flag of
|
|
@@ -14950,6 +15008,7 @@ var init_three_core = __esm({
|
|
|
14950
15008
|
* @param {number} index - The instance index.
|
|
14951
15009
|
* @param {Mesh} object - A mesh which `morphTargetInfluences` property containing the morph target weights
|
|
14952
15010
|
* of a single instance.
|
|
15011
|
+
* @return {InstancedMesh} A reference to this instanced mesh.
|
|
14953
15012
|
*/
|
|
14954
15013
|
setMorphAt(index, object) {
|
|
14955
15014
|
const objectInfluences = object.morphTargetInfluences;
|
|
@@ -14966,6 +15025,7 @@ var init_three_core = __esm({
|
|
|
14966
15025
|
const dataIndex = len * index;
|
|
14967
15026
|
array[dataIndex] = morphBaseInfluence;
|
|
14968
15027
|
array.set(objectInfluences, dataIndex + 1);
|
|
15028
|
+
return this;
|
|
14969
15029
|
}
|
|
14970
15030
|
updateMorphTargets() {
|
|
14971
15031
|
}
|
|
@@ -15118,9 +15178,10 @@ var init_three_core = __esm({
|
|
|
15118
15178
|
*
|
|
15119
15179
|
* @param {Line3} line - The line to compute the intersection for.
|
|
15120
15180
|
* @param {Vector3} target - The target vector that is used to store the method's result.
|
|
15121
|
-
* @
|
|
15181
|
+
* @param {boolean} [clampToLine=true] - Whether to clamp the intersection to the line segment.
|
|
15182
|
+
* @return {?Vector3} The intersection point. Returns `null` if no intersection is detected.
|
|
15122
15183
|
*/
|
|
15123
|
-
intersectLine(line, target) {
|
|
15184
|
+
intersectLine(line, target, clampToLine = true) {
|
|
15124
15185
|
const direction = line.delta(_vector1);
|
|
15125
15186
|
const denominator = this.normal.dot(direction);
|
|
15126
15187
|
if (denominator === 0) {
|
|
@@ -15130,7 +15191,7 @@ var init_three_core = __esm({
|
|
|
15130
15191
|
return null;
|
|
15131
15192
|
}
|
|
15132
15193
|
const t2 = -(line.start.dot(this.normal) + this.constant) / denominator;
|
|
15133
|
-
if (t2 < 0 || t2 > 1) {
|
|
15194
|
+
if (clampToLine === true && (t2 < 0 || t2 > 1)) {
|
|
15134
15195
|
return null;
|
|
15135
15196
|
}
|
|
15136
15197
|
return target.copy(line.start).addScaledVector(direction, t2);
|
|
@@ -15638,7 +15699,6 @@ var init_three_core = __esm({
|
|
|
15638
15699
|
this._multiDrawCounts = new Int32Array(maxInstanceCount);
|
|
15639
15700
|
this._multiDrawStarts = new Int32Array(maxInstanceCount);
|
|
15640
15701
|
this._multiDrawCount = 0;
|
|
15641
|
-
this._multiDrawInstances = null;
|
|
15642
15702
|
this._matricesTexture = null;
|
|
15643
15703
|
this._indirectTexture = null;
|
|
15644
15704
|
this._colorsTexture = null;
|
|
@@ -16183,7 +16243,15 @@ var init_three_core = __esm({
|
|
|
16183
16243
|
*/
|
|
16184
16244
|
getColorAt(instanceId, color) {
|
|
16185
16245
|
this.validateInstanceId(instanceId);
|
|
16186
|
-
|
|
16246
|
+
if (this._colorsTexture === null) {
|
|
16247
|
+
if (color.isVector4) {
|
|
16248
|
+
return color.set(1, 1, 1, 1);
|
|
16249
|
+
} else {
|
|
16250
|
+
return color.setRGB(1, 1, 1);
|
|
16251
|
+
}
|
|
16252
|
+
} else {
|
|
16253
|
+
return color.fromArray(this._colorsTexture.image.data, instanceId * 4);
|
|
16254
|
+
}
|
|
16187
16255
|
}
|
|
16188
16256
|
/**
|
|
16189
16257
|
* Sets the visibility of the instance.
|
|
@@ -17087,6 +17155,41 @@ var init_three_core = __esm({
|
|
|
17087
17155
|
this.needsUpdate = true;
|
|
17088
17156
|
}
|
|
17089
17157
|
};
|
|
17158
|
+
HTMLTexture = class extends Texture {
|
|
17159
|
+
/**
|
|
17160
|
+
* Constructs a new texture.
|
|
17161
|
+
*
|
|
17162
|
+
* @param {HTMLElement} [element] - The HTML element.
|
|
17163
|
+
* @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping.
|
|
17164
|
+
* @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value.
|
|
17165
|
+
* @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value.
|
|
17166
|
+
* @param {number} [magFilter=LinearFilter] - The mag filter value.
|
|
17167
|
+
* @param {number} [minFilter=LinearMipmapLinearFilter] - The min filter value.
|
|
17168
|
+
* @param {number} [format=RGBAFormat] - The texture format.
|
|
17169
|
+
* @param {number} [type=UnsignedByteType] - The texture type.
|
|
17170
|
+
* @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.
|
|
17171
|
+
*/
|
|
17172
|
+
constructor(element2, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) {
|
|
17173
|
+
super(element2, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy);
|
|
17174
|
+
this.isHTMLTexture = true;
|
|
17175
|
+
this.generateMipmaps = false;
|
|
17176
|
+
this.needsUpdate = true;
|
|
17177
|
+
const parent = element2 ? element2.parentNode : null;
|
|
17178
|
+
if (parent !== null && "requestPaint" in parent) {
|
|
17179
|
+
parent.onpaint = () => {
|
|
17180
|
+
this.needsUpdate = true;
|
|
17181
|
+
};
|
|
17182
|
+
parent.requestPaint();
|
|
17183
|
+
}
|
|
17184
|
+
}
|
|
17185
|
+
dispose() {
|
|
17186
|
+
const parent = this.image ? this.image.parentNode : null;
|
|
17187
|
+
if (parent !== null && "onpaint" in parent) {
|
|
17188
|
+
parent.onpaint = null;
|
|
17189
|
+
}
|
|
17190
|
+
super.dispose();
|
|
17191
|
+
}
|
|
17192
|
+
};
|
|
17090
17193
|
DepthTexture = class extends Texture {
|
|
17091
17194
|
/**
|
|
17092
17195
|
* Constructs a new depth texture.
|
|
@@ -18541,6 +18644,7 @@ var init_three_core = __esm({
|
|
|
18541
18644
|
}
|
|
18542
18645
|
};
|
|
18543
18646
|
tmp = /* @__PURE__ */ new Vector3();
|
|
18647
|
+
tmp2 = /* @__PURE__ */ new Vector3();
|
|
18544
18648
|
px = /* @__PURE__ */ new CubicPoly();
|
|
18545
18649
|
py = /* @__PURE__ */ new CubicPoly();
|
|
18546
18650
|
pz = /* @__PURE__ */ new CubicPoly();
|
|
@@ -18586,8 +18690,8 @@ var init_three_core = __esm({
|
|
|
18586
18690
|
if (this.closed || intPoint > 0) {
|
|
18587
18691
|
p0 = points[(intPoint - 1) % l2];
|
|
18588
18692
|
} else {
|
|
18589
|
-
|
|
18590
|
-
p0 =
|
|
18693
|
+
tmp2.subVectors(points[0], points[1]).add(points[0]);
|
|
18694
|
+
p0 = tmp2;
|
|
18591
18695
|
}
|
|
18592
18696
|
const p1 = points[intPoint % l2];
|
|
18593
18697
|
const p22 = points[(intPoint + 1) % l2];
|
|
@@ -23436,7 +23540,6 @@ var init_three_core = __esm({
|
|
|
23436
23540
|
* @param {function(any)} onLoad - Executed when the loading process has been finished.
|
|
23437
23541
|
* @param {onProgressCallback} [onProgress] - Executed while the loading is in progress.
|
|
23438
23542
|
* @param {onErrorCallback} [onError] - Executed when errors occur.
|
|
23439
|
-
* @return {any|undefined} The cached resource if available.
|
|
23440
23543
|
*/
|
|
23441
23544
|
load(url, onLoad, onProgress, onError) {
|
|
23442
23545
|
if (url === void 0) url = "";
|
|
@@ -23449,7 +23552,7 @@ var init_three_core = __esm({
|
|
|
23449
23552
|
if (onLoad) onLoad(cached);
|
|
23450
23553
|
this.manager.itemEnd(url);
|
|
23451
23554
|
}, 0);
|
|
23452
|
-
return
|
|
23555
|
+
return;
|
|
23453
23556
|
}
|
|
23454
23557
|
if (loading[url] !== void 0) {
|
|
23455
23558
|
loading[url].push({
|
|
@@ -23893,13 +23996,13 @@ var init_three_core = __esm({
|
|
|
23893
23996
|
let texData;
|
|
23894
23997
|
try {
|
|
23895
23998
|
texData = scope.parse(buffer);
|
|
23896
|
-
} catch (
|
|
23999
|
+
} catch (e2) {
|
|
23897
24000
|
if (onError !== void 0) {
|
|
23898
|
-
onError(
|
|
24001
|
+
onError(e2);
|
|
23899
24002
|
} else {
|
|
23900
|
-
|
|
23901
|
-
return;
|
|
24003
|
+
error(e2);
|
|
23902
24004
|
}
|
|
24005
|
+
return;
|
|
23903
24006
|
}
|
|
23904
24007
|
if (texData.image !== void 0) {
|
|
23905
24008
|
texture.image = texData.image;
|
|
@@ -25235,7 +25338,7 @@ var init_three_core = __esm({
|
|
|
25235
25338
|
if (json.userData !== void 0) material.userData = json.userData;
|
|
25236
25339
|
if (json.vertexColors !== void 0) {
|
|
25237
25340
|
if (typeof json.vertexColors === "number") {
|
|
25238
|
-
material.vertexColors = json.vertexColors > 0
|
|
25341
|
+
material.vertexColors = json.vertexColors > 0;
|
|
25239
25342
|
} else {
|
|
25240
25343
|
material.vertexColors = json.vertexColors;
|
|
25241
25344
|
}
|
|
@@ -25563,6 +25666,7 @@ var init_three_core = __esm({
|
|
|
25563
25666
|
return geometry;
|
|
25564
25667
|
}
|
|
25565
25668
|
};
|
|
25669
|
+
_customGeometries = {};
|
|
25566
25670
|
ObjectLoader = class extends Loader {
|
|
25567
25671
|
/**
|
|
25568
25672
|
* Constructs a new object loader.
|
|
@@ -25592,9 +25696,9 @@ var init_three_core = __esm({
|
|
|
25592
25696
|
let json = null;
|
|
25593
25697
|
try {
|
|
25594
25698
|
json = JSON.parse(text2);
|
|
25595
|
-
} catch (
|
|
25596
|
-
if (onError !== void 0) onError(
|
|
25597
|
-
|
|
25699
|
+
} catch (e2) {
|
|
25700
|
+
if (onError !== void 0) onError(e2);
|
|
25701
|
+
error("ObjectLoader: Can't parse " + url + ".", e2.message);
|
|
25598
25702
|
return;
|
|
25599
25703
|
}
|
|
25600
25704
|
const metadata = json.metadata;
|
|
@@ -25687,6 +25791,17 @@ var init_three_core = __esm({
|
|
|
25687
25791
|
this.bindLightTargets(object);
|
|
25688
25792
|
return object;
|
|
25689
25793
|
}
|
|
25794
|
+
/**
|
|
25795
|
+
* Registers the given geometry at the internal
|
|
25796
|
+
* geometry library.
|
|
25797
|
+
*
|
|
25798
|
+
* @static
|
|
25799
|
+
* @param {string} type - The geometry type.
|
|
25800
|
+
* @param {BufferGeometry.constructor} geometryClass - The geometry class.
|
|
25801
|
+
*/
|
|
25802
|
+
static registerGeometry(type, geometryClass) {
|
|
25803
|
+
_customGeometries[type] = geometryClass;
|
|
25804
|
+
}
|
|
25690
25805
|
// internals
|
|
25691
25806
|
parseShapes(json) {
|
|
25692
25807
|
const shapes = {};
|
|
@@ -25727,8 +25842,10 @@ var init_three_core = __esm({
|
|
|
25727
25842
|
default:
|
|
25728
25843
|
if (data.type in Geometries) {
|
|
25729
25844
|
geometry = Geometries[data.type].fromJSON(data, shapes);
|
|
25845
|
+
} else if (data.type in _customGeometries) {
|
|
25846
|
+
geometry = _customGeometries[data.type].fromJSON(data, shapes);
|
|
25730
25847
|
} else {
|
|
25731
|
-
warn(`ObjectLoader:
|
|
25848
|
+
warn(`ObjectLoader: Unknown geometry type "${data.type}". Use .registerGeometry() before starting the deserialization process.`);
|
|
25732
25849
|
}
|
|
25733
25850
|
}
|
|
25734
25851
|
geometry.uuid = data.uuid;
|
|
@@ -25929,6 +26046,7 @@ var init_three_core = __esm({
|
|
|
25929
26046
|
if (data.premultiplyAlpha !== void 0) texture.premultiplyAlpha = data.premultiplyAlpha;
|
|
25930
26047
|
if (data.unpackAlignment !== void 0) texture.unpackAlignment = data.unpackAlignment;
|
|
25931
26048
|
if (data.compareFunction !== void 0) texture.compareFunction = data.compareFunction;
|
|
26049
|
+
if (data.normalized !== void 0) texture.normalized = data.normalized;
|
|
25932
26050
|
if (data.userData !== void 0) texture.userData = data.userData;
|
|
25933
26051
|
textures[data.uuid] = texture;
|
|
25934
26052
|
}
|
|
@@ -26260,6 +26378,9 @@ var init_three_core = __esm({
|
|
|
26260
26378
|
* Sets the given loader options. The structure of the object must match the `options` parameter of
|
|
26261
26379
|
* [createImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap).
|
|
26262
26380
|
*
|
|
26381
|
+
* Note: When caching is enabled, the cache key is based on the URL only. Loading the same URL with
|
|
26382
|
+
* different options will return the cached result of the first request.
|
|
26383
|
+
*
|
|
26263
26384
|
* @param {Object} options - The loader options to set.
|
|
26264
26385
|
* @return {ImageBitmapLoader} A reference to this image bitmap loader.
|
|
26265
26386
|
*/
|
|
@@ -26274,7 +26395,6 @@ var init_three_core = __esm({
|
|
|
26274
26395
|
* @param {function(ImageBitmap)} onLoad - Executed when the loading process has been finished.
|
|
26275
26396
|
* @param {onProgressCallback} onProgress - Unsupported in this loader.
|
|
26276
26397
|
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
26277
|
-
* @return {ImageBitmap|undefined} The image bitmap.
|
|
26278
26398
|
*/
|
|
26279
26399
|
load(url, onLoad, onProgress, onError) {
|
|
26280
26400
|
if (url === void 0) url = "";
|
|
@@ -26293,7 +26413,6 @@ var init_three_core = __esm({
|
|
|
26293
26413
|
} else {
|
|
26294
26414
|
if (onLoad) onLoad(imageBitmap);
|
|
26295
26415
|
scope.manager.itemEnd(url);
|
|
26296
|
-
return imageBitmap;
|
|
26297
26416
|
}
|
|
26298
26417
|
});
|
|
26299
26418
|
return;
|
|
@@ -26302,7 +26421,7 @@ var init_three_core = __esm({
|
|
|
26302
26421
|
if (onLoad) onLoad(cached);
|
|
26303
26422
|
scope.manager.itemEnd(url);
|
|
26304
26423
|
}, 0);
|
|
26305
|
-
return
|
|
26424
|
+
return;
|
|
26306
26425
|
}
|
|
26307
26426
|
const fetchOptions = {};
|
|
26308
26427
|
fetchOptions.credentials = this.crossOrigin === "anonymous" ? "same-origin" : "include";
|
|
@@ -26316,7 +26435,6 @@ var init_three_core = __esm({
|
|
|
26316
26435
|
Cache.add(`image-bitmap:${url}`, imageBitmap);
|
|
26317
26436
|
if (onLoad) onLoad(imageBitmap);
|
|
26318
26437
|
scope.manager.itemEnd(url);
|
|
26319
|
-
return imageBitmap;
|
|
26320
26438
|
}).catch(function(e2) {
|
|
26321
26439
|
if (onError) onError(e2);
|
|
26322
26440
|
_errorMap.set(promise, e2);
|
|
@@ -26342,7 +26460,7 @@ var init_three_core = __esm({
|
|
|
26342
26460
|
/**
|
|
26343
26461
|
* Returns the global native audio context.
|
|
26344
26462
|
*
|
|
26345
|
-
* @return {AudioContext} The native audio context.
|
|
26463
|
+
* @return {Window.AudioContext} The native audio context.
|
|
26346
26464
|
*/
|
|
26347
26465
|
static getContext() {
|
|
26348
26466
|
if (_context === void 0) {
|
|
@@ -26353,7 +26471,7 @@ var init_three_core = __esm({
|
|
|
26353
26471
|
/**
|
|
26354
26472
|
* Allows to set the global native audio context from outside.
|
|
26355
26473
|
*
|
|
26356
|
-
* @param {AudioContext} value - The native context to set.
|
|
26474
|
+
* @param {Window.AudioContext} value - The native context to set.
|
|
26357
26475
|
*/
|
|
26358
26476
|
static setContext(value) {
|
|
26359
26477
|
_context = value;
|
|
@@ -26388,9 +26506,15 @@ var init_three_core = __esm({
|
|
|
26388
26506
|
try {
|
|
26389
26507
|
const bufferCopy = buffer.slice(0);
|
|
26390
26508
|
const context2 = AudioContext.getContext();
|
|
26509
|
+
const decodeUrl = url + "#decode";
|
|
26510
|
+
scope.manager.itemStart(decodeUrl);
|
|
26391
26511
|
context2.decodeAudioData(bufferCopy, function(audioBuffer) {
|
|
26392
26512
|
onLoad(audioBuffer);
|
|
26393
|
-
|
|
26513
|
+
scope.manager.itemEnd(decodeUrl);
|
|
26514
|
+
}).catch(function(e2) {
|
|
26515
|
+
handleError(e2);
|
|
26516
|
+
scope.manager.itemEnd(decodeUrl);
|
|
26517
|
+
});
|
|
26394
26518
|
} catch (e2) {
|
|
26395
26519
|
handleError(e2);
|
|
26396
26520
|
}
|
|
@@ -28226,6 +28350,9 @@ var init_three_core = __esm({
|
|
|
28226
28350
|
for (let i3 = 0; i3 !== nTracks; ++i3) {
|
|
28227
28351
|
const interpolant = tracks[i3].createInterpolant(null);
|
|
28228
28352
|
interpolants[i3] = interpolant;
|
|
28353
|
+
if (interpolant.settings) {
|
|
28354
|
+
Object.assign(interpolantSettings, interpolant.settings);
|
|
28355
|
+
}
|
|
28229
28356
|
interpolant.settings = interpolantSettings;
|
|
28230
28357
|
}
|
|
28231
28358
|
this._interpolantSettings = interpolantSettings;
|
|
@@ -28669,6 +28796,7 @@ var init_three_core = __esm({
|
|
|
28669
28796
|
});
|
|
28670
28797
|
}
|
|
28671
28798
|
} else {
|
|
28799
|
+
this._loopCount = loopCount;
|
|
28672
28800
|
this.time = time;
|
|
28673
28801
|
}
|
|
28674
28802
|
if (pingPong && (loopCount & 1) === 1) {
|
|
@@ -29508,7 +29636,7 @@ var init_three_core = __esm({
|
|
|
29508
29636
|
this.oldTime = 0;
|
|
29509
29637
|
this.elapsedTime = 0;
|
|
29510
29638
|
this.running = false;
|
|
29511
|
-
warn("
|
|
29639
|
+
warn("Clock: This module has been deprecated. Please use THREE.Timer instead.");
|
|
29512
29640
|
}
|
|
29513
29641
|
/**
|
|
29514
29642
|
* Starts the clock. When `autoStart` is set to `true`, the method is automatically
|
|
@@ -29718,6 +29846,9 @@ var init_three_core = __esm({
|
|
|
29718
29846
|
}
|
|
29719
29847
|
};
|
|
29720
29848
|
Matrix2 = class _Matrix2 {
|
|
29849
|
+
static {
|
|
29850
|
+
_Matrix2.prototype.isMatrix2 = true;
|
|
29851
|
+
}
|
|
29721
29852
|
/**
|
|
29722
29853
|
* Constructs a new 2x2 matrix. The arguments are supposed to be
|
|
29723
29854
|
* in row-major order. If no arguments are provided, the constructor
|
|
@@ -29729,7 +29860,6 @@ var init_three_core = __esm({
|
|
|
29729
29860
|
* @param {number} [n22] - 2-2 matrix element.
|
|
29730
29861
|
*/
|
|
29731
29862
|
constructor(n11, n12, n21, n22) {
|
|
29732
|
-
_Matrix2.prototype.isMatrix2 = true;
|
|
29733
29863
|
this.elements = [
|
|
29734
29864
|
1,
|
|
29735
29865
|
0,
|
|
@@ -30141,6 +30271,7 @@ var init_three_core = __esm({
|
|
|
30141
30271
|
_startP.subVectors(point, this.start);
|
|
30142
30272
|
_startEnd.subVectors(this.end, this.start);
|
|
30143
30273
|
const startEnd2 = _startEnd.dot(_startEnd);
|
|
30274
|
+
if (startEnd2 === 0) return 0;
|
|
30144
30275
|
const startEnd_startP = _startEnd.dot(_startP);
|
|
30145
30276
|
let t2 = startEnd_startP / startEnd2;
|
|
30146
30277
|
if (clampToLine) {
|
|
@@ -31557,7 +31688,7 @@ var init_three_core = __esm({
|
|
|
31557
31688
|
}
|
|
31558
31689
|
});
|
|
31559
31690
|
|
|
31560
|
-
// ../../node_modules/.bun/three@0.
|
|
31691
|
+
// ../../node_modules/.bun/three@0.184.0/node_modules/three/build/three.module.js
|
|
31561
31692
|
var three_module_exports = {};
|
|
31562
31693
|
__export(three_module_exports, {
|
|
31563
31694
|
ACESFilmicToneMapping: () => ACESFilmicToneMapping,
|
|
@@ -31699,6 +31830,7 @@ __export(three_module_exports, {
|
|
|
31699
31830
|
GreaterStencilFunc: () => GreaterStencilFunc,
|
|
31700
31831
|
GridHelper: () => GridHelper,
|
|
31701
31832
|
Group: () => Group,
|
|
31833
|
+
HTMLTexture: () => HTMLTexture,
|
|
31702
31834
|
HalfFloatType: () => HalfFloatType,
|
|
31703
31835
|
HemisphereLight: () => HemisphereLight,
|
|
31704
31836
|
HemisphereLightHelper: () => HemisphereLightHelper,
|
|
@@ -32014,11 +32146,12 @@ function WebGLAnimation() {
|
|
|
32014
32146
|
start: function() {
|
|
32015
32147
|
if (isAnimating === true) return;
|
|
32016
32148
|
if (animationLoop === null) return;
|
|
32149
|
+
if (context2 === null) return;
|
|
32017
32150
|
requestId = context2.requestAnimationFrame(onAnimationFrame);
|
|
32018
32151
|
isAnimating = true;
|
|
32019
32152
|
},
|
|
32020
32153
|
stop: function() {
|
|
32021
|
-
context2.cancelAnimationFrame(requestId);
|
|
32154
|
+
if (context2 !== null) context2.cancelAnimationFrame(requestId);
|
|
32022
32155
|
isAnimating = false;
|
|
32023
32156
|
},
|
|
32024
32157
|
setAnimationLoop: function(callback) {
|
|
@@ -32221,19 +32354,13 @@ function WebGLBackground(renderer, environments, state2, objects, alpha, premult
|
|
|
32221
32354
|
});
|
|
32222
32355
|
objects.update(boxMesh);
|
|
32223
32356
|
}
|
|
32224
|
-
_e1$1.copy(scene.backgroundRotation);
|
|
32225
|
-
_e1$1.x *= -1;
|
|
32226
|
-
_e1$1.y *= -1;
|
|
32227
|
-
_e1$1.z *= -1;
|
|
32228
|
-
if (background.isCubeTexture && background.isRenderTargetTexture === false) {
|
|
32229
|
-
_e1$1.y *= -1;
|
|
32230
|
-
_e1$1.z *= -1;
|
|
32231
|
-
}
|
|
32232
32357
|
boxMesh.material.uniforms.envMap.value = background;
|
|
32233
|
-
boxMesh.material.uniforms.flipEnvMap.value = background.isCubeTexture && background.isRenderTargetTexture === false ? -1 : 1;
|
|
32234
32358
|
boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
|
|
32235
32359
|
boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
|
|
32236
|
-
boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4(_m1$12.makeRotationFromEuler(
|
|
32360
|
+
boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4(_m1$12.makeRotationFromEuler(scene.backgroundRotation)).transpose();
|
|
32361
|
+
if (background.isCubeTexture && background.isRenderTargetTexture === false) {
|
|
32362
|
+
boxMesh.material.uniforms.backgroundRotation.value.premultiply(_m$1);
|
|
32363
|
+
}
|
|
32237
32364
|
boxMesh.material.toneMapped = ColorManagement.getTransfer(background.colorSpace) !== SRGBTransfer;
|
|
32238
32365
|
if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping) {
|
|
32239
32366
|
boxMesh.material.needsUpdate = true;
|
|
@@ -32709,27 +32836,10 @@ function WebGLBufferRenderer(gl, extensions2, info) {
|
|
|
32709
32836
|
}
|
|
32710
32837
|
info.update(elementCount, mode, 1);
|
|
32711
32838
|
}
|
|
32712
|
-
function renderMultiDrawInstances(starts, counts, drawCount, primcount) {
|
|
32713
|
-
if (drawCount === 0) return;
|
|
32714
|
-
const extension = extensions2.get("WEBGL_multi_draw");
|
|
32715
|
-
if (extension === null) {
|
|
32716
|
-
for (let i3 = 0; i3 < starts.length; i3++) {
|
|
32717
|
-
renderInstances(starts[i3], counts[i3], primcount[i3]);
|
|
32718
|
-
}
|
|
32719
|
-
} else {
|
|
32720
|
-
extension.multiDrawArraysInstancedWEBGL(mode, starts, 0, counts, 0, primcount, 0, drawCount);
|
|
32721
|
-
let elementCount = 0;
|
|
32722
|
-
for (let i3 = 0; i3 < drawCount; i3++) {
|
|
32723
|
-
elementCount += counts[i3] * primcount[i3];
|
|
32724
|
-
}
|
|
32725
|
-
info.update(elementCount, mode, 1);
|
|
32726
|
-
}
|
|
32727
|
-
}
|
|
32728
32839
|
this.setMode = setMode;
|
|
32729
32840
|
this.render = render;
|
|
32730
32841
|
this.renderInstances = renderInstances;
|
|
32731
32842
|
this.renderMultiDraw = renderMultiDraw;
|
|
32732
|
-
this.renderMultiDrawInstances = renderMultiDrawInstances;
|
|
32733
32843
|
}
|
|
32734
32844
|
function WebGLCapabilities(gl, extensions2, parameters, utils) {
|
|
32735
32845
|
let maxAnisotropy;
|
|
@@ -32779,6 +32889,9 @@ function WebGLCapabilities(gl, extensions2, parameters, utils) {
|
|
|
32779
32889
|
}
|
|
32780
32890
|
const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
|
|
32781
32891
|
const reversedDepthBuffer = parameters.reversedDepthBuffer === true && extensions2.has("EXT_clip_control");
|
|
32892
|
+
if (parameters.reversedDepthBuffer === true && reversedDepthBuffer === false) {
|
|
32893
|
+
warn("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");
|
|
32894
|
+
}
|
|
32782
32895
|
const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);
|
|
32783
32896
|
const maxVertexTextures = gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
|
|
32784
32897
|
const maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);
|
|
@@ -33584,28 +33697,11 @@ function WebGLIndexedBufferRenderer(gl, extensions2, info) {
|
|
|
33584
33697
|
}
|
|
33585
33698
|
info.update(elementCount, mode, 1);
|
|
33586
33699
|
}
|
|
33587
|
-
function renderMultiDrawInstances(starts, counts, drawCount, primcount) {
|
|
33588
|
-
if (drawCount === 0) return;
|
|
33589
|
-
const extension = extensions2.get("WEBGL_multi_draw");
|
|
33590
|
-
if (extension === null) {
|
|
33591
|
-
for (let i3 = 0; i3 < starts.length; i3++) {
|
|
33592
|
-
renderInstances(starts[i3] / bytesPerElement, counts[i3], primcount[i3]);
|
|
33593
|
-
}
|
|
33594
|
-
} else {
|
|
33595
|
-
extension.multiDrawElementsInstancedWEBGL(mode, counts, 0, type, starts, 0, primcount, 0, drawCount);
|
|
33596
|
-
let elementCount = 0;
|
|
33597
|
-
for (let i3 = 0; i3 < drawCount; i3++) {
|
|
33598
|
-
elementCount += counts[i3] * primcount[i3];
|
|
33599
|
-
}
|
|
33600
|
-
info.update(elementCount, mode, 1);
|
|
33601
|
-
}
|
|
33602
|
-
}
|
|
33603
33700
|
this.setMode = setMode;
|
|
33604
33701
|
this.setIndex = setIndex;
|
|
33605
33702
|
this.render = render;
|
|
33606
33703
|
this.renderInstances = renderInstances;
|
|
33607
33704
|
this.renderMultiDraw = renderMultiDraw;
|
|
33608
|
-
this.renderMultiDrawInstances = renderMultiDrawInstances;
|
|
33609
33705
|
}
|
|
33610
33706
|
function WebGLInfo(gl) {
|
|
33611
33707
|
const memory = {
|
|
@@ -33799,7 +33895,8 @@ function WebGLOutput(type, width, height, depth, stencil) {
|
|
|
33799
33895
|
const targetA = new WebGLRenderTarget(width, height, {
|
|
33800
33896
|
type,
|
|
33801
33897
|
depthBuffer: depth,
|
|
33802
|
-
stencilBuffer: stencil
|
|
33898
|
+
stencilBuffer: stencil,
|
|
33899
|
+
depthTexture: depth ? new DepthTexture(width, height) : void 0
|
|
33803
33900
|
});
|
|
33804
33901
|
const targetB = new WebGLRenderTarget(width, height, {
|
|
33805
33902
|
type: HalfFloatType,
|
|
@@ -33952,6 +34049,7 @@ function WebGLOutput(type, width, height, depth, stencil) {
|
|
|
33952
34049
|
return _isCompositing;
|
|
33953
34050
|
};
|
|
33954
34051
|
this.dispose = function() {
|
|
34052
|
+
if (targetA.depthTexture) targetA.depthTexture.dispose();
|
|
33955
34053
|
targetA.dispose();
|
|
33956
34054
|
targetB.dispose();
|
|
33957
34055
|
geometry.dispose();
|
|
@@ -34839,6 +34937,7 @@ function WebGLProgram(renderer, cacheKey, parameters, bindingStates) {
|
|
|
34839
34937
|
parameters.thicknessMapUv ? "#define THICKNESSMAP_UV " + parameters.thicknessMapUv : "",
|
|
34840
34938
|
//
|
|
34841
34939
|
parameters.vertexTangents && parameters.flatShading === false ? "#define USE_TANGENT" : "",
|
|
34940
|
+
parameters.vertexNormals ? "#define HAS_NORMAL" : "",
|
|
34842
34941
|
parameters.vertexColors ? "#define USE_COLOR" : "",
|
|
34843
34942
|
parameters.vertexAlphas ? "#define USE_COLOR_ALPHA" : "",
|
|
34844
34943
|
parameters.vertexUv1s ? "#define USE_UV1" : "",
|
|
@@ -34925,6 +35024,7 @@ function WebGLProgram(renderer, cacheKey, parameters, bindingStates) {
|
|
|
34925
35024
|
parameters.normalMap ? "#define USE_NORMALMAP" : "",
|
|
34926
35025
|
parameters.normalMapObjectSpace ? "#define USE_NORMALMAP_OBJECTSPACE" : "",
|
|
34927
35026
|
parameters.normalMapTangentSpace ? "#define USE_NORMALMAP_TANGENTSPACE" : "",
|
|
35027
|
+
parameters.packedNormalMap ? "#define USE_PACKED_NORMALMAP" : "",
|
|
34928
35028
|
parameters.emissiveMap ? "#define USE_EMISSIVEMAP" : "",
|
|
34929
35029
|
parameters.anisotropy ? "#define USE_ANISOTROPY" : "",
|
|
34930
35030
|
parameters.anisotropyMap ? "#define USE_ANISOTROPYMAP" : "",
|
|
@@ -34965,6 +35065,7 @@ function WebGLProgram(renderer, cacheKey, parameters, bindingStates) {
|
|
|
34965
35065
|
parameters.shadowMapEnabled ? "#define " + shadowMapTypeDefine : "",
|
|
34966
35066
|
parameters.premultipliedAlpha ? "#define PREMULTIPLIED_ALPHA" : "",
|
|
34967
35067
|
parameters.numLightProbes > 0 ? "#define USE_LIGHT_PROBES" : "",
|
|
35068
|
+
parameters.numLightProbeGrids > 0 ? "#define USE_LIGHT_PROBES_GRID" : "",
|
|
34968
35069
|
parameters.decodeVideoTexture ? "#define DECODE_VIDEO_TEXTURE" : "",
|
|
34969
35070
|
parameters.decodeVideoTextureEmissive ? "#define DECODE_VIDEO_TEXTURE_EMISSIVE" : "",
|
|
34970
35071
|
parameters.logarithmicDepthBuffer ? "#define USE_LOGARITHMIC_DEPTH_BUFFER" : "",
|
|
@@ -35112,6 +35213,9 @@ function WebGLProgram(renderer, cacheKey, parameters, bindingStates) {
|
|
|
35112
35213
|
this.fragmentShader = glFragmentShader;
|
|
35113
35214
|
return this;
|
|
35114
35215
|
}
|
|
35216
|
+
function isPackedRGFormat(format) {
|
|
35217
|
+
return format === RGFormat || format === RG11_EAC_Format || format === RED_GREEN_RGTC2_Format;
|
|
35218
|
+
}
|
|
35115
35219
|
function WebGLPrograms(renderer, environments, extensions2, capabilities, bindingStates, clipping) {
|
|
35116
35220
|
const _programLayers = new Layers();
|
|
35117
35221
|
const _customShaders = new WebGLShaderCache();
|
|
@@ -35142,7 +35246,7 @@ function WebGLPrograms(renderer, environments, extensions2, capabilities, bindin
|
|
|
35142
35246
|
if (value === 0) return "uv";
|
|
35143
35247
|
return `uv${value}`;
|
|
35144
35248
|
}
|
|
35145
|
-
function getParameters(material, lights, shadows, scene, object) {
|
|
35249
|
+
function getParameters(material, lights, shadows, scene, object, lightProbeGrids) {
|
|
35146
35250
|
const fog = scene.fog;
|
|
35147
35251
|
const geometry = object.geometry;
|
|
35148
35252
|
const environment = material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ? scene.environment : null;
|
|
@@ -35237,7 +35341,7 @@ function WebGLPrograms(renderer, environments, extensions2, capabilities, bindin
|
|
|
35237
35341
|
instancing: IS_INSTANCEDMESH,
|
|
35238
35342
|
instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,
|
|
35239
35343
|
instancingMorph: IS_INSTANCEDMESH && object.morphTexture !== null,
|
|
35240
|
-
outputColorSpace: currentRenderTarget === null ? renderer.outputColorSpace : currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace :
|
|
35344
|
+
outputColorSpace: currentRenderTarget === null ? renderer.outputColorSpace : currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : ColorManagement.workingColorSpace,
|
|
35241
35345
|
alphaToCoverage: !!material.alphaToCoverage,
|
|
35242
35346
|
map: HAS_MAP,
|
|
35243
35347
|
matcap: HAS_MATCAP,
|
|
@@ -35252,6 +35356,7 @@ function WebGLPrograms(renderer, environments, extensions2, capabilities, bindin
|
|
|
35252
35356
|
emissiveMap: HAS_EMISSIVEMAP,
|
|
35253
35357
|
normalMapObjectSpace: HAS_NORMALMAP && material.normalMapType === ObjectSpaceNormalMap,
|
|
35254
35358
|
normalMapTangentSpace: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap,
|
|
35359
|
+
packedNormalMap: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap && isPackedRGFormat(material.normalMap.format),
|
|
35255
35360
|
metalnessMap: HAS_METALNESSMAP,
|
|
35256
35361
|
roughnessMap: HAS_ROUGHNESSMAP,
|
|
35257
35362
|
anisotropy: HAS_ANISOTROPY,
|
|
@@ -35305,6 +35410,7 @@ function WebGLPrograms(renderer, environments, extensions2, capabilities, bindin
|
|
|
35305
35410
|
alphaMapUv: HAS_ALPHAMAP && getChannel2(material.alphaMap.channel),
|
|
35306
35411
|
//
|
|
35307
35412
|
vertexTangents: !!geometry.attributes.tangent && (HAS_NORMALMAP || HAS_ANISOTROPY),
|
|
35413
|
+
vertexNormals: !!geometry.attributes.normal,
|
|
35308
35414
|
vertexColors: material.vertexColors,
|
|
35309
35415
|
vertexAlphas: material.vertexColors === true && !!geometry.attributes.color && geometry.attributes.color.itemSize === 4,
|
|
35310
35416
|
pointsUvs: object.isPoints === true && !!geometry.attributes.uv && (HAS_MAP || HAS_ALPHAMAP),
|
|
@@ -35332,6 +35438,7 @@ function WebGLPrograms(renderer, environments, extensions2, capabilities, bindin
|
|
|
35332
35438
|
numSpotLightShadows: lights.spotShadowMap.length,
|
|
35333
35439
|
numSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps,
|
|
35334
35440
|
numLightProbes: lights.numLightProbes,
|
|
35441
|
+
numLightProbeGrids: lightProbeGrids.length,
|
|
35335
35442
|
numClippingPlanes: clipping.numPlanes,
|
|
35336
35443
|
numClipIntersection: clipping.numIntersection,
|
|
35337
35444
|
dithering: material.dithering,
|
|
@@ -35475,6 +35582,10 @@ function WebGLPrograms(renderer, environments, extensions2, capabilities, bindin
|
|
|
35475
35582
|
_programLayers.enable(20);
|
|
35476
35583
|
if (parameters.gradientMap)
|
|
35477
35584
|
_programLayers.enable(21);
|
|
35585
|
+
if (parameters.packedNormalMap)
|
|
35586
|
+
_programLayers.enable(22);
|
|
35587
|
+
if (parameters.vertexNormals)
|
|
35588
|
+
_programLayers.enable(23);
|
|
35478
35589
|
array.push(_programLayers.mask);
|
|
35479
35590
|
_programLayers.disableAll();
|
|
35480
35591
|
if (parameters.fog)
|
|
@@ -35521,6 +35632,8 @@ function WebGLPrograms(renderer, environments, extensions2, capabilities, bindin
|
|
|
35521
35632
|
_programLayers.enable(20);
|
|
35522
35633
|
if (parameters.alphaToCoverage)
|
|
35523
35634
|
_programLayers.enable(21);
|
|
35635
|
+
if (parameters.numLightProbeGrids > 0)
|
|
35636
|
+
_programLayers.enable(22);
|
|
35524
35637
|
array.push(_programLayers.mask);
|
|
35525
35638
|
}
|
|
35526
35639
|
function getUniforms(material) {
|
|
@@ -36119,10 +36232,12 @@ function WebGLRenderState(extensions2) {
|
|
|
36119
36232
|
const lights = new WebGLLights(extensions2);
|
|
36120
36233
|
const lightsArray = [];
|
|
36121
36234
|
const shadowsArray = [];
|
|
36235
|
+
const lightProbeGridArray = [];
|
|
36122
36236
|
function init(camera) {
|
|
36123
36237
|
state2.camera = camera;
|
|
36124
36238
|
lightsArray.length = 0;
|
|
36125
36239
|
shadowsArray.length = 0;
|
|
36240
|
+
lightProbeGridArray.length = 0;
|
|
36126
36241
|
}
|
|
36127
36242
|
function pushLight(light) {
|
|
36128
36243
|
lightsArray.push(light);
|
|
@@ -36130,6 +36245,9 @@ function WebGLRenderState(extensions2) {
|
|
|
36130
36245
|
function pushShadow(shadowLight) {
|
|
36131
36246
|
shadowsArray.push(shadowLight);
|
|
36132
36247
|
}
|
|
36248
|
+
function pushLightProbeGrid(volume) {
|
|
36249
|
+
lightProbeGridArray.push(volume);
|
|
36250
|
+
}
|
|
36133
36251
|
function setupLights() {
|
|
36134
36252
|
lights.setup(lightsArray);
|
|
36135
36253
|
}
|
|
@@ -36139,9 +36257,11 @@ function WebGLRenderState(extensions2) {
|
|
|
36139
36257
|
const state2 = {
|
|
36140
36258
|
lightsArray,
|
|
36141
36259
|
shadowsArray,
|
|
36260
|
+
lightProbeGridArray,
|
|
36142
36261
|
camera: null,
|
|
36143
36262
|
lights,
|
|
36144
|
-
transmissionRenderTarget: {}
|
|
36263
|
+
transmissionRenderTarget: {},
|
|
36264
|
+
textureUnits: 0
|
|
36145
36265
|
};
|
|
36146
36266
|
return {
|
|
36147
36267
|
init,
|
|
@@ -36149,7 +36269,8 @@ function WebGLRenderState(extensions2) {
|
|
|
36149
36269
|
setupLights,
|
|
36150
36270
|
setupLightsView,
|
|
36151
36271
|
pushLight,
|
|
36152
|
-
pushShadow
|
|
36272
|
+
pushShadow,
|
|
36273
|
+
pushLightProbeGrid
|
|
36153
36274
|
};
|
|
36154
36275
|
}
|
|
36155
36276
|
function WebGLRenderStates(extensions2) {
|
|
@@ -36688,6 +36809,7 @@ function WebGLState(gl, extensions2) {
|
|
|
36688
36809
|
const uboBindings = /* @__PURE__ */ new WeakMap();
|
|
36689
36810
|
const uboProgramMap = /* @__PURE__ */ new WeakMap();
|
|
36690
36811
|
let enabledCapabilities = {};
|
|
36812
|
+
let parameters = {};
|
|
36691
36813
|
let currentBoundFramebuffers = {};
|
|
36692
36814
|
let currentDrawbuffers = /* @__PURE__ */ new WeakMap();
|
|
36693
36815
|
let defaultDrawbuffers = [];
|
|
@@ -37112,6 +37234,19 @@ function WebGLState(gl, extensions2) {
|
|
|
37112
37234
|
error("WebGLState:", e2);
|
|
37113
37235
|
}
|
|
37114
37236
|
}
|
|
37237
|
+
function getParameter(name) {
|
|
37238
|
+
if (parameters[name] !== void 0) {
|
|
37239
|
+
return parameters[name];
|
|
37240
|
+
} else {
|
|
37241
|
+
return gl.getParameter(name);
|
|
37242
|
+
}
|
|
37243
|
+
}
|
|
37244
|
+
function pixelStorei(name, value) {
|
|
37245
|
+
if (parameters[name] !== value) {
|
|
37246
|
+
gl.pixelStorei(name, value);
|
|
37247
|
+
parameters[name] = value;
|
|
37248
|
+
}
|
|
37249
|
+
}
|
|
37115
37250
|
function scissor(scissor2) {
|
|
37116
37251
|
if (currentScissor.equals(scissor2) === false) {
|
|
37117
37252
|
gl.scissor(scissor2.x, scissor2.y, scissor2.z, scissor2.w);
|
|
@@ -37177,7 +37312,21 @@ function WebGLState(gl, extensions2) {
|
|
|
37177
37312
|
gl.lineWidth(1);
|
|
37178
37313
|
gl.scissor(0, 0, gl.canvas.width, gl.canvas.height);
|
|
37179
37314
|
gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);
|
|
37315
|
+
gl.pixelStorei(gl.PACK_ALIGNMENT, 4);
|
|
37316
|
+
gl.pixelStorei(gl.UNPACK_ALIGNMENT, 4);
|
|
37317
|
+
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
|
37318
|
+
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
|
|
37319
|
+
gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.BROWSER_DEFAULT_WEBGL);
|
|
37320
|
+
gl.pixelStorei(gl.PACK_ROW_LENGTH, 0);
|
|
37321
|
+
gl.pixelStorei(gl.PACK_SKIP_PIXELS, 0);
|
|
37322
|
+
gl.pixelStorei(gl.PACK_SKIP_ROWS, 0);
|
|
37323
|
+
gl.pixelStorei(gl.UNPACK_ROW_LENGTH, 0);
|
|
37324
|
+
gl.pixelStorei(gl.UNPACK_IMAGE_HEIGHT, 0);
|
|
37325
|
+
gl.pixelStorei(gl.UNPACK_SKIP_PIXELS, 0);
|
|
37326
|
+
gl.pixelStorei(gl.UNPACK_SKIP_ROWS, 0);
|
|
37327
|
+
gl.pixelStorei(gl.UNPACK_SKIP_IMAGES, 0);
|
|
37180
37328
|
enabledCapabilities = {};
|
|
37329
|
+
parameters = {};
|
|
37181
37330
|
currentTextureSlot = null;
|
|
37182
37331
|
currentBoundTextures = {};
|
|
37183
37332
|
currentBoundFramebuffers = {};
|
|
@@ -37231,6 +37380,8 @@ function WebGLState(gl, extensions2) {
|
|
|
37231
37380
|
compressedTexImage3D,
|
|
37232
37381
|
texImage2D,
|
|
37233
37382
|
texImage3D,
|
|
37383
|
+
pixelStorei,
|
|
37384
|
+
getParameter,
|
|
37234
37385
|
updateUBOMapping,
|
|
37235
37386
|
uniformBlockBinding,
|
|
37236
37387
|
texStorage2D,
|
|
@@ -37249,6 +37400,7 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37249
37400
|
const supportsInvalidateFramebuffer = typeof navigator === "undefined" ? false : /OculusBrowser/g.test(navigator.userAgent);
|
|
37250
37401
|
const _imageDimensions = new Vector2();
|
|
37251
37402
|
const _videoTextures = /* @__PURE__ */ new WeakMap();
|
|
37403
|
+
const _htmlTextures = /* @__PURE__ */ new Set();
|
|
37252
37404
|
let _canvas2;
|
|
37253
37405
|
const _sources = /* @__PURE__ */ new WeakMap();
|
|
37254
37406
|
let useOffscreenCanvas = false;
|
|
@@ -37298,16 +37450,25 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37298
37450
|
if (texture.isWebGLArrayRenderTarget || texture.isCompressedArrayTexture) return _gl.TEXTURE_2D_ARRAY;
|
|
37299
37451
|
return _gl.TEXTURE_2D;
|
|
37300
37452
|
}
|
|
37301
|
-
function getInternalFormat(internalFormatName, glFormat, glType, colorSpace, forceLinearTransfer = false) {
|
|
37453
|
+
function getInternalFormat(internalFormatName, glFormat, glType, normalized, colorSpace, forceLinearTransfer = false) {
|
|
37302
37454
|
if (internalFormatName !== null) {
|
|
37303
37455
|
if (_gl[internalFormatName] !== void 0) return _gl[internalFormatName];
|
|
37304
37456
|
warn("WebGLRenderer: Attempt to use non-existing WebGL internal format '" + internalFormatName + "'");
|
|
37305
37457
|
}
|
|
37458
|
+
let ext_texture_norm16;
|
|
37459
|
+
if (normalized) {
|
|
37460
|
+
ext_texture_norm16 = extensions2.get("EXT_texture_norm16");
|
|
37461
|
+
if (!ext_texture_norm16) {
|
|
37462
|
+
warn("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension");
|
|
37463
|
+
}
|
|
37464
|
+
}
|
|
37306
37465
|
let internalFormat = glFormat;
|
|
37307
37466
|
if (glFormat === _gl.RED) {
|
|
37308
37467
|
if (glType === _gl.FLOAT) internalFormat = _gl.R32F;
|
|
37309
37468
|
if (glType === _gl.HALF_FLOAT) internalFormat = _gl.R16F;
|
|
37310
37469
|
if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.R8;
|
|
37470
|
+
if (glType === _gl.UNSIGNED_SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.R16_EXT;
|
|
37471
|
+
if (glType === _gl.SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.R16_SNORM_EXT;
|
|
37311
37472
|
}
|
|
37312
37473
|
if (glFormat === _gl.RED_INTEGER) {
|
|
37313
37474
|
if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.R8UI;
|
|
@@ -37321,6 +37482,8 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37321
37482
|
if (glType === _gl.FLOAT) internalFormat = _gl.RG32F;
|
|
37322
37483
|
if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RG16F;
|
|
37323
37484
|
if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RG8;
|
|
37485
|
+
if (glType === _gl.UNSIGNED_SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RG16_EXT;
|
|
37486
|
+
if (glType === _gl.SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RG16_SNORM_EXT;
|
|
37324
37487
|
}
|
|
37325
37488
|
if (glFormat === _gl.RG_INTEGER) {
|
|
37326
37489
|
if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RG8UI;
|
|
@@ -37347,6 +37510,8 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37347
37510
|
if (glType === _gl.INT) internalFormat = _gl.RGBA32I;
|
|
37348
37511
|
}
|
|
37349
37512
|
if (glFormat === _gl.RGB) {
|
|
37513
|
+
if (glType === _gl.UNSIGNED_SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RGB16_EXT;
|
|
37514
|
+
if (glType === _gl.SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RGB16_SNORM_EXT;
|
|
37350
37515
|
if (glType === _gl.UNSIGNED_INT_5_9_9_9_REV) internalFormat = _gl.RGB9_E5;
|
|
37351
37516
|
if (glType === _gl.UNSIGNED_INT_10F_11F_11F_REV) internalFormat = _gl.R11F_G11F_B10F;
|
|
37352
37517
|
}
|
|
@@ -37355,6 +37520,8 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37355
37520
|
if (glType === _gl.FLOAT) internalFormat = _gl.RGBA32F;
|
|
37356
37521
|
if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RGBA16F;
|
|
37357
37522
|
if (glType === _gl.UNSIGNED_BYTE) internalFormat = transfer === SRGBTransfer ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;
|
|
37523
|
+
if (glType === _gl.UNSIGNED_SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RGBA16_EXT;
|
|
37524
|
+
if (glType === _gl.SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RGBA16_SNORM_EXT;
|
|
37358
37525
|
if (glType === _gl.UNSIGNED_SHORT_4_4_4_4) internalFormat = _gl.RGBA4;
|
|
37359
37526
|
if (glType === _gl.UNSIGNED_SHORT_5_5_5_1) internalFormat = _gl.RGB5_A1;
|
|
37360
37527
|
}
|
|
@@ -37403,6 +37570,9 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37403
37570
|
if (texture.isVideoTexture) {
|
|
37404
37571
|
_videoTextures.delete(texture);
|
|
37405
37572
|
}
|
|
37573
|
+
if (texture.isHTMLTexture) {
|
|
37574
|
+
_htmlTextures.delete(texture);
|
|
37575
|
+
}
|
|
37406
37576
|
}
|
|
37407
37577
|
function onRenderTargetDispose(event) {
|
|
37408
37578
|
const renderTarget2 = event.target;
|
|
@@ -37479,6 +37649,12 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37479
37649
|
function resetTextureUnits() {
|
|
37480
37650
|
textureUnits = 0;
|
|
37481
37651
|
}
|
|
37652
|
+
function getTextureUnits() {
|
|
37653
|
+
return textureUnits;
|
|
37654
|
+
}
|
|
37655
|
+
function setTextureUnits(value) {
|
|
37656
|
+
textureUnits = value;
|
|
37657
|
+
}
|
|
37482
37658
|
function allocateTextureUnit() {
|
|
37483
37659
|
const textureUnit = textureUnits;
|
|
37484
37660
|
if (textureUnit >= capabilities.maxTextures) {
|
|
@@ -37661,10 +37837,10 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37661
37837
|
}
|
|
37662
37838
|
}
|
|
37663
37839
|
updateRanges.length = mergeIndex + 1;
|
|
37664
|
-
const currentUnpackRowLen =
|
|
37665
|
-
const currentUnpackSkipPixels =
|
|
37666
|
-
const currentUnpackSkipRows =
|
|
37667
|
-
|
|
37840
|
+
const currentUnpackRowLen = state2.getParameter(_gl.UNPACK_ROW_LENGTH);
|
|
37841
|
+
const currentUnpackSkipPixels = state2.getParameter(_gl.UNPACK_SKIP_PIXELS);
|
|
37842
|
+
const currentUnpackSkipRows = state2.getParameter(_gl.UNPACK_SKIP_ROWS);
|
|
37843
|
+
state2.pixelStorei(_gl.UNPACK_ROW_LENGTH, image.width);
|
|
37668
37844
|
for (let i3 = 0, l2 = updateRanges.length; i3 < l2; i3++) {
|
|
37669
37845
|
const range = updateRanges[i3];
|
|
37670
37846
|
const pixelStart = Math.floor(range.start / componentStride);
|
|
@@ -37673,14 +37849,14 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37673
37849
|
const y = Math.floor(pixelStart / image.width);
|
|
37674
37850
|
const width = pixelCount;
|
|
37675
37851
|
const height = 1;
|
|
37676
|
-
|
|
37677
|
-
|
|
37852
|
+
state2.pixelStorei(_gl.UNPACK_SKIP_PIXELS, x2);
|
|
37853
|
+
state2.pixelStorei(_gl.UNPACK_SKIP_ROWS, y);
|
|
37678
37854
|
state2.texSubImage2D(_gl.TEXTURE_2D, 0, x2, y, width, height, glFormat, glType, image.data);
|
|
37679
37855
|
}
|
|
37680
37856
|
texture.clearUpdateRanges();
|
|
37681
|
-
|
|
37682
|
-
|
|
37683
|
-
|
|
37857
|
+
state2.pixelStorei(_gl.UNPACK_ROW_LENGTH, currentUnpackRowLen);
|
|
37858
|
+
state2.pixelStorei(_gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels);
|
|
37859
|
+
state2.pixelStorei(_gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows);
|
|
37684
37860
|
}
|
|
37685
37861
|
}
|
|
37686
37862
|
function uploadTexture(textureProperties, texture, slot) {
|
|
@@ -37693,18 +37869,21 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37693
37869
|
const sourceProperties = properties.get(source);
|
|
37694
37870
|
if (source.version !== sourceProperties.__version || forceUpload === true) {
|
|
37695
37871
|
state2.activeTexture(_gl.TEXTURE0 + slot);
|
|
37696
|
-
const
|
|
37697
|
-
|
|
37698
|
-
|
|
37699
|
-
|
|
37700
|
-
|
|
37701
|
-
|
|
37702
|
-
|
|
37872
|
+
const isImageBitmap = typeof ImageBitmap !== "undefined" && texture.image instanceof ImageBitmap;
|
|
37873
|
+
if (isImageBitmap === false) {
|
|
37874
|
+
const workingPrimaries = ColorManagement.getPrimaries(ColorManagement.workingColorSpace);
|
|
37875
|
+
const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries(texture.colorSpace);
|
|
37876
|
+
const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
|
|
37877
|
+
state2.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
|
|
37878
|
+
state2.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
|
|
37879
|
+
state2.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion);
|
|
37880
|
+
}
|
|
37881
|
+
state2.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment);
|
|
37703
37882
|
let image = resizeImage(texture.image, false, capabilities.maxTextureSize);
|
|
37704
37883
|
image = verifyColorSpace(texture, image);
|
|
37705
37884
|
const glFormat = utils.convert(texture.format, texture.colorSpace);
|
|
37706
37885
|
const glType = utils.convert(texture.type);
|
|
37707
|
-
let glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture);
|
|
37886
|
+
let glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace, texture.isVideoTexture);
|
|
37708
37887
|
setTextureParameters(textureType, texture);
|
|
37709
37888
|
let mipmap;
|
|
37710
37889
|
const mipmaps = texture.mipmaps;
|
|
@@ -37866,6 +38045,35 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37866
38045
|
}
|
|
37867
38046
|
}
|
|
37868
38047
|
}
|
|
38048
|
+
} else if (texture.isHTMLTexture) {
|
|
38049
|
+
if ("texElementImage2D" in _gl) {
|
|
38050
|
+
const canvas = _gl.canvas;
|
|
38051
|
+
if (!canvas.hasAttribute("layoutsubtree")) {
|
|
38052
|
+
canvas.setAttribute("layoutsubtree", "true");
|
|
38053
|
+
}
|
|
38054
|
+
if (image.parentNode !== canvas) {
|
|
38055
|
+
canvas.appendChild(image);
|
|
38056
|
+
_htmlTextures.add(texture);
|
|
38057
|
+
canvas.onpaint = (event) => {
|
|
38058
|
+
const changed = event.changedElements;
|
|
38059
|
+
for (const t2 of _htmlTextures) {
|
|
38060
|
+
if (changed.includes(t2.image)) {
|
|
38061
|
+
t2.needsUpdate = true;
|
|
38062
|
+
}
|
|
38063
|
+
}
|
|
38064
|
+
};
|
|
38065
|
+
canvas.requestPaint();
|
|
38066
|
+
return;
|
|
38067
|
+
}
|
|
38068
|
+
const level = 0;
|
|
38069
|
+
const internalFormat = _gl.RGBA;
|
|
38070
|
+
const srcFormat = _gl.RGBA;
|
|
38071
|
+
const srcType = _gl.UNSIGNED_BYTE;
|
|
38072
|
+
_gl.texElementImage2D(_gl.TEXTURE_2D, level, internalFormat, srcFormat, srcType, image);
|
|
38073
|
+
_gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, _gl.LINEAR);
|
|
38074
|
+
_gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE);
|
|
38075
|
+
_gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE);
|
|
38076
|
+
}
|
|
37869
38077
|
} else {
|
|
37870
38078
|
if (mipmaps.length > 0) {
|
|
37871
38079
|
if (useTexStorage && allocateMemory) {
|
|
@@ -37916,10 +38124,10 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37916
38124
|
const workingPrimaries = ColorManagement.getPrimaries(ColorManagement.workingColorSpace);
|
|
37917
38125
|
const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries(texture.colorSpace);
|
|
37918
38126
|
const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
|
|
37919
|
-
|
|
37920
|
-
|
|
37921
|
-
|
|
37922
|
-
|
|
38127
|
+
state2.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
|
|
38128
|
+
state2.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
|
|
38129
|
+
state2.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment);
|
|
38130
|
+
state2.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion);
|
|
37923
38131
|
const isCompressed = texture.isCompressedTexture || texture.image[0].isCompressedTexture;
|
|
37924
38132
|
const isDataTexture = texture.image[0] && texture.image[0].isDataTexture;
|
|
37925
38133
|
const cubeImage = [];
|
|
@@ -37931,7 +38139,7 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37931
38139
|
}
|
|
37932
38140
|
cubeImage[i3] = verifyColorSpace(texture, cubeImage[i3]);
|
|
37933
38141
|
}
|
|
37934
|
-
const image = cubeImage[0], glFormat = utils.convert(texture.format, texture.colorSpace), glType = utils.convert(texture.type), glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);
|
|
38142
|
+
const image = cubeImage[0], glFormat = utils.convert(texture.format, texture.colorSpace), glType = utils.convert(texture.type), glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace);
|
|
37935
38143
|
const useTexStorage = texture.isVideoTexture !== true;
|
|
37936
38144
|
const allocateMemory = sourceProperties.__version === void 0 || forceUpload === true;
|
|
37937
38145
|
const dataReady = source.dataReady;
|
|
@@ -38028,7 +38236,7 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
38028
38236
|
function setupFrameBufferTexture(framebuffer, renderTarget2, texture, attachment, textureTarget, level) {
|
|
38029
38237
|
const glFormat = utils.convert(texture.format, texture.colorSpace);
|
|
38030
38238
|
const glType = utils.convert(texture.type);
|
|
38031
|
-
const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);
|
|
38239
|
+
const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace);
|
|
38032
38240
|
const renderTargetProperties = properties.get(renderTarget2);
|
|
38033
38241
|
const textureProperties = properties.get(texture);
|
|
38034
38242
|
textureProperties.__renderTarget = renderTarget2;
|
|
@@ -38070,7 +38278,7 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
38070
38278
|
const texture = textures[i3];
|
|
38071
38279
|
const glFormat = utils.convert(texture.format, texture.colorSpace);
|
|
38072
38280
|
const glType = utils.convert(texture.type);
|
|
38073
|
-
const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);
|
|
38281
|
+
const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace);
|
|
38074
38282
|
if (useMultisampledRTT(renderTarget2)) {
|
|
38075
38283
|
multisampledRTTExt.renderbufferStorageMultisampleEXT(_gl.RENDERBUFFER, getRenderTargetSamples(renderTarget2), glInternalFormat, renderTarget2.width, renderTarget2.height);
|
|
38076
38284
|
} else if (useMultisample) {
|
|
@@ -38270,7 +38478,7 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
38270
38478
|
_gl.bindRenderbuffer(_gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i3]);
|
|
38271
38479
|
const glFormat = utils.convert(texture2.format, texture2.colorSpace);
|
|
38272
38480
|
const glType = utils.convert(texture2.type);
|
|
38273
|
-
const glInternalFormat = getInternalFormat(texture2.internalFormat, glFormat, glType, texture2.colorSpace, renderTarget2.isXRRenderTarget === true);
|
|
38481
|
+
const glInternalFormat = getInternalFormat(texture2.internalFormat, glFormat, glType, texture2.normalized, texture2.colorSpace, renderTarget2.isXRRenderTarget === true);
|
|
38274
38482
|
const samples = getRenderTargetSamples(renderTarget2);
|
|
38275
38483
|
_gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget2.width, renderTarget2.height);
|
|
38276
38484
|
_gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i3, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i3]);
|
|
@@ -38466,6 +38674,8 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
38466
38674
|
}
|
|
38467
38675
|
this.allocateTextureUnit = allocateTextureUnit;
|
|
38468
38676
|
this.resetTextureUnits = resetTextureUnits;
|
|
38677
|
+
this.getTextureUnits = getTextureUnits;
|
|
38678
|
+
this.setTextureUnits = setTextureUnits;
|
|
38469
38679
|
this.setTexture2D = setTexture2D;
|
|
38470
38680
|
this.setTexture2DArray = setTexture2DArray;
|
|
38471
38681
|
this.setTexture3D = setTexture3D;
|
|
@@ -38618,7 +38828,9 @@ function WebGLMaterials(renderer, properties) {
|
|
|
38618
38828
|
}
|
|
38619
38829
|
}
|
|
38620
38830
|
function refreshMaterialUniforms(uniforms, material, pixelRatio, height, transmissionRenderTarget) {
|
|
38621
|
-
if (material.
|
|
38831
|
+
if (material.isNodeMaterial) {
|
|
38832
|
+
material.uniformsNeedUpdate = false;
|
|
38833
|
+
} else if (material.isMeshBasicMaterial) {
|
|
38622
38834
|
refreshUniformsCommon(uniforms, material);
|
|
38623
38835
|
} else if (material.isMeshLambertMaterial) {
|
|
38624
38836
|
refreshUniformsCommon(uniforms, material);
|
|
@@ -38720,16 +38932,10 @@ function WebGLMaterials(renderer, properties) {
|
|
|
38720
38932
|
const envMapRotation = materialProperties.envMapRotation;
|
|
38721
38933
|
if (envMap) {
|
|
38722
38934
|
uniforms.envMap.value = envMap;
|
|
38723
|
-
|
|
38724
|
-
_e1.x *= -1;
|
|
38725
|
-
_e1.y *= -1;
|
|
38726
|
-
_e1.z *= -1;
|
|
38935
|
+
uniforms.envMapRotation.value.setFromMatrix4(_m12.makeRotationFromEuler(envMapRotation)).transpose();
|
|
38727
38936
|
if (envMap.isCubeTexture && envMap.isRenderTargetTexture === false) {
|
|
38728
|
-
|
|
38729
|
-
_e1.z *= -1;
|
|
38937
|
+
uniforms.envMapRotation.value.premultiply(_m);
|
|
38730
38938
|
}
|
|
38731
|
-
uniforms.envMapRotation.value.setFromMatrix4(_m12.makeRotationFromEuler(_e1));
|
|
38732
|
-
uniforms.flipEnvMap.value = envMap.isCubeTexture && envMap.isRenderTargetTexture === false ? -1 : 1;
|
|
38733
38939
|
uniforms.reflectivity.value = material.reflectivity;
|
|
38734
38940
|
uniforms.ior.value = material.ior;
|
|
38735
38941
|
uniforms.refractionRatio.value = material.refractionRatio;
|
|
@@ -38995,6 +39201,8 @@ function WebGLUniformsGroups(gl, info, capabilities, state2) {
|
|
|
38995
39201
|
uniform.__data[9] = value.elements[7];
|
|
38996
39202
|
uniform.__data[10] = value.elements[8];
|
|
38997
39203
|
uniform.__data[11] = 0;
|
|
39204
|
+
} else if (ArrayBuffer.isView(value)) {
|
|
39205
|
+
uniform.__data.set(new value.constructor(value.buffer, value.byteOffset, uniform.__data.length));
|
|
38998
39206
|
} else {
|
|
38999
39207
|
value.toArray(uniform.__data, arrayOffset);
|
|
39000
39208
|
arrayOffset += info2.storage / Float32Array.BYTES_PER_ELEMENT;
|
|
@@ -39012,6 +39220,8 @@ function WebGLUniformsGroups(gl, info, capabilities, state2) {
|
|
|
39012
39220
|
if (cache[indexString] === void 0) {
|
|
39013
39221
|
if (typeof value === "number" || typeof value === "boolean") {
|
|
39014
39222
|
cache[indexString] = value;
|
|
39223
|
+
} else if (ArrayBuffer.isView(value)) {
|
|
39224
|
+
cache[indexString] = value.slice();
|
|
39015
39225
|
} else {
|
|
39016
39226
|
cache[indexString] = value.clone();
|
|
39017
39227
|
}
|
|
@@ -39023,6 +39233,8 @@ function WebGLUniformsGroups(gl, info, capabilities, state2) {
|
|
|
39023
39233
|
cache[indexString] = value;
|
|
39024
39234
|
return true;
|
|
39025
39235
|
}
|
|
39236
|
+
} else if (ArrayBuffer.isView(value)) {
|
|
39237
|
+
return true;
|
|
39026
39238
|
} else {
|
|
39027
39239
|
if (cachedObject.equals(value) === false) {
|
|
39028
39240
|
cachedObject.copy(value);
|
|
@@ -39090,6 +39302,9 @@ function WebGLUniformsGroups(gl, info, capabilities, state2) {
|
|
|
39090
39302
|
info2.storage = 64;
|
|
39091
39303
|
} else if (value.isTexture) {
|
|
39092
39304
|
warn("WebGLRenderer: Texture samplers can not be part of an uniforms group.");
|
|
39305
|
+
} else if (ArrayBuffer.isView(value)) {
|
|
39306
|
+
info2.boundary = 16;
|
|
39307
|
+
info2.storage = value.byteLength;
|
|
39093
39308
|
} else {
|
|
39094
39309
|
warn("WebGLRenderer: Unsupported uniform value type.", value);
|
|
39095
39310
|
}
|
|
@@ -39131,9 +39346,9 @@ function getDFGLUT() {
|
|
|
39131
39346
|
}
|
|
39132
39347
|
return lut;
|
|
39133
39348
|
}
|
|
39134
|
-
var alphahash_fragment, alphahash_pars_fragment, alphamap_fragment, alphamap_pars_fragment, alphatest_fragment, alphatest_pars_fragment, aomap_fragment, aomap_pars_fragment, batching_pars_vertex, batching_vertex, begin_vertex, beginnormal_vertex, bsdfs, iridescence_fragment, bumpmap_pars_fragment, clipping_planes_fragment, clipping_planes_pars_fragment, clipping_planes_pars_vertex, clipping_planes_vertex, color_fragment, color_pars_fragment, color_pars_vertex, color_vertex, common, cube_uv_reflection_fragment, defaultnormal_vertex, displacementmap_pars_vertex, displacementmap_vertex, emissivemap_fragment, emissivemap_pars_fragment, colorspace_fragment, colorspace_pars_fragment, envmap_fragment, envmap_common_pars_fragment, envmap_pars_fragment, envmap_pars_vertex, envmap_vertex, fog_vertex, fog_pars_vertex, fog_fragment, fog_pars_fragment, gradientmap_pars_fragment, lightmap_pars_fragment, lights_lambert_fragment, lights_lambert_pars_fragment, lights_pars_begin, envmap_physical_pars_fragment, lights_toon_fragment, lights_toon_pars_fragment, lights_phong_fragment, lights_phong_pars_fragment, lights_physical_fragment, lights_physical_pars_fragment, lights_fragment_begin, lights_fragment_maps, lights_fragment_end, logdepthbuf_fragment, logdepthbuf_pars_fragment, logdepthbuf_pars_vertex, logdepthbuf_vertex, map_fragment, map_pars_fragment, map_particle_fragment, map_particle_pars_fragment, metalnessmap_fragment, metalnessmap_pars_fragment, morphinstance_vertex, morphcolor_vertex, morphnormal_vertex, morphtarget_pars_vertex, morphtarget_vertex, normal_fragment_begin, normal_fragment_maps, normal_pars_fragment, normal_pars_vertex, normal_vertex, normalmap_pars_fragment, clearcoat_normal_fragment_begin, clearcoat_normal_fragment_maps, clearcoat_pars_fragment, iridescence_pars_fragment, opaque_fragment, packing, premultiplied_alpha_fragment, project_vertex, dithering_fragment, dithering_pars_fragment, roughnessmap_fragment, roughnessmap_pars_fragment, shadowmap_pars_fragment, shadowmap_pars_vertex, shadowmap_vertex, shadowmask_pars_fragment, skinbase_vertex, skinning_pars_vertex, skinning_vertex, skinnormal_vertex, specularmap_fragment, specularmap_pars_fragment, tonemapping_fragment, tonemapping_pars_fragment, transmission_fragment, transmission_pars_fragment, uv_pars_fragment, uv_pars_vertex, uv_vertex, worldpos_vertex, vertex$h, fragment$h, vertex$g, fragment$g, vertex$f, fragment$f, vertex$e, fragment$e, vertex$d, fragment$d, vertex$c, fragment$c, vertex$b, fragment$b, vertex$a, fragment$a, vertex$9, fragment$9, vertex$8, fragment$8, vertex$7, fragment$7, vertex$6, fragment$6, vertex$5, fragment$5, vertex$4, fragment$4, vertex$3, fragment$3, vertex$2, fragment$2, vertex$1, fragment$1, ShaderChunk, UniformsLib, ShaderLib, _rgb,
|
|
39349
|
+
var alphahash_fragment, alphahash_pars_fragment, alphamap_fragment, alphamap_pars_fragment, alphatest_fragment, alphatest_pars_fragment, aomap_fragment, aomap_pars_fragment, batching_pars_vertex, batching_vertex, begin_vertex, beginnormal_vertex, bsdfs, iridescence_fragment, bumpmap_pars_fragment, clipping_planes_fragment, clipping_planes_pars_fragment, clipping_planes_pars_vertex, clipping_planes_vertex, color_fragment, color_pars_fragment, color_pars_vertex, color_vertex, common, cube_uv_reflection_fragment, defaultnormal_vertex, displacementmap_pars_vertex, displacementmap_vertex, emissivemap_fragment, emissivemap_pars_fragment, colorspace_fragment, colorspace_pars_fragment, envmap_fragment, envmap_common_pars_fragment, envmap_pars_fragment, envmap_pars_vertex, envmap_vertex, fog_vertex, fog_pars_vertex, fog_fragment, fog_pars_fragment, gradientmap_pars_fragment, lightmap_pars_fragment, lights_lambert_fragment, lights_lambert_pars_fragment, lights_pars_begin, envmap_physical_pars_fragment, lights_toon_fragment, lights_toon_pars_fragment, lights_phong_fragment, lights_phong_pars_fragment, lights_physical_fragment, lights_physical_pars_fragment, lights_fragment_begin, lights_fragment_maps, lights_fragment_end, lightprobes_pars_fragment, logdepthbuf_fragment, logdepthbuf_pars_fragment, logdepthbuf_pars_vertex, logdepthbuf_vertex, map_fragment, map_pars_fragment, map_particle_fragment, map_particle_pars_fragment, metalnessmap_fragment, metalnessmap_pars_fragment, morphinstance_vertex, morphcolor_vertex, morphnormal_vertex, morphtarget_pars_vertex, morphtarget_vertex, normal_fragment_begin, normal_fragment_maps, normal_pars_fragment, normal_pars_vertex, normal_vertex, normalmap_pars_fragment, clearcoat_normal_fragment_begin, clearcoat_normal_fragment_maps, clearcoat_pars_fragment, iridescence_pars_fragment, opaque_fragment, packing, premultiplied_alpha_fragment, project_vertex, dithering_fragment, dithering_pars_fragment, roughnessmap_fragment, roughnessmap_pars_fragment, shadowmap_pars_fragment, shadowmap_pars_vertex, shadowmap_vertex, shadowmask_pars_fragment, skinbase_vertex, skinning_pars_vertex, skinning_vertex, skinnormal_vertex, specularmap_fragment, specularmap_pars_fragment, tonemapping_fragment, tonemapping_pars_fragment, transmission_fragment, transmission_pars_fragment, uv_pars_fragment, uv_pars_vertex, uv_vertex, worldpos_vertex, vertex$h, fragment$h, vertex$g, fragment$g, vertex$f, fragment$f, vertex$e, fragment$e, vertex$d, fragment$d, vertex$c, fragment$c, vertex$b, fragment$b, vertex$a, fragment$a, vertex$9, fragment$9, vertex$8, fragment$8, vertex$7, fragment$7, vertex$6, fragment$6, vertex$5, fragment$5, vertex$4, fragment$4, vertex$3, fragment$3, vertex$2, fragment$2, vertex$1, fragment$1, ShaderChunk, UniformsLib, ShaderLib, _rgb, _m1$12, _m$1, LOD_MIN, EXTRA_LOD_SIGMA, MAX_SAMPLES, GGX_SAMPLES, _flatCamera, _clearColor, _oldTarget, _oldActiveCubeFace, _oldActiveMipmapLevel, _oldXrEnabled, _origin, PMREMGenerator, WebGLCubeRenderTarget, toneMappingMap, emptyTexture, emptyShadowTexture, emptyArrayTexture, empty3dTexture, emptyCubeTexture, arrayCacheF32, arrayCacheI32, mat4array, mat3array, mat2array, SingleUniform, PureArrayUniform, StructuredUniform, RePathPart, WebGLUniforms, COMPLETION_STATUS_KHR, programIdCount, _m0, toneMappingFunctions, _v02, includePattern, shaderChunkMap, unrollLoopPattern, shadowMapTypeDefines, envMapTypeDefines, envMapModeDefines, envMapBlendingDefines, _id2, WebGLShaderCache, WebGLShaderStage, nextVersion, vertex, fragment, _cubeDirections, _cubeUps, _projScreenMatrix2, _lightPositionWorld2, _lookTarget2, _occlusion_vertex, _occlusion_fragment, WebXRDepthSensing, WebXRManager, _m12, _m, DATA, lut, WebGLRenderer;
|
|
39135
39350
|
var init_three_module = __esm({
|
|
39136
|
-
"../../node_modules/.bun/three@0.
|
|
39351
|
+
"../../node_modules/.bun/three@0.184.0/node_modules/three/build/three.module.js"() {
|
|
39137
39352
|
init_three_core();
|
|
39138
39353
|
init_three_core();
|
|
39139
39354
|
alphahash_fragment = "#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif";
|
|
@@ -39168,8 +39383,8 @@ var init_three_module = __esm({
|
|
|
39168
39383
|
emissivemap_pars_fragment = "#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif";
|
|
39169
39384
|
colorspace_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );";
|
|
39170
39385
|
colorspace_pars_fragment = "vec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}";
|
|
39171
|
-
envmap_fragment = "#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, envMapRotation *
|
|
39172
|
-
envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform
|
|
39386
|
+
envmap_fragment = "#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, envMapRotation * reflectVec );\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n #endif\n#endif";
|
|
39387
|
+
envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform mat3 envMapRotation;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n#endif";
|
|
39173
39388
|
envmap_pars_fragment = "#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif";
|
|
39174
39389
|
envmap_pars_vertex = "#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif";
|
|
39175
39390
|
envmap_vertex = "#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif";
|
|
@@ -39181,17 +39396,18 @@ var init_three_module = __esm({
|
|
|
39181
39396
|
lightmap_pars_fragment = "#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif";
|
|
39182
39397
|
lights_lambert_fragment = "LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;";
|
|
39183
39398
|
lights_lambert_pars_fragment = "varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert";
|
|
39184
|
-
lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif";
|
|
39399
|
+
lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif\n#include <lightprobes_pars_fragment>";
|
|
39185
39400
|
envmap_physical_pars_fragment = "#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif";
|
|
39186
39401
|
lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
|
|
39187
39402
|
lights_toon_pars_fragment = "varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon";
|
|
39188
39403
|
lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;";
|
|
39189
39404
|
lights_phong_pars_fragment = "varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong";
|
|
39190
39405
|
lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = metalnessFactor;\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = vec3( 0.04 );\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n material.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n if( material.anisotropy == 0.0 ) {\n anisotropyV = vec2( 1.0, 0.0 );\n } else {\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n }\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif";
|
|
39191
|
-
lights_physical_pars_fragment = "uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n vec3 diffuseColor;\n vec3 diffuseContribution;\n vec3 specularColor;\n vec3 specularColorBlended;\n float roughness;\n float metalness;\n float specularF90;\n float dispersion;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n vec3 iridescenceFresnelDielectric;\n vec3 iridescenceFresnelMetallic;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return v;\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColorBlended;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float rInv = 1.0 / ( roughness + 0.1 );\n float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n float DG = exp( a * dotNV + b );\n return saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\n vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\n vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\n vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\n float Ess_V = dfgV.x + dfgV.y;\n float Ess_L = dfgL.x + dfgL.y;\n float Ems_V = 1.0 - Ess_V;\n float Ems_L = 1.0 - Ess_L;\n vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\n vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\n float compensationFactor = Ems_V * Ems_L;\n vec3 multiScatter = Fms * compensationFactor;\n return singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n #ifdef USE_CLEARCOAT\n vec3 Ncc = geometryClearcoatNormal;\n vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );\n vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );\n vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );\n mat3 mInvClearcoat = mat3(\n vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),\n vec3( 0, 1, 0 ),\n vec3( t1Clearcoat.z, 0, t1Clearcoat.w )\n );\n vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;\n clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );\n #endif\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n \n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n irradiance *= sheenEnergyComp;\n \n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n diffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectDiffuse += diffuse;\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n #endif\n vec3 singleScatteringDielectric = vec3( 0.0 );\n vec3 multiScatteringDielectric = vec3( 0.0 );\n vec3 singleScatteringMetallic = vec3( 0.0 );\n vec3 multiScatteringMetallic = vec3( 0.0 );\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #endif\n vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n vec3 indirectSpecular = radiance * singleScattering;\n indirectSpecular += multiScattering * cosineWeightedIrradiance;\n vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n indirectSpecular *= sheenEnergyComp;\n indirectDiffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectSpecular += indirectSpecular;\n reflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
|
|
39192
|
-
lights_fragment_begin = "\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
|
|
39406
|
+
lights_physical_pars_fragment = "uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n vec3 diffuseColor;\n vec3 diffuseContribution;\n vec3 specularColor;\n vec3 specularColorBlended;\n float roughness;\n float metalness;\n float specularF90;\n float dispersion;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n vec3 iridescenceFresnelDielectric;\n vec3 iridescenceFresnelMetallic;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColorBlended;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float rInv = 1.0 / ( roughness + 0.1 );\n float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n float DG = exp( a * dotNV + b );\n return saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\n vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\n vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\n vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\n float Ess_V = dfgV.x + dfgV.y;\n float Ess_L = dfgL.x + dfgL.y;\n float Ems_V = 1.0 - Ess_V;\n float Ems_L = 1.0 - Ess_L;\n vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\n vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\n float compensationFactor = Ems_V * Ems_L;\n vec3 multiScatter = Fms * compensationFactor;\n return singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n #ifdef USE_CLEARCOAT\n vec3 Ncc = geometryClearcoatNormal;\n vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );\n vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );\n vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );\n mat3 mInvClearcoat = mat3(\n vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),\n vec3( 0, 1, 0 ),\n vec3( t1Clearcoat.z, 0, t1Clearcoat.w )\n );\n vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;\n clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );\n #endif\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n \n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n irradiance *= sheenEnergyComp;\n \n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n diffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectDiffuse += diffuse;\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n #endif\n vec3 singleScatteringDielectric = vec3( 0.0 );\n vec3 multiScatteringDielectric = vec3( 0.0 );\n vec3 singleScatteringMetallic = vec3( 0.0 );\n vec3 multiScatteringMetallic = vec3( 0.0 );\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #endif\n vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n vec3 indirectSpecular = radiance * singleScattering;\n indirectSpecular += multiScattering * cosineWeightedIrradiance;\n vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n indirectSpecular *= sheenEnergyComp;\n indirectDiffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectSpecular += indirectSpecular;\n reflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
|
|
39407
|
+
lights_fragment_begin = "\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n #ifdef USE_LIGHT_PROBES_GRID\n vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;\n vec3 probeWorldNormal = inverseTransformDirection( geometryNormal, viewMatrix );\n irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
|
|
39193
39408
|
lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )\n #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif";
|
|
39194
39409
|
lights_fragment_end = "#if defined( RE_IndirectDiffuse )\n #if defined( LAMBERT ) || defined( PHONG )\n irradiance += iblIrradiance;\n #endif\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif";
|
|
39410
|
+
lightprobes_pars_fragment = "#ifdef USE_LIGHT_PROBES_GRID\nuniform highp sampler3D probesSH;\nuniform vec3 probesMin;\nuniform vec3 probesMax;\nuniform vec3 probesResolution;\nvec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {\n vec3 res = probesResolution;\n vec3 gridRange = probesMax - probesMin;\n vec3 resMinusOne = res - 1.0;\n vec3 probeSpacing = gridRange / resMinusOne;\n vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;\n vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );\n uvw = uvw * resMinusOne / res + 0.5 / res;\n float nz = res.z;\n float paddedSlices = nz + 2.0;\n float atlasDepth = 7.0 * paddedSlices;\n float uvZBase = uvw.z * nz + 1.0;\n vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) );\n vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) );\n vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) );\n vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) );\n vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) );\n vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) );\n vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) );\n vec3 c0 = s0.xyz;\n vec3 c1 = vec3( s0.w, s1.xy );\n vec3 c2 = vec3( s1.zw, s2.x );\n vec3 c3 = s2.yzw;\n vec3 c4 = s3.xyz;\n vec3 c5 = vec3( s3.w, s4.xy );\n vec3 c6 = vec3( s4.zw, s5.x );\n vec3 c7 = s5.yzw;\n vec3 c8 = s6.xyz;\n float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;\n vec3 result = c0 * 0.886227;\n result += c1 * 2.0 * 0.511664 * y;\n result += c2 * 2.0 * 0.511664 * z;\n result += c3 * 2.0 * 0.511664 * x;\n result += c4 * 2.0 * 0.429043 * x * y;\n result += c5 * 2.0 * 0.429043 * y * z;\n result += c6 * ( 0.743125 * z * z - 0.247708 );\n result += c7 * 2.0 * 0.429043 * x * z;\n result += c8 * 0.429043 * ( x * x - y * y );\n return max( result, vec3( 0.0 ) );\n}\n#endif";
|
|
39195
39411
|
logdepthbuf_fragment = "#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif";
|
|
39196
39412
|
logdepthbuf_pars_fragment = "#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif";
|
|
39197
39413
|
logdepthbuf_pars_vertex = "#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif";
|
|
@@ -39208,7 +39424,7 @@ var init_three_module = __esm({
|
|
|
39208
39424
|
morphtarget_pars_vertex = "#ifdef USE_MORPHTARGETS\n #ifndef USE_INSTANCING_MORPH\n uniform float morphTargetBaseInfluence;\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n #endif\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n#endif";
|
|
39209
39425
|
morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n#endif";
|
|
39210
39426
|
normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;";
|
|
39211
|
-
normal_fragment_maps = "#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif";
|
|
39427
|
+
normal_fragment_maps = "#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #if defined( USE_PACKED_NORMALMAP )\n mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );\n #endif\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif";
|
|
39212
39428
|
normal_pars_fragment = "#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif";
|
|
39213
39429
|
normal_pars_vertex = "#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif";
|
|
39214
39430
|
normal_vertex = "#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif";
|
|
@@ -39227,7 +39443,7 @@ var init_three_module = __esm({
|
|
|
39227
39443
|
roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif";
|
|
39228
39444
|
shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #else\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #else\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #elif defined( SHADOWMAP_TYPE_BASIC )\n uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float interleavedGradientNoise( vec2 position ) {\n return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n }\n vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n const float goldenAngle = 2.399963229728653;\n float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n float theta = float( sampleIndex ) * goldenAngle + phi;\n return vec2( cos( theta ), sin( theta ) ) * r;\n }\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float radius = shadowRadius * texelSize.x;\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n shadow = (\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_VSM )\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadowCoord.z -= shadowBias;\n #else\n shadowCoord.z += shadowBias;\n #endif\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n float mean = distribution.x;\n float variance = distribution.y * distribution.y;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float hard_shadow = step( mean, shadowCoord.z );\n #else\n float hard_shadow = step( shadowCoord.z, mean );\n #endif\n \n if ( hard_shadow == 1.0 ) {\n shadow = 1.0;\n } else {\n variance = max( variance, 0.0000001 );\n float d = shadowCoord.z - mean;\n float p_max = variance / ( variance + d * d );\n p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n shadow = max( hard_shadow, p_max );\n }\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #else\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadowCoord.z -= shadowBias;\n #else\n shadowCoord.z += shadowBias;\n #endif\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n float depth = texture2D( shadowMap, shadowCoord.xy ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadow = step( depth, shadowCoord.z );\n #else\n shadow = step( shadowCoord.z, depth );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp -= shadowBias;\n #else\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n #endif\n float texelSize = shadowRadius / shadowMapSize.x;\n vec3 absDir = abs( bd3D );\n vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n tangent = normalize( cross( bd3D, tangent ) );\n vec3 bitangent = cross( bd3D, tangent );\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n vec2 sample0 = vogelDiskSample( 0, 5, phi );\n vec2 sample1 = vogelDiskSample( 1, 5, phi );\n vec2 sample2 = vogelDiskSample( 2, 5, phi );\n vec2 sample3 = vogelDiskSample( 3, 5, phi );\n vec2 sample4 = vogelDiskSample( 4, 5, phi );\n shadow = (\n texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_BASIC )\n float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n float depth = textureCube( shadowMap, bd3D ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n depth = 1.0 - depth;\n #endif\n shadow = step( dp, depth );\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #endif\n#endif";
|
|
39229
39445
|
shadowmap_pars_vertex = "#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif";
|
|
39230
|
-
shadowmap_vertex = "#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif";
|
|
39446
|
+
shadowmap_vertex = "#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n #ifdef HAS_NORMAL\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #else\n vec3 shadowWorldNormal = vec3( 0.0 );\n #endif\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif";
|
|
39231
39447
|
shadowmask_pars_fragment = "float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}";
|
|
39232
39448
|
skinbase_vertex = "#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif";
|
|
39233
39449
|
skinning_pars_vertex = "#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n mat4 getBoneMatrix( const in float i ) {\n int size = textureSize( boneTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif";
|
|
@@ -39246,7 +39462,7 @@ var init_three_module = __esm({
|
|
|
39246
39462
|
vertex$h = "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}";
|
|
39247
39463
|
fragment$h = "uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}";
|
|
39248
39464
|
vertex$g = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}";
|
|
39249
|
-
fragment$g = "#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float
|
|
39465
|
+
fragment$g = "#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}";
|
|
39250
39466
|
vertex$f = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}";
|
|
39251
39467
|
fragment$f = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}";
|
|
39252
39468
|
vertex$e = "#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vHighPrecisionZW = gl_Position.zw;\n}";
|
|
@@ -39334,6 +39550,7 @@ var init_three_module = __esm({
|
|
|
39334
39550
|
lights_fragment_begin,
|
|
39335
39551
|
lights_fragment_maps,
|
|
39336
39552
|
lights_fragment_end,
|
|
39553
|
+
lightprobes_pars_fragment,
|
|
39337
39554
|
logdepthbuf_fragment,
|
|
39338
39555
|
logdepthbuf_pars_fragment,
|
|
39339
39556
|
logdepthbuf_pars_vertex,
|
|
@@ -39437,7 +39654,6 @@ var init_three_module = __esm({
|
|
|
39437
39654
|
envmap: {
|
|
39438
39655
|
envMap: { value: null },
|
|
39439
39656
|
envMapRotation: { value: /* @__PURE__ */ new Matrix3() },
|
|
39440
|
-
flipEnvMap: { value: -1 },
|
|
39441
39657
|
reflectivity: { value: 1 },
|
|
39442
39658
|
// basic, lambert, phong
|
|
39443
39659
|
ior: { value: 1.5 },
|
|
@@ -39556,7 +39772,11 @@ var init_three_module = __esm({
|
|
|
39556
39772
|
height: {}
|
|
39557
39773
|
} },
|
|
39558
39774
|
ltc_1: { value: null },
|
|
39559
|
-
ltc_2: { value: null }
|
|
39775
|
+
ltc_2: { value: null },
|
|
39776
|
+
probesSH: { value: null },
|
|
39777
|
+
probesMin: { value: /* @__PURE__ */ new Vector3() },
|
|
39778
|
+
probesMax: { value: /* @__PURE__ */ new Vector3() },
|
|
39779
|
+
probesResolution: { value: /* @__PURE__ */ new Vector3() }
|
|
39560
39780
|
},
|
|
39561
39781
|
points: {
|
|
39562
39782
|
diffuse: { value: /* @__PURE__ */ new Color(16777215) },
|
|
@@ -39757,7 +39977,6 @@ var init_three_module = __esm({
|
|
|
39757
39977
|
backgroundCube: {
|
|
39758
39978
|
uniforms: {
|
|
39759
39979
|
envMap: { value: null },
|
|
39760
|
-
flipEnvMap: { value: -1 },
|
|
39761
39980
|
backgroundBlurriness: { value: 0 },
|
|
39762
39981
|
backgroundIntensity: { value: 1 },
|
|
39763
39982
|
backgroundRotation: { value: /* @__PURE__ */ new Matrix3() }
|
|
@@ -39861,8 +40080,9 @@ var init_three_module = __esm({
|
|
|
39861
40080
|
fragmentShader: ShaderChunk.meshphysical_frag
|
|
39862
40081
|
};
|
|
39863
40082
|
_rgb = { r: 0, b: 0, g: 0 };
|
|
39864
|
-
_e1$1 = /* @__PURE__ */ new Euler();
|
|
39865
40083
|
_m1$12 = /* @__PURE__ */ new Matrix4();
|
|
40084
|
+
_m$1 = /* @__PURE__ */ new Matrix3();
|
|
40085
|
+
_m$1.set(-1, 0, 0, 0, 1, 0, 0, 0, 1);
|
|
39866
40086
|
LOD_MIN = 4;
|
|
39867
40087
|
EXTRA_LOD_SIGMA = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582];
|
|
39868
40088
|
MAX_SAMPLES = 20;
|
|
@@ -41206,8 +41426,9 @@ void main() {
|
|
|
41206
41426
|
};
|
|
41207
41427
|
}
|
|
41208
41428
|
};
|
|
41209
|
-
_e1 = /* @__PURE__ */ new Euler();
|
|
41210
41429
|
_m12 = /* @__PURE__ */ new Matrix4();
|
|
41430
|
+
_m = /* @__PURE__ */ new Matrix3();
|
|
41431
|
+
_m.set(-1, 0, 0, 0, 1, 0, 0, 0, 1);
|
|
41211
41432
|
DATA = new Uint16Array([
|
|
41212
41433
|
12469,
|
|
41213
41434
|
15057,
|
|
@@ -41770,6 +41991,7 @@ void main() {
|
|
|
41770
41991
|
]);
|
|
41771
41992
|
const uintClearColor = new Uint32Array(4);
|
|
41772
41993
|
const intClearColor = new Int32Array(4);
|
|
41994
|
+
const objectPosition = new Vector3();
|
|
41773
41995
|
let currentRenderList = null;
|
|
41774
41996
|
let currentRenderState = null;
|
|
41775
41997
|
const renderListStack = [];
|
|
@@ -41800,6 +42022,7 @@ void main() {
|
|
|
41800
42022
|
this.transmissionResolutionScale = 1;
|
|
41801
42023
|
const _this = this;
|
|
41802
42024
|
let _isContextLost = false;
|
|
42025
|
+
let _nodesHandler = null;
|
|
41803
42026
|
this._outputColorSpace = SRGBColorSpace;
|
|
41804
42027
|
let _currentActiveCubeFace = 0;
|
|
41805
42028
|
let _currentActiveMipmapLevel = 0;
|
|
@@ -41823,8 +42046,8 @@ void main() {
|
|
|
41823
42046
|
let _clippingEnabled = false;
|
|
41824
42047
|
let _localClippingEnabled = false;
|
|
41825
42048
|
const _projScreenMatrix3 = new Matrix4();
|
|
41826
|
-
const
|
|
41827
|
-
const
|
|
42049
|
+
const _vector3 = new Vector3();
|
|
42050
|
+
const _vector42 = new Vector4();
|
|
41828
42051
|
const _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };
|
|
41829
42052
|
let _renderBackground = false;
|
|
41830
42053
|
function getTargetPixelRatio() {
|
|
@@ -41968,13 +42191,13 @@ void main() {
|
|
|
41968
42191
|
};
|
|
41969
42192
|
this.setEffects = function(effects) {
|
|
41970
42193
|
if (_outputBufferType === UnsignedByteType) {
|
|
41971
|
-
|
|
42194
|
+
error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");
|
|
41972
42195
|
return;
|
|
41973
42196
|
}
|
|
41974
42197
|
if (effects) {
|
|
41975
42198
|
for (let i3 = 0; i3 < effects.length; i3++) {
|
|
41976
42199
|
if (effects[i3].isOutputPass === true) {
|
|
41977
|
-
|
|
42200
|
+
warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");
|
|
41978
42201
|
break;
|
|
41979
42202
|
}
|
|
41980
42203
|
}
|
|
@@ -42065,6 +42288,7 @@ void main() {
|
|
|
42065
42288
|
}
|
|
42066
42289
|
if (depth2) {
|
|
42067
42290
|
bits |= _gl.DEPTH_BUFFER_BIT;
|
|
42291
|
+
this.state.buffers.depth.setMask(true);
|
|
42068
42292
|
}
|
|
42069
42293
|
if (stencil2) {
|
|
42070
42294
|
bits |= _gl.STENCIL_BUFFER_BIT;
|
|
@@ -42083,6 +42307,10 @@ void main() {
|
|
|
42083
42307
|
this.clearStencil = function() {
|
|
42084
42308
|
this.clear(false, false, true);
|
|
42085
42309
|
};
|
|
42310
|
+
this.setNodesHandler = function(nodesHandler) {
|
|
42311
|
+
nodesHandler.setRenderer(this);
|
|
42312
|
+
_nodesHandler = nodesHandler;
|
|
42313
|
+
};
|
|
42086
42314
|
this.dispose = function() {
|
|
42087
42315
|
canvas.removeEventListener("webglcontextlost", onContextLost, false);
|
|
42088
42316
|
canvas.removeEventListener("webglcontextrestored", onContextRestore, false);
|
|
@@ -42205,23 +42433,18 @@ void main() {
|
|
|
42205
42433
|
renderer.setMode(_gl.TRIANGLES);
|
|
42206
42434
|
}
|
|
42207
42435
|
if (object.isBatchedMesh) {
|
|
42208
|
-
if (
|
|
42209
|
-
|
|
42210
|
-
|
|
42211
|
-
|
|
42212
|
-
|
|
42213
|
-
|
|
42214
|
-
|
|
42215
|
-
|
|
42216
|
-
|
|
42217
|
-
const uniforms = properties.get(material).currentProgram.getUniforms();
|
|
42218
|
-
for (let i3 = 0; i3 < drawCount2; i3++) {
|
|
42219
|
-
uniforms.setValue(_gl, "_gl_DrawID", i3);
|
|
42220
|
-
renderer.render(starts[i3] / bytesPerElement, counts[i3]);
|
|
42221
|
-
}
|
|
42222
|
-
} else {
|
|
42223
|
-
renderer.renderMultiDraw(object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount);
|
|
42436
|
+
if (!extensions2.get("WEBGL_multi_draw")) {
|
|
42437
|
+
const starts = object._multiDrawStarts;
|
|
42438
|
+
const counts = object._multiDrawCounts;
|
|
42439
|
+
const drawCount2 = object._multiDrawCount;
|
|
42440
|
+
const bytesPerElement = index ? attributes.get(index).bytesPerElement : 1;
|
|
42441
|
+
const uniforms = properties.get(material).currentProgram.getUniforms();
|
|
42442
|
+
for (let i3 = 0; i3 < drawCount2; i3++) {
|
|
42443
|
+
uniforms.setValue(_gl, "_gl_DrawID", i3);
|
|
42444
|
+
renderer.render(starts[i3] / bytesPerElement, counts[i3]);
|
|
42224
42445
|
}
|
|
42446
|
+
} else {
|
|
42447
|
+
renderer.renderMultiDraw(object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount);
|
|
42225
42448
|
}
|
|
42226
42449
|
} else if (object.isInstancedMesh) {
|
|
42227
42450
|
renderer.renderInstances(drawStart, drawCount, object.count);
|
|
@@ -42342,6 +42565,9 @@ void main() {
|
|
|
42342
42565
|
return;
|
|
42343
42566
|
}
|
|
42344
42567
|
if (_isContextLost === true) return;
|
|
42568
|
+
if (_nodesHandler !== null) {
|
|
42569
|
+
_nodesHandler.renderStart(scene, camera);
|
|
42570
|
+
}
|
|
42345
42571
|
const isXRPresenting = xr.enabled === true && xr.isPresenting === true;
|
|
42346
42572
|
const useOutput = output !== null && (_currentRenderTarget === null || isXRPresenting) && output.begin(_this, _currentRenderTarget);
|
|
42347
42573
|
if (scene.matrixWorldAutoUpdate === true) scene.updateMatrixWorld();
|
|
@@ -42353,6 +42579,7 @@ void main() {
|
|
|
42353
42579
|
if (scene.isScene === true) scene.onBeforeRender(_this, scene, camera, _currentRenderTarget);
|
|
42354
42580
|
currentRenderState = renderStates.get(scene, renderStateStack.length);
|
|
42355
42581
|
currentRenderState.init(camera);
|
|
42582
|
+
currentRenderState.state.textureUnits = textures.getTextureUnits();
|
|
42356
42583
|
renderStateStack.push(currentRenderState);
|
|
42357
42584
|
_projScreenMatrix3.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);
|
|
42358
42585
|
_frustum2.setFromProjectionMatrix(_projScreenMatrix3, WebGLCoordinateSystem, camera.reversedDepth);
|
|
@@ -42420,6 +42647,7 @@ void main() {
|
|
|
42420
42647
|
renderStateStack.pop();
|
|
42421
42648
|
if (renderStateStack.length > 0) {
|
|
42422
42649
|
currentRenderState = renderStateStack[renderStateStack.length - 1];
|
|
42650
|
+
textures.setTextureUnits(currentRenderState.state.textureUnits);
|
|
42423
42651
|
if (_clippingEnabled === true) clipping.setGlobalState(_this.clippingPlanes, currentRenderState.state.camera);
|
|
42424
42652
|
} else {
|
|
42425
42653
|
currentRenderState = null;
|
|
@@ -42430,6 +42658,9 @@ void main() {
|
|
|
42430
42658
|
} else {
|
|
42431
42659
|
currentRenderList = null;
|
|
42432
42660
|
}
|
|
42661
|
+
if (_nodesHandler !== null) {
|
|
42662
|
+
_nodesHandler.renderEnd();
|
|
42663
|
+
}
|
|
42433
42664
|
};
|
|
42434
42665
|
function projectObject(object, camera, groupOrder, sortObjects) {
|
|
42435
42666
|
if (object.visible === false) return;
|
|
@@ -42439,6 +42670,8 @@ void main() {
|
|
|
42439
42670
|
groupOrder = object.renderOrder;
|
|
42440
42671
|
} else if (object.isLOD) {
|
|
42441
42672
|
if (object.autoUpdate === true) object.update(camera);
|
|
42673
|
+
} else if (object.isLightProbeGrid) {
|
|
42674
|
+
currentRenderState.pushLightProbeGrid(object);
|
|
42442
42675
|
} else if (object.isLight) {
|
|
42443
42676
|
currentRenderState.pushLight(object);
|
|
42444
42677
|
if (object.castShadow) {
|
|
@@ -42447,12 +42680,12 @@ void main() {
|
|
|
42447
42680
|
} else if (object.isSprite) {
|
|
42448
42681
|
if (!object.frustumCulled || _frustum2.intersectsSprite(object)) {
|
|
42449
42682
|
if (sortObjects) {
|
|
42450
|
-
|
|
42683
|
+
_vector42.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix3);
|
|
42451
42684
|
}
|
|
42452
42685
|
const geometry = objects.update(object);
|
|
42453
42686
|
const material = object.material;
|
|
42454
42687
|
if (material.visible) {
|
|
42455
|
-
currentRenderList.push(object, geometry, material, groupOrder,
|
|
42688
|
+
currentRenderList.push(object, geometry, material, groupOrder, _vector42.z, null);
|
|
42456
42689
|
}
|
|
42457
42690
|
}
|
|
42458
42691
|
} else if (object.isMesh || object.isLine || object.isPoints) {
|
|
@@ -42462,12 +42695,12 @@ void main() {
|
|
|
42462
42695
|
if (sortObjects) {
|
|
42463
42696
|
if (object.boundingSphere !== void 0) {
|
|
42464
42697
|
if (object.boundingSphere === null) object.computeBoundingSphere();
|
|
42465
|
-
|
|
42698
|
+
_vector42.copy(object.boundingSphere.center);
|
|
42466
42699
|
} else {
|
|
42467
42700
|
if (geometry.boundingSphere === null) geometry.computeBoundingSphere();
|
|
42468
|
-
|
|
42701
|
+
_vector42.copy(geometry.boundingSphere.center);
|
|
42469
42702
|
}
|
|
42470
|
-
|
|
42703
|
+
_vector42.applyMatrix4(object.matrixWorld).applyMatrix4(_projScreenMatrix3);
|
|
42471
42704
|
}
|
|
42472
42705
|
if (Array.isArray(material)) {
|
|
42473
42706
|
const groups = geometry.groups;
|
|
@@ -42475,11 +42708,11 @@ void main() {
|
|
|
42475
42708
|
const group = groups[i3];
|
|
42476
42709
|
const groupMaterial = material[group.materialIndex];
|
|
42477
42710
|
if (groupMaterial && groupMaterial.visible) {
|
|
42478
|
-
currentRenderList.push(object, geometry, groupMaterial, groupOrder,
|
|
42711
|
+
currentRenderList.push(object, geometry, groupMaterial, groupOrder, _vector42.z, group);
|
|
42479
42712
|
}
|
|
42480
42713
|
}
|
|
42481
42714
|
} else if (material.visible) {
|
|
42482
|
-
currentRenderList.push(object, geometry, material, groupOrder,
|
|
42715
|
+
currentRenderList.push(object, geometry, material, groupOrder, _vector42.z, null);
|
|
42483
42716
|
}
|
|
42484
42717
|
}
|
|
42485
42718
|
}
|
|
@@ -42605,7 +42838,7 @@ void main() {
|
|
|
42605
42838
|
const lights = currentRenderState.state.lights;
|
|
42606
42839
|
const shadowsArray = currentRenderState.state.shadowsArray;
|
|
42607
42840
|
const lightsStateVersion = lights.state.version;
|
|
42608
|
-
const parameters2 = programCache.getParameters(material, lights.state, shadowsArray, scene, object);
|
|
42841
|
+
const parameters2 = programCache.getParameters(material, lights.state, shadowsArray, scene, object, currentRenderState.state.lightProbeGridArray);
|
|
42609
42842
|
const programCacheKey = programCache.getProgramCacheKey(parameters2);
|
|
42610
42843
|
let programs = materialProperties.programs;
|
|
42611
42844
|
materialProperties.environment = material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ? scene.environment : null;
|
|
@@ -42626,6 +42859,9 @@ void main() {
|
|
|
42626
42859
|
}
|
|
42627
42860
|
} else {
|
|
42628
42861
|
parameters2.uniforms = programCache.getUniforms(material);
|
|
42862
|
+
if (_nodesHandler !== null && material.isNodeMaterial) {
|
|
42863
|
+
_nodesHandler.build(material, object, parameters2);
|
|
42864
|
+
}
|
|
42629
42865
|
material.onBeforeCompile(parameters2, _this);
|
|
42630
42866
|
program = programCache.acquireProgram(parameters2, programCacheKey);
|
|
42631
42867
|
programs.set(programCacheKey, program);
|
|
@@ -42656,6 +42892,7 @@ void main() {
|
|
|
42656
42892
|
uniforms.spotLightMap.value = lights.state.spotLightMap;
|
|
42657
42893
|
uniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix;
|
|
42658
42894
|
}
|
|
42895
|
+
materialProperties.lightProbeGrid = currentRenderState.state.lightProbeGridArray.length > 0;
|
|
42659
42896
|
materialProperties.currentProgram = program;
|
|
42660
42897
|
materialProperties.uniformsList = null;
|
|
42661
42898
|
return program;
|
|
@@ -42686,12 +42923,24 @@ void main() {
|
|
|
42686
42923
|
materialProperties.vertexTangents = parameters2.vertexTangents;
|
|
42687
42924
|
materialProperties.toneMapping = parameters2.toneMapping;
|
|
42688
42925
|
}
|
|
42926
|
+
function findLightProbeGrid(volumes, object) {
|
|
42927
|
+
if (volumes.length === 0) return null;
|
|
42928
|
+
if (volumes.length === 1) {
|
|
42929
|
+
return volumes[0].texture !== null ? volumes[0] : null;
|
|
42930
|
+
}
|
|
42931
|
+
objectPosition.setFromMatrixPosition(object.matrixWorld);
|
|
42932
|
+
for (let i3 = 0, l2 = volumes.length; i3 < l2; i3++) {
|
|
42933
|
+
const v = volumes[i3];
|
|
42934
|
+
if (v.texture !== null && v.boundingBox.containsPoint(objectPosition)) return v;
|
|
42935
|
+
}
|
|
42936
|
+
return null;
|
|
42937
|
+
}
|
|
42689
42938
|
function setProgram(camera, scene, geometry, material, object) {
|
|
42690
42939
|
if (scene.isScene !== true) scene = _emptyScene;
|
|
42691
42940
|
textures.resetTextureUnits();
|
|
42692
42941
|
const fog = scene.fog;
|
|
42693
42942
|
const environment = material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ? scene.environment : null;
|
|
42694
|
-
const colorSpace = _currentRenderTarget === null ? _this.outputColorSpace : _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace :
|
|
42943
|
+
const colorSpace = _currentRenderTarget === null ? _this.outputColorSpace : _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace : ColorManagement.workingColorSpace;
|
|
42695
42944
|
const usePMREM = material.isMeshStandardMaterial || material.isMeshLambertMaterial && !material.envMap || material.isMeshPhongMaterial && !material.envMap;
|
|
42696
42945
|
const envMap = environments.get(material.envMap || environment, usePMREM);
|
|
42697
42946
|
const vertexAlphas = material.vertexColors === true && !!geometry.attributes.color && geometry.attributes.color.itemSize === 4;
|
|
@@ -42765,6 +43014,8 @@ void main() {
|
|
|
42765
43014
|
needsProgramChange = true;
|
|
42766
43015
|
} else if (materialProperties.morphTargetsCount !== morphTargetsCount) {
|
|
42767
43016
|
needsProgramChange = true;
|
|
43017
|
+
} else if (!!materialProperties.lightProbeGrid !== currentRenderState.state.lightProbeGridArray.length > 0) {
|
|
43018
|
+
needsProgramChange = true;
|
|
42768
43019
|
}
|
|
42769
43020
|
} else {
|
|
42770
43021
|
needsProgramChange = true;
|
|
@@ -42773,6 +43024,9 @@ void main() {
|
|
|
42773
43024
|
let program = materialProperties.currentProgram;
|
|
42774
43025
|
if (needsProgramChange === true) {
|
|
42775
43026
|
program = getProgram(material, scene, object);
|
|
43027
|
+
if (_nodesHandler && material.isNodeMaterial) {
|
|
43028
|
+
_nodesHandler.onUpdateProgram(material, program, materialProperties);
|
|
43029
|
+
}
|
|
42776
43030
|
}
|
|
42777
43031
|
let refreshProgram = false;
|
|
42778
43032
|
let refreshMaterial = false;
|
|
@@ -42787,6 +43041,13 @@ void main() {
|
|
|
42787
43041
|
_currentMaterialId = material.id;
|
|
42788
43042
|
refreshMaterial = true;
|
|
42789
43043
|
}
|
|
43044
|
+
if (materialProperties.needsLights) {
|
|
43045
|
+
const objectVolume = findLightProbeGrid(currentRenderState.state.lightProbeGridArray, object);
|
|
43046
|
+
if (materialProperties.lightProbeGrid !== objectVolume) {
|
|
43047
|
+
materialProperties.lightProbeGrid = objectVolume;
|
|
43048
|
+
refreshMaterial = true;
|
|
43049
|
+
}
|
|
43050
|
+
}
|
|
42790
43051
|
if (refreshProgram || _currentCamera !== camera) {
|
|
42791
43052
|
const reversedDepthBuffer2 = state2.buffers.depth.getReversed();
|
|
42792
43053
|
if (reversedDepthBuffer2 && camera.reversedDepth !== true) {
|
|
@@ -42797,7 +43058,7 @@ void main() {
|
|
|
42797
43058
|
p_uniforms.setValue(_gl, "viewMatrix", camera.matrixWorldInverse);
|
|
42798
43059
|
const uCamPos = p_uniforms.map.cameraPosition;
|
|
42799
43060
|
if (uCamPos !== void 0) {
|
|
42800
|
-
uCamPos.setValue(_gl,
|
|
43061
|
+
uCamPos.setValue(_gl, _vector3.setFromMatrixPosition(camera.matrixWorld));
|
|
42801
43062
|
}
|
|
42802
43063
|
if (capabilities.logarithmicDepthBuffer) {
|
|
42803
43064
|
p_uniforms.setValue(
|
|
@@ -42868,6 +43129,13 @@ void main() {
|
|
|
42868
43129
|
materials.refreshFogUniforms(m_uniforms, fog);
|
|
42869
43130
|
}
|
|
42870
43131
|
materials.refreshMaterialUniforms(m_uniforms, material, _pixelRatio, _height, currentRenderState.state.transmissionRenderTarget[camera.id]);
|
|
43132
|
+
if (materialProperties.needsLights && materialProperties.lightProbeGrid) {
|
|
43133
|
+
const volume = materialProperties.lightProbeGrid;
|
|
43134
|
+
m_uniforms.probesSH.value = volume.texture;
|
|
43135
|
+
m_uniforms.probesMin.value.copy(volume.boundingBox.min);
|
|
43136
|
+
m_uniforms.probesMax.value.copy(volume.boundingBox.max);
|
|
43137
|
+
m_uniforms.probesResolution.value.copy(volume.resolution);
|
|
43138
|
+
}
|
|
42871
43139
|
WebGLUniforms.upload(_gl, getUniformList(materialProperties), m_uniforms, textures);
|
|
42872
43140
|
}
|
|
42873
43141
|
if (material.isShaderMaterial && material.uniformsNeedUpdate === true) {
|
|
@@ -42880,7 +43148,7 @@ void main() {
|
|
|
42880
43148
|
p_uniforms.setValue(_gl, "modelViewMatrix", object.modelViewMatrix);
|
|
42881
43149
|
p_uniforms.setValue(_gl, "normalMatrix", object.normalMatrix);
|
|
42882
43150
|
p_uniforms.setValue(_gl, "modelMatrix", object.matrixWorld);
|
|
42883
|
-
if (material.
|
|
43151
|
+
if (material.uniformsGroups !== void 0) {
|
|
42884
43152
|
const groups = material.uniformsGroups;
|
|
42885
43153
|
for (let i3 = 0, l2 = groups.length; i3 < l2; i3++) {
|
|
42886
43154
|
const group = groups[i3];
|
|
@@ -43149,19 +43417,20 @@ void main() {
|
|
|
43149
43417
|
textures.setTexture2D(dstTexture, 0);
|
|
43150
43418
|
glTarget = _gl.TEXTURE_2D;
|
|
43151
43419
|
}
|
|
43152
|
-
|
|
43153
|
-
|
|
43154
|
-
|
|
43155
|
-
|
|
43156
|
-
const
|
|
43157
|
-
const
|
|
43158
|
-
const
|
|
43159
|
-
const
|
|
43160
|
-
|
|
43161
|
-
|
|
43162
|
-
|
|
43163
|
-
|
|
43164
|
-
|
|
43420
|
+
state2.activeTexture(_gl.TEXTURE0);
|
|
43421
|
+
state2.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY);
|
|
43422
|
+
state2.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha);
|
|
43423
|
+
state2.pixelStorei(_gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment);
|
|
43424
|
+
const currentUnpackRowLen = state2.getParameter(_gl.UNPACK_ROW_LENGTH);
|
|
43425
|
+
const currentUnpackImageHeight = state2.getParameter(_gl.UNPACK_IMAGE_HEIGHT);
|
|
43426
|
+
const currentUnpackSkipPixels = state2.getParameter(_gl.UNPACK_SKIP_PIXELS);
|
|
43427
|
+
const currentUnpackSkipRows = state2.getParameter(_gl.UNPACK_SKIP_ROWS);
|
|
43428
|
+
const currentUnpackSkipImages = state2.getParameter(_gl.UNPACK_SKIP_IMAGES);
|
|
43429
|
+
state2.pixelStorei(_gl.UNPACK_ROW_LENGTH, image.width);
|
|
43430
|
+
state2.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, image.height);
|
|
43431
|
+
state2.pixelStorei(_gl.UNPACK_SKIP_PIXELS, minX);
|
|
43432
|
+
state2.pixelStorei(_gl.UNPACK_SKIP_ROWS, minY);
|
|
43433
|
+
state2.pixelStorei(_gl.UNPACK_SKIP_IMAGES, minZ);
|
|
43165
43434
|
const isSrc3D = srcTexture.isDataArrayTexture || srcTexture.isData3DTexture;
|
|
43166
43435
|
const isDst3D = dstTexture.isDataArrayTexture || dstTexture.isData3DTexture;
|
|
43167
43436
|
if (srcTexture.isDepthTexture) {
|
|
@@ -43225,11 +43494,11 @@ void main() {
|
|
|
43225
43494
|
}
|
|
43226
43495
|
}
|
|
43227
43496
|
}
|
|
43228
|
-
|
|
43229
|
-
|
|
43230
|
-
|
|
43231
|
-
|
|
43232
|
-
|
|
43497
|
+
state2.pixelStorei(_gl.UNPACK_ROW_LENGTH, currentUnpackRowLen);
|
|
43498
|
+
state2.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight);
|
|
43499
|
+
state2.pixelStorei(_gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels);
|
|
43500
|
+
state2.pixelStorei(_gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows);
|
|
43501
|
+
state2.pixelStorei(_gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages);
|
|
43233
43502
|
if (dstLevel === 0 && dstTexture.generateMipmaps) {
|
|
43234
43503
|
_gl.generateMipmap(glTarget);
|
|
43235
43504
|
}
|
|
@@ -43294,15 +43563,15 @@ void main() {
|
|
|
43294
43563
|
}
|
|
43295
43564
|
});
|
|
43296
43565
|
|
|
43297
|
-
// ../../node_modules/.bun/use-sync-external-store@1.6.0+
|
|
43566
|
+
// ../../node_modules/.bun/use-sync-external-store@1.6.0+3f10a4be4e334a9b/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
|
|
43298
43567
|
var require_use_sync_external_store_shim_development = __commonJS({
|
|
43299
|
-
"../../node_modules/.bun/use-sync-external-store@1.6.0+
|
|
43568
|
+
"../../node_modules/.bun/use-sync-external-store@1.6.0+3f10a4be4e334a9b/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports$1) {
|
|
43300
43569
|
(function() {
|
|
43301
43570
|
function is2(x2, y) {
|
|
43302
43571
|
return x2 === y && (0 !== x2 || 1 / x2 === 1 / y) || x2 !== x2 && y !== y;
|
|
43303
43572
|
}
|
|
43304
43573
|
function useSyncExternalStore$2(subscribe3, getSnapshot2) {
|
|
43305
|
-
didWarnOld18Alpha || void 0 ===
|
|
43574
|
+
didWarnOld18Alpha || void 0 === React100.startTransition || (didWarnOld18Alpha = true, console.error(
|
|
43306
43575
|
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
|
|
43307
43576
|
));
|
|
43308
43577
|
var value = getSnapshot2();
|
|
@@ -43312,7 +43581,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
43312
43581
|
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
43313
43582
|
), didWarnUncachedGetSnapshot = true);
|
|
43314
43583
|
}
|
|
43315
|
-
cachedValue =
|
|
43584
|
+
cachedValue = useState86({
|
|
43316
43585
|
inst: { value, getSnapshot: getSnapshot2 }
|
|
43317
43586
|
});
|
|
43318
43587
|
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
|
|
@@ -43350,31 +43619,31 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
43350
43619
|
return getSnapshot2();
|
|
43351
43620
|
}
|
|
43352
43621
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
43353
|
-
var
|
|
43354
|
-
exports$1.useSyncExternalStore = void 0 !==
|
|
43622
|
+
var React100 = __require("react"), objectIs = "function" === typeof Object.is ? Object.is : is2, useState86 = React100.useState, useEffect72 = React100.useEffect, useLayoutEffect7 = React100.useLayoutEffect, useDebugValue = React100.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
43623
|
+
exports$1.useSyncExternalStore = void 0 !== React100.useSyncExternalStore ? React100.useSyncExternalStore : shim;
|
|
43355
43624
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
43356
43625
|
})();
|
|
43357
43626
|
}
|
|
43358
43627
|
});
|
|
43359
43628
|
|
|
43360
|
-
// ../../node_modules/.bun/use-sync-external-store@1.6.0+
|
|
43629
|
+
// ../../node_modules/.bun/use-sync-external-store@1.6.0+3f10a4be4e334a9b/node_modules/use-sync-external-store/shim/index.js
|
|
43361
43630
|
var require_shim = __commonJS({
|
|
43362
|
-
"../../node_modules/.bun/use-sync-external-store@1.6.0+
|
|
43631
|
+
"../../node_modules/.bun/use-sync-external-store@1.6.0+3f10a4be4e334a9b/node_modules/use-sync-external-store/shim/index.js"(exports$1, module) {
|
|
43363
43632
|
{
|
|
43364
43633
|
module.exports = require_use_sync_external_store_shim_development();
|
|
43365
43634
|
}
|
|
43366
43635
|
}
|
|
43367
43636
|
});
|
|
43368
43637
|
|
|
43369
|
-
// ../../node_modules/.bun/use-sync-external-store@1.6.0+
|
|
43638
|
+
// ../../node_modules/.bun/use-sync-external-store@1.6.0+3f10a4be4e334a9b/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js
|
|
43370
43639
|
var require_with_selector_development = __commonJS({
|
|
43371
|
-
"../../node_modules/.bun/use-sync-external-store@1.6.0+
|
|
43640
|
+
"../../node_modules/.bun/use-sync-external-store@1.6.0+3f10a4be4e334a9b/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports$1) {
|
|
43372
43641
|
(function() {
|
|
43373
43642
|
function is2(x2, y) {
|
|
43374
43643
|
return x2 === y && (0 !== x2 || 1 / x2 === 1 / y) || x2 !== x2 && y !== y;
|
|
43375
43644
|
}
|
|
43376
43645
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
43377
|
-
var
|
|
43646
|
+
var React100 = __require("react"), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is2, useSyncExternalStore3 = shim.useSyncExternalStore, useRef73 = React100.useRef, useEffect72 = React100.useEffect, useMemo42 = React100.useMemo, useDebugValue = React100.useDebugValue;
|
|
43378
43647
|
exports$1.useSyncExternalStoreWithSelector = function(subscribe3, getSnapshot2, getServerSnapshot2, selector, isEqual) {
|
|
43379
43648
|
var instRef = useRef73(null);
|
|
43380
43649
|
if (null === instRef.current) {
|
|
@@ -43432,19 +43701,19 @@ var require_with_selector_development = __commonJS({
|
|
|
43432
43701
|
}
|
|
43433
43702
|
});
|
|
43434
43703
|
|
|
43435
|
-
// ../../node_modules/.bun/use-sync-external-store@1.6.0+
|
|
43704
|
+
// ../../node_modules/.bun/use-sync-external-store@1.6.0+3f10a4be4e334a9b/node_modules/use-sync-external-store/shim/with-selector.js
|
|
43436
43705
|
var require_with_selector = __commonJS({
|
|
43437
|
-
"../../node_modules/.bun/use-sync-external-store@1.6.0+
|
|
43706
|
+
"../../node_modules/.bun/use-sync-external-store@1.6.0+3f10a4be4e334a9b/node_modules/use-sync-external-store/shim/with-selector.js"(exports$1, module) {
|
|
43438
43707
|
{
|
|
43439
43708
|
module.exports = require_with_selector_development();
|
|
43440
43709
|
}
|
|
43441
43710
|
}
|
|
43442
43711
|
});
|
|
43443
43712
|
|
|
43444
|
-
// ../../node_modules/.bun/zustand@5.0.11+
|
|
43713
|
+
// ../../node_modules/.bun/zustand@5.0.11+5e3d5174673d7dcb/node_modules/zustand/esm/vanilla.mjs
|
|
43445
43714
|
var createStoreImpl, createStore;
|
|
43446
43715
|
var init_vanilla = __esm({
|
|
43447
|
-
"../../node_modules/.bun/zustand@5.0.11+
|
|
43716
|
+
"../../node_modules/.bun/zustand@5.0.11+5e3d5174673d7dcb/node_modules/zustand/esm/vanilla.mjs"() {
|
|
43448
43717
|
createStoreImpl = (createState) => {
|
|
43449
43718
|
let state2;
|
|
43450
43719
|
const listeners = /* @__PURE__ */ new Set();
|
|
@@ -43482,7 +43751,7 @@ function useStoreWithEqualityFn(api, selector = identity, equalityFn) {
|
|
|
43482
43751
|
}
|
|
43483
43752
|
var import_with_selector, useSyncExternalStoreWithSelector, identity, createWithEqualityFnImpl, createWithEqualityFn;
|
|
43484
43753
|
var init_traditional = __esm({
|
|
43485
|
-
"../../node_modules/.bun/zustand@5.0.11+
|
|
43754
|
+
"../../node_modules/.bun/zustand@5.0.11+5e3d5174673d7dcb/node_modules/zustand/esm/traditional.mjs"() {
|
|
43486
43755
|
import_with_selector = __toESM(require_with_selector(), 1);
|
|
43487
43756
|
init_vanilla();
|
|
43488
43757
|
({ useSyncExternalStoreWithSelector } = import_with_selector.default);
|
|
@@ -43497,7 +43766,7 @@ var init_traditional = __esm({
|
|
|
43497
43766
|
}
|
|
43498
43767
|
});
|
|
43499
43768
|
|
|
43500
|
-
// ../../node_modules/.bun/suspend-react@0.1.3+
|
|
43769
|
+
// ../../node_modules/.bun/suspend-react@0.1.3+3f10a4be4e334a9b/node_modules/suspend-react/index.js
|
|
43501
43770
|
function shallowEqualArrays(arrA, arrB, equal = (a2, b2) => a2 === b2) {
|
|
43502
43771
|
if (arrA === arrB) return true;
|
|
43503
43772
|
if (!arrA || !arrB) return false;
|
|
@@ -43545,7 +43814,7 @@ function query(fn, keys2 = null, preload2 = false, config = {}) {
|
|
|
43545
43814
|
}
|
|
43546
43815
|
var isPromise, globalCache, suspend, preload, clear;
|
|
43547
43816
|
var init_suspend_react = __esm({
|
|
43548
|
-
"../../node_modules/.bun/suspend-react@0.1.3+
|
|
43817
|
+
"../../node_modules/.bun/suspend-react@0.1.3+3f10a4be4e334a9b/node_modules/suspend-react/index.js"() {
|
|
43549
43818
|
isPromise = (promise) => typeof promise === "object" && typeof promise.then === "function";
|
|
43550
43819
|
globalCache = [];
|
|
43551
43820
|
suspend = (fn, keys2, config) => query(fn, keys2, false, config);
|
|
@@ -43898,7 +44167,7 @@ function x() {
|
|
|
43898
44167
|
}
|
|
43899
44168
|
var a, m, p, b;
|
|
43900
44169
|
var init_dist = __esm({
|
|
43901
|
-
"../../node_modules/.bun/its-fine@2.0.0+
|
|
44170
|
+
"../../node_modules/.bun/its-fine@2.0.0+b2e33729a97476bf/node_modules/its-fine/dist/index.js"() {
|
|
43902
44171
|
a = /* @__PURE__ */ l(/* @__PURE__ */ React10.createContext(null));
|
|
43903
44172
|
m = class extends React10.Component {
|
|
43904
44173
|
render() {
|
|
@@ -44214,6 +44483,35 @@ function releaseInternalPointerCapture(capturedMap, obj, captures, pointerId) {
|
|
|
44214
44483
|
}
|
|
44215
44484
|
}
|
|
44216
44485
|
}
|
|
44486
|
+
function swapInteractivity(store, object, newObject) {
|
|
44487
|
+
const {
|
|
44488
|
+
internal
|
|
44489
|
+
} = store.getState();
|
|
44490
|
+
for (let i3 = 0; i3 < internal.interaction.length; i3++) {
|
|
44491
|
+
if (internal.interaction[i3] === object) internal.interaction[i3] = newObject;
|
|
44492
|
+
}
|
|
44493
|
+
for (let i3 = 0; i3 < internal.initialHits.length; i3++) {
|
|
44494
|
+
if (internal.initialHits[i3] === object) internal.initialHits[i3] = newObject;
|
|
44495
|
+
}
|
|
44496
|
+
internal.hovered.forEach((value, key) => {
|
|
44497
|
+
if (value.eventObject === object || value.object === object) {
|
|
44498
|
+
internal.hovered.delete(key);
|
|
44499
|
+
const next = {
|
|
44500
|
+
...value,
|
|
44501
|
+
eventObject: value.eventObject === object ? newObject : value.eventObject,
|
|
44502
|
+
object: value.object === object ? newObject : value.object
|
|
44503
|
+
};
|
|
44504
|
+
internal.hovered.set(makeId(next), next);
|
|
44505
|
+
}
|
|
44506
|
+
});
|
|
44507
|
+
internal.capturedMap.forEach((captures) => {
|
|
44508
|
+
const captureData = captures.get(object);
|
|
44509
|
+
if (captureData) {
|
|
44510
|
+
captures.delete(object);
|
|
44511
|
+
captures.set(newObject, captureData);
|
|
44512
|
+
}
|
|
44513
|
+
});
|
|
44514
|
+
}
|
|
44217
44515
|
function removeInteractivity(store, object) {
|
|
44218
44516
|
const {
|
|
44219
44517
|
internal
|
|
@@ -50609,10 +50907,10 @@ This ensures that you're testing the behavior the user would see in the browser.
|
|
|
50609
50907
|
if ((ye & Zn) === Jn) {
|
|
50610
50908
|
var n = e2.tag;
|
|
50611
50909
|
if (n === 3 || n === 1 || n === 0 || n === 11 || n === 14 || n === 15) {
|
|
50612
|
-
if (n = G(e2) || "ReactComponent",
|
|
50613
|
-
if (
|
|
50614
|
-
|
|
50615
|
-
} else
|
|
50910
|
+
if (n = G(e2) || "ReactComponent", _m2 !== null) {
|
|
50911
|
+
if (_m2.has(n)) return;
|
|
50912
|
+
_m2.add(n);
|
|
50913
|
+
} else _m2 = /* @__PURE__ */ new Set([n]);
|
|
50616
50914
|
B(e2, function() {
|
|
50617
50915
|
console.error("Can't perform a React state update on a component that hasn't mounted yet. This indicates that you have a side-effect in your render function that asynchronously tries to update the component. Move this work to useEffect instead.");
|
|
50618
50916
|
});
|
|
@@ -51834,7 +52132,7 @@ Check the top-level render call using <` + i3 + ">.");
|
|
|
51834
52132
|
var bp = Symbol.for;
|
|
51835
52133
|
pm = bp("selector.component"), hm = bp("selector.has_pseudo_class"), mm = bp("selector.role"), gm = bp("selector.test_id"), ym = bp("selector.text");
|
|
51836
52134
|
}
|
|
51837
|
-
var bm = [], qb = typeof WeakMap == "function" ? WeakMap : Map, Jn = 0, Zn = 2, uo = 4, ki = 0, vp = 1, iu = 2, vm = 3, Tl = 4, Sm = 6, Ky = 5, ye = Jn, je = null, se = null, ae = 0, tr = 0, km = 1, lu = 2, Sp = 3, eb = 4, Eg = 5, kp = 6, wm = 7, Ig = 8, su = 9, Le = tr, Er = null, _l = false, Pd = false, Lg = false, Ta = 0, nn = ki, Rl = 0, El = 0, Ng = 0, rr = 0, uu = 0, wp = null, Bt = null, Pm = false, xm = 0, nb = 0, tb = 300, Pp = 1 / 0, Fg = 500, xp = null, gn = null, Il = null, zm = 0, Hg = 1, Ag = 2, rb = 3, Ll = 0, ob = 1, ab = 2, ib = 3, lb = 4, Cm = 5, Rn = 0, Nl = null, xd = null, qo = 0, jg = 0, Dg = -0, Wg = null, sb = null, ub = null, Go = zm, cb = null, Gb = 50, zp = 0, Ug = null, Bg = false, Tm = false, Jb = 50, cu = 0, Cp = null, zd = false,
|
|
52135
|
+
var bm = [], qb = typeof WeakMap == "function" ? WeakMap : Map, Jn = 0, Zn = 2, uo = 4, ki = 0, vp = 1, iu = 2, vm = 3, Tl = 4, Sm = 6, Ky = 5, ye = Jn, je = null, se = null, ae = 0, tr = 0, km = 1, lu = 2, Sp = 3, eb = 4, Eg = 5, kp = 6, wm = 7, Ig = 8, su = 9, Le = tr, Er = null, _l = false, Pd = false, Lg = false, Ta = 0, nn = ki, Rl = 0, El = 0, Ng = 0, rr = 0, uu = 0, wp = null, Bt = null, Pm = false, xm = 0, nb = 0, tb = 300, Pp = 1 / 0, Fg = 500, xp = null, gn = null, Il = null, zm = 0, Hg = 1, Ag = 2, rb = 3, Ll = 0, ob = 1, ab = 2, ib = 3, lb = 4, Cm = 5, Rn = 0, Nl = null, xd = null, qo = 0, jg = 0, Dg = -0, Wg = null, sb = null, ub = null, Go = zm, cb = null, Gb = 50, zp = 0, Ug = null, Bg = false, Tm = false, Jb = 50, cu = 0, Cp = null, zd = false, _m2 = null, db = false, fb = /* @__PURE__ */ new Set(), Zb = {}, co = null, Cd = null, pb = false;
|
|
51838
52136
|
try {
|
|
51839
52137
|
var o0 = Object.preventExtensions({});
|
|
51840
52138
|
} catch {
|
|
@@ -52291,9 +52589,11 @@ function swapInstances() {
|
|
|
52291
52589
|
if (parent) {
|
|
52292
52590
|
var _instance$props$objec, _instance$props$args;
|
|
52293
52591
|
const target = catalogue[toPascalCase(instance.type)];
|
|
52592
|
+
const prevObject = instance.object;
|
|
52294
52593
|
instance.object = (_instance$props$objec = instance.props.object) != null ? _instance$props$objec : new target(...(_instance$props$args = instance.props.args) != null ? _instance$props$args : []);
|
|
52295
52594
|
instance.object.__r3f = instance;
|
|
52296
52595
|
setFiberRef(fiber, instance.object);
|
|
52596
|
+
swapInteractivity(findInitialRoot(instance), prevObject, instance.object);
|
|
52297
52597
|
applyProps(instance.object, instance.props);
|
|
52298
52598
|
if (instance.props.attach) {
|
|
52299
52599
|
attach(parent, instance);
|
|
@@ -52877,8 +53177,8 @@ function createPointerEvents(store) {
|
|
|
52877
53177
|
};
|
|
52878
53178
|
}
|
|
52879
53179
|
var import_scheduler, threeTypes, act2, isOrthographicCamera, isRef, isColorRepresentation, useIsomorphicLayoutEffect, ErrorBoundary, is, REACT_INTERNAL_PROPS, INDEX_REGEX, RESERVED_PROPS, MEMOIZED_PROTOTYPES, colorMaps, EVENT_REGEX, isObject3D, isRenderer, context, createStore2, memoizedLoaders, isConstructor$1, t, o2, r, e, packageData, Rm, Og, Mg, Rb, Eb, t0, r0, NoEventPriority, catalogue, PREFIX_REGEX, toPascalCase, i2, isConstructor, reconstructed, handleTextInstance, NO_CONTEXT, currentUpdatePriority, NoFlags, Update, reconciler, _roots, shallowLoose, globalEffects, globalAfterEffects, globalTailEffects, addEffect, addAfterEffect, addTail, subscribers, subscription, running, useFrameInProgress, repeat, frame, state, DOM_EVENTS;
|
|
52880
|
-
var
|
|
52881
|
-
"../../node_modules/.bun/@react-three+fiber@9.6.
|
|
53180
|
+
var init_events_b389eeca_esm = __esm({
|
|
53181
|
+
"../../node_modules/.bun/@react-three+fiber@9.6.1+26134fee8850b5e9/node_modules/@react-three/fiber/dist/events-b389eeca.esm.js"() {
|
|
52882
53182
|
init_three_module();
|
|
52883
53183
|
init_traditional();
|
|
52884
53184
|
init_suspend_react();
|
|
@@ -53202,7 +53502,7 @@ var init_events_760a1017_esm = __esm({
|
|
|
53202
53502
|
e = 2;
|
|
53203
53503
|
packageData = {
|
|
53204
53504
|
name: "@react-three/fiber",
|
|
53205
|
-
version: "9.6.
|
|
53505
|
+
version: "9.6.1",
|
|
53206
53506
|
description: "A React renderer for Threejs",
|
|
53207
53507
|
keywords: [
|
|
53208
53508
|
"react",
|
|
@@ -53596,13 +53896,13 @@ function E(n) {
|
|
|
53596
53896
|
}
|
|
53597
53897
|
var k, D;
|
|
53598
53898
|
var init_dist2 = __esm({
|
|
53599
|
-
"../../node_modules/.bun/react-use-measure@2.1.7+
|
|
53899
|
+
"../../node_modules/.bun/react-use-measure@2.1.7+21ccd8898788a04d/node_modules/react-use-measure/dist/index.js"() {
|
|
53600
53900
|
k = ["x", "y", "top", "bottom", "left", "right", "width", "height"];
|
|
53601
53901
|
D = (n, t2) => k.every((o3) => n[o3] === t2[o3]);
|
|
53602
53902
|
}
|
|
53603
53903
|
});
|
|
53604
53904
|
|
|
53605
|
-
// ../../node_modules/.bun/@react-three+fiber@9.6.
|
|
53905
|
+
// ../../node_modules/.bun/@react-three+fiber@9.6.1+26134fee8850b5e9/node_modules/@react-three/fiber/dist/react-three-fiber.esm.js
|
|
53606
53906
|
var react_three_fiber_esm_exports = {};
|
|
53607
53907
|
__export(react_three_fiber_esm_exports, {
|
|
53608
53908
|
Canvas: () => Canvas,
|
|
@@ -53771,9 +54071,9 @@ function Canvas(props) {
|
|
|
53771
54071
|
});
|
|
53772
54072
|
}
|
|
53773
54073
|
var init_react_three_fiber_esm = __esm({
|
|
53774
|
-
"../../node_modules/.bun/@react-three+fiber@9.6.
|
|
53775
|
-
|
|
53776
|
-
|
|
54074
|
+
"../../node_modules/.bun/@react-three+fiber@9.6.1+26134fee8850b5e9/node_modules/@react-three/fiber/dist/react-three-fiber.esm.js"() {
|
|
54075
|
+
init_events_b389eeca_esm();
|
|
54076
|
+
init_events_b389eeca_esm();
|
|
53777
54077
|
init_three_module();
|
|
53778
54078
|
init_dist2();
|
|
53779
54079
|
init_dist();
|
|
@@ -53845,7 +54145,7 @@ function isRefObject(ref) {
|
|
|
53845
54145
|
}
|
|
53846
54146
|
var v1, v2, v3, v4, epsilon, getCameraCSSMatrix, getObjectCSSMatrix, Html;
|
|
53847
54147
|
var init_Html = __esm({
|
|
53848
|
-
"../../node_modules/.bun/@react-three+drei@10.7.7+
|
|
54148
|
+
"../../node_modules/.bun/@react-three+drei@10.7.7+20209eb6acc591f5/node_modules/@react-three/drei/web/Html.js"() {
|
|
53849
54149
|
init_extends();
|
|
53850
54150
|
init_three_module();
|
|
53851
54151
|
init_react_three_fiber_esm();
|
|
@@ -54162,16 +54462,16 @@ var init_Html = __esm({
|
|
|
54162
54462
|
}
|
|
54163
54463
|
});
|
|
54164
54464
|
|
|
54165
|
-
// ../../node_modules/.bun/three-stdlib@2.36.1+
|
|
54465
|
+
// ../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/_polyfill/constants.js
|
|
54166
54466
|
var version;
|
|
54167
54467
|
var init_constants = __esm({
|
|
54168
|
-
"../../node_modules/.bun/three-stdlib@2.36.1+
|
|
54468
|
+
"../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/_polyfill/constants.js"() {
|
|
54169
54469
|
init_three_module();
|
|
54170
54470
|
version = /* @__PURE__ */ (() => parseInt(REVISION.replace(/\D+/g, "")))();
|
|
54171
54471
|
}
|
|
54172
54472
|
});
|
|
54173
54473
|
|
|
54174
|
-
// ../../node_modules/.bun/three-stdlib@2.36.1+
|
|
54474
|
+
// ../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/utils/BufferGeometryUtils.js
|
|
54175
54475
|
function toTrianglesDrawMode(geometry, drawMode) {
|
|
54176
54476
|
if (drawMode === TrianglesDrawMode) {
|
|
54177
54477
|
console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.");
|
|
@@ -54231,15 +54531,15 @@ function toTrianglesDrawMode(geometry, drawMode) {
|
|
|
54231
54531
|
}
|
|
54232
54532
|
}
|
|
54233
54533
|
var init_BufferGeometryUtils = __esm({
|
|
54234
|
-
"../../node_modules/.bun/three-stdlib@2.36.1+
|
|
54534
|
+
"../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/utils/BufferGeometryUtils.js"() {
|
|
54235
54535
|
init_three_module();
|
|
54236
54536
|
}
|
|
54237
54537
|
});
|
|
54238
54538
|
|
|
54239
|
-
// ../../node_modules/.bun/three-stdlib@2.36.1+
|
|
54539
|
+
// ../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/controls/EventDispatcher.js
|
|
54240
54540
|
var __defProp2, __defNormalProp, __publicField, EventDispatcher2;
|
|
54241
54541
|
var init_EventDispatcher = __esm({
|
|
54242
|
-
"../../node_modules/.bun/three-stdlib@2.36.1+
|
|
54542
|
+
"../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/controls/EventDispatcher.js"() {
|
|
54243
54543
|
__defProp2 = Object.defineProperty;
|
|
54244
54544
|
__defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
54245
54545
|
__publicField = (obj, key, value) => {
|
|
@@ -54316,10 +54616,10 @@ var init_EventDispatcher = __esm({
|
|
|
54316
54616
|
}
|
|
54317
54617
|
});
|
|
54318
54618
|
|
|
54319
|
-
// ../../node_modules/.bun/three-stdlib@2.36.1+
|
|
54619
|
+
// ../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/controls/OrbitControls.js
|
|
54320
54620
|
var __defProp3, __defNormalProp2, __publicField2, _ray2, _plane, TILT_LIMIT, moduloWrapAround, OrbitControls;
|
|
54321
54621
|
var init_OrbitControls = __esm({
|
|
54322
|
-
"../../node_modules/.bun/three-stdlib@2.36.1+
|
|
54622
|
+
"../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/controls/OrbitControls.js"() {
|
|
54323
54623
|
init_three_module();
|
|
54324
54624
|
init_EventDispatcher();
|
|
54325
54625
|
__defProp3 = Object.defineProperty;
|
|
@@ -55155,7 +55455,7 @@ var init_OrbitControls = __esm({
|
|
|
55155
55455
|
}
|
|
55156
55456
|
});
|
|
55157
55457
|
|
|
55158
|
-
// ../../node_modules/.bun/three-stdlib@2.36.1+
|
|
55458
|
+
// ../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/_polyfill/LoaderUtils.js
|
|
55159
55459
|
function decodeText(array) {
|
|
55160
55460
|
if (typeof TextDecoder !== "undefined") {
|
|
55161
55461
|
return new TextDecoder().decode(array);
|
|
@@ -55171,11 +55471,11 @@ function decodeText(array) {
|
|
|
55171
55471
|
}
|
|
55172
55472
|
}
|
|
55173
55473
|
var init_LoaderUtils = __esm({
|
|
55174
|
-
"../../node_modules/.bun/three-stdlib@2.36.1+
|
|
55474
|
+
"../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/_polyfill/LoaderUtils.js"() {
|
|
55175
55475
|
}
|
|
55176
55476
|
});
|
|
55177
55477
|
|
|
55178
|
-
// ../../node_modules/.bun/three-stdlib@2.36.1+
|
|
55478
|
+
// ../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/loaders/GLTFLoader.js
|
|
55179
55479
|
function GLTFRegistry() {
|
|
55180
55480
|
let objects = {};
|
|
55181
55481
|
return {
|
|
@@ -55421,7 +55721,7 @@ function addPrimitiveAttributes(geometry, primitiveDef, parser) {
|
|
|
55421
55721
|
}
|
|
55422
55722
|
var SRGBColorSpace2, LinearSRGBColorSpace2, sRGBEncoding, LinearEncoding, GLTFLoader, EXTENSIONS, GLTFLightsExtension, GLTFMaterialsUnlitExtension, GLTFMaterialsEmissiveStrengthExtension, GLTFMaterialsClearcoatExtension, GLTFMaterialsDispersionExtension, GLTFMaterialsIridescenceExtension, GLTFMaterialsSheenExtension, GLTFMaterialsTransmissionExtension, GLTFMaterialsVolumeExtension, GLTFMaterialsIorExtension, GLTFMaterialsSpecularExtension, GLTFMaterialsBumpExtension, GLTFMaterialsAnisotropyExtension, GLTFTextureBasisUExtension, GLTFTextureWebPExtension, GLTFTextureAVIFExtension, GLTFMeshoptCompression, GLTFMeshGpuInstancing, BINARY_EXTENSION_HEADER_MAGIC, BINARY_EXTENSION_HEADER_LENGTH, BINARY_EXTENSION_CHUNK_TYPES, GLTFBinaryExtension, GLTFDracoMeshCompressionExtension, GLTFTextureTransformExtension, GLTFMeshQuantizationExtension, GLTFCubicSplineInterpolant, _q, GLTFCubicSplineQuaternionInterpolant, WEBGL_CONSTANTS, WEBGL_COMPONENT_TYPES, WEBGL_FILTERS, WEBGL_WRAPPINGS, WEBGL_TYPE_SIZES, ATTRIBUTES, PATH_PROPERTIES, INTERPOLATION, ALPHA_MODES, _identityMatrix2, GLTFParser;
|
|
55423
55723
|
var init_GLTFLoader = __esm({
|
|
55424
|
-
"../../node_modules/.bun/three-stdlib@2.36.1+
|
|
55724
|
+
"../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/loaders/GLTFLoader.js"() {
|
|
55425
55725
|
init_three_module();
|
|
55426
55726
|
init_BufferGeometryUtils();
|
|
55427
55727
|
init_constants();
|
|
@@ -57803,7 +58103,7 @@ var init_GLTFLoader = __esm({
|
|
|
57803
58103
|
}
|
|
57804
58104
|
});
|
|
57805
58105
|
|
|
57806
|
-
// ../../node_modules/.bun/three-stdlib@2.36.1+
|
|
58106
|
+
// ../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/loaders/DRACOLoader.js
|
|
57807
58107
|
function DRACOWorker() {
|
|
57808
58108
|
let decoderConfig;
|
|
57809
58109
|
let decoderPending;
|
|
@@ -57931,7 +58231,7 @@ function DRACOWorker() {
|
|
|
57931
58231
|
}
|
|
57932
58232
|
var _taskCache, DRACOLoader;
|
|
57933
58233
|
var init_DRACOLoader = __esm({
|
|
57934
|
-
"../../node_modules/.bun/three-stdlib@2.36.1+
|
|
58234
|
+
"../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/loaders/DRACOLoader.js"() {
|
|
57935
58235
|
init_three_module();
|
|
57936
58236
|
_taskCache = /* @__PURE__ */ new WeakMap();
|
|
57937
58237
|
DRACOLoader = class extends Loader {
|
|
@@ -58148,10 +58448,10 @@ var init_DRACOLoader = __esm({
|
|
|
58148
58448
|
}
|
|
58149
58449
|
});
|
|
58150
58450
|
|
|
58151
|
-
// ../../node_modules/.bun/three-stdlib@2.36.1+
|
|
58451
|
+
// ../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/libs/MeshoptDecoder.js
|
|
58152
58452
|
var generated, MeshoptDecoder;
|
|
58153
58453
|
var init_MeshoptDecoder = __esm({
|
|
58154
|
-
"../../node_modules/.bun/three-stdlib@2.36.1+
|
|
58454
|
+
"../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/libs/MeshoptDecoder.js"() {
|
|
58155
58455
|
MeshoptDecoder = () => {
|
|
58156
58456
|
if (generated)
|
|
58157
58457
|
return generated;
|
|
@@ -58372,9 +58672,9 @@ var init_MeshoptDecoder = __esm({
|
|
|
58372
58672
|
}
|
|
58373
58673
|
});
|
|
58374
58674
|
|
|
58375
|
-
// ../../node_modules/.bun/three-stdlib@2.36.1+
|
|
58675
|
+
// ../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/index.js
|
|
58376
58676
|
var init_three_stdlib = __esm({
|
|
58377
|
-
"../../node_modules/.bun/three-stdlib@2.36.1+
|
|
58677
|
+
"../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/index.js"() {
|
|
58378
58678
|
init_OrbitControls();
|
|
58379
58679
|
init_GLTFLoader();
|
|
58380
58680
|
init_DRACOLoader();
|
|
@@ -58400,7 +58700,7 @@ function extensions(useDraco = true, useMeshopt = true, extendLoader) {
|
|
|
58400
58700
|
}
|
|
58401
58701
|
var dracoLoader, decoderPath, useGLTF;
|
|
58402
58702
|
var init_Gltf = __esm({
|
|
58403
|
-
"../../node_modules/.bun/@react-three+drei@10.7.7+
|
|
58703
|
+
"../../node_modules/.bun/@react-three+drei@10.7.7+20209eb6acc591f5/node_modules/@react-three/drei/core/Gltf.js"() {
|
|
58404
58704
|
init_extends();
|
|
58405
58705
|
init_three_stdlib();
|
|
58406
58706
|
init_react_three_fiber_esm();
|
|
@@ -58416,7 +58716,7 @@ var init_Gltf = __esm({
|
|
|
58416
58716
|
});
|
|
58417
58717
|
var OrbitControls2;
|
|
58418
58718
|
var init_OrbitControls2 = __esm({
|
|
58419
|
-
"../../node_modules/.bun/@react-three+drei@10.7.7+
|
|
58719
|
+
"../../node_modules/.bun/@react-three+drei@10.7.7+20209eb6acc591f5/node_modules/@react-three/drei/core/OrbitControls.js"() {
|
|
58420
58720
|
init_extends();
|
|
58421
58721
|
init_react_three_fiber_esm();
|
|
58422
58722
|
init_three_stdlib();
|
|
@@ -58494,12 +58794,12 @@ var init_OrbitControls2 = __esm({
|
|
|
58494
58794
|
}
|
|
58495
58795
|
});
|
|
58496
58796
|
var init_camera_controls_module = __esm({
|
|
58497
|
-
"../../node_modules/.bun/camera-controls@3.1.2+
|
|
58797
|
+
"../../node_modules/.bun/camera-controls@3.1.2+7b565cd016fb14f9/node_modules/camera-controls/dist/camera-controls.module.js"() {
|
|
58498
58798
|
}
|
|
58499
58799
|
});
|
|
58500
58800
|
var Center;
|
|
58501
58801
|
var init_Center = __esm({
|
|
58502
|
-
"../../node_modules/.bun/@react-three+drei@10.7.7+
|
|
58802
|
+
"../../node_modules/.bun/@react-three+drei@10.7.7+20209eb6acc591f5/node_modules/@react-three/drei/core/Center.js"() {
|
|
58503
58803
|
init_extends();
|
|
58504
58804
|
init_three_module();
|
|
58505
58805
|
Center = /* @__PURE__ */ React10.forwardRef(function Center2({
|
|
@@ -58564,9 +58864,9 @@ var init_Center = __esm({
|
|
|
58564
58864
|
}
|
|
58565
58865
|
});
|
|
58566
58866
|
|
|
58567
|
-
// ../../node_modules/.bun/@react-three+drei@10.7.7+
|
|
58867
|
+
// ../../node_modules/.bun/@react-three+drei@10.7.7+20209eb6acc591f5/node_modules/@react-three/drei/index.js
|
|
58568
58868
|
var init_drei = __esm({
|
|
58569
|
-
"../../node_modules/.bun/@react-three+drei@10.7.7+
|
|
58869
|
+
"../../node_modules/.bun/@react-three+drei@10.7.7+20209eb6acc591f5/node_modules/@react-three/drei/index.js"() {
|
|
58570
58870
|
init_Html();
|
|
58571
58871
|
init_Gltf();
|
|
58572
58872
|
init_OrbitControls2();
|
|
@@ -73764,6 +74064,13 @@ function hasDistinctScriptFonts(fonts) {
|
|
|
73764
74064
|
}
|
|
73765
74065
|
return Boolean(fonts.eastAsia) && fonts.eastAsia !== base || Boolean(fonts.complexScript) && fonts.complexScript !== base || Boolean(fonts.symbol) && fonts.symbol !== base;
|
|
73766
74066
|
}
|
|
74067
|
+
function sanitizeMathMl(markup) {
|
|
74068
|
+
const purify = DOMPurify;
|
|
74069
|
+
if (typeof purify.sanitize !== "function") {
|
|
74070
|
+
return markup;
|
|
74071
|
+
}
|
|
74072
|
+
return purify.sanitize(markup, { USE_PROFILES: { mathMl: true, svg: true } });
|
|
74073
|
+
}
|
|
73767
74074
|
function renderScriptAwareText(text2, needsScriptFonts, scriptFonts, baseFontFamily, keyPrefix) {
|
|
73768
74075
|
if (!needsScriptFonts || !text2) {
|
|
73769
74076
|
return text2;
|
|
@@ -73854,14 +74161,15 @@ function renderSegmentContent(elementId, segmentIndex, textValue, lines, needsSc
|
|
|
73854
74161
|
}
|
|
73855
74162
|
function renderEquationSegment(elementId, segmentIndex, equationXml, equationNumber) {
|
|
73856
74163
|
const mathml = convertOmmlToMathMl(equationXml);
|
|
73857
|
-
const
|
|
74164
|
+
const safeMathml = mathml ? sanitizeMathMl(mathml) : "";
|
|
74165
|
+
const equationContent = safeMathml ? /* @__PURE__ */ jsx(
|
|
73858
74166
|
"span",
|
|
73859
74167
|
{
|
|
73860
74168
|
className: "inline-block align-middle",
|
|
73861
74169
|
style: {
|
|
73862
74170
|
fontFamily: '"Cambria Math", "STIX Two Math", serif'
|
|
73863
74171
|
},
|
|
73864
|
-
dangerouslySetInnerHTML: { __html:
|
|
74172
|
+
dangerouslySetInnerHTML: { __html: safeMathml }
|
|
73865
74173
|
}
|
|
73866
74174
|
) : /* @__PURE__ */ jsx("span", { className: "inline-block px-1 py-0.5 rounded text-xs bg-gray-200/20 text-gray-400 italic", children: "Equation" });
|
|
73867
74175
|
if (equationNumber) {
|
|
@@ -86218,7 +86526,7 @@ function ResizeHandle({
|
|
|
86218
86526
|
}
|
|
86219
86527
|
);
|
|
86220
86528
|
}
|
|
86221
|
-
function
|
|
86529
|
+
function SlideThumbnailImpl({
|
|
86222
86530
|
slide,
|
|
86223
86531
|
templateElements,
|
|
86224
86532
|
canvasSize
|
|
@@ -86456,6 +86764,37 @@ function ThumbnailTable({
|
|
|
86456
86764
|
}
|
|
86457
86765
|
return /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center justify-center text-[10px] text-muted-foreground pointer-events-none", children: "Table" });
|
|
86458
86766
|
}
|
|
86767
|
+
function arePropsEqual(prev, next) {
|
|
86768
|
+
if (prev.slide.id !== next.slide.id) {
|
|
86769
|
+
return false;
|
|
86770
|
+
}
|
|
86771
|
+
if (prev.slide.isDirty !== next.slide.isDirty) {
|
|
86772
|
+
return false;
|
|
86773
|
+
}
|
|
86774
|
+
if (prev.slide.hidden !== next.slide.hidden) {
|
|
86775
|
+
return false;
|
|
86776
|
+
}
|
|
86777
|
+
if (prev.slide.elements !== next.slide.elements) {
|
|
86778
|
+
return false;
|
|
86779
|
+
}
|
|
86780
|
+
if (prev.slide.backgroundColor !== next.slide.backgroundColor) {
|
|
86781
|
+
return false;
|
|
86782
|
+
}
|
|
86783
|
+
if (prev.slide.backgroundImage !== next.slide.backgroundImage) {
|
|
86784
|
+
return false;
|
|
86785
|
+
}
|
|
86786
|
+
if (prev.slide.backgroundGradient !== next.slide.backgroundGradient) {
|
|
86787
|
+
return false;
|
|
86788
|
+
}
|
|
86789
|
+
if (prev.templateElements !== next.templateElements) {
|
|
86790
|
+
return false;
|
|
86791
|
+
}
|
|
86792
|
+
if (prev.canvasSize.width !== next.canvasSize.width || prev.canvasSize.height !== next.canvasSize.height) {
|
|
86793
|
+
return false;
|
|
86794
|
+
}
|
|
86795
|
+
return true;
|
|
86796
|
+
}
|
|
86797
|
+
var SlideThumbnail = React10__default.memo(SlideThumbnailImpl, arePropsEqual);
|
|
86459
86798
|
function ContextMenu({
|
|
86460
86799
|
contextMenuState,
|
|
86461
86800
|
mode,
|
|
@@ -90189,7 +90528,7 @@ function BendingProcessRenderer({
|
|
|
90189
90528
|
}
|
|
90190
90529
|
);
|
|
90191
90530
|
}
|
|
90192
|
-
function
|
|
90531
|
+
function SmartArtRendererImpl({
|
|
90193
90532
|
element: element2,
|
|
90194
90533
|
className = ""
|
|
90195
90534
|
}) {
|
|
@@ -90300,6 +90639,30 @@ function renderLayout(layoutType, element2, nodes, palette, style) {
|
|
|
90300
90639
|
}
|
|
90301
90640
|
return /* @__PURE__ */ jsx(ListRenderer, { element: element2, nodes, palette, style });
|
|
90302
90641
|
}
|
|
90642
|
+
function arePropsEqual2(prev, next) {
|
|
90643
|
+
if (prev.className !== next.className) {
|
|
90644
|
+
return false;
|
|
90645
|
+
}
|
|
90646
|
+
if (prev.element.id !== next.element.id) {
|
|
90647
|
+
return false;
|
|
90648
|
+
}
|
|
90649
|
+
if (prev.element.type !== next.element.type) {
|
|
90650
|
+
return false;
|
|
90651
|
+
}
|
|
90652
|
+
if (prev.element.width !== next.element.width || prev.element.height !== next.element.height) {
|
|
90653
|
+
return false;
|
|
90654
|
+
}
|
|
90655
|
+
if (prev.element.x !== next.element.x || prev.element.y !== next.element.y) {
|
|
90656
|
+
return false;
|
|
90657
|
+
}
|
|
90658
|
+
const prevData = prev.element.type === "smartArt" ? prev.element.smartArtData : void 0;
|
|
90659
|
+
const nextData = next.element.type === "smartArt" ? next.element.smartArtData : void 0;
|
|
90660
|
+
if (prevData !== nextData) {
|
|
90661
|
+
return false;
|
|
90662
|
+
}
|
|
90663
|
+
return true;
|
|
90664
|
+
}
|
|
90665
|
+
var SmartArtRenderer = React10__default.memo(SmartArtRendererImpl, arePropsEqual2);
|
|
90303
90666
|
function ZoomElementRenderer({
|
|
90304
90667
|
element: element2,
|
|
90305
90668
|
slides,
|
|
@@ -93338,7 +93701,7 @@ function SectionBlock({
|
|
|
93338
93701
|
)
|
|
93339
93702
|
] });
|
|
93340
93703
|
}
|
|
93341
|
-
function
|
|
93704
|
+
function SlideCardImpl({
|
|
93342
93705
|
slide,
|
|
93343
93706
|
index,
|
|
93344
93707
|
isActive,
|
|
@@ -93392,6 +93755,49 @@ function SlideCard({
|
|
|
93392
93755
|
}
|
|
93393
93756
|
);
|
|
93394
93757
|
}
|
|
93758
|
+
function arePropsEqual3(prev, next) {
|
|
93759
|
+
if (prev.slide.id !== next.slide.id) {
|
|
93760
|
+
return false;
|
|
93761
|
+
}
|
|
93762
|
+
if (prev.slide.isDirty !== next.slide.isDirty) {
|
|
93763
|
+
return false;
|
|
93764
|
+
}
|
|
93765
|
+
if (prev.slide.hidden !== next.slide.hidden) {
|
|
93766
|
+
return false;
|
|
93767
|
+
}
|
|
93768
|
+
if (prev.slide.elements !== next.slide.elements) {
|
|
93769
|
+
return false;
|
|
93770
|
+
}
|
|
93771
|
+
if (prev.index !== next.index) {
|
|
93772
|
+
return false;
|
|
93773
|
+
}
|
|
93774
|
+
if (prev.isActive !== next.isActive) {
|
|
93775
|
+
return false;
|
|
93776
|
+
}
|
|
93777
|
+
if (prev.isDragTarget !== next.isDragTarget) {
|
|
93778
|
+
return false;
|
|
93779
|
+
}
|
|
93780
|
+
if (prev.isSelected !== next.isSelected) {
|
|
93781
|
+
return false;
|
|
93782
|
+
}
|
|
93783
|
+
if (prev.selectedCount !== next.selectedCount) {
|
|
93784
|
+
return false;
|
|
93785
|
+
}
|
|
93786
|
+
if (prev.selectionOrder !== next.selectionOrder) {
|
|
93787
|
+
return false;
|
|
93788
|
+
}
|
|
93789
|
+
if (prev.canEdit !== next.canEdit) {
|
|
93790
|
+
return false;
|
|
93791
|
+
}
|
|
93792
|
+
if (prev.canvasSize.width !== next.canvasSize.width || prev.canvasSize.height !== next.canvasSize.height) {
|
|
93793
|
+
return false;
|
|
93794
|
+
}
|
|
93795
|
+
if (prev.onSlideClick !== next.onSlideClick || prev.onDoubleClick !== next.onDoubleClick || prev.onContextMenu !== next.onContextMenu || prev.onDragStart !== next.onDragStart || prev.onDragOver !== next.onDragOver || prev.onDragLeave !== next.onDragLeave || prev.onDrop !== next.onDrop) {
|
|
93796
|
+
return false;
|
|
93797
|
+
}
|
|
93798
|
+
return true;
|
|
93799
|
+
}
|
|
93800
|
+
var SlideCard = React10__default.memo(SlideCardImpl, arePropsEqual3);
|
|
93395
93801
|
function SorterContextMenu({
|
|
93396
93802
|
x: x2,
|
|
93397
93803
|
y,
|
|
@@ -94185,6 +94591,14 @@ function getCurrentParagraphIndex(editorEl, segments) {
|
|
|
94185
94591
|
}
|
|
94186
94592
|
return paraIdx;
|
|
94187
94593
|
}
|
|
94594
|
+
var CSS_VALUE_SAFE = /^[a-zA-Z0-9 _,.\-+#'%/]{1,100}$/;
|
|
94595
|
+
function isCssValueSafe(value) {
|
|
94596
|
+
if (value === void 0 || value === null) {
|
|
94597
|
+
return false;
|
|
94598
|
+
}
|
|
94599
|
+
const str = String(value);
|
|
94600
|
+
return str.length > 0 && CSS_VALUE_SAFE.test(str);
|
|
94601
|
+
}
|
|
94188
94602
|
function deriveStyleFromElement(element2, inheritedStyle) {
|
|
94189
94603
|
const style = { ...inheritedStyle };
|
|
94190
94604
|
const tagName = element2.tagName.toLowerCase();
|
|
@@ -94317,17 +94731,17 @@ function segmentsToEditorHtml(segments) {
|
|
|
94317
94731
|
if (segment.style.strikethrough) {
|
|
94318
94732
|
inlineStyles.push("text-decoration:line-through");
|
|
94319
94733
|
}
|
|
94320
|
-
if (segment.style.color) {
|
|
94734
|
+
if (segment.style.color && isCssValueSafe(segment.style.color)) {
|
|
94321
94735
|
inlineStyles.push(`color:${segment.style.color}`);
|
|
94322
94736
|
}
|
|
94323
|
-
if (segment.style.fontSize) {
|
|
94324
|
-
inlineStyles.push(`font-size:${segment.style.fontSize}pt`);
|
|
94737
|
+
if (segment.style.fontSize && Number.isFinite(Number(segment.style.fontSize))) {
|
|
94738
|
+
inlineStyles.push(`font-size:${Number(segment.style.fontSize)}pt`);
|
|
94325
94739
|
}
|
|
94326
|
-
if (segment.style.fontFamily) {
|
|
94740
|
+
if (segment.style.fontFamily && isCssValueSafe(segment.style.fontFamily)) {
|
|
94327
94741
|
inlineStyles.push(`font-family:${segment.style.fontFamily}`);
|
|
94328
94742
|
}
|
|
94329
94743
|
const text2 = escapeHtml(segment.text);
|
|
94330
|
-
if (segment.style.hyperlink) {
|
|
94744
|
+
if (segment.style.hyperlink && isUrlSafe(segment.style.hyperlink)) {
|
|
94331
94745
|
const href = escapeHtml(segment.style.hyperlink);
|
|
94332
94746
|
return `<a href="${href}" style="color:#4a9eff;text-decoration:underline;cursor:pointer" data-hyperlink="${href}">${text2}</a>`;
|
|
94333
94747
|
}
|
|
@@ -94410,7 +94824,8 @@ function renderRichNotesSegments(segments) {
|
|
|
94410
94824
|
if (segment.style.fontFamily) {
|
|
94411
94825
|
style.fontFamily = segment.style.fontFamily;
|
|
94412
94826
|
}
|
|
94413
|
-
if (segment.style.hyperlink) {
|
|
94827
|
+
if (segment.style.hyperlink && isUrlSafe(segment.style.hyperlink)) {
|
|
94828
|
+
const safeHref = segment.style.hyperlink;
|
|
94414
94829
|
style.color = "#4a9eff";
|
|
94415
94830
|
style.textDecoration = "underline";
|
|
94416
94831
|
style.cursor = "pointer";
|
|
@@ -94418,11 +94833,11 @@ function renderRichNotesSegments(segments) {
|
|
|
94418
94833
|
/* @__PURE__ */ jsx(
|
|
94419
94834
|
"a",
|
|
94420
94835
|
{
|
|
94421
|
-
href:
|
|
94836
|
+
href: safeHref,
|
|
94422
94837
|
style,
|
|
94423
94838
|
onClick: (e2) => {
|
|
94424
94839
|
e2.preventDefault();
|
|
94425
|
-
|
|
94840
|
+
safeOpenUrl(safeHref);
|
|
94426
94841
|
},
|
|
94427
94842
|
children: segment.text
|
|
94428
94843
|
},
|
|
@@ -94974,7 +95389,7 @@ function useSlideNotes({
|
|
|
94974
95389
|
const href = target.getAttribute("data-hyperlink") || target.getAttribute("href");
|
|
94975
95390
|
if (href && (e2.ctrlKey || e2.metaKey)) {
|
|
94976
95391
|
e2.preventDefault();
|
|
94977
|
-
|
|
95392
|
+
safeOpenUrl(href);
|
|
94978
95393
|
}
|
|
94979
95394
|
}, []);
|
|
94980
95395
|
return {
|
|
@@ -96647,7 +97062,7 @@ function renderNotesSegments(segments) {
|
|
|
96647
97062
|
return React10__default.createElement("span", { key: `seg-${index}`, style }, segment.text);
|
|
96648
97063
|
});
|
|
96649
97064
|
}
|
|
96650
|
-
function
|
|
97065
|
+
function ScaledSlidePreviewImpl({
|
|
96651
97066
|
slide,
|
|
96652
97067
|
templateElements,
|
|
96653
97068
|
canvasSize,
|
|
@@ -96794,6 +97209,40 @@ function ScaledSlidePreview({
|
|
|
96794
97209
|
}
|
|
96795
97210
|
);
|
|
96796
97211
|
}
|
|
97212
|
+
function arePropsEqual4(prev, next) {
|
|
97213
|
+
if (prev.slide.id !== next.slide.id) {
|
|
97214
|
+
return false;
|
|
97215
|
+
}
|
|
97216
|
+
if (prev.slide.isDirty !== next.slide.isDirty) {
|
|
97217
|
+
return false;
|
|
97218
|
+
}
|
|
97219
|
+
if (prev.slide.hidden !== next.slide.hidden) {
|
|
97220
|
+
return false;
|
|
97221
|
+
}
|
|
97222
|
+
if (prev.slide.elements !== next.slide.elements) {
|
|
97223
|
+
return false;
|
|
97224
|
+
}
|
|
97225
|
+
if (prev.slide.backgroundColor !== next.slide.backgroundColor) {
|
|
97226
|
+
return false;
|
|
97227
|
+
}
|
|
97228
|
+
if (prev.slide.backgroundImage !== next.slide.backgroundImage) {
|
|
97229
|
+
return false;
|
|
97230
|
+
}
|
|
97231
|
+
if (prev.slide.backgroundGradient !== next.slide.backgroundGradient) {
|
|
97232
|
+
return false;
|
|
97233
|
+
}
|
|
97234
|
+
if (prev.templateElements !== next.templateElements) {
|
|
97235
|
+
return false;
|
|
97236
|
+
}
|
|
97237
|
+
if (prev.canvasSize.width !== next.canvasSize.width || prev.canvasSize.height !== next.canvasSize.height) {
|
|
97238
|
+
return false;
|
|
97239
|
+
}
|
|
97240
|
+
if (prev.className !== next.className) {
|
|
97241
|
+
return false;
|
|
97242
|
+
}
|
|
97243
|
+
return true;
|
|
97244
|
+
}
|
|
97245
|
+
var ScaledSlidePreview = React10__default.memo(ScaledSlidePreviewImpl, arePropsEqual4);
|
|
96797
97246
|
function PresenterView({
|
|
96798
97247
|
slides,
|
|
96799
97248
|
currentSlideIndex,
|
|
@@ -111097,6 +111546,13 @@ function convertOmmlToLatex(omml) {
|
|
|
111097
111546
|
}
|
|
111098
111547
|
return ommlChildrenToLatex(oMath);
|
|
111099
111548
|
}
|
|
111549
|
+
function sanitizeMathMl2(markup) {
|
|
111550
|
+
const purify = DOMPurify;
|
|
111551
|
+
if (typeof purify.sanitize !== "function") {
|
|
111552
|
+
return markup;
|
|
111553
|
+
}
|
|
111554
|
+
return purify.sanitize(markup, { USE_PROFILES: { mathMl: true, svg: true } });
|
|
111555
|
+
}
|
|
111100
111556
|
var TEMPLATES = [
|
|
111101
111557
|
{
|
|
111102
111558
|
label: "Fraction",
|
|
@@ -111162,7 +111618,8 @@ var TEMPLATES = [
|
|
|
111162
111618
|
var TEMPLATE_MATHML = TEMPLATES.map((tmpl) => {
|
|
111163
111619
|
try {
|
|
111164
111620
|
const tmplOmml = convertLatexToOmml(tmpl.latex);
|
|
111165
|
-
|
|
111621
|
+
const raw = convertOmmlToMathMl(tmplOmml);
|
|
111622
|
+
return raw ? sanitizeMathMl2(raw) : "";
|
|
111166
111623
|
} catch {
|
|
111167
111624
|
return "";
|
|
111168
111625
|
}
|
|
@@ -111174,7 +111631,7 @@ function MathMlPreview({ mathml }) {
|
|
|
111174
111631
|
return;
|
|
111175
111632
|
}
|
|
111176
111633
|
if (mathml) {
|
|
111177
|
-
containerRef.current.innerHTML = mathml;
|
|
111634
|
+
containerRef.current.innerHTML = sanitizeMathMl2(mathml);
|
|
111178
111635
|
} else {
|
|
111179
111636
|
containerRef.current.innerHTML = "";
|
|
111180
111637
|
}
|
|
@@ -111202,6 +111659,7 @@ function EquationEditorDialog({
|
|
|
111202
111659
|
return convertOmmlToLatex(existingOmml);
|
|
111203
111660
|
}, [existingOmml]);
|
|
111204
111661
|
const [latex, setLatex] = useState(initialLatex);
|
|
111662
|
+
const deferredLatex = useDeferredValue(latex);
|
|
111205
111663
|
const textareaRef = useRef(null);
|
|
111206
111664
|
useEffect(() => {
|
|
111207
111665
|
if (isOpen) {
|
|
@@ -111210,17 +111668,17 @@ function EquationEditorDialog({
|
|
|
111210
111668
|
}
|
|
111211
111669
|
}, [isOpen, initialLatex]);
|
|
111212
111670
|
const { mathml, omml } = useMemo(() => {
|
|
111213
|
-
if (!
|
|
111671
|
+
if (!deferredLatex.trim()) {
|
|
111214
111672
|
return { mathml: "", omml: {} };
|
|
111215
111673
|
}
|
|
111216
111674
|
try {
|
|
111217
|
-
const ommlObj = convertLatexToOmml(
|
|
111675
|
+
const ommlObj = convertLatexToOmml(deferredLatex);
|
|
111218
111676
|
const mathmlStr = convertOmmlToMathMl(ommlObj);
|
|
111219
111677
|
return { mathml: mathmlStr, omml: ommlObj };
|
|
111220
111678
|
} catch {
|
|
111221
111679
|
return { mathml: "", omml: {} };
|
|
111222
111680
|
}
|
|
111223
|
-
}, [
|
|
111681
|
+
}, [deferredLatex]);
|
|
111224
111682
|
const handleInsert = useCallback(() => {
|
|
111225
111683
|
if (!latex.trim()) {
|
|
111226
111684
|
return;
|
|
@@ -113984,6 +114442,7 @@ function useEditorHistory(input) {
|
|
|
113984
114442
|
const historyFutureRef = useRef([]);
|
|
113985
114443
|
const lastHistorySnapshotRef = useRef(null);
|
|
113986
114444
|
const lastHistorySerializedRef = useRef("");
|
|
114445
|
+
const lastCheapHashRef = useRef("");
|
|
113987
114446
|
const isApplyingHistoryRef = useRef(false);
|
|
113988
114447
|
const unlockHistoryTimerRef = useRef(null);
|
|
113989
114448
|
const [canUndo, setCanUndo] = useState(false);
|
|
@@ -114125,15 +114584,21 @@ function useEditorHistory(input) {
|
|
|
114125
114584
|
if (hasActivePointerInteraction()) {
|
|
114126
114585
|
return;
|
|
114127
114586
|
}
|
|
114587
|
+
const cheapHash = `${slides.length}|${activeSlideIndex}|${canvasSize.width}x${canvasSize.height}|${slides.map((s) => `${s.id}:${s.elements.length}`).join("/")}`;
|
|
114588
|
+
if (cheapHash === lastCheapHashRef.current) {
|
|
114589
|
+
return;
|
|
114590
|
+
}
|
|
114128
114591
|
const snapshot2 = buildHistorySnapshot();
|
|
114129
114592
|
const serialized = JSON.stringify(snapshot2);
|
|
114130
114593
|
if (serialized === lastHistorySerializedRef.current) {
|
|
114594
|
+
lastCheapHashRef.current = cheapHash;
|
|
114131
114595
|
return;
|
|
114132
114596
|
}
|
|
114133
114597
|
const previousSnapshot = lastHistorySnapshotRef.current;
|
|
114134
114598
|
if (!previousSnapshot) {
|
|
114135
114599
|
lastHistorySnapshotRef.current = cloneHistorySnapshot(snapshot2);
|
|
114136
114600
|
lastHistorySerializedRef.current = serialized;
|
|
114601
|
+
lastCheapHashRef.current = cheapHash;
|
|
114137
114602
|
updateHistoryAvailability();
|
|
114138
114603
|
return;
|
|
114139
114604
|
}
|
|
@@ -114144,13 +114609,18 @@ function useEditorHistory(input) {
|
|
|
114144
114609
|
historyFutureRef.current = [];
|
|
114145
114610
|
lastHistorySnapshotRef.current = cloneHistorySnapshot(snapshot2);
|
|
114146
114611
|
lastHistorySerializedRef.current = serialized;
|
|
114612
|
+
lastCheapHashRef.current = cheapHash;
|
|
114147
114613
|
updateHistoryAvailability();
|
|
114148
114614
|
}, [
|
|
114615
|
+
activeSlideIndex,
|
|
114149
114616
|
buildHistorySnapshot,
|
|
114617
|
+
canvasSize.height,
|
|
114618
|
+
canvasSize.width,
|
|
114150
114619
|
error2,
|
|
114151
114620
|
hasActivePointerInteraction,
|
|
114152
114621
|
loading2,
|
|
114153
114622
|
pointerCommitNonce,
|
|
114623
|
+
slides,
|
|
114154
114624
|
updateHistoryAvailability
|
|
114155
114625
|
]);
|
|
114156
114626
|
return {
|
|
@@ -117843,6 +118313,7 @@ var DB_NAME2 = "pptx-viewer-audience";
|
|
|
117843
118313
|
var DB_VERSION2 = 1;
|
|
117844
118314
|
var STORE_NAME2 = "content";
|
|
117845
118315
|
var CONTENT_KEY = "pptx-bytes";
|
|
118316
|
+
var MAX_CONTENT_AGE_MS = 5 * 60 * 1e3;
|
|
117846
118317
|
function openDb() {
|
|
117847
118318
|
return new Promise((resolve2, reject) => {
|
|
117848
118319
|
const request = indexedDB.open(DB_NAME2, DB_VERSION2);
|
|
@@ -117862,7 +118333,8 @@ async function storeAudienceContent(content) {
|
|
|
117862
118333
|
const tx = db.transaction(STORE_NAME2, "readwrite");
|
|
117863
118334
|
const store = tx.objectStore(STORE_NAME2);
|
|
117864
118335
|
const bytes = content instanceof Uint8Array ? content : new Uint8Array(content);
|
|
117865
|
-
|
|
118336
|
+
const record = { bytes, createdAt: Date.now() };
|
|
118337
|
+
store.put(record, CONTENT_KEY);
|
|
117866
118338
|
tx.oncomplete = () => {
|
|
117867
118339
|
db.close();
|
|
117868
118340
|
resolve2();
|
|
@@ -117883,13 +118355,24 @@ async function loadAudienceContent() {
|
|
|
117883
118355
|
request.onsuccess = () => {
|
|
117884
118356
|
db.close();
|
|
117885
118357
|
const result = request.result;
|
|
117886
|
-
if (result
|
|
117887
|
-
|
|
117888
|
-
|
|
117889
|
-
|
|
117890
|
-
|
|
117891
|
-
|
|
118358
|
+
if (result && typeof result === "object" && "bytes" in result && "createdAt" in result) {
|
|
118359
|
+
const record = result;
|
|
118360
|
+
const age = Date.now() - record.createdAt;
|
|
118361
|
+
if (age > MAX_CONTENT_AGE_MS) {
|
|
118362
|
+
resolve2(null);
|
|
118363
|
+
return;
|
|
118364
|
+
}
|
|
118365
|
+
const raw = record.bytes;
|
|
118366
|
+
if (raw instanceof Uint8Array) {
|
|
118367
|
+
resolve2(raw);
|
|
118368
|
+
} else if (raw instanceof ArrayBuffer) {
|
|
118369
|
+
resolve2(new Uint8Array(raw));
|
|
118370
|
+
} else {
|
|
118371
|
+
resolve2(null);
|
|
118372
|
+
}
|
|
118373
|
+
return;
|
|
117892
118374
|
}
|
|
118375
|
+
resolve2(null);
|
|
117893
118376
|
};
|
|
117894
118377
|
request.onerror = () => {
|
|
117895
118378
|
db.close();
|
|
@@ -117922,14 +118405,34 @@ async function clearAudienceContent() {
|
|
|
117922
118405
|
var PRESENTER_CHANNEL_NAME = "pptx-viewer-presenter";
|
|
117923
118406
|
var AUDIENCE_HASH = "#pptx-audience";
|
|
117924
118407
|
var PRESENTER_MSG_ORIGIN = "pptx-viewer-presenter";
|
|
118408
|
+
var AUDIENCE_NONCE_KEY = "nonce";
|
|
118409
|
+
function generateSessionId() {
|
|
118410
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
118411
|
+
return crypto.randomUUID();
|
|
118412
|
+
}
|
|
118413
|
+
return `s${Date.now().toString(36)}${Math.random().toString(36).slice(2, 10)}`;
|
|
118414
|
+
}
|
|
118415
|
+
function parseAudienceNonce() {
|
|
118416
|
+
const hash = window.location.hash;
|
|
118417
|
+
if (!hash.startsWith(AUDIENCE_HASH)) {
|
|
118418
|
+
return null;
|
|
118419
|
+
}
|
|
118420
|
+
const trailing = hash.slice(AUDIENCE_HASH.length);
|
|
118421
|
+
if (!trailing) {
|
|
118422
|
+
return null;
|
|
118423
|
+
}
|
|
118424
|
+
const params2 = new URLSearchParams(trailing.replace(/^[&;?]/, ""));
|
|
118425
|
+
return params2.get(AUDIENCE_NONCE_KEY);
|
|
118426
|
+
}
|
|
117925
118427
|
function isAudienceTab() {
|
|
117926
|
-
return window.location.hash
|
|
118428
|
+
return window.location.hash.startsWith(AUDIENCE_HASH);
|
|
117927
118429
|
}
|
|
117928
118430
|
function usePresenterWindow(input) {
|
|
117929
118431
|
const { currentSlideIndex, isPresenterMode, content } = input;
|
|
117930
118432
|
const audienceWindowRef = useRef(null);
|
|
117931
118433
|
const channelRef = useRef(null);
|
|
117932
118434
|
const pollTimerRef = useRef(null);
|
|
118435
|
+
const sessionIdRef = useRef("");
|
|
117933
118436
|
const getChannel2 = useCallback(() => {
|
|
117934
118437
|
if (!channelRef.current) {
|
|
117935
118438
|
channelRef.current = new BroadcastChannel(PRESENTER_CHANNEL_NAME);
|
|
@@ -117941,10 +118444,14 @@ function usePresenterWindow(input) {
|
|
|
117941
118444
|
}, []);
|
|
117942
118445
|
const syncSlideToAudience = useCallback(
|
|
117943
118446
|
(slideIndex) => {
|
|
118447
|
+
if (!sessionIdRef.current) {
|
|
118448
|
+
return;
|
|
118449
|
+
}
|
|
117944
118450
|
const msg = {
|
|
117945
118451
|
origin: PRESENTER_MSG_ORIGIN,
|
|
117946
118452
|
type: "presenter-slide-change",
|
|
117947
|
-
slideIndex
|
|
118453
|
+
slideIndex,
|
|
118454
|
+
sessionId: sessionIdRef.current
|
|
117948
118455
|
};
|
|
117949
118456
|
try {
|
|
117950
118457
|
getChannel2().postMessage(msg);
|
|
@@ -117954,13 +118461,16 @@ function usePresenterWindow(input) {
|
|
|
117954
118461
|
[getChannel2]
|
|
117955
118462
|
);
|
|
117956
118463
|
const closeAudienceWindow = useCallback(() => {
|
|
117957
|
-
|
|
117958
|
-
|
|
117959
|
-
|
|
117960
|
-
|
|
117961
|
-
|
|
117962
|
-
|
|
117963
|
-
|
|
118464
|
+
if (sessionIdRef.current) {
|
|
118465
|
+
try {
|
|
118466
|
+
const exitMsg = {
|
|
118467
|
+
origin: PRESENTER_MSG_ORIGIN,
|
|
118468
|
+
type: "presenter-exit",
|
|
118469
|
+
sessionId: sessionIdRef.current
|
|
118470
|
+
};
|
|
118471
|
+
getChannel2().postMessage(exitMsg);
|
|
118472
|
+
} catch {
|
|
118473
|
+
}
|
|
117964
118474
|
}
|
|
117965
118475
|
const win = audienceWindowRef.current;
|
|
117966
118476
|
if (win && !win.closed) {
|
|
@@ -117970,6 +118480,7 @@ function usePresenterWindow(input) {
|
|
|
117970
118480
|
}
|
|
117971
118481
|
}
|
|
117972
118482
|
audienceWindowRef.current = null;
|
|
118483
|
+
sessionIdRef.current = "";
|
|
117973
118484
|
if (pollTimerRef.current !== null) {
|
|
117974
118485
|
clearInterval(pollTimerRef.current);
|
|
117975
118486
|
pollTimerRef.current = null;
|
|
@@ -117980,20 +118491,53 @@ function usePresenterWindow(input) {
|
|
|
117980
118491
|
if (isAudienceWindowOpen()) {
|
|
117981
118492
|
closeAudienceWindow();
|
|
117982
118493
|
}
|
|
117983
|
-
|
|
117984
|
-
|
|
117985
|
-
}
|
|
117986
|
-
const url = new URL(window.location.href);
|
|
117987
|
-
url.hash = AUDIENCE_HASH;
|
|
117988
|
-
const win = window.open(url.toString(), "_blank");
|
|
117989
|
-
if (!win) {
|
|
118494
|
+
const blankWin = window.open("about:blank", "_blank");
|
|
118495
|
+
if (!blankWin) {
|
|
117990
118496
|
return false;
|
|
117991
118497
|
}
|
|
117992
|
-
audienceWindowRef.current =
|
|
118498
|
+
audienceWindowRef.current = blankWin;
|
|
118499
|
+
const sessionId = generateSessionId();
|
|
118500
|
+
sessionIdRef.current = sessionId;
|
|
118501
|
+
const audienceUrl = new URL(window.location.href);
|
|
118502
|
+
const params2 = new URLSearchParams();
|
|
118503
|
+
params2.set(AUDIENCE_NONCE_KEY, sessionId);
|
|
118504
|
+
audienceUrl.hash = `${AUDIENCE_HASH}&${params2.toString()}`;
|
|
118505
|
+
const navigateOrClose = (ok) => {
|
|
118506
|
+
const win = audienceWindowRef.current;
|
|
118507
|
+
if (!win || win.closed) {
|
|
118508
|
+
return;
|
|
118509
|
+
}
|
|
118510
|
+
if (!ok) {
|
|
118511
|
+
try {
|
|
118512
|
+
win.close();
|
|
118513
|
+
} catch {
|
|
118514
|
+
}
|
|
118515
|
+
audienceWindowRef.current = null;
|
|
118516
|
+
sessionIdRef.current = "";
|
|
118517
|
+
return;
|
|
118518
|
+
}
|
|
118519
|
+
try {
|
|
118520
|
+
win.location.replace(audienceUrl.toString());
|
|
118521
|
+
} catch {
|
|
118522
|
+
try {
|
|
118523
|
+
win.close();
|
|
118524
|
+
} catch {
|
|
118525
|
+
}
|
|
118526
|
+
audienceWindowRef.current = null;
|
|
118527
|
+
sessionIdRef.current = "";
|
|
118528
|
+
}
|
|
118529
|
+
};
|
|
118530
|
+
if (content) {
|
|
118531
|
+
void storeAudienceContent(content).then(() => navigateOrClose(true)).catch(() => navigateOrClose(false));
|
|
118532
|
+
} else {
|
|
118533
|
+
navigateOrClose(true);
|
|
118534
|
+
}
|
|
117993
118535
|
window.setTimeout(() => syncSlideToAudience(currentSlideIndex), 1500);
|
|
117994
118536
|
pollTimerRef.current = setInterval(() => {
|
|
117995
|
-
|
|
118537
|
+
const win = audienceWindowRef.current;
|
|
118538
|
+
if (!win || win.closed) {
|
|
117996
118539
|
audienceWindowRef.current = null;
|
|
118540
|
+
sessionIdRef.current = "";
|
|
117997
118541
|
if (pollTimerRef.current !== null) {
|
|
117998
118542
|
clearInterval(pollTimerRef.current);
|
|
117999
118543
|
pollTimerRef.current = null;
|
|
@@ -118021,6 +118565,13 @@ function usePresenterWindow(input) {
|
|
|
118021
118565
|
closeAudienceWindow();
|
|
118022
118566
|
}
|
|
118023
118567
|
}, [isPresenterMode, closeAudienceWindow]);
|
|
118568
|
+
useEffect(() => {
|
|
118569
|
+
const handleBeforeUnload = () => {
|
|
118570
|
+
void clearAudienceContent();
|
|
118571
|
+
};
|
|
118572
|
+
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
118573
|
+
return () => window.removeEventListener("beforeunload", handleBeforeUnload);
|
|
118574
|
+
}, []);
|
|
118024
118575
|
return {
|
|
118025
118576
|
openAudienceWindow,
|
|
118026
118577
|
closeAudienceWindow,
|
|
@@ -118058,6 +118609,7 @@ function useAudienceMode(input) {
|
|
|
118058
118609
|
if (!isAudienceTab()) {
|
|
118059
118610
|
return;
|
|
118060
118611
|
}
|
|
118612
|
+
const expectedSessionId = parseAudienceNonce();
|
|
118061
118613
|
let channel;
|
|
118062
118614
|
try {
|
|
118063
118615
|
channel = new BroadcastChannel(PRESENTER_CHANNEL_NAME);
|
|
@@ -118069,6 +118621,9 @@ function useAudienceMode(input) {
|
|
|
118069
118621
|
if (!data || data.origin !== PRESENTER_MSG_ORIGIN) {
|
|
118070
118622
|
return;
|
|
118071
118623
|
}
|
|
118624
|
+
if (expectedSessionId && data.sessionId !== expectedSessionId) {
|
|
118625
|
+
return;
|
|
118626
|
+
}
|
|
118072
118627
|
if (data.type === "presenter-slide-change") {
|
|
118073
118628
|
onSetActiveSlideIndex(data.slideIndex);
|
|
118074
118629
|
}
|
|
@@ -119002,6 +119557,12 @@ function useTouchGestures(input) {
|
|
|
119002
119557
|
callbacksRef.current = callbacks;
|
|
119003
119558
|
const scaleRef = useRef(currentScale);
|
|
119004
119559
|
scaleRef.current = currentScale;
|
|
119560
|
+
const [targetVersion, setTargetVersion] = useState(0);
|
|
119561
|
+
const lastTargetRef = useRef(null);
|
|
119562
|
+
if (targetRef.current !== lastTargetRef.current) {
|
|
119563
|
+
lastTargetRef.current = targetRef.current;
|
|
119564
|
+
queueMicrotask(() => setTargetVersion((v) => v + 1));
|
|
119565
|
+
}
|
|
119005
119566
|
useEffect(() => {
|
|
119006
119567
|
const el = targetRef.current;
|
|
119007
119568
|
if (!el || !enabled) {
|
|
@@ -119090,7 +119651,7 @@ function useTouchGestures(input) {
|
|
|
119090
119651
|
el.removeEventListener("touchcancel", handleTouchCancel);
|
|
119091
119652
|
cancelLongPress();
|
|
119092
119653
|
};
|
|
119093
|
-
}, [targetRef, enabled]);
|
|
119654
|
+
}, [targetRef, enabled, targetVersion]);
|
|
119094
119655
|
}
|
|
119095
119656
|
|
|
119096
119657
|
// src/viewer/utils/dom-helpers.ts
|
|
@@ -119111,11 +119672,31 @@ function safeConfirm(message) {
|
|
|
119111
119672
|
return false;
|
|
119112
119673
|
}
|
|
119113
119674
|
}
|
|
119675
|
+
function sanitizeDownloadFilename(input) {
|
|
119676
|
+
if (typeof input !== "string" || input.trim().length === 0) {
|
|
119677
|
+
return "presentation.pptx";
|
|
119678
|
+
}
|
|
119679
|
+
let cleaned = input.replace(/[\x00-\x1f\x7f"\\/:*?<>|]/g, "_").replace(/\.\./g, "__").replace(/^\.+/, "").trim();
|
|
119680
|
+
if (cleaned.length === 0) {
|
|
119681
|
+
return "presentation.pptx";
|
|
119682
|
+
}
|
|
119683
|
+
if (cleaned.length > 200) {
|
|
119684
|
+
const dot = cleaned.lastIndexOf(".");
|
|
119685
|
+
if (dot > 0 && cleaned.length - dot <= 16) {
|
|
119686
|
+
const ext = cleaned.slice(dot);
|
|
119687
|
+
cleaned = cleaned.slice(0, 200 - ext.length) + ext;
|
|
119688
|
+
} else {
|
|
119689
|
+
cleaned = cleaned.slice(0, 200);
|
|
119690
|
+
}
|
|
119691
|
+
}
|
|
119692
|
+
return cleaned;
|
|
119693
|
+
}
|
|
119114
119694
|
function downloadBlob(blob, filename) {
|
|
119695
|
+
const safeName = sanitizeDownloadFilename(filename);
|
|
119115
119696
|
const url = URL.createObjectURL(blob);
|
|
119116
119697
|
const a2 = document.createElement("a");
|
|
119117
119698
|
a2.href = url;
|
|
119118
|
-
a2.download =
|
|
119699
|
+
a2.download = safeName;
|
|
119119
119700
|
document.body.appendChild(a2);
|
|
119120
119701
|
a2.click();
|
|
119121
119702
|
setTimeout(() => {
|
|
@@ -119546,27 +120127,82 @@ function openAutosaveDb2() {
|
|
|
119546
120127
|
req.onerror = () => reject(req.error);
|
|
119547
120128
|
});
|
|
119548
120129
|
}
|
|
119549
|
-
async function
|
|
120130
|
+
async function deleteOldestAutosaveEntry() {
|
|
119550
120131
|
const db = await openAutosaveDb2();
|
|
119551
|
-
return new Promise((resolve2
|
|
119552
|
-
|
|
119553
|
-
|
|
119554
|
-
|
|
119555
|
-
|
|
119556
|
-
|
|
119557
|
-
|
|
119558
|
-
|
|
119559
|
-
|
|
119560
|
-
|
|
119561
|
-
|
|
119562
|
-
|
|
119563
|
-
|
|
119564
|
-
|
|
119565
|
-
|
|
119566
|
-
|
|
119567
|
-
|
|
120132
|
+
return new Promise((resolve2) => {
|
|
120133
|
+
try {
|
|
120134
|
+
const tx = db.transaction(STORE_NAME3, "readwrite");
|
|
120135
|
+
const store = tx.objectStore(STORE_NAME3);
|
|
120136
|
+
let oldestKey = null;
|
|
120137
|
+
let oldestTimestamp = Infinity;
|
|
120138
|
+
const cursorReq = store.openCursor();
|
|
120139
|
+
cursorReq.onsuccess = () => {
|
|
120140
|
+
const cursor = cursorReq.result;
|
|
120141
|
+
if (cursor) {
|
|
120142
|
+
const value = cursor.value;
|
|
120143
|
+
if (typeof value.timestamp === "number" && value.timestamp < oldestTimestamp) {
|
|
120144
|
+
oldestTimestamp = value.timestamp;
|
|
120145
|
+
oldestKey = cursor.primaryKey;
|
|
120146
|
+
}
|
|
120147
|
+
cursor.continue();
|
|
120148
|
+
} else if (oldestKey !== null) {
|
|
120149
|
+
store.delete(oldestKey);
|
|
120150
|
+
}
|
|
120151
|
+
};
|
|
120152
|
+
tx.oncomplete = () => {
|
|
120153
|
+
db.close();
|
|
120154
|
+
resolve2(oldestKey !== null);
|
|
120155
|
+
};
|
|
120156
|
+
tx.onerror = () => {
|
|
120157
|
+
db.close();
|
|
120158
|
+
resolve2(false);
|
|
120159
|
+
};
|
|
120160
|
+
} catch {
|
|
120161
|
+
try {
|
|
120162
|
+
db.close();
|
|
120163
|
+
} catch {
|
|
120164
|
+
}
|
|
120165
|
+
resolve2(false);
|
|
120166
|
+
}
|
|
119568
120167
|
});
|
|
119569
120168
|
}
|
|
120169
|
+
function putAutosaveRecord(filePath, data) {
|
|
120170
|
+
return openAutosaveDb2().then(
|
|
120171
|
+
(db) => new Promise((resolve2, reject) => {
|
|
120172
|
+
const tx = db.transaction(STORE_NAME3, "readwrite");
|
|
120173
|
+
const store = tx.objectStore(STORE_NAME3);
|
|
120174
|
+
store.put({
|
|
120175
|
+
key: filePath,
|
|
120176
|
+
data,
|
|
120177
|
+
timestamp: Date.now(),
|
|
120178
|
+
size: data.byteLength
|
|
120179
|
+
});
|
|
120180
|
+
tx.oncomplete = () => {
|
|
120181
|
+
db.close();
|
|
120182
|
+
resolve2(true);
|
|
120183
|
+
};
|
|
120184
|
+
tx.onerror = () => {
|
|
120185
|
+
db.close();
|
|
120186
|
+
reject(tx.error);
|
|
120187
|
+
};
|
|
120188
|
+
})
|
|
120189
|
+
);
|
|
120190
|
+
}
|
|
120191
|
+
async function saveToIndexedDb(filePath, data) {
|
|
120192
|
+
try {
|
|
120193
|
+
return await putAutosaveRecord(filePath, data);
|
|
120194
|
+
} catch (err) {
|
|
120195
|
+
const errName = err instanceof Error || err instanceof DOMException ? err.name : "";
|
|
120196
|
+
if (errName !== "QuotaExceededError") {
|
|
120197
|
+
throw err;
|
|
120198
|
+
}
|
|
120199
|
+
const deleted = await deleteOldestAutosaveEntry();
|
|
120200
|
+
if (!deleted) {
|
|
120201
|
+
throw err;
|
|
120202
|
+
}
|
|
120203
|
+
return putAutosaveRecord(filePath, data);
|
|
120204
|
+
}
|
|
120205
|
+
}
|
|
119570
120206
|
function useAutosave(input) {
|
|
119571
120207
|
const {
|
|
119572
120208
|
isDirty,
|
|
@@ -119683,6 +120319,25 @@ function collectReferencedFontFamilies(slides) {
|
|
|
119683
120319
|
}
|
|
119684
120320
|
return families;
|
|
119685
120321
|
}
|
|
120322
|
+
var FONT_NAME_UNSAFE_CHARS = /["\\\n\r;}<>]/;
|
|
120323
|
+
var FONT_FORMAT_ALLOWED = /* @__PURE__ */ new Set([
|
|
120324
|
+
"truetype",
|
|
120325
|
+
"opentype",
|
|
120326
|
+
"woff",
|
|
120327
|
+
"woff2",
|
|
120328
|
+
"svg",
|
|
120329
|
+
"embedded-opentype"
|
|
120330
|
+
]);
|
|
120331
|
+
var FONT_DATA_URL_PATTERN = /^data:font\/[a-z0-9+.-]+(?:;charset=[a-z0-9-]+)?;base64,[A-Za-z0-9+/=]+$/i;
|
|
120332
|
+
function isFontDataUrlSafe(url) {
|
|
120333
|
+
if (typeof url !== "string" || url.length === 0) {
|
|
120334
|
+
return false;
|
|
120335
|
+
}
|
|
120336
|
+
if (url.startsWith("blob:")) {
|
|
120337
|
+
return true;
|
|
120338
|
+
}
|
|
120339
|
+
return FONT_DATA_URL_PATTERN.test(url);
|
|
120340
|
+
}
|
|
119686
120341
|
function useFontInjection({ embeddedFonts, slides }) {
|
|
119687
120342
|
useEffect(() => {
|
|
119688
120343
|
if (!embeddedFonts.length) {
|
|
@@ -119690,17 +120345,28 @@ function useFontInjection({ embeddedFonts, slides }) {
|
|
|
119690
120345
|
}
|
|
119691
120346
|
const styleEl = document.createElement("style");
|
|
119692
120347
|
styleEl.id = EMBEDDED_FONTS_STYLE_ID;
|
|
119693
|
-
const cssRules = embeddedFonts.
|
|
120348
|
+
const cssRules = embeddedFonts.flatMap((font) => {
|
|
120349
|
+
if (typeof font.name !== "string" || font.name.length === 0 || FONT_NAME_UNSAFE_CHARS.test(font.name)) {
|
|
120350
|
+
return [];
|
|
120351
|
+
}
|
|
120352
|
+
if (!isFontDataUrlSafe(font.dataUrl)) {
|
|
120353
|
+
return [];
|
|
120354
|
+
}
|
|
120355
|
+
const fontFormat = font.format ?? "truetype";
|
|
120356
|
+
if (!FONT_FORMAT_ALLOWED.has(fontFormat)) {
|
|
120357
|
+
return [];
|
|
120358
|
+
}
|
|
119694
120359
|
const fontWeight = font.bold ? "700" : "400";
|
|
119695
120360
|
const fontStyleCss = font.italic ? "italic" : "normal";
|
|
119696
|
-
|
|
119697
|
-
|
|
120361
|
+
return [
|
|
120362
|
+
`@font-face {
|
|
119698
120363
|
font-family: "${font.name}";
|
|
119699
120364
|
src: url("${font.dataUrl}") format("${fontFormat}");
|
|
119700
120365
|
font-weight: ${fontWeight};
|
|
119701
120366
|
font-style: ${fontStyleCss};
|
|
119702
120367
|
font-display: swap;
|
|
119703
|
-
}
|
|
120368
|
+
}`
|
|
120369
|
+
];
|
|
119704
120370
|
}).join("\n");
|
|
119705
120371
|
styleEl.textContent = cssRules;
|
|
119706
120372
|
document.head.appendChild(styleEl);
|
|
@@ -119729,7 +120395,7 @@ function useFontInjection({ embeddedFonts, slides }) {
|
|
|
119729
120395
|
const linkEl = document.createElement("link");
|
|
119730
120396
|
linkEl.id = GOOGLE_FONTS_LINK_ID;
|
|
119731
120397
|
linkEl.rel = "stylesheet";
|
|
119732
|
-
linkEl.href = `https://fonts.googleapis.com/css2?${googleFamilies.map((f) => `family=${GOOGLE_FONTS_AVAILABLE[f]}`).join("&")}&display=swap`;
|
|
120398
|
+
linkEl.href = `https://fonts.googleapis.com/css2?${googleFamilies.map((f) => `family=${encodeURIComponent(GOOGLE_FONTS_AVAILABLE[f])}`).join("&")}&display=swap`;
|
|
119733
120399
|
document.head.appendChild(linkEl);
|
|
119734
120400
|
return () => {
|
|
119735
120401
|
const existing = document.getElementById(GOOGLE_FONTS_LINK_ID);
|
|
@@ -119745,13 +120411,18 @@ function useFontInjection({ embeddedFonts, slides }) {
|
|
|
119745
120411
|
}
|
|
119746
120412
|
const styleEl = document.createElement("style");
|
|
119747
120413
|
styleEl.id = SYMBOL_FONTS_STYLE_ID;
|
|
119748
|
-
const rules = neededSymbolFonts.
|
|
119749
|
-
(font
|
|
120414
|
+
const rules = neededSymbolFonts.flatMap((font) => {
|
|
120415
|
+
if (typeof font !== "string" || FONT_NAME_UNSAFE_CHARS.test(font)) {
|
|
120416
|
+
return [];
|
|
120417
|
+
}
|
|
120418
|
+
return [
|
|
120419
|
+
`@font-face {
|
|
119750
120420
|
font-family: "${font}";
|
|
119751
120421
|
src: local("${font}"), local("${font} Regular");
|
|
119752
120422
|
font-display: swap;
|
|
119753
120423
|
}`
|
|
119754
|
-
|
|
120424
|
+
];
|
|
120425
|
+
}).join("\n");
|
|
119755
120426
|
styleEl.textContent = rules;
|
|
119756
120427
|
document.head.appendChild(styleEl);
|
|
119757
120428
|
return () => {
|
|
@@ -119894,16 +120565,17 @@ function useLoadContent({
|
|
|
119894
120565
|
`[pptx] Large file detected (${fileSizeMB.toFixed(1)} MB). Loading may use significant memory.`
|
|
119895
120566
|
);
|
|
119896
120567
|
}
|
|
119897
|
-
|
|
119898
|
-
handlerRef.current.dispose();
|
|
119899
|
-
handlerRef.current = null;
|
|
119900
|
-
}
|
|
120568
|
+
const previousHandler = handlerRef.current;
|
|
119901
120569
|
const handler = new PptxHandler();
|
|
119902
120570
|
const parsed = await handler.load(buffer);
|
|
119903
120571
|
if (cancelled || token !== renderTokenRef.current) {
|
|
119904
120572
|
handler.dispose();
|
|
119905
120573
|
return;
|
|
119906
120574
|
}
|
|
120575
|
+
if (previousHandler) {
|
|
120576
|
+
previousHandler.dispose();
|
|
120577
|
+
}
|
|
120578
|
+
handlerRef.current = null;
|
|
119907
120579
|
const mediaElements = [];
|
|
119908
120580
|
for (const slide of parsed.slides) {
|
|
119909
120581
|
collectMediaElements(slide.elements, mediaElements);
|
|
@@ -119948,6 +120620,7 @@ function useLoadContent({
|
|
|
119948
120620
|
})
|
|
119949
120621
|
);
|
|
119950
120622
|
const { paths: imagePaths, refs: imageRefs } = collectImagePaths(parsed.slides);
|
|
120623
|
+
let nextSlides = parsed.slides;
|
|
119951
120624
|
if (imagePaths.size > 0) {
|
|
119952
120625
|
const resolvedMap = /* @__PURE__ */ new Map();
|
|
119953
120626
|
await Promise.all(
|
|
@@ -119961,15 +120634,47 @@ function useLoadContent({
|
|
|
119961
120634
|
}
|
|
119962
120635
|
})
|
|
119963
120636
|
);
|
|
120637
|
+
const elementPatches = /* @__PURE__ */ new Map();
|
|
119964
120638
|
for (const ref of imageRefs) {
|
|
119965
120639
|
const url = resolvedMap.get(ref.path);
|
|
119966
|
-
if (url) {
|
|
119967
|
-
|
|
120640
|
+
if (!url) {
|
|
120641
|
+
continue;
|
|
119968
120642
|
}
|
|
120643
|
+
const id2 = ref.element.id;
|
|
120644
|
+
const existing = elementPatches.get(id2) ?? {};
|
|
120645
|
+
existing[ref.field] = url;
|
|
120646
|
+
elementPatches.set(id2, existing);
|
|
120647
|
+
}
|
|
120648
|
+
if (elementPatches.size > 0) {
|
|
120649
|
+
const patchElements = (elements) => {
|
|
120650
|
+
let mutated = false;
|
|
120651
|
+
const next = elements.map((el) => {
|
|
120652
|
+
let updated = el;
|
|
120653
|
+
const patch = elementPatches.get(el.id);
|
|
120654
|
+
if (patch) {
|
|
120655
|
+
updated = { ...el, ...patch };
|
|
120656
|
+
}
|
|
120657
|
+
if (updated.type === "group" && updated.children?.length) {
|
|
120658
|
+
const newChildren = patchElements(updated.children);
|
|
120659
|
+
if (newChildren !== updated.children) {
|
|
120660
|
+
updated = { ...updated, children: newChildren };
|
|
120661
|
+
}
|
|
120662
|
+
}
|
|
120663
|
+
if (updated !== el) {
|
|
120664
|
+
mutated = true;
|
|
120665
|
+
}
|
|
120666
|
+
return updated;
|
|
120667
|
+
});
|
|
120668
|
+
return mutated ? next : elements;
|
|
120669
|
+
};
|
|
120670
|
+
nextSlides = parsed.slides.map((s) => {
|
|
120671
|
+
const newElements = patchElements(s.elements);
|
|
120672
|
+
return newElements === s.elements ? s : { ...s, elements: newElements };
|
|
120673
|
+
});
|
|
119969
120674
|
}
|
|
119970
120675
|
}
|
|
119971
120676
|
handlerRef.current = handler;
|
|
119972
|
-
setSlides(
|
|
120677
|
+
setSlides(nextSlides);
|
|
119973
120678
|
setTemplateElementsBySlideId({});
|
|
119974
120679
|
setCanvasSize({
|
|
119975
120680
|
width: parsed.width ?? DEFAULT_CANVAS_WIDTH,
|
|
@@ -121143,7 +121848,19 @@ function injectFontFaces(svg, fontFaces) {
|
|
|
121143
121848
|
if (!fontFaces.length) {
|
|
121144
121849
|
return svg;
|
|
121145
121850
|
}
|
|
121146
|
-
const
|
|
121851
|
+
const safeFontFaces = fontFaces.filter((f) => {
|
|
121852
|
+
if (f.css.toLowerCase().includes("</style")) {
|
|
121853
|
+
console.warn(
|
|
121854
|
+
`[export-svg] Dropping @font-face entry for "${f.family}" containing "</style" \u2014 would break out of the <style> block.`
|
|
121855
|
+
);
|
|
121856
|
+
return false;
|
|
121857
|
+
}
|
|
121858
|
+
return true;
|
|
121859
|
+
});
|
|
121860
|
+
if (!safeFontFaces.length) {
|
|
121861
|
+
return svg;
|
|
121862
|
+
}
|
|
121863
|
+
const styleBlock = `<style type="text/css">${safeFontFaces.map((f) => f.css).join("\n")}</style>`;
|
|
121147
121864
|
if (svg.includes("<defs>")) {
|
|
121148
121865
|
return svg.replace("<defs>", `<defs>${styleBlock}`);
|
|
121149
121866
|
}
|
|
@@ -121469,7 +122186,7 @@ function useExportHandlers(input) {
|
|
|
121469
122186
|
activeSlideIndexForGuides,
|
|
121470
122187
|
modalControls
|
|
121471
122188
|
});
|
|
121472
|
-
const handleExportPng = async () => {
|
|
122189
|
+
const handleExportPng = useCallback(async () => {
|
|
121473
122190
|
const stageEl = canvasStageRef.current;
|
|
121474
122191
|
if (!stageEl) {
|
|
121475
122192
|
return;
|
|
@@ -121481,8 +122198,8 @@ function useExportHandlers(input) {
|
|
|
121481
122198
|
} catch (err) {
|
|
121482
122199
|
console.error("[PowerPointViewer] PNG export failed:", err);
|
|
121483
122200
|
}
|
|
121484
|
-
};
|
|
121485
|
-
const handleExportPdf = async () => {
|
|
122201
|
+
}, [canvasStageRef, activeSlideIndex, activeSlide?.backgroundColor]);
|
|
122202
|
+
const handleExportPdf = useCallback(async () => {
|
|
121486
122203
|
if (!canvasStageRef.current) {
|
|
121487
122204
|
return;
|
|
121488
122205
|
}
|
|
@@ -121523,8 +122240,8 @@ function useExportHandlers(input) {
|
|
|
121523
122240
|
exportAbortRef.current = null;
|
|
121524
122241
|
setExportModalOpen(false);
|
|
121525
122242
|
}
|
|
121526
|
-
};
|
|
121527
|
-
const handleExportNotesPdf = async () => {
|
|
122243
|
+
}, [canvasStageRef, slides.length, setActiveSlideIndex, activeSlideIndex]);
|
|
122244
|
+
const handleExportNotesPdf = useCallback(async () => {
|
|
121528
122245
|
if (!canvasStageRef.current) {
|
|
121529
122246
|
return;
|
|
121530
122247
|
}
|
|
@@ -121567,8 +122284,8 @@ function useExportHandlers(input) {
|
|
|
121567
122284
|
exportAbortRef.current = null;
|
|
121568
122285
|
setExportModalOpen(false);
|
|
121569
122286
|
}
|
|
121570
|
-
};
|
|
121571
|
-
const handleCopySlideAsImage = async () => {
|
|
122287
|
+
}, [canvasStageRef, slides, setActiveSlideIndex, activeSlideIndex]);
|
|
122288
|
+
const handleCopySlideAsImage = useCallback(async () => {
|
|
121572
122289
|
const stageEl = canvasStageRef.current;
|
|
121573
122290
|
if (!stageEl) {
|
|
121574
122291
|
return;
|
|
@@ -121580,8 +122297,8 @@ function useExportHandlers(input) {
|
|
|
121580
122297
|
} catch (err) {
|
|
121581
122298
|
console.error("[PowerPointViewer] Copy slide as image failed:", err);
|
|
121582
122299
|
}
|
|
121583
|
-
};
|
|
121584
|
-
const handleExportVideo = async () => {
|
|
122300
|
+
}, [canvasStageRef, activeSlide?.backgroundColor]);
|
|
122301
|
+
const handleExportVideo = useCallback(async () => {
|
|
121585
122302
|
if (!canvasStageRef.current) {
|
|
121586
122303
|
return;
|
|
121587
122304
|
}
|
|
@@ -121623,8 +122340,8 @@ function useExportHandlers(input) {
|
|
|
121623
122340
|
exportAbortRef.current = null;
|
|
121624
122341
|
setExportModalOpen(false);
|
|
121625
122342
|
}
|
|
121626
|
-
};
|
|
121627
|
-
const handleExportGif = async () => {
|
|
122343
|
+
}, [canvasStageRef, slides.length, setActiveSlideIndex, activeSlideIndex]);
|
|
122344
|
+
const handleExportGif = useCallback(async () => {
|
|
121628
122345
|
if (!canvasStageRef.current) {
|
|
121629
122346
|
return;
|
|
121630
122347
|
}
|
|
@@ -121662,7 +122379,7 @@ function useExportHandlers(input) {
|
|
|
121662
122379
|
exportAbortRef.current = null;
|
|
121663
122380
|
setExportModalOpen(false);
|
|
121664
122381
|
}
|
|
121665
|
-
};
|
|
122382
|
+
}, [canvasStageRef, slides.length, setActiveSlideIndex, activeSlideIndex]);
|
|
121666
122383
|
const handleCancelExport = useCallback(() => {
|
|
121667
122384
|
exportAbortRef.current?.abort();
|
|
121668
122385
|
exportAbortRef.current = null;
|
|
@@ -121688,6 +122405,15 @@ function useExportHandlers(input) {
|
|
|
121688
122405
|
exportStatusMessage
|
|
121689
122406
|
};
|
|
121690
122407
|
}
|
|
122408
|
+
function escapeHtmlAttr(value) {
|
|
122409
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
122410
|
+
}
|
|
122411
|
+
function safeDataImageSrc(src) {
|
|
122412
|
+
if (typeof src !== "string" || !src.startsWith("data:image/")) {
|
|
122413
|
+
return "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNgAAIAAAUAAen63NgAAAAASUVORK5CYII=";
|
|
122414
|
+
}
|
|
122415
|
+
return escapeHtmlAttr(src);
|
|
122416
|
+
}
|
|
121691
122417
|
function openPrintWindow(title, bodyHtml, orientation, colorFilter, frameSlides) {
|
|
121692
122418
|
const printWindow = window.open("", "_blank", "noopener,noreferrer");
|
|
121693
122419
|
if (!printWindow) {
|
|
@@ -121870,7 +122596,7 @@ function usePrintHandlers(input) {
|
|
|
121870
122596
|
const slideImages = slideIndices.map((idx) => allImages[idx]).filter(Boolean);
|
|
121871
122597
|
if (settings.printWhat === "slides") {
|
|
121872
122598
|
const bodyHtml = slideImages.map(
|
|
121873
|
-
(img, i3) => `<section class="page slide-page"><img class="slide-img" src="${img}" alt="Slide ${slideIndices[i3] + 1}" /></section>`
|
|
122599
|
+
(img, i3) => `<section class="page slide-page"><img class="slide-img" src="${safeDataImageSrc(img)}" alt="Slide ${slideIndices[i3] + 1}" /></section>`
|
|
121874
122600
|
).join("");
|
|
121875
122601
|
openPrintWindow(
|
|
121876
122602
|
"Slides",
|
|
@@ -121886,7 +122612,7 @@ function usePrintHandlers(input) {
|
|
|
121886
122612
|
const idx = slideIndices[i3];
|
|
121887
122613
|
const notes = slides[idx]?.notes?.trim() || "";
|
|
121888
122614
|
return `<section class="page notes-page">
|
|
121889
|
-
<img class="notes-slide" src="${img}" alt="Slide ${idx + 1}" />
|
|
122615
|
+
<img class="notes-slide" src="${safeDataImageSrc(img)}" alt="Slide ${idx + 1}" />
|
|
121890
122616
|
<div class="notes-text">${escapeHtml2(notes)}</div>
|
|
121891
122617
|
</section>`;
|
|
121892
122618
|
}).join("");
|
|
@@ -121918,14 +122644,14 @@ function usePrintHandlers(input) {
|
|
|
121918
122644
|
if (isThreePerPage) {
|
|
121919
122645
|
const rows = Array.from({ length: spp }, (_, cellIndex) => {
|
|
121920
122646
|
const img = pageImgs[cellIndex];
|
|
121921
|
-
const slideCell = img ? `<div class="handout-cell"><img src="${img}" alt="Slide ${slideIndices[i3 + cellIndex] + 1}" /></div>` : `<div class="handout-cell"></div>`;
|
|
122647
|
+
const slideCell = img ? `<div class="handout-cell"><img src="${safeDataImageSrc(img)}" alt="Slide ${slideIndices[i3 + cellIndex] + 1}" /></div>` : `<div class="handout-cell"></div>`;
|
|
121922
122648
|
return `<div class="handout-row-3">${slideCell}${buildNoteLines()}</div>`;
|
|
121923
122649
|
}).join("");
|
|
121924
122650
|
pages.push(`<section class="page"><div class="handout-grid-3">${rows}</div></section>`);
|
|
121925
122651
|
} else {
|
|
121926
122652
|
const cells = Array.from({ length: spp }, (_, cellIndex) => {
|
|
121927
122653
|
const img = pageImgs[cellIndex];
|
|
121928
|
-
return img ? `<div class="handout-cell"><img src="${img}" alt="Slide ${slideIndices[i3 + cellIndex] + 1}" /></div>` : `<div class="handout-cell"></div>`;
|
|
122654
|
+
return img ? `<div class="handout-cell"><img src="${safeDataImageSrc(img)}" alt="Slide ${slideIndices[i3 + cellIndex] + 1}" /></div>` : `<div class="handout-cell"></div>`;
|
|
121929
122655
|
}).join("");
|
|
121930
122656
|
pages.push(
|
|
121931
122657
|
`<section class="page"><div class="handout-grid" style="grid-template-columns: repeat(${grid.columns}, minmax(0, 1fr)); grid-template-rows: repeat(${grid.rows}, minmax(0, 1fr));">${cells}</div></section>`
|
|
@@ -124456,7 +125182,7 @@ scheduler/cjs/scheduler.development.js:
|
|
|
124456
125182
|
* LICENSE file in the root directory of this source tree.
|
|
124457
125183
|
*)
|
|
124458
125184
|
|
|
124459
|
-
@react-three/fiber/dist/events-
|
|
125185
|
+
@react-three/fiber/dist/events-b389eeca.esm.js:
|
|
124460
125186
|
(**
|
|
124461
125187
|
* @license React
|
|
124462
125188
|
* react-reconciler-constants.production.js
|