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.js
CHANGED
|
@@ -7,6 +7,7 @@ var clsx = require('clsx');
|
|
|
7
7
|
var tailwindMerge = require('tailwind-merge');
|
|
8
8
|
var lu = require('react-icons/lu');
|
|
9
9
|
var pptxViewerCore = require('pptx-viewer-core');
|
|
10
|
+
var DOMPurify = require('dompurify');
|
|
10
11
|
var reactI18next = require('react-i18next');
|
|
11
12
|
var html2canvasPro = require('html2canvas-pro');
|
|
12
13
|
var JSZip = require('jszip');
|
|
@@ -33,6 +34,7 @@ function _interopNamespace(e) {
|
|
|
33
34
|
|
|
34
35
|
var React10__namespace = /*#__PURE__*/_interopNamespace(React10);
|
|
35
36
|
var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
37
|
+
var DOMPurify__default = /*#__PURE__*/_interopDefault(DOMPurify);
|
|
36
38
|
var html2canvasPro__default = /*#__PURE__*/_interopDefault(html2canvasPro);
|
|
37
39
|
var JSZip__default = /*#__PURE__*/_interopDefault(JSZip);
|
|
38
40
|
|
|
@@ -90,7 +92,7 @@ var init_extends = __esm({
|
|
|
90
92
|
}
|
|
91
93
|
});
|
|
92
94
|
|
|
93
|
-
// ../../node_modules/.bun/three@0.
|
|
95
|
+
// ../../node_modules/.bun/three@0.184.0/node_modules/three/build/three.core.js
|
|
94
96
|
function arrayNeedsUint32(array) {
|
|
95
97
|
for (let i3 = array.length - 1; i3 >= 0; --i3) {
|
|
96
98
|
if (array[i3] >= 65535) return true;
|
|
@@ -1258,7 +1260,7 @@ function cloneUniforms(src) {
|
|
|
1258
1260
|
dst[u2] = {};
|
|
1259
1261
|
for (const p3 in src[u2]) {
|
|
1260
1262
|
const property = src[u2][p3];
|
|
1261
|
-
if (
|
|
1263
|
+
if (isThreeObject(property)) {
|
|
1262
1264
|
if (property.isRenderTargetTexture) {
|
|
1263
1265
|
warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().");
|
|
1264
1266
|
dst[u2][p3] = null;
|
|
@@ -1266,7 +1268,15 @@ function cloneUniforms(src) {
|
|
|
1266
1268
|
dst[u2][p3] = property.clone();
|
|
1267
1269
|
}
|
|
1268
1270
|
} else if (Array.isArray(property)) {
|
|
1269
|
-
|
|
1271
|
+
if (isThreeObject(property[0])) {
|
|
1272
|
+
const clonedProperty = [];
|
|
1273
|
+
for (let i3 = 0, l2 = property.length; i3 < l2; i3++) {
|
|
1274
|
+
clonedProperty[i3] = property[i3].clone();
|
|
1275
|
+
}
|
|
1276
|
+
dst[u2][p3] = clonedProperty;
|
|
1277
|
+
} else {
|
|
1278
|
+
dst[u2][p3] = property.slice();
|
|
1279
|
+
}
|
|
1270
1280
|
} else {
|
|
1271
1281
|
dst[u2][p3] = property;
|
|
1272
1282
|
}
|
|
@@ -1277,13 +1287,16 @@ function cloneUniforms(src) {
|
|
|
1277
1287
|
function mergeUniforms(uniforms) {
|
|
1278
1288
|
const merged = {};
|
|
1279
1289
|
for (let u2 = 0; u2 < uniforms.length; u2++) {
|
|
1280
|
-
const
|
|
1281
|
-
for (const p3 in
|
|
1282
|
-
merged[p3] =
|
|
1290
|
+
const tmp3 = cloneUniforms(uniforms[u2]);
|
|
1291
|
+
for (const p3 in tmp3) {
|
|
1292
|
+
merged[p3] = tmp3[p3];
|
|
1283
1293
|
}
|
|
1284
1294
|
}
|
|
1285
1295
|
return merged;
|
|
1286
1296
|
}
|
|
1297
|
+
function isThreeObject(property) {
|
|
1298
|
+
return property && (property.isColor || property.isMatrix3 || property.isMatrix4 || property.isVector2 || property.isVector3 || property.isVector4 || property.isTexture || property.isQuaternion);
|
|
1299
|
+
}
|
|
1287
1300
|
function cloneUniformsGroups(src) {
|
|
1288
1301
|
const dst = [];
|
|
1289
1302
|
for (let u2 = 0; u2 < src.length; u2++) {
|
|
@@ -1706,10 +1719,10 @@ function getTextureTypeByteLength(type) {
|
|
|
1706
1719
|
}
|
|
1707
1720
|
throw new Error(`Unknown texture type ${type}.`);
|
|
1708
1721
|
}
|
|
1709
|
-
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;
|
|
1722
|
+
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;
|
|
1710
1723
|
var init_three_core = __esm({
|
|
1711
|
-
"../../node_modules/.bun/three@0.
|
|
1712
|
-
REVISION = "
|
|
1724
|
+
"../../node_modules/.bun/three@0.184.0/node_modules/three/build/three.core.js"() {
|
|
1725
|
+
REVISION = "184";
|
|
1713
1726
|
MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
1714
1727
|
TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
1715
1728
|
CullFaceNone = 0;
|
|
@@ -2272,6 +2285,9 @@ var init_three_core = __esm({
|
|
|
2272
2285
|
denormalize
|
|
2273
2286
|
};
|
|
2274
2287
|
Vector2 = class _Vector2 {
|
|
2288
|
+
static {
|
|
2289
|
+
_Vector2.prototype.isVector2 = true;
|
|
2290
|
+
}
|
|
2275
2291
|
/**
|
|
2276
2292
|
* Constructs a new 2D vector.
|
|
2277
2293
|
*
|
|
@@ -2279,7 +2295,6 @@ var init_three_core = __esm({
|
|
|
2279
2295
|
* @param {number} [y=0] - The y value of this vector.
|
|
2280
2296
|
*/
|
|
2281
2297
|
constructor(x2 = 0, y = 0) {
|
|
2282
|
-
_Vector2.prototype.isVector2 = true;
|
|
2283
2298
|
this.x = x2;
|
|
2284
2299
|
this.y = y;
|
|
2285
2300
|
}
|
|
@@ -3497,6 +3512,9 @@ var init_three_core = __esm({
|
|
|
3497
3512
|
}
|
|
3498
3513
|
};
|
|
3499
3514
|
Vector3 = class _Vector3 {
|
|
3515
|
+
static {
|
|
3516
|
+
_Vector3.prototype.isVector3 = true;
|
|
3517
|
+
}
|
|
3500
3518
|
/**
|
|
3501
3519
|
* Constructs a new 3D vector.
|
|
3502
3520
|
*
|
|
@@ -3505,7 +3523,6 @@ var init_three_core = __esm({
|
|
|
3505
3523
|
* @param {number} [z=0] - The z value of this vector.
|
|
3506
3524
|
*/
|
|
3507
3525
|
constructor(x2 = 0, y = 0, z = 0) {
|
|
3508
|
-
_Vector3.prototype.isVector3 = true;
|
|
3509
3526
|
this.x = x2;
|
|
3510
3527
|
this.y = y;
|
|
3511
3528
|
this.z = z;
|
|
@@ -4403,6 +4420,9 @@ var init_three_core = __esm({
|
|
|
4403
4420
|
_vector$c = /* @__PURE__ */ new Vector3();
|
|
4404
4421
|
_quaternion$5 = /* @__PURE__ */ new Quaternion();
|
|
4405
4422
|
Matrix3 = class _Matrix3 {
|
|
4423
|
+
static {
|
|
4424
|
+
_Matrix3.prototype.isMatrix3 = true;
|
|
4425
|
+
}
|
|
4406
4426
|
/**
|
|
4407
4427
|
* Constructs a new 3x3 matrix. The arguments are supposed to be
|
|
4408
4428
|
* in row-major order. If no arguments are provided, the constructor
|
|
@@ -4419,7 +4439,6 @@ var init_three_core = __esm({
|
|
|
4419
4439
|
* @param {number} [n33] - 3-3 matrix element.
|
|
4420
4440
|
*/
|
|
4421
4441
|
constructor(n11, n12, n13, n21, n22, n23, n31, n32, n33) {
|
|
4422
|
-
_Matrix3.prototype.isMatrix3 = true;
|
|
4423
4442
|
this.elements = [
|
|
4424
4443
|
1,
|
|
4425
4444
|
0,
|
|
@@ -4641,17 +4660,17 @@ var init_three_core = __esm({
|
|
|
4641
4660
|
* @return {Matrix3} A reference to this matrix.
|
|
4642
4661
|
*/
|
|
4643
4662
|
transpose() {
|
|
4644
|
-
let
|
|
4663
|
+
let tmp3;
|
|
4645
4664
|
const m2 = this.elements;
|
|
4646
|
-
|
|
4665
|
+
tmp3 = m2[1];
|
|
4647
4666
|
m2[1] = m2[3];
|
|
4648
|
-
m2[3] =
|
|
4649
|
-
|
|
4667
|
+
m2[3] = tmp3;
|
|
4668
|
+
tmp3 = m2[2];
|
|
4650
4669
|
m2[2] = m2[6];
|
|
4651
|
-
m2[6] =
|
|
4652
|
-
|
|
4670
|
+
m2[6] = tmp3;
|
|
4671
|
+
tmp3 = m2[5];
|
|
4653
4672
|
m2[5] = m2[7];
|
|
4654
|
-
m2[7] =
|
|
4673
|
+
m2[7] = tmp3;
|
|
4655
4674
|
return this;
|
|
4656
4675
|
}
|
|
4657
4676
|
/**
|
|
@@ -5001,7 +5020,7 @@ var init_three_core = __esm({
|
|
|
5001
5020
|
if (typeof HTMLVideoElement !== "undefined" && data instanceof HTMLVideoElement) {
|
|
5002
5021
|
target.set(data.videoWidth, data.videoHeight, 0);
|
|
5003
5022
|
} else if (typeof VideoFrame !== "undefined" && data instanceof VideoFrame) {
|
|
5004
|
-
target.set(data.
|
|
5023
|
+
target.set(data.displayWidth, data.displayHeight, 0);
|
|
5005
5024
|
} else if (data !== null) {
|
|
5006
5025
|
target.set(data.width, data.height, data.depth || 0);
|
|
5007
5026
|
} else {
|
|
@@ -5114,6 +5133,7 @@ var init_three_core = __esm({
|
|
|
5114
5133
|
this.isRenderTargetTexture = false;
|
|
5115
5134
|
this.isArrayTexture = image && image.depth && image.depth > 1 ? true : false;
|
|
5116
5135
|
this.pmremVersion = 0;
|
|
5136
|
+
this.normalized = false;
|
|
5117
5137
|
}
|
|
5118
5138
|
/**
|
|
5119
5139
|
* The width of the texture in pixels.
|
|
@@ -5141,11 +5161,11 @@ var init_three_core = __esm({
|
|
|
5141
5161
|
get image() {
|
|
5142
5162
|
return this.source.data;
|
|
5143
5163
|
}
|
|
5144
|
-
set image(value
|
|
5164
|
+
set image(value) {
|
|
5145
5165
|
this.source.data = value;
|
|
5146
5166
|
}
|
|
5147
5167
|
/**
|
|
5148
|
-
* Updates the texture transformation matrix from the
|
|
5168
|
+
* Updates the texture transformation matrix from the properties {@link Texture#offset},
|
|
5149
5169
|
* {@link Texture#repeat}, {@link Texture#rotation}, and {@link Texture#center}.
|
|
5150
5170
|
*/
|
|
5151
5171
|
updateMatrix() {
|
|
@@ -5194,6 +5214,7 @@ var init_three_core = __esm({
|
|
|
5194
5214
|
this.format = source.format;
|
|
5195
5215
|
this.internalFormat = source.internalFormat;
|
|
5196
5216
|
this.type = source.type;
|
|
5217
|
+
this.normalized = source.normalized;
|
|
5197
5218
|
this.offset.copy(source.offset);
|
|
5198
5219
|
this.repeat.copy(source.repeat);
|
|
5199
5220
|
this.center.copy(source.center);
|
|
@@ -5270,6 +5291,7 @@ var init_three_core = __esm({
|
|
|
5270
5291
|
format: this.format,
|
|
5271
5292
|
internalFormat: this.internalFormat,
|
|
5272
5293
|
type: this.type,
|
|
5294
|
+
normalized: this.normalized,
|
|
5273
5295
|
colorSpace: this.colorSpace,
|
|
5274
5296
|
minFilter: this.minFilter,
|
|
5275
5297
|
magFilter: this.magFilter,
|
|
@@ -5375,6 +5397,9 @@ var init_three_core = __esm({
|
|
|
5375
5397
|
Texture.DEFAULT_MAPPING = UVMapping;
|
|
5376
5398
|
Texture.DEFAULT_ANISOTROPY = 1;
|
|
5377
5399
|
Vector4 = class _Vector4 {
|
|
5400
|
+
static {
|
|
5401
|
+
_Vector4.prototype.isVector4 = true;
|
|
5402
|
+
}
|
|
5378
5403
|
/**
|
|
5379
5404
|
* Constructs a new 4D vector.
|
|
5380
5405
|
*
|
|
@@ -5384,7 +5409,6 @@ var init_three_core = __esm({
|
|
|
5384
5409
|
* @param {number} [w=1] - The w value of this vector.
|
|
5385
5410
|
*/
|
|
5386
5411
|
constructor(x2 = 0, y = 0, z = 0, w = 1) {
|
|
5387
|
-
_Vector4.prototype.isVector4 = true;
|
|
5388
5412
|
this.x = x2;
|
|
5389
5413
|
this.y = y;
|
|
5390
5414
|
this.z = z;
|
|
@@ -6292,6 +6316,7 @@ var init_three_core = __esm({
|
|
|
6292
6316
|
this.resolveStencilBuffer = source.resolveStencilBuffer;
|
|
6293
6317
|
if (source.depthTexture !== null) this.depthTexture = source.depthTexture.clone();
|
|
6294
6318
|
this.samples = source.samples;
|
|
6319
|
+
this.multiview = source.multiview;
|
|
6295
6320
|
return this;
|
|
6296
6321
|
}
|
|
6297
6322
|
/**
|
|
@@ -6415,6 +6440,9 @@ var init_three_core = __esm({
|
|
|
6415
6440
|
}
|
|
6416
6441
|
};
|
|
6417
6442
|
Matrix4 = class _Matrix4 {
|
|
6443
|
+
static {
|
|
6444
|
+
_Matrix4.prototype.isMatrix4 = true;
|
|
6445
|
+
}
|
|
6418
6446
|
/**
|
|
6419
6447
|
* Constructs a new 4x4 matrix. The arguments are supposed to be
|
|
6420
6448
|
* in row-major order. If no arguments are provided, the constructor
|
|
@@ -6438,7 +6466,6 @@ var init_three_core = __esm({
|
|
|
6438
6466
|
* @param {number} [n44] - 4-4 matrix element.
|
|
6439
6467
|
*/
|
|
6440
6468
|
constructor(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) {
|
|
6441
|
-
_Matrix4.prototype.isMatrix4 = true;
|
|
6442
6469
|
this.elements = [
|
|
6443
6470
|
1,
|
|
6444
6471
|
0,
|
|
@@ -6943,25 +6970,25 @@ var init_three_core = __esm({
|
|
|
6943
6970
|
*/
|
|
6944
6971
|
transpose() {
|
|
6945
6972
|
const te = this.elements;
|
|
6946
|
-
let
|
|
6947
|
-
|
|
6973
|
+
let tmp3;
|
|
6974
|
+
tmp3 = te[1];
|
|
6948
6975
|
te[1] = te[4];
|
|
6949
|
-
te[4] =
|
|
6950
|
-
|
|
6976
|
+
te[4] = tmp3;
|
|
6977
|
+
tmp3 = te[2];
|
|
6951
6978
|
te[2] = te[8];
|
|
6952
|
-
te[8] =
|
|
6953
|
-
|
|
6979
|
+
te[8] = tmp3;
|
|
6980
|
+
tmp3 = te[6];
|
|
6954
6981
|
te[6] = te[9];
|
|
6955
|
-
te[9] =
|
|
6956
|
-
|
|
6982
|
+
te[9] = tmp3;
|
|
6983
|
+
tmp3 = te[3];
|
|
6957
6984
|
te[3] = te[12];
|
|
6958
|
-
te[12] =
|
|
6959
|
-
|
|
6985
|
+
te[12] = tmp3;
|
|
6986
|
+
tmp3 = te[7];
|
|
6960
6987
|
te[7] = te[13];
|
|
6961
|
-
te[13] =
|
|
6962
|
-
|
|
6988
|
+
te[13] = tmp3;
|
|
6989
|
+
tmp3 = te[11];
|
|
6963
6990
|
te[11] = te[14];
|
|
6964
|
-
te[14] =
|
|
6991
|
+
te[14] = tmp3;
|
|
6965
6992
|
return this;
|
|
6966
6993
|
}
|
|
6967
6994
|
/**
|
|
@@ -8801,9 +8828,7 @@ var init_three_core = __esm({
|
|
|
8801
8828
|
this.rotation.order = source.rotation.order;
|
|
8802
8829
|
this.quaternion.copy(source.quaternion);
|
|
8803
8830
|
this.scale.copy(source.scale);
|
|
8804
|
-
|
|
8805
|
-
this.pivot = source.pivot.clone();
|
|
8806
|
-
}
|
|
8831
|
+
this.pivot = source.pivot !== null ? source.pivot.clone() : null;
|
|
8807
8832
|
this.matrix.copy(source.matrix);
|
|
8808
8833
|
this.matrixWorld.copy(source.matrixWorld);
|
|
8809
8834
|
this.matrixAutoUpdate = source.matrixAutoUpdate;
|
|
@@ -8893,6 +8918,7 @@ var init_three_core = __esm({
|
|
|
8893
8918
|
this._grip.linearVelocity = new Vector3();
|
|
8894
8919
|
this._grip.hasAngularVelocity = false;
|
|
8895
8920
|
this._grip.angularVelocity = new Vector3();
|
|
8921
|
+
this._grip.eventsEnabled = false;
|
|
8896
8922
|
}
|
|
8897
8923
|
return this._grip;
|
|
8898
8924
|
}
|
|
@@ -9022,6 +9048,13 @@ var init_three_core = __esm({
|
|
|
9022
9048
|
} else {
|
|
9023
9049
|
grip.hasAngularVelocity = false;
|
|
9024
9050
|
}
|
|
9051
|
+
if (grip.eventsEnabled) {
|
|
9052
|
+
grip.dispatchEvent({
|
|
9053
|
+
type: "gripUpdated",
|
|
9054
|
+
data: inputSource,
|
|
9055
|
+
target: this
|
|
9056
|
+
});
|
|
9057
|
+
}
|
|
9025
9058
|
}
|
|
9026
9059
|
}
|
|
9027
9060
|
}
|
|
@@ -10101,7 +10134,7 @@ var init_three_core = __esm({
|
|
|
10101
10134
|
static isFrontFacing(a2, b2, c2, direction) {
|
|
10102
10135
|
_v0$2.subVectors(c2, b2);
|
|
10103
10136
|
_v1$5.subVectors(a2, b2);
|
|
10104
|
-
return _v0$2.cross(_v1$5).dot(direction) < 0
|
|
10137
|
+
return _v0$2.cross(_v1$5).dot(direction) < 0;
|
|
10105
10138
|
}
|
|
10106
10139
|
/**
|
|
10107
10140
|
* Sets the triangle's vertices by copying the given values.
|
|
@@ -10872,7 +10905,7 @@ var init_three_core = __esm({
|
|
|
10872
10905
|
_vector$a = /* @__PURE__ */ new Vector3();
|
|
10873
10906
|
_vector2$1 = /* @__PURE__ */ new Vector2();
|
|
10874
10907
|
_id$2 = 0;
|
|
10875
|
-
BufferAttribute = class {
|
|
10908
|
+
BufferAttribute = class extends EventDispatcher {
|
|
10876
10909
|
/**
|
|
10877
10910
|
* Constructs a new buffer attribute.
|
|
10878
10911
|
*
|
|
@@ -10881,6 +10914,7 @@ var init_three_core = __esm({
|
|
|
10881
10914
|
* @param {boolean} [normalized=false] - Whether the data are normalized or not.
|
|
10882
10915
|
*/
|
|
10883
10916
|
constructor(array, itemSize, normalized = false) {
|
|
10917
|
+
super();
|
|
10884
10918
|
if (Array.isArray(array)) {
|
|
10885
10919
|
throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");
|
|
10886
10920
|
}
|
|
@@ -11277,6 +11311,12 @@ var init_three_core = __esm({
|
|
|
11277
11311
|
if (this.usage !== StaticDrawUsage) data.usage = this.usage;
|
|
11278
11312
|
return data;
|
|
11279
11313
|
}
|
|
11314
|
+
/**
|
|
11315
|
+
* Disposes of the buffer attribute. Available only in {@link WebGPURenderer}.
|
|
11316
|
+
*/
|
|
11317
|
+
dispose() {
|
|
11318
|
+
this.dispatchEvent({ type: "dispose" });
|
|
11319
|
+
}
|
|
11280
11320
|
};
|
|
11281
11321
|
Int8BufferAttribute = class extends BufferAttribute {
|
|
11282
11322
|
/**
|
|
@@ -12218,18 +12258,18 @@ var init_three_core = __esm({
|
|
|
12218
12258
|
);
|
|
12219
12259
|
}
|
|
12220
12260
|
}
|
|
12221
|
-
const
|
|
12261
|
+
const tmp3 = new Vector3(), tmp22 = new Vector3();
|
|
12222
12262
|
const n = new Vector3(), n2 = new Vector3();
|
|
12223
12263
|
function handleVertex(v) {
|
|
12224
12264
|
n.fromBufferAttribute(normalAttribute, v);
|
|
12225
12265
|
n2.copy(n);
|
|
12226
12266
|
const t2 = tan1[v];
|
|
12227
|
-
|
|
12228
|
-
|
|
12267
|
+
tmp3.copy(t2);
|
|
12268
|
+
tmp3.sub(n.multiplyScalar(n.dot(t2))).normalize();
|
|
12229
12269
|
tmp22.crossVectors(n2, t2);
|
|
12230
12270
|
const test = tmp22.dot(tan2[v]);
|
|
12231
12271
|
const w = test < 0 ? -1 : 1;
|
|
12232
|
-
tangentAttribute.setXYZW(v,
|
|
12272
|
+
tangentAttribute.setXYZW(v, tmp3.x, tmp3.y, tmp3.z, w);
|
|
12233
12273
|
}
|
|
12234
12274
|
for (let i3 = 0, il = groups.length; i3 < il; ++i3) {
|
|
12235
12275
|
const group = groups[i3];
|
|
@@ -14380,10 +14420,10 @@ var init_three_core = __esm({
|
|
|
14380
14420
|
}
|
|
14381
14421
|
}
|
|
14382
14422
|
};
|
|
14383
|
-
|
|
14423
|
+
_baseVector = /* @__PURE__ */ new Vector4();
|
|
14384
14424
|
_skinIndex = /* @__PURE__ */ new Vector4();
|
|
14385
14425
|
_skinWeight = /* @__PURE__ */ new Vector4();
|
|
14386
|
-
|
|
14426
|
+
_vector4 = /* @__PURE__ */ new Vector4();
|
|
14387
14427
|
_matrix4 = /* @__PURE__ */ new Matrix4();
|
|
14388
14428
|
_vertex = /* @__PURE__ */ new Vector3();
|
|
14389
14429
|
_sphere$5 = /* @__PURE__ */ new Sphere();
|
|
@@ -14525,28 +14565,37 @@ var init_three_core = __esm({
|
|
|
14525
14565
|
}
|
|
14526
14566
|
/**
|
|
14527
14567
|
* Applies the bone transform associated with the given index to the given
|
|
14528
|
-
*
|
|
14568
|
+
* vector. Can be used to transform positions or direction vectors by providing
|
|
14569
|
+
* a Vector4 with 1 or 0 in the w component respectively. Returns the updated vector.
|
|
14529
14570
|
*
|
|
14530
14571
|
* @param {number} index - The vertex index.
|
|
14531
|
-
* @param {Vector3} target - The target object that is used to store the method's result.
|
|
14532
|
-
*
|
|
14533
|
-
* @return {Vector3} The updated vertex position.
|
|
14572
|
+
* @param {Vector3|Vector4} target - The target object that is used to store the method's result.
|
|
14573
|
+
* @return {Vector3|Vector4} The updated vertex attribute data.
|
|
14534
14574
|
*/
|
|
14535
14575
|
applyBoneTransform(index, target) {
|
|
14536
14576
|
const skeleton = this.skeleton;
|
|
14537
14577
|
const geometry = this.geometry;
|
|
14538
14578
|
_skinIndex.fromBufferAttribute(geometry.attributes.skinIndex, index);
|
|
14539
14579
|
_skinWeight.fromBufferAttribute(geometry.attributes.skinWeight, index);
|
|
14540
|
-
|
|
14541
|
-
|
|
14580
|
+
if (target.isVector4) {
|
|
14581
|
+
_baseVector.copy(target);
|
|
14582
|
+
target.set(0, 0, 0, 0);
|
|
14583
|
+
} else {
|
|
14584
|
+
_baseVector.set(...target, 1);
|
|
14585
|
+
target.set(0, 0, 0);
|
|
14586
|
+
}
|
|
14587
|
+
_baseVector.applyMatrix4(this.bindMatrix);
|
|
14542
14588
|
for (let i3 = 0; i3 < 4; i3++) {
|
|
14543
14589
|
const weight = _skinWeight.getComponent(i3);
|
|
14544
14590
|
if (weight !== 0) {
|
|
14545
14591
|
const boneIndex = _skinIndex.getComponent(i3);
|
|
14546
14592
|
_matrix4.multiplyMatrices(skeleton.bones[boneIndex].matrixWorld, skeleton.boneInverses[boneIndex]);
|
|
14547
|
-
target.addScaledVector(
|
|
14593
|
+
target.addScaledVector(_vector4.copy(_baseVector).applyMatrix4(_matrix4), weight);
|
|
14548
14594
|
}
|
|
14549
14595
|
}
|
|
14596
|
+
if (target.isVector4) {
|
|
14597
|
+
target.w = _baseVector.w;
|
|
14598
|
+
}
|
|
14550
14599
|
return target.applyMatrix4(this.bindMatrixInverse);
|
|
14551
14600
|
}
|
|
14552
14601
|
};
|
|
@@ -14894,18 +14943,24 @@ var init_three_core = __esm({
|
|
|
14894
14943
|
*
|
|
14895
14944
|
* @param {number} index - The instance index.
|
|
14896
14945
|
* @param {Color} color - The target object that is used to store the method's result.
|
|
14946
|
+
* @return {Color} A reference to the target color.
|
|
14897
14947
|
*/
|
|
14898
14948
|
getColorAt(index, color) {
|
|
14899
|
-
|
|
14949
|
+
if (this.instanceColor === null) {
|
|
14950
|
+
return color.setRGB(1, 1, 1);
|
|
14951
|
+
} else {
|
|
14952
|
+
return color.fromArray(this.instanceColor.array, index * 3);
|
|
14953
|
+
}
|
|
14900
14954
|
}
|
|
14901
14955
|
/**
|
|
14902
14956
|
* Gets the local transformation matrix of the defined instance.
|
|
14903
14957
|
*
|
|
14904
14958
|
* @param {number} index - The instance index.
|
|
14905
14959
|
* @param {Matrix4} matrix - The target object that is used to store the method's result.
|
|
14960
|
+
* @return {Matrix4} A reference to the target matrix.
|
|
14906
14961
|
*/
|
|
14907
14962
|
getMatrixAt(index, matrix) {
|
|
14908
|
-
matrix.fromArray(this.instanceMatrix.array, index * 16);
|
|
14963
|
+
return matrix.fromArray(this.instanceMatrix.array, index * 16);
|
|
14909
14964
|
}
|
|
14910
14965
|
/**
|
|
14911
14966
|
* Gets the morph target weights of the defined instance.
|
|
@@ -14952,22 +15007,26 @@ var init_three_core = __esm({
|
|
|
14952
15007
|
*
|
|
14953
15008
|
* @param {number} index - The instance index.
|
|
14954
15009
|
* @param {Color} color - The instance color.
|
|
15010
|
+
* @return {InstancedMesh} A reference to this instanced mesh.
|
|
14955
15011
|
*/
|
|
14956
15012
|
setColorAt(index, color) {
|
|
14957
15013
|
if (this.instanceColor === null) {
|
|
14958
15014
|
this.instanceColor = new InstancedBufferAttribute(new Float32Array(this.instanceMatrix.count * 3).fill(1), 3);
|
|
14959
15015
|
}
|
|
14960
15016
|
color.toArray(this.instanceColor.array, index * 3);
|
|
15017
|
+
return this;
|
|
14961
15018
|
}
|
|
14962
15019
|
/**
|
|
14963
15020
|
* Sets the given local transformation matrix to the defined instance. Make sure you set the `needsUpdate` flag of
|
|
14964
|
-
* {@link InstancedMesh#instanceMatrix} to `true` after updating all the
|
|
15021
|
+
* {@link InstancedMesh#instanceMatrix} to `true` after updating all the matrices.
|
|
14965
15022
|
*
|
|
14966
15023
|
* @param {number} index - The instance index.
|
|
14967
15024
|
* @param {Matrix4} matrix - The local transformation.
|
|
15025
|
+
* @return {InstancedMesh} A reference to this instanced mesh.
|
|
14968
15026
|
*/
|
|
14969
15027
|
setMatrixAt(index, matrix) {
|
|
14970
15028
|
matrix.toArray(this.instanceMatrix.array, index * 16);
|
|
15029
|
+
return this;
|
|
14971
15030
|
}
|
|
14972
15031
|
/**
|
|
14973
15032
|
* Sets the morph target weights to the defined instance. Make sure you set the `needsUpdate` flag of
|
|
@@ -14976,6 +15035,7 @@ var init_three_core = __esm({
|
|
|
14976
15035
|
* @param {number} index - The instance index.
|
|
14977
15036
|
* @param {Mesh} object - A mesh which `morphTargetInfluences` property containing the morph target weights
|
|
14978
15037
|
* of a single instance.
|
|
15038
|
+
* @return {InstancedMesh} A reference to this instanced mesh.
|
|
14979
15039
|
*/
|
|
14980
15040
|
setMorphAt(index, object) {
|
|
14981
15041
|
const objectInfluences = object.morphTargetInfluences;
|
|
@@ -14992,6 +15052,7 @@ var init_three_core = __esm({
|
|
|
14992
15052
|
const dataIndex = len * index;
|
|
14993
15053
|
array[dataIndex] = morphBaseInfluence;
|
|
14994
15054
|
array.set(objectInfluences, dataIndex + 1);
|
|
15055
|
+
return this;
|
|
14995
15056
|
}
|
|
14996
15057
|
updateMorphTargets() {
|
|
14997
15058
|
}
|
|
@@ -15144,9 +15205,10 @@ var init_three_core = __esm({
|
|
|
15144
15205
|
*
|
|
15145
15206
|
* @param {Line3} line - The line to compute the intersection for.
|
|
15146
15207
|
* @param {Vector3} target - The target vector that is used to store the method's result.
|
|
15147
|
-
* @
|
|
15208
|
+
* @param {boolean} [clampToLine=true] - Whether to clamp the intersection to the line segment.
|
|
15209
|
+
* @return {?Vector3} The intersection point. Returns `null` if no intersection is detected.
|
|
15148
15210
|
*/
|
|
15149
|
-
intersectLine(line, target) {
|
|
15211
|
+
intersectLine(line, target, clampToLine = true) {
|
|
15150
15212
|
const direction = line.delta(_vector1);
|
|
15151
15213
|
const denominator = this.normal.dot(direction);
|
|
15152
15214
|
if (denominator === 0) {
|
|
@@ -15156,7 +15218,7 @@ var init_three_core = __esm({
|
|
|
15156
15218
|
return null;
|
|
15157
15219
|
}
|
|
15158
15220
|
const t2 = -(line.start.dot(this.normal) + this.constant) / denominator;
|
|
15159
|
-
if (t2 < 0 || t2 > 1) {
|
|
15221
|
+
if (clampToLine === true && (t2 < 0 || t2 > 1)) {
|
|
15160
15222
|
return null;
|
|
15161
15223
|
}
|
|
15162
15224
|
return target.copy(line.start).addScaledVector(direction, t2);
|
|
@@ -15664,7 +15726,6 @@ var init_three_core = __esm({
|
|
|
15664
15726
|
this._multiDrawCounts = new Int32Array(maxInstanceCount);
|
|
15665
15727
|
this._multiDrawStarts = new Int32Array(maxInstanceCount);
|
|
15666
15728
|
this._multiDrawCount = 0;
|
|
15667
|
-
this._multiDrawInstances = null;
|
|
15668
15729
|
this._matricesTexture = null;
|
|
15669
15730
|
this._indirectTexture = null;
|
|
15670
15731
|
this._colorsTexture = null;
|
|
@@ -16209,7 +16270,15 @@ var init_three_core = __esm({
|
|
|
16209
16270
|
*/
|
|
16210
16271
|
getColorAt(instanceId, color) {
|
|
16211
16272
|
this.validateInstanceId(instanceId);
|
|
16212
|
-
|
|
16273
|
+
if (this._colorsTexture === null) {
|
|
16274
|
+
if (color.isVector4) {
|
|
16275
|
+
return color.set(1, 1, 1, 1);
|
|
16276
|
+
} else {
|
|
16277
|
+
return color.setRGB(1, 1, 1);
|
|
16278
|
+
}
|
|
16279
|
+
} else {
|
|
16280
|
+
return color.fromArray(this._colorsTexture.image.data, instanceId * 4);
|
|
16281
|
+
}
|
|
16213
16282
|
}
|
|
16214
16283
|
/**
|
|
16215
16284
|
* Sets the visibility of the instance.
|
|
@@ -17113,6 +17182,41 @@ var init_three_core = __esm({
|
|
|
17113
17182
|
this.needsUpdate = true;
|
|
17114
17183
|
}
|
|
17115
17184
|
};
|
|
17185
|
+
HTMLTexture = class extends Texture {
|
|
17186
|
+
/**
|
|
17187
|
+
* Constructs a new texture.
|
|
17188
|
+
*
|
|
17189
|
+
* @param {HTMLElement} [element] - The HTML element.
|
|
17190
|
+
* @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping.
|
|
17191
|
+
* @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value.
|
|
17192
|
+
* @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value.
|
|
17193
|
+
* @param {number} [magFilter=LinearFilter] - The mag filter value.
|
|
17194
|
+
* @param {number} [minFilter=LinearMipmapLinearFilter] - The min filter value.
|
|
17195
|
+
* @param {number} [format=RGBAFormat] - The texture format.
|
|
17196
|
+
* @param {number} [type=UnsignedByteType] - The texture type.
|
|
17197
|
+
* @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value.
|
|
17198
|
+
*/
|
|
17199
|
+
constructor(element2, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) {
|
|
17200
|
+
super(element2, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy);
|
|
17201
|
+
this.isHTMLTexture = true;
|
|
17202
|
+
this.generateMipmaps = false;
|
|
17203
|
+
this.needsUpdate = true;
|
|
17204
|
+
const parent = element2 ? element2.parentNode : null;
|
|
17205
|
+
if (parent !== null && "requestPaint" in parent) {
|
|
17206
|
+
parent.onpaint = () => {
|
|
17207
|
+
this.needsUpdate = true;
|
|
17208
|
+
};
|
|
17209
|
+
parent.requestPaint();
|
|
17210
|
+
}
|
|
17211
|
+
}
|
|
17212
|
+
dispose() {
|
|
17213
|
+
const parent = this.image ? this.image.parentNode : null;
|
|
17214
|
+
if (parent !== null && "onpaint" in parent) {
|
|
17215
|
+
parent.onpaint = null;
|
|
17216
|
+
}
|
|
17217
|
+
super.dispose();
|
|
17218
|
+
}
|
|
17219
|
+
};
|
|
17116
17220
|
DepthTexture = class extends Texture {
|
|
17117
17221
|
/**
|
|
17118
17222
|
* Constructs a new depth texture.
|
|
@@ -18567,6 +18671,7 @@ var init_three_core = __esm({
|
|
|
18567
18671
|
}
|
|
18568
18672
|
};
|
|
18569
18673
|
tmp = /* @__PURE__ */ new Vector3();
|
|
18674
|
+
tmp2 = /* @__PURE__ */ new Vector3();
|
|
18570
18675
|
px = /* @__PURE__ */ new CubicPoly();
|
|
18571
18676
|
py = /* @__PURE__ */ new CubicPoly();
|
|
18572
18677
|
pz = /* @__PURE__ */ new CubicPoly();
|
|
@@ -18612,8 +18717,8 @@ var init_three_core = __esm({
|
|
|
18612
18717
|
if (this.closed || intPoint > 0) {
|
|
18613
18718
|
p0 = points[(intPoint - 1) % l2];
|
|
18614
18719
|
} else {
|
|
18615
|
-
|
|
18616
|
-
p0 =
|
|
18720
|
+
tmp2.subVectors(points[0], points[1]).add(points[0]);
|
|
18721
|
+
p0 = tmp2;
|
|
18617
18722
|
}
|
|
18618
18723
|
const p1 = points[intPoint % l2];
|
|
18619
18724
|
const p22 = points[(intPoint + 1) % l2];
|
|
@@ -23462,7 +23567,6 @@ var init_three_core = __esm({
|
|
|
23462
23567
|
* @param {function(any)} onLoad - Executed when the loading process has been finished.
|
|
23463
23568
|
* @param {onProgressCallback} [onProgress] - Executed while the loading is in progress.
|
|
23464
23569
|
* @param {onErrorCallback} [onError] - Executed when errors occur.
|
|
23465
|
-
* @return {any|undefined} The cached resource if available.
|
|
23466
23570
|
*/
|
|
23467
23571
|
load(url, onLoad, onProgress, onError) {
|
|
23468
23572
|
if (url === void 0) url = "";
|
|
@@ -23475,7 +23579,7 @@ var init_three_core = __esm({
|
|
|
23475
23579
|
if (onLoad) onLoad(cached);
|
|
23476
23580
|
this.manager.itemEnd(url);
|
|
23477
23581
|
}, 0);
|
|
23478
|
-
return
|
|
23582
|
+
return;
|
|
23479
23583
|
}
|
|
23480
23584
|
if (loading[url] !== void 0) {
|
|
23481
23585
|
loading[url].push({
|
|
@@ -23919,13 +24023,13 @@ var init_three_core = __esm({
|
|
|
23919
24023
|
let texData;
|
|
23920
24024
|
try {
|
|
23921
24025
|
texData = scope.parse(buffer);
|
|
23922
|
-
} catch (
|
|
24026
|
+
} catch (e2) {
|
|
23923
24027
|
if (onError !== void 0) {
|
|
23924
|
-
onError(
|
|
24028
|
+
onError(e2);
|
|
23925
24029
|
} else {
|
|
23926
|
-
|
|
23927
|
-
return;
|
|
24030
|
+
error(e2);
|
|
23928
24031
|
}
|
|
24032
|
+
return;
|
|
23929
24033
|
}
|
|
23930
24034
|
if (texData.image !== void 0) {
|
|
23931
24035
|
texture.image = texData.image;
|
|
@@ -25261,7 +25365,7 @@ var init_three_core = __esm({
|
|
|
25261
25365
|
if (json.userData !== void 0) material.userData = json.userData;
|
|
25262
25366
|
if (json.vertexColors !== void 0) {
|
|
25263
25367
|
if (typeof json.vertexColors === "number") {
|
|
25264
|
-
material.vertexColors = json.vertexColors > 0
|
|
25368
|
+
material.vertexColors = json.vertexColors > 0;
|
|
25265
25369
|
} else {
|
|
25266
25370
|
material.vertexColors = json.vertexColors;
|
|
25267
25371
|
}
|
|
@@ -25589,6 +25693,7 @@ var init_three_core = __esm({
|
|
|
25589
25693
|
return geometry;
|
|
25590
25694
|
}
|
|
25591
25695
|
};
|
|
25696
|
+
_customGeometries = {};
|
|
25592
25697
|
ObjectLoader = class extends Loader {
|
|
25593
25698
|
/**
|
|
25594
25699
|
* Constructs a new object loader.
|
|
@@ -25618,9 +25723,9 @@ var init_three_core = __esm({
|
|
|
25618
25723
|
let json = null;
|
|
25619
25724
|
try {
|
|
25620
25725
|
json = JSON.parse(text2);
|
|
25621
|
-
} catch (
|
|
25622
|
-
if (onError !== void 0) onError(
|
|
25623
|
-
|
|
25726
|
+
} catch (e2) {
|
|
25727
|
+
if (onError !== void 0) onError(e2);
|
|
25728
|
+
error("ObjectLoader: Can't parse " + url + ".", e2.message);
|
|
25624
25729
|
return;
|
|
25625
25730
|
}
|
|
25626
25731
|
const metadata = json.metadata;
|
|
@@ -25713,6 +25818,17 @@ var init_three_core = __esm({
|
|
|
25713
25818
|
this.bindLightTargets(object);
|
|
25714
25819
|
return object;
|
|
25715
25820
|
}
|
|
25821
|
+
/**
|
|
25822
|
+
* Registers the given geometry at the internal
|
|
25823
|
+
* geometry library.
|
|
25824
|
+
*
|
|
25825
|
+
* @static
|
|
25826
|
+
* @param {string} type - The geometry type.
|
|
25827
|
+
* @param {BufferGeometry.constructor} geometryClass - The geometry class.
|
|
25828
|
+
*/
|
|
25829
|
+
static registerGeometry(type, geometryClass) {
|
|
25830
|
+
_customGeometries[type] = geometryClass;
|
|
25831
|
+
}
|
|
25716
25832
|
// internals
|
|
25717
25833
|
parseShapes(json) {
|
|
25718
25834
|
const shapes = {};
|
|
@@ -25753,8 +25869,10 @@ var init_three_core = __esm({
|
|
|
25753
25869
|
default:
|
|
25754
25870
|
if (data.type in Geometries) {
|
|
25755
25871
|
geometry = Geometries[data.type].fromJSON(data, shapes);
|
|
25872
|
+
} else if (data.type in _customGeometries) {
|
|
25873
|
+
geometry = _customGeometries[data.type].fromJSON(data, shapes);
|
|
25756
25874
|
} else {
|
|
25757
|
-
warn(`ObjectLoader:
|
|
25875
|
+
warn(`ObjectLoader: Unknown geometry type "${data.type}". Use .registerGeometry() before starting the deserialization process.`);
|
|
25758
25876
|
}
|
|
25759
25877
|
}
|
|
25760
25878
|
geometry.uuid = data.uuid;
|
|
@@ -25955,6 +26073,7 @@ var init_three_core = __esm({
|
|
|
25955
26073
|
if (data.premultiplyAlpha !== void 0) texture.premultiplyAlpha = data.premultiplyAlpha;
|
|
25956
26074
|
if (data.unpackAlignment !== void 0) texture.unpackAlignment = data.unpackAlignment;
|
|
25957
26075
|
if (data.compareFunction !== void 0) texture.compareFunction = data.compareFunction;
|
|
26076
|
+
if (data.normalized !== void 0) texture.normalized = data.normalized;
|
|
25958
26077
|
if (data.userData !== void 0) texture.userData = data.userData;
|
|
25959
26078
|
textures[data.uuid] = texture;
|
|
25960
26079
|
}
|
|
@@ -26286,6 +26405,9 @@ var init_three_core = __esm({
|
|
|
26286
26405
|
* Sets the given loader options. The structure of the object must match the `options` parameter of
|
|
26287
26406
|
* [createImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap).
|
|
26288
26407
|
*
|
|
26408
|
+
* Note: When caching is enabled, the cache key is based on the URL only. Loading the same URL with
|
|
26409
|
+
* different options will return the cached result of the first request.
|
|
26410
|
+
*
|
|
26289
26411
|
* @param {Object} options - The loader options to set.
|
|
26290
26412
|
* @return {ImageBitmapLoader} A reference to this image bitmap loader.
|
|
26291
26413
|
*/
|
|
@@ -26300,7 +26422,6 @@ var init_three_core = __esm({
|
|
|
26300
26422
|
* @param {function(ImageBitmap)} onLoad - Executed when the loading process has been finished.
|
|
26301
26423
|
* @param {onProgressCallback} onProgress - Unsupported in this loader.
|
|
26302
26424
|
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
26303
|
-
* @return {ImageBitmap|undefined} The image bitmap.
|
|
26304
26425
|
*/
|
|
26305
26426
|
load(url, onLoad, onProgress, onError) {
|
|
26306
26427
|
if (url === void 0) url = "";
|
|
@@ -26319,7 +26440,6 @@ var init_three_core = __esm({
|
|
|
26319
26440
|
} else {
|
|
26320
26441
|
if (onLoad) onLoad(imageBitmap);
|
|
26321
26442
|
scope.manager.itemEnd(url);
|
|
26322
|
-
return imageBitmap;
|
|
26323
26443
|
}
|
|
26324
26444
|
});
|
|
26325
26445
|
return;
|
|
@@ -26328,7 +26448,7 @@ var init_three_core = __esm({
|
|
|
26328
26448
|
if (onLoad) onLoad(cached);
|
|
26329
26449
|
scope.manager.itemEnd(url);
|
|
26330
26450
|
}, 0);
|
|
26331
|
-
return
|
|
26451
|
+
return;
|
|
26332
26452
|
}
|
|
26333
26453
|
const fetchOptions = {};
|
|
26334
26454
|
fetchOptions.credentials = this.crossOrigin === "anonymous" ? "same-origin" : "include";
|
|
@@ -26342,7 +26462,6 @@ var init_three_core = __esm({
|
|
|
26342
26462
|
Cache.add(`image-bitmap:${url}`, imageBitmap);
|
|
26343
26463
|
if (onLoad) onLoad(imageBitmap);
|
|
26344
26464
|
scope.manager.itemEnd(url);
|
|
26345
|
-
return imageBitmap;
|
|
26346
26465
|
}).catch(function(e2) {
|
|
26347
26466
|
if (onError) onError(e2);
|
|
26348
26467
|
_errorMap.set(promise, e2);
|
|
@@ -26368,7 +26487,7 @@ var init_three_core = __esm({
|
|
|
26368
26487
|
/**
|
|
26369
26488
|
* Returns the global native audio context.
|
|
26370
26489
|
*
|
|
26371
|
-
* @return {AudioContext} The native audio context.
|
|
26490
|
+
* @return {Window.AudioContext} The native audio context.
|
|
26372
26491
|
*/
|
|
26373
26492
|
static getContext() {
|
|
26374
26493
|
if (_context === void 0) {
|
|
@@ -26379,7 +26498,7 @@ var init_three_core = __esm({
|
|
|
26379
26498
|
/**
|
|
26380
26499
|
* Allows to set the global native audio context from outside.
|
|
26381
26500
|
*
|
|
26382
|
-
* @param {AudioContext} value - The native context to set.
|
|
26501
|
+
* @param {Window.AudioContext} value - The native context to set.
|
|
26383
26502
|
*/
|
|
26384
26503
|
static setContext(value) {
|
|
26385
26504
|
_context = value;
|
|
@@ -26414,9 +26533,15 @@ var init_three_core = __esm({
|
|
|
26414
26533
|
try {
|
|
26415
26534
|
const bufferCopy = buffer.slice(0);
|
|
26416
26535
|
const context2 = AudioContext.getContext();
|
|
26536
|
+
const decodeUrl = url + "#decode";
|
|
26537
|
+
scope.manager.itemStart(decodeUrl);
|
|
26417
26538
|
context2.decodeAudioData(bufferCopy, function(audioBuffer) {
|
|
26418
26539
|
onLoad(audioBuffer);
|
|
26419
|
-
|
|
26540
|
+
scope.manager.itemEnd(decodeUrl);
|
|
26541
|
+
}).catch(function(e2) {
|
|
26542
|
+
handleError(e2);
|
|
26543
|
+
scope.manager.itemEnd(decodeUrl);
|
|
26544
|
+
});
|
|
26420
26545
|
} catch (e2) {
|
|
26421
26546
|
handleError(e2);
|
|
26422
26547
|
}
|
|
@@ -28252,6 +28377,9 @@ var init_three_core = __esm({
|
|
|
28252
28377
|
for (let i3 = 0; i3 !== nTracks; ++i3) {
|
|
28253
28378
|
const interpolant = tracks[i3].createInterpolant(null);
|
|
28254
28379
|
interpolants[i3] = interpolant;
|
|
28380
|
+
if (interpolant.settings) {
|
|
28381
|
+
Object.assign(interpolantSettings, interpolant.settings);
|
|
28382
|
+
}
|
|
28255
28383
|
interpolant.settings = interpolantSettings;
|
|
28256
28384
|
}
|
|
28257
28385
|
this._interpolantSettings = interpolantSettings;
|
|
@@ -28695,6 +28823,7 @@ var init_three_core = __esm({
|
|
|
28695
28823
|
});
|
|
28696
28824
|
}
|
|
28697
28825
|
} else {
|
|
28826
|
+
this._loopCount = loopCount;
|
|
28698
28827
|
this.time = time;
|
|
28699
28828
|
}
|
|
28700
28829
|
if (pingPong && (loopCount & 1) === 1) {
|
|
@@ -29534,7 +29663,7 @@ var init_three_core = __esm({
|
|
|
29534
29663
|
this.oldTime = 0;
|
|
29535
29664
|
this.elapsedTime = 0;
|
|
29536
29665
|
this.running = false;
|
|
29537
|
-
warn("
|
|
29666
|
+
warn("Clock: This module has been deprecated. Please use THREE.Timer instead.");
|
|
29538
29667
|
}
|
|
29539
29668
|
/**
|
|
29540
29669
|
* Starts the clock. When `autoStart` is set to `true`, the method is automatically
|
|
@@ -29744,6 +29873,9 @@ var init_three_core = __esm({
|
|
|
29744
29873
|
}
|
|
29745
29874
|
};
|
|
29746
29875
|
Matrix2 = class _Matrix2 {
|
|
29876
|
+
static {
|
|
29877
|
+
_Matrix2.prototype.isMatrix2 = true;
|
|
29878
|
+
}
|
|
29747
29879
|
/**
|
|
29748
29880
|
* Constructs a new 2x2 matrix. The arguments are supposed to be
|
|
29749
29881
|
* in row-major order. If no arguments are provided, the constructor
|
|
@@ -29755,7 +29887,6 @@ var init_three_core = __esm({
|
|
|
29755
29887
|
* @param {number} [n22] - 2-2 matrix element.
|
|
29756
29888
|
*/
|
|
29757
29889
|
constructor(n11, n12, n21, n22) {
|
|
29758
|
-
_Matrix2.prototype.isMatrix2 = true;
|
|
29759
29890
|
this.elements = [
|
|
29760
29891
|
1,
|
|
29761
29892
|
0,
|
|
@@ -30167,6 +30298,7 @@ var init_three_core = __esm({
|
|
|
30167
30298
|
_startP.subVectors(point, this.start);
|
|
30168
30299
|
_startEnd.subVectors(this.end, this.start);
|
|
30169
30300
|
const startEnd2 = _startEnd.dot(_startEnd);
|
|
30301
|
+
if (startEnd2 === 0) return 0;
|
|
30170
30302
|
const startEnd_startP = _startEnd.dot(_startP);
|
|
30171
30303
|
let t2 = startEnd_startP / startEnd2;
|
|
30172
30304
|
if (clampToLine) {
|
|
@@ -31583,7 +31715,7 @@ var init_three_core = __esm({
|
|
|
31583
31715
|
}
|
|
31584
31716
|
});
|
|
31585
31717
|
|
|
31586
|
-
// ../../node_modules/.bun/three@0.
|
|
31718
|
+
// ../../node_modules/.bun/three@0.184.0/node_modules/three/build/three.module.js
|
|
31587
31719
|
var three_module_exports = {};
|
|
31588
31720
|
__export(three_module_exports, {
|
|
31589
31721
|
ACESFilmicToneMapping: () => ACESFilmicToneMapping,
|
|
@@ -31725,6 +31857,7 @@ __export(three_module_exports, {
|
|
|
31725
31857
|
GreaterStencilFunc: () => GreaterStencilFunc,
|
|
31726
31858
|
GridHelper: () => GridHelper,
|
|
31727
31859
|
Group: () => Group,
|
|
31860
|
+
HTMLTexture: () => HTMLTexture,
|
|
31728
31861
|
HalfFloatType: () => HalfFloatType,
|
|
31729
31862
|
HemisphereLight: () => HemisphereLight,
|
|
31730
31863
|
HemisphereLightHelper: () => HemisphereLightHelper,
|
|
@@ -32040,11 +32173,12 @@ function WebGLAnimation() {
|
|
|
32040
32173
|
start: function() {
|
|
32041
32174
|
if (isAnimating === true) return;
|
|
32042
32175
|
if (animationLoop === null) return;
|
|
32176
|
+
if (context2 === null) return;
|
|
32043
32177
|
requestId = context2.requestAnimationFrame(onAnimationFrame);
|
|
32044
32178
|
isAnimating = true;
|
|
32045
32179
|
},
|
|
32046
32180
|
stop: function() {
|
|
32047
|
-
context2.cancelAnimationFrame(requestId);
|
|
32181
|
+
if (context2 !== null) context2.cancelAnimationFrame(requestId);
|
|
32048
32182
|
isAnimating = false;
|
|
32049
32183
|
},
|
|
32050
32184
|
setAnimationLoop: function(callback) {
|
|
@@ -32247,19 +32381,13 @@ function WebGLBackground(renderer, environments, state2, objects, alpha, premult
|
|
|
32247
32381
|
});
|
|
32248
32382
|
objects.update(boxMesh);
|
|
32249
32383
|
}
|
|
32250
|
-
_e1$1.copy(scene.backgroundRotation);
|
|
32251
|
-
_e1$1.x *= -1;
|
|
32252
|
-
_e1$1.y *= -1;
|
|
32253
|
-
_e1$1.z *= -1;
|
|
32254
|
-
if (background.isCubeTexture && background.isRenderTargetTexture === false) {
|
|
32255
|
-
_e1$1.y *= -1;
|
|
32256
|
-
_e1$1.z *= -1;
|
|
32257
|
-
}
|
|
32258
32384
|
boxMesh.material.uniforms.envMap.value = background;
|
|
32259
|
-
boxMesh.material.uniforms.flipEnvMap.value = background.isCubeTexture && background.isRenderTargetTexture === false ? -1 : 1;
|
|
32260
32385
|
boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
|
|
32261
32386
|
boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
|
|
32262
|
-
boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4(_m1$12.makeRotationFromEuler(
|
|
32387
|
+
boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4(_m1$12.makeRotationFromEuler(scene.backgroundRotation)).transpose();
|
|
32388
|
+
if (background.isCubeTexture && background.isRenderTargetTexture === false) {
|
|
32389
|
+
boxMesh.material.uniforms.backgroundRotation.value.premultiply(_m$1);
|
|
32390
|
+
}
|
|
32263
32391
|
boxMesh.material.toneMapped = ColorManagement.getTransfer(background.colorSpace) !== SRGBTransfer;
|
|
32264
32392
|
if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping) {
|
|
32265
32393
|
boxMesh.material.needsUpdate = true;
|
|
@@ -32735,27 +32863,10 @@ function WebGLBufferRenderer(gl, extensions2, info) {
|
|
|
32735
32863
|
}
|
|
32736
32864
|
info.update(elementCount, mode, 1);
|
|
32737
32865
|
}
|
|
32738
|
-
function renderMultiDrawInstances(starts, counts, drawCount, primcount) {
|
|
32739
|
-
if (drawCount === 0) return;
|
|
32740
|
-
const extension = extensions2.get("WEBGL_multi_draw");
|
|
32741
|
-
if (extension === null) {
|
|
32742
|
-
for (let i3 = 0; i3 < starts.length; i3++) {
|
|
32743
|
-
renderInstances(starts[i3], counts[i3], primcount[i3]);
|
|
32744
|
-
}
|
|
32745
|
-
} else {
|
|
32746
|
-
extension.multiDrawArraysInstancedWEBGL(mode, starts, 0, counts, 0, primcount, 0, drawCount);
|
|
32747
|
-
let elementCount = 0;
|
|
32748
|
-
for (let i3 = 0; i3 < drawCount; i3++) {
|
|
32749
|
-
elementCount += counts[i3] * primcount[i3];
|
|
32750
|
-
}
|
|
32751
|
-
info.update(elementCount, mode, 1);
|
|
32752
|
-
}
|
|
32753
|
-
}
|
|
32754
32866
|
this.setMode = setMode;
|
|
32755
32867
|
this.render = render;
|
|
32756
32868
|
this.renderInstances = renderInstances;
|
|
32757
32869
|
this.renderMultiDraw = renderMultiDraw;
|
|
32758
|
-
this.renderMultiDrawInstances = renderMultiDrawInstances;
|
|
32759
32870
|
}
|
|
32760
32871
|
function WebGLCapabilities(gl, extensions2, parameters, utils) {
|
|
32761
32872
|
let maxAnisotropy;
|
|
@@ -32805,6 +32916,9 @@ function WebGLCapabilities(gl, extensions2, parameters, utils) {
|
|
|
32805
32916
|
}
|
|
32806
32917
|
const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
|
|
32807
32918
|
const reversedDepthBuffer = parameters.reversedDepthBuffer === true && extensions2.has("EXT_clip_control");
|
|
32919
|
+
if (parameters.reversedDepthBuffer === true && reversedDepthBuffer === false) {
|
|
32920
|
+
warn("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");
|
|
32921
|
+
}
|
|
32808
32922
|
const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);
|
|
32809
32923
|
const maxVertexTextures = gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
|
|
32810
32924
|
const maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);
|
|
@@ -33610,28 +33724,11 @@ function WebGLIndexedBufferRenderer(gl, extensions2, info) {
|
|
|
33610
33724
|
}
|
|
33611
33725
|
info.update(elementCount, mode, 1);
|
|
33612
33726
|
}
|
|
33613
|
-
function renderMultiDrawInstances(starts, counts, drawCount, primcount) {
|
|
33614
|
-
if (drawCount === 0) return;
|
|
33615
|
-
const extension = extensions2.get("WEBGL_multi_draw");
|
|
33616
|
-
if (extension === null) {
|
|
33617
|
-
for (let i3 = 0; i3 < starts.length; i3++) {
|
|
33618
|
-
renderInstances(starts[i3] / bytesPerElement, counts[i3], primcount[i3]);
|
|
33619
|
-
}
|
|
33620
|
-
} else {
|
|
33621
|
-
extension.multiDrawElementsInstancedWEBGL(mode, counts, 0, type, starts, 0, primcount, 0, drawCount);
|
|
33622
|
-
let elementCount = 0;
|
|
33623
|
-
for (let i3 = 0; i3 < drawCount; i3++) {
|
|
33624
|
-
elementCount += counts[i3] * primcount[i3];
|
|
33625
|
-
}
|
|
33626
|
-
info.update(elementCount, mode, 1);
|
|
33627
|
-
}
|
|
33628
|
-
}
|
|
33629
33727
|
this.setMode = setMode;
|
|
33630
33728
|
this.setIndex = setIndex;
|
|
33631
33729
|
this.render = render;
|
|
33632
33730
|
this.renderInstances = renderInstances;
|
|
33633
33731
|
this.renderMultiDraw = renderMultiDraw;
|
|
33634
|
-
this.renderMultiDrawInstances = renderMultiDrawInstances;
|
|
33635
33732
|
}
|
|
33636
33733
|
function WebGLInfo(gl) {
|
|
33637
33734
|
const memory = {
|
|
@@ -33825,7 +33922,8 @@ function WebGLOutput(type, width, height, depth, stencil) {
|
|
|
33825
33922
|
const targetA = new WebGLRenderTarget(width, height, {
|
|
33826
33923
|
type,
|
|
33827
33924
|
depthBuffer: depth,
|
|
33828
|
-
stencilBuffer: stencil
|
|
33925
|
+
stencilBuffer: stencil,
|
|
33926
|
+
depthTexture: depth ? new DepthTexture(width, height) : void 0
|
|
33829
33927
|
});
|
|
33830
33928
|
const targetB = new WebGLRenderTarget(width, height, {
|
|
33831
33929
|
type: HalfFloatType,
|
|
@@ -33978,6 +34076,7 @@ function WebGLOutput(type, width, height, depth, stencil) {
|
|
|
33978
34076
|
return _isCompositing;
|
|
33979
34077
|
};
|
|
33980
34078
|
this.dispose = function() {
|
|
34079
|
+
if (targetA.depthTexture) targetA.depthTexture.dispose();
|
|
33981
34080
|
targetA.dispose();
|
|
33982
34081
|
targetB.dispose();
|
|
33983
34082
|
geometry.dispose();
|
|
@@ -34865,6 +34964,7 @@ function WebGLProgram(renderer, cacheKey, parameters, bindingStates) {
|
|
|
34865
34964
|
parameters.thicknessMapUv ? "#define THICKNESSMAP_UV " + parameters.thicknessMapUv : "",
|
|
34866
34965
|
//
|
|
34867
34966
|
parameters.vertexTangents && parameters.flatShading === false ? "#define USE_TANGENT" : "",
|
|
34967
|
+
parameters.vertexNormals ? "#define HAS_NORMAL" : "",
|
|
34868
34968
|
parameters.vertexColors ? "#define USE_COLOR" : "",
|
|
34869
34969
|
parameters.vertexAlphas ? "#define USE_COLOR_ALPHA" : "",
|
|
34870
34970
|
parameters.vertexUv1s ? "#define USE_UV1" : "",
|
|
@@ -34951,6 +35051,7 @@ function WebGLProgram(renderer, cacheKey, parameters, bindingStates) {
|
|
|
34951
35051
|
parameters.normalMap ? "#define USE_NORMALMAP" : "",
|
|
34952
35052
|
parameters.normalMapObjectSpace ? "#define USE_NORMALMAP_OBJECTSPACE" : "",
|
|
34953
35053
|
parameters.normalMapTangentSpace ? "#define USE_NORMALMAP_TANGENTSPACE" : "",
|
|
35054
|
+
parameters.packedNormalMap ? "#define USE_PACKED_NORMALMAP" : "",
|
|
34954
35055
|
parameters.emissiveMap ? "#define USE_EMISSIVEMAP" : "",
|
|
34955
35056
|
parameters.anisotropy ? "#define USE_ANISOTROPY" : "",
|
|
34956
35057
|
parameters.anisotropyMap ? "#define USE_ANISOTROPYMAP" : "",
|
|
@@ -34991,6 +35092,7 @@ function WebGLProgram(renderer, cacheKey, parameters, bindingStates) {
|
|
|
34991
35092
|
parameters.shadowMapEnabled ? "#define " + shadowMapTypeDefine : "",
|
|
34992
35093
|
parameters.premultipliedAlpha ? "#define PREMULTIPLIED_ALPHA" : "",
|
|
34993
35094
|
parameters.numLightProbes > 0 ? "#define USE_LIGHT_PROBES" : "",
|
|
35095
|
+
parameters.numLightProbeGrids > 0 ? "#define USE_LIGHT_PROBES_GRID" : "",
|
|
34994
35096
|
parameters.decodeVideoTexture ? "#define DECODE_VIDEO_TEXTURE" : "",
|
|
34995
35097
|
parameters.decodeVideoTextureEmissive ? "#define DECODE_VIDEO_TEXTURE_EMISSIVE" : "",
|
|
34996
35098
|
parameters.logarithmicDepthBuffer ? "#define USE_LOGARITHMIC_DEPTH_BUFFER" : "",
|
|
@@ -35138,6 +35240,9 @@ function WebGLProgram(renderer, cacheKey, parameters, bindingStates) {
|
|
|
35138
35240
|
this.fragmentShader = glFragmentShader;
|
|
35139
35241
|
return this;
|
|
35140
35242
|
}
|
|
35243
|
+
function isPackedRGFormat(format) {
|
|
35244
|
+
return format === RGFormat || format === RG11_EAC_Format || format === RED_GREEN_RGTC2_Format;
|
|
35245
|
+
}
|
|
35141
35246
|
function WebGLPrograms(renderer, environments, extensions2, capabilities, bindingStates, clipping) {
|
|
35142
35247
|
const _programLayers = new Layers();
|
|
35143
35248
|
const _customShaders = new WebGLShaderCache();
|
|
@@ -35168,7 +35273,7 @@ function WebGLPrograms(renderer, environments, extensions2, capabilities, bindin
|
|
|
35168
35273
|
if (value === 0) return "uv";
|
|
35169
35274
|
return `uv${value}`;
|
|
35170
35275
|
}
|
|
35171
|
-
function getParameters(material, lights, shadows, scene, object) {
|
|
35276
|
+
function getParameters(material, lights, shadows, scene, object, lightProbeGrids) {
|
|
35172
35277
|
const fog = scene.fog;
|
|
35173
35278
|
const geometry = object.geometry;
|
|
35174
35279
|
const environment = material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ? scene.environment : null;
|
|
@@ -35263,7 +35368,7 @@ function WebGLPrograms(renderer, environments, extensions2, capabilities, bindin
|
|
|
35263
35368
|
instancing: IS_INSTANCEDMESH,
|
|
35264
35369
|
instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,
|
|
35265
35370
|
instancingMorph: IS_INSTANCEDMESH && object.morphTexture !== null,
|
|
35266
|
-
outputColorSpace: currentRenderTarget === null ? renderer.outputColorSpace : currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace :
|
|
35371
|
+
outputColorSpace: currentRenderTarget === null ? renderer.outputColorSpace : currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : ColorManagement.workingColorSpace,
|
|
35267
35372
|
alphaToCoverage: !!material.alphaToCoverage,
|
|
35268
35373
|
map: HAS_MAP,
|
|
35269
35374
|
matcap: HAS_MATCAP,
|
|
@@ -35278,6 +35383,7 @@ function WebGLPrograms(renderer, environments, extensions2, capabilities, bindin
|
|
|
35278
35383
|
emissiveMap: HAS_EMISSIVEMAP,
|
|
35279
35384
|
normalMapObjectSpace: HAS_NORMALMAP && material.normalMapType === ObjectSpaceNormalMap,
|
|
35280
35385
|
normalMapTangentSpace: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap,
|
|
35386
|
+
packedNormalMap: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap && isPackedRGFormat(material.normalMap.format),
|
|
35281
35387
|
metalnessMap: HAS_METALNESSMAP,
|
|
35282
35388
|
roughnessMap: HAS_ROUGHNESSMAP,
|
|
35283
35389
|
anisotropy: HAS_ANISOTROPY,
|
|
@@ -35331,6 +35437,7 @@ function WebGLPrograms(renderer, environments, extensions2, capabilities, bindin
|
|
|
35331
35437
|
alphaMapUv: HAS_ALPHAMAP && getChannel2(material.alphaMap.channel),
|
|
35332
35438
|
//
|
|
35333
35439
|
vertexTangents: !!geometry.attributes.tangent && (HAS_NORMALMAP || HAS_ANISOTROPY),
|
|
35440
|
+
vertexNormals: !!geometry.attributes.normal,
|
|
35334
35441
|
vertexColors: material.vertexColors,
|
|
35335
35442
|
vertexAlphas: material.vertexColors === true && !!geometry.attributes.color && geometry.attributes.color.itemSize === 4,
|
|
35336
35443
|
pointsUvs: object.isPoints === true && !!geometry.attributes.uv && (HAS_MAP || HAS_ALPHAMAP),
|
|
@@ -35358,6 +35465,7 @@ function WebGLPrograms(renderer, environments, extensions2, capabilities, bindin
|
|
|
35358
35465
|
numSpotLightShadows: lights.spotShadowMap.length,
|
|
35359
35466
|
numSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps,
|
|
35360
35467
|
numLightProbes: lights.numLightProbes,
|
|
35468
|
+
numLightProbeGrids: lightProbeGrids.length,
|
|
35361
35469
|
numClippingPlanes: clipping.numPlanes,
|
|
35362
35470
|
numClipIntersection: clipping.numIntersection,
|
|
35363
35471
|
dithering: material.dithering,
|
|
@@ -35501,6 +35609,10 @@ function WebGLPrograms(renderer, environments, extensions2, capabilities, bindin
|
|
|
35501
35609
|
_programLayers.enable(20);
|
|
35502
35610
|
if (parameters.gradientMap)
|
|
35503
35611
|
_programLayers.enable(21);
|
|
35612
|
+
if (parameters.packedNormalMap)
|
|
35613
|
+
_programLayers.enable(22);
|
|
35614
|
+
if (parameters.vertexNormals)
|
|
35615
|
+
_programLayers.enable(23);
|
|
35504
35616
|
array.push(_programLayers.mask);
|
|
35505
35617
|
_programLayers.disableAll();
|
|
35506
35618
|
if (parameters.fog)
|
|
@@ -35547,6 +35659,8 @@ function WebGLPrograms(renderer, environments, extensions2, capabilities, bindin
|
|
|
35547
35659
|
_programLayers.enable(20);
|
|
35548
35660
|
if (parameters.alphaToCoverage)
|
|
35549
35661
|
_programLayers.enable(21);
|
|
35662
|
+
if (parameters.numLightProbeGrids > 0)
|
|
35663
|
+
_programLayers.enable(22);
|
|
35550
35664
|
array.push(_programLayers.mask);
|
|
35551
35665
|
}
|
|
35552
35666
|
function getUniforms(material) {
|
|
@@ -36145,10 +36259,12 @@ function WebGLRenderState(extensions2) {
|
|
|
36145
36259
|
const lights = new WebGLLights(extensions2);
|
|
36146
36260
|
const lightsArray = [];
|
|
36147
36261
|
const shadowsArray = [];
|
|
36262
|
+
const lightProbeGridArray = [];
|
|
36148
36263
|
function init(camera) {
|
|
36149
36264
|
state2.camera = camera;
|
|
36150
36265
|
lightsArray.length = 0;
|
|
36151
36266
|
shadowsArray.length = 0;
|
|
36267
|
+
lightProbeGridArray.length = 0;
|
|
36152
36268
|
}
|
|
36153
36269
|
function pushLight(light) {
|
|
36154
36270
|
lightsArray.push(light);
|
|
@@ -36156,6 +36272,9 @@ function WebGLRenderState(extensions2) {
|
|
|
36156
36272
|
function pushShadow(shadowLight) {
|
|
36157
36273
|
shadowsArray.push(shadowLight);
|
|
36158
36274
|
}
|
|
36275
|
+
function pushLightProbeGrid(volume) {
|
|
36276
|
+
lightProbeGridArray.push(volume);
|
|
36277
|
+
}
|
|
36159
36278
|
function setupLights() {
|
|
36160
36279
|
lights.setup(lightsArray);
|
|
36161
36280
|
}
|
|
@@ -36165,9 +36284,11 @@ function WebGLRenderState(extensions2) {
|
|
|
36165
36284
|
const state2 = {
|
|
36166
36285
|
lightsArray,
|
|
36167
36286
|
shadowsArray,
|
|
36287
|
+
lightProbeGridArray,
|
|
36168
36288
|
camera: null,
|
|
36169
36289
|
lights,
|
|
36170
|
-
transmissionRenderTarget: {}
|
|
36290
|
+
transmissionRenderTarget: {},
|
|
36291
|
+
textureUnits: 0
|
|
36171
36292
|
};
|
|
36172
36293
|
return {
|
|
36173
36294
|
init,
|
|
@@ -36175,7 +36296,8 @@ function WebGLRenderState(extensions2) {
|
|
|
36175
36296
|
setupLights,
|
|
36176
36297
|
setupLightsView,
|
|
36177
36298
|
pushLight,
|
|
36178
|
-
pushShadow
|
|
36299
|
+
pushShadow,
|
|
36300
|
+
pushLightProbeGrid
|
|
36179
36301
|
};
|
|
36180
36302
|
}
|
|
36181
36303
|
function WebGLRenderStates(extensions2) {
|
|
@@ -36714,6 +36836,7 @@ function WebGLState(gl, extensions2) {
|
|
|
36714
36836
|
const uboBindings = /* @__PURE__ */ new WeakMap();
|
|
36715
36837
|
const uboProgramMap = /* @__PURE__ */ new WeakMap();
|
|
36716
36838
|
let enabledCapabilities = {};
|
|
36839
|
+
let parameters = {};
|
|
36717
36840
|
let currentBoundFramebuffers = {};
|
|
36718
36841
|
let currentDrawbuffers = /* @__PURE__ */ new WeakMap();
|
|
36719
36842
|
let defaultDrawbuffers = [];
|
|
@@ -37138,6 +37261,19 @@ function WebGLState(gl, extensions2) {
|
|
|
37138
37261
|
error("WebGLState:", e2);
|
|
37139
37262
|
}
|
|
37140
37263
|
}
|
|
37264
|
+
function getParameter(name) {
|
|
37265
|
+
if (parameters[name] !== void 0) {
|
|
37266
|
+
return parameters[name];
|
|
37267
|
+
} else {
|
|
37268
|
+
return gl.getParameter(name);
|
|
37269
|
+
}
|
|
37270
|
+
}
|
|
37271
|
+
function pixelStorei(name, value) {
|
|
37272
|
+
if (parameters[name] !== value) {
|
|
37273
|
+
gl.pixelStorei(name, value);
|
|
37274
|
+
parameters[name] = value;
|
|
37275
|
+
}
|
|
37276
|
+
}
|
|
37141
37277
|
function scissor(scissor2) {
|
|
37142
37278
|
if (currentScissor.equals(scissor2) === false) {
|
|
37143
37279
|
gl.scissor(scissor2.x, scissor2.y, scissor2.z, scissor2.w);
|
|
@@ -37203,7 +37339,21 @@ function WebGLState(gl, extensions2) {
|
|
|
37203
37339
|
gl.lineWidth(1);
|
|
37204
37340
|
gl.scissor(0, 0, gl.canvas.width, gl.canvas.height);
|
|
37205
37341
|
gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);
|
|
37342
|
+
gl.pixelStorei(gl.PACK_ALIGNMENT, 4);
|
|
37343
|
+
gl.pixelStorei(gl.UNPACK_ALIGNMENT, 4);
|
|
37344
|
+
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
|
37345
|
+
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
|
|
37346
|
+
gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.BROWSER_DEFAULT_WEBGL);
|
|
37347
|
+
gl.pixelStorei(gl.PACK_ROW_LENGTH, 0);
|
|
37348
|
+
gl.pixelStorei(gl.PACK_SKIP_PIXELS, 0);
|
|
37349
|
+
gl.pixelStorei(gl.PACK_SKIP_ROWS, 0);
|
|
37350
|
+
gl.pixelStorei(gl.UNPACK_ROW_LENGTH, 0);
|
|
37351
|
+
gl.pixelStorei(gl.UNPACK_IMAGE_HEIGHT, 0);
|
|
37352
|
+
gl.pixelStorei(gl.UNPACK_SKIP_PIXELS, 0);
|
|
37353
|
+
gl.pixelStorei(gl.UNPACK_SKIP_ROWS, 0);
|
|
37354
|
+
gl.pixelStorei(gl.UNPACK_SKIP_IMAGES, 0);
|
|
37206
37355
|
enabledCapabilities = {};
|
|
37356
|
+
parameters = {};
|
|
37207
37357
|
currentTextureSlot = null;
|
|
37208
37358
|
currentBoundTextures = {};
|
|
37209
37359
|
currentBoundFramebuffers = {};
|
|
@@ -37257,6 +37407,8 @@ function WebGLState(gl, extensions2) {
|
|
|
37257
37407
|
compressedTexImage3D,
|
|
37258
37408
|
texImage2D,
|
|
37259
37409
|
texImage3D,
|
|
37410
|
+
pixelStorei,
|
|
37411
|
+
getParameter,
|
|
37260
37412
|
updateUBOMapping,
|
|
37261
37413
|
uniformBlockBinding,
|
|
37262
37414
|
texStorage2D,
|
|
@@ -37275,6 +37427,7 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37275
37427
|
const supportsInvalidateFramebuffer = typeof navigator === "undefined" ? false : /OculusBrowser/g.test(navigator.userAgent);
|
|
37276
37428
|
const _imageDimensions = new Vector2();
|
|
37277
37429
|
const _videoTextures = /* @__PURE__ */ new WeakMap();
|
|
37430
|
+
const _htmlTextures = /* @__PURE__ */ new Set();
|
|
37278
37431
|
let _canvas2;
|
|
37279
37432
|
const _sources = /* @__PURE__ */ new WeakMap();
|
|
37280
37433
|
let useOffscreenCanvas = false;
|
|
@@ -37324,16 +37477,25 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37324
37477
|
if (texture.isWebGLArrayRenderTarget || texture.isCompressedArrayTexture) return _gl.TEXTURE_2D_ARRAY;
|
|
37325
37478
|
return _gl.TEXTURE_2D;
|
|
37326
37479
|
}
|
|
37327
|
-
function getInternalFormat(internalFormatName, glFormat, glType, colorSpace, forceLinearTransfer = false) {
|
|
37480
|
+
function getInternalFormat(internalFormatName, glFormat, glType, normalized, colorSpace, forceLinearTransfer = false) {
|
|
37328
37481
|
if (internalFormatName !== null) {
|
|
37329
37482
|
if (_gl[internalFormatName] !== void 0) return _gl[internalFormatName];
|
|
37330
37483
|
warn("WebGLRenderer: Attempt to use non-existing WebGL internal format '" + internalFormatName + "'");
|
|
37331
37484
|
}
|
|
37485
|
+
let ext_texture_norm16;
|
|
37486
|
+
if (normalized) {
|
|
37487
|
+
ext_texture_norm16 = extensions2.get("EXT_texture_norm16");
|
|
37488
|
+
if (!ext_texture_norm16) {
|
|
37489
|
+
warn("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension");
|
|
37490
|
+
}
|
|
37491
|
+
}
|
|
37332
37492
|
let internalFormat = glFormat;
|
|
37333
37493
|
if (glFormat === _gl.RED) {
|
|
37334
37494
|
if (glType === _gl.FLOAT) internalFormat = _gl.R32F;
|
|
37335
37495
|
if (glType === _gl.HALF_FLOAT) internalFormat = _gl.R16F;
|
|
37336
37496
|
if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.R8;
|
|
37497
|
+
if (glType === _gl.UNSIGNED_SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.R16_EXT;
|
|
37498
|
+
if (glType === _gl.SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.R16_SNORM_EXT;
|
|
37337
37499
|
}
|
|
37338
37500
|
if (glFormat === _gl.RED_INTEGER) {
|
|
37339
37501
|
if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.R8UI;
|
|
@@ -37347,6 +37509,8 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37347
37509
|
if (glType === _gl.FLOAT) internalFormat = _gl.RG32F;
|
|
37348
37510
|
if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RG16F;
|
|
37349
37511
|
if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RG8;
|
|
37512
|
+
if (glType === _gl.UNSIGNED_SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RG16_EXT;
|
|
37513
|
+
if (glType === _gl.SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RG16_SNORM_EXT;
|
|
37350
37514
|
}
|
|
37351
37515
|
if (glFormat === _gl.RG_INTEGER) {
|
|
37352
37516
|
if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RG8UI;
|
|
@@ -37373,6 +37537,8 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37373
37537
|
if (glType === _gl.INT) internalFormat = _gl.RGBA32I;
|
|
37374
37538
|
}
|
|
37375
37539
|
if (glFormat === _gl.RGB) {
|
|
37540
|
+
if (glType === _gl.UNSIGNED_SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RGB16_EXT;
|
|
37541
|
+
if (glType === _gl.SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RGB16_SNORM_EXT;
|
|
37376
37542
|
if (glType === _gl.UNSIGNED_INT_5_9_9_9_REV) internalFormat = _gl.RGB9_E5;
|
|
37377
37543
|
if (glType === _gl.UNSIGNED_INT_10F_11F_11F_REV) internalFormat = _gl.R11F_G11F_B10F;
|
|
37378
37544
|
}
|
|
@@ -37381,6 +37547,8 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37381
37547
|
if (glType === _gl.FLOAT) internalFormat = _gl.RGBA32F;
|
|
37382
37548
|
if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RGBA16F;
|
|
37383
37549
|
if (glType === _gl.UNSIGNED_BYTE) internalFormat = transfer === SRGBTransfer ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;
|
|
37550
|
+
if (glType === _gl.UNSIGNED_SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RGBA16_EXT;
|
|
37551
|
+
if (glType === _gl.SHORT && ext_texture_norm16) internalFormat = ext_texture_norm16.RGBA16_SNORM_EXT;
|
|
37384
37552
|
if (glType === _gl.UNSIGNED_SHORT_4_4_4_4) internalFormat = _gl.RGBA4;
|
|
37385
37553
|
if (glType === _gl.UNSIGNED_SHORT_5_5_5_1) internalFormat = _gl.RGB5_A1;
|
|
37386
37554
|
}
|
|
@@ -37429,6 +37597,9 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37429
37597
|
if (texture.isVideoTexture) {
|
|
37430
37598
|
_videoTextures.delete(texture);
|
|
37431
37599
|
}
|
|
37600
|
+
if (texture.isHTMLTexture) {
|
|
37601
|
+
_htmlTextures.delete(texture);
|
|
37602
|
+
}
|
|
37432
37603
|
}
|
|
37433
37604
|
function onRenderTargetDispose(event) {
|
|
37434
37605
|
const renderTarget2 = event.target;
|
|
@@ -37505,6 +37676,12 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37505
37676
|
function resetTextureUnits() {
|
|
37506
37677
|
textureUnits = 0;
|
|
37507
37678
|
}
|
|
37679
|
+
function getTextureUnits() {
|
|
37680
|
+
return textureUnits;
|
|
37681
|
+
}
|
|
37682
|
+
function setTextureUnits(value) {
|
|
37683
|
+
textureUnits = value;
|
|
37684
|
+
}
|
|
37508
37685
|
function allocateTextureUnit() {
|
|
37509
37686
|
const textureUnit = textureUnits;
|
|
37510
37687
|
if (textureUnit >= capabilities.maxTextures) {
|
|
@@ -37687,10 +37864,10 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37687
37864
|
}
|
|
37688
37865
|
}
|
|
37689
37866
|
updateRanges.length = mergeIndex + 1;
|
|
37690
|
-
const currentUnpackRowLen =
|
|
37691
|
-
const currentUnpackSkipPixels =
|
|
37692
|
-
const currentUnpackSkipRows =
|
|
37693
|
-
|
|
37867
|
+
const currentUnpackRowLen = state2.getParameter(_gl.UNPACK_ROW_LENGTH);
|
|
37868
|
+
const currentUnpackSkipPixels = state2.getParameter(_gl.UNPACK_SKIP_PIXELS);
|
|
37869
|
+
const currentUnpackSkipRows = state2.getParameter(_gl.UNPACK_SKIP_ROWS);
|
|
37870
|
+
state2.pixelStorei(_gl.UNPACK_ROW_LENGTH, image.width);
|
|
37694
37871
|
for (let i3 = 0, l2 = updateRanges.length; i3 < l2; i3++) {
|
|
37695
37872
|
const range = updateRanges[i3];
|
|
37696
37873
|
const pixelStart = Math.floor(range.start / componentStride);
|
|
@@ -37699,14 +37876,14 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37699
37876
|
const y = Math.floor(pixelStart / image.width);
|
|
37700
37877
|
const width = pixelCount;
|
|
37701
37878
|
const height = 1;
|
|
37702
|
-
|
|
37703
|
-
|
|
37879
|
+
state2.pixelStorei(_gl.UNPACK_SKIP_PIXELS, x2);
|
|
37880
|
+
state2.pixelStorei(_gl.UNPACK_SKIP_ROWS, y);
|
|
37704
37881
|
state2.texSubImage2D(_gl.TEXTURE_2D, 0, x2, y, width, height, glFormat, glType, image.data);
|
|
37705
37882
|
}
|
|
37706
37883
|
texture.clearUpdateRanges();
|
|
37707
|
-
|
|
37708
|
-
|
|
37709
|
-
|
|
37884
|
+
state2.pixelStorei(_gl.UNPACK_ROW_LENGTH, currentUnpackRowLen);
|
|
37885
|
+
state2.pixelStorei(_gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels);
|
|
37886
|
+
state2.pixelStorei(_gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows);
|
|
37710
37887
|
}
|
|
37711
37888
|
}
|
|
37712
37889
|
function uploadTexture(textureProperties, texture, slot) {
|
|
@@ -37719,18 +37896,21 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37719
37896
|
const sourceProperties = properties.get(source);
|
|
37720
37897
|
if (source.version !== sourceProperties.__version || forceUpload === true) {
|
|
37721
37898
|
state2.activeTexture(_gl.TEXTURE0 + slot);
|
|
37722
|
-
const
|
|
37723
|
-
|
|
37724
|
-
|
|
37725
|
-
|
|
37726
|
-
|
|
37727
|
-
|
|
37728
|
-
|
|
37899
|
+
const isImageBitmap = typeof ImageBitmap !== "undefined" && texture.image instanceof ImageBitmap;
|
|
37900
|
+
if (isImageBitmap === false) {
|
|
37901
|
+
const workingPrimaries = ColorManagement.getPrimaries(ColorManagement.workingColorSpace);
|
|
37902
|
+
const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries(texture.colorSpace);
|
|
37903
|
+
const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
|
|
37904
|
+
state2.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
|
|
37905
|
+
state2.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
|
|
37906
|
+
state2.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion);
|
|
37907
|
+
}
|
|
37908
|
+
state2.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment);
|
|
37729
37909
|
let image = resizeImage(texture.image, false, capabilities.maxTextureSize);
|
|
37730
37910
|
image = verifyColorSpace(texture, image);
|
|
37731
37911
|
const glFormat = utils.convert(texture.format, texture.colorSpace);
|
|
37732
37912
|
const glType = utils.convert(texture.type);
|
|
37733
|
-
let glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture);
|
|
37913
|
+
let glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace, texture.isVideoTexture);
|
|
37734
37914
|
setTextureParameters(textureType, texture);
|
|
37735
37915
|
let mipmap;
|
|
37736
37916
|
const mipmaps = texture.mipmaps;
|
|
@@ -37892,6 +38072,35 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37892
38072
|
}
|
|
37893
38073
|
}
|
|
37894
38074
|
}
|
|
38075
|
+
} else if (texture.isHTMLTexture) {
|
|
38076
|
+
if ("texElementImage2D" in _gl) {
|
|
38077
|
+
const canvas = _gl.canvas;
|
|
38078
|
+
if (!canvas.hasAttribute("layoutsubtree")) {
|
|
38079
|
+
canvas.setAttribute("layoutsubtree", "true");
|
|
38080
|
+
}
|
|
38081
|
+
if (image.parentNode !== canvas) {
|
|
38082
|
+
canvas.appendChild(image);
|
|
38083
|
+
_htmlTextures.add(texture);
|
|
38084
|
+
canvas.onpaint = (event) => {
|
|
38085
|
+
const changed = event.changedElements;
|
|
38086
|
+
for (const t2 of _htmlTextures) {
|
|
38087
|
+
if (changed.includes(t2.image)) {
|
|
38088
|
+
t2.needsUpdate = true;
|
|
38089
|
+
}
|
|
38090
|
+
}
|
|
38091
|
+
};
|
|
38092
|
+
canvas.requestPaint();
|
|
38093
|
+
return;
|
|
38094
|
+
}
|
|
38095
|
+
const level = 0;
|
|
38096
|
+
const internalFormat = _gl.RGBA;
|
|
38097
|
+
const srcFormat = _gl.RGBA;
|
|
38098
|
+
const srcType = _gl.UNSIGNED_BYTE;
|
|
38099
|
+
_gl.texElementImage2D(_gl.TEXTURE_2D, level, internalFormat, srcFormat, srcType, image);
|
|
38100
|
+
_gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, _gl.LINEAR);
|
|
38101
|
+
_gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE);
|
|
38102
|
+
_gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE);
|
|
38103
|
+
}
|
|
37895
38104
|
} else {
|
|
37896
38105
|
if (mipmaps.length > 0) {
|
|
37897
38106
|
if (useTexStorage && allocateMemory) {
|
|
@@ -37942,10 +38151,10 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37942
38151
|
const workingPrimaries = ColorManagement.getPrimaries(ColorManagement.workingColorSpace);
|
|
37943
38152
|
const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries(texture.colorSpace);
|
|
37944
38153
|
const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
|
|
37945
|
-
|
|
37946
|
-
|
|
37947
|
-
|
|
37948
|
-
|
|
38154
|
+
state2.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
|
|
38155
|
+
state2.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
|
|
38156
|
+
state2.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment);
|
|
38157
|
+
state2.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion);
|
|
37949
38158
|
const isCompressed = texture.isCompressedTexture || texture.image[0].isCompressedTexture;
|
|
37950
38159
|
const isDataTexture = texture.image[0] && texture.image[0].isDataTexture;
|
|
37951
38160
|
const cubeImage = [];
|
|
@@ -37957,7 +38166,7 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
37957
38166
|
}
|
|
37958
38167
|
cubeImage[i3] = verifyColorSpace(texture, cubeImage[i3]);
|
|
37959
38168
|
}
|
|
37960
|
-
const image = cubeImage[0], glFormat = utils.convert(texture.format, texture.colorSpace), glType = utils.convert(texture.type), glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);
|
|
38169
|
+
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);
|
|
37961
38170
|
const useTexStorage = texture.isVideoTexture !== true;
|
|
37962
38171
|
const allocateMemory = sourceProperties.__version === void 0 || forceUpload === true;
|
|
37963
38172
|
const dataReady = source.dataReady;
|
|
@@ -38054,7 +38263,7 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
38054
38263
|
function setupFrameBufferTexture(framebuffer, renderTarget2, texture, attachment, textureTarget, level) {
|
|
38055
38264
|
const glFormat = utils.convert(texture.format, texture.colorSpace);
|
|
38056
38265
|
const glType = utils.convert(texture.type);
|
|
38057
|
-
const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);
|
|
38266
|
+
const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace);
|
|
38058
38267
|
const renderTargetProperties = properties.get(renderTarget2);
|
|
38059
38268
|
const textureProperties = properties.get(texture);
|
|
38060
38269
|
textureProperties.__renderTarget = renderTarget2;
|
|
@@ -38096,7 +38305,7 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
38096
38305
|
const texture = textures[i3];
|
|
38097
38306
|
const glFormat = utils.convert(texture.format, texture.colorSpace);
|
|
38098
38307
|
const glType = utils.convert(texture.type);
|
|
38099
|
-
const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace);
|
|
38308
|
+
const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace);
|
|
38100
38309
|
if (useMultisampledRTT(renderTarget2)) {
|
|
38101
38310
|
multisampledRTTExt.renderbufferStorageMultisampleEXT(_gl.RENDERBUFFER, getRenderTargetSamples(renderTarget2), glInternalFormat, renderTarget2.width, renderTarget2.height);
|
|
38102
38311
|
} else if (useMultisample) {
|
|
@@ -38296,7 +38505,7 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
38296
38505
|
_gl.bindRenderbuffer(_gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i3]);
|
|
38297
38506
|
const glFormat = utils.convert(texture2.format, texture2.colorSpace);
|
|
38298
38507
|
const glType = utils.convert(texture2.type);
|
|
38299
|
-
const glInternalFormat = getInternalFormat(texture2.internalFormat, glFormat, glType, texture2.colorSpace, renderTarget2.isXRRenderTarget === true);
|
|
38508
|
+
const glInternalFormat = getInternalFormat(texture2.internalFormat, glFormat, glType, texture2.normalized, texture2.colorSpace, renderTarget2.isXRRenderTarget === true);
|
|
38300
38509
|
const samples = getRenderTargetSamples(renderTarget2);
|
|
38301
38510
|
_gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget2.width, renderTarget2.height);
|
|
38302
38511
|
_gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i3, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i3]);
|
|
@@ -38492,6 +38701,8 @@ function WebGLTextures(_gl, extensions2, state2, properties, capabilities, utils
|
|
|
38492
38701
|
}
|
|
38493
38702
|
this.allocateTextureUnit = allocateTextureUnit;
|
|
38494
38703
|
this.resetTextureUnits = resetTextureUnits;
|
|
38704
|
+
this.getTextureUnits = getTextureUnits;
|
|
38705
|
+
this.setTextureUnits = setTextureUnits;
|
|
38495
38706
|
this.setTexture2D = setTexture2D;
|
|
38496
38707
|
this.setTexture2DArray = setTexture2DArray;
|
|
38497
38708
|
this.setTexture3D = setTexture3D;
|
|
@@ -38644,7 +38855,9 @@ function WebGLMaterials(renderer, properties) {
|
|
|
38644
38855
|
}
|
|
38645
38856
|
}
|
|
38646
38857
|
function refreshMaterialUniforms(uniforms, material, pixelRatio, height, transmissionRenderTarget) {
|
|
38647
|
-
if (material.
|
|
38858
|
+
if (material.isNodeMaterial) {
|
|
38859
|
+
material.uniformsNeedUpdate = false;
|
|
38860
|
+
} else if (material.isMeshBasicMaterial) {
|
|
38648
38861
|
refreshUniformsCommon(uniforms, material);
|
|
38649
38862
|
} else if (material.isMeshLambertMaterial) {
|
|
38650
38863
|
refreshUniformsCommon(uniforms, material);
|
|
@@ -38746,16 +38959,10 @@ function WebGLMaterials(renderer, properties) {
|
|
|
38746
38959
|
const envMapRotation = materialProperties.envMapRotation;
|
|
38747
38960
|
if (envMap) {
|
|
38748
38961
|
uniforms.envMap.value = envMap;
|
|
38749
|
-
|
|
38750
|
-
_e1.x *= -1;
|
|
38751
|
-
_e1.y *= -1;
|
|
38752
|
-
_e1.z *= -1;
|
|
38962
|
+
uniforms.envMapRotation.value.setFromMatrix4(_m12.makeRotationFromEuler(envMapRotation)).transpose();
|
|
38753
38963
|
if (envMap.isCubeTexture && envMap.isRenderTargetTexture === false) {
|
|
38754
|
-
|
|
38755
|
-
_e1.z *= -1;
|
|
38964
|
+
uniforms.envMapRotation.value.premultiply(_m);
|
|
38756
38965
|
}
|
|
38757
|
-
uniforms.envMapRotation.value.setFromMatrix4(_m12.makeRotationFromEuler(_e1));
|
|
38758
|
-
uniforms.flipEnvMap.value = envMap.isCubeTexture && envMap.isRenderTargetTexture === false ? -1 : 1;
|
|
38759
38966
|
uniforms.reflectivity.value = material.reflectivity;
|
|
38760
38967
|
uniforms.ior.value = material.ior;
|
|
38761
38968
|
uniforms.refractionRatio.value = material.refractionRatio;
|
|
@@ -39021,6 +39228,8 @@ function WebGLUniformsGroups(gl, info, capabilities, state2) {
|
|
|
39021
39228
|
uniform.__data[9] = value.elements[7];
|
|
39022
39229
|
uniform.__data[10] = value.elements[8];
|
|
39023
39230
|
uniform.__data[11] = 0;
|
|
39231
|
+
} else if (ArrayBuffer.isView(value)) {
|
|
39232
|
+
uniform.__data.set(new value.constructor(value.buffer, value.byteOffset, uniform.__data.length));
|
|
39024
39233
|
} else {
|
|
39025
39234
|
value.toArray(uniform.__data, arrayOffset);
|
|
39026
39235
|
arrayOffset += info2.storage / Float32Array.BYTES_PER_ELEMENT;
|
|
@@ -39038,6 +39247,8 @@ function WebGLUniformsGroups(gl, info, capabilities, state2) {
|
|
|
39038
39247
|
if (cache[indexString] === void 0) {
|
|
39039
39248
|
if (typeof value === "number" || typeof value === "boolean") {
|
|
39040
39249
|
cache[indexString] = value;
|
|
39250
|
+
} else if (ArrayBuffer.isView(value)) {
|
|
39251
|
+
cache[indexString] = value.slice();
|
|
39041
39252
|
} else {
|
|
39042
39253
|
cache[indexString] = value.clone();
|
|
39043
39254
|
}
|
|
@@ -39049,6 +39260,8 @@ function WebGLUniformsGroups(gl, info, capabilities, state2) {
|
|
|
39049
39260
|
cache[indexString] = value;
|
|
39050
39261
|
return true;
|
|
39051
39262
|
}
|
|
39263
|
+
} else if (ArrayBuffer.isView(value)) {
|
|
39264
|
+
return true;
|
|
39052
39265
|
} else {
|
|
39053
39266
|
if (cachedObject.equals(value) === false) {
|
|
39054
39267
|
cachedObject.copy(value);
|
|
@@ -39116,6 +39329,9 @@ function WebGLUniformsGroups(gl, info, capabilities, state2) {
|
|
|
39116
39329
|
info2.storage = 64;
|
|
39117
39330
|
} else if (value.isTexture) {
|
|
39118
39331
|
warn("WebGLRenderer: Texture samplers can not be part of an uniforms group.");
|
|
39332
|
+
} else if (ArrayBuffer.isView(value)) {
|
|
39333
|
+
info2.boundary = 16;
|
|
39334
|
+
info2.storage = value.byteLength;
|
|
39119
39335
|
} else {
|
|
39120
39336
|
warn("WebGLRenderer: Unsupported uniform value type.", value);
|
|
39121
39337
|
}
|
|
@@ -39157,9 +39373,9 @@ function getDFGLUT() {
|
|
|
39157
39373
|
}
|
|
39158
39374
|
return lut;
|
|
39159
39375
|
}
|
|
39160
|
-
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,
|
|
39376
|
+
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;
|
|
39161
39377
|
var init_three_module = __esm({
|
|
39162
|
-
"../../node_modules/.bun/three@0.
|
|
39378
|
+
"../../node_modules/.bun/three@0.184.0/node_modules/three/build/three.module.js"() {
|
|
39163
39379
|
init_three_core();
|
|
39164
39380
|
init_three_core();
|
|
39165
39381
|
alphahash_fragment = "#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif";
|
|
@@ -39194,8 +39410,8 @@ var init_three_module = __esm({
|
|
|
39194
39410
|
emissivemap_pars_fragment = "#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif";
|
|
39195
39411
|
colorspace_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );";
|
|
39196
39412
|
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}";
|
|
39197
|
-
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 *
|
|
39198
|
-
envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform
|
|
39413
|
+
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";
|
|
39414
|
+
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";
|
|
39199
39415
|
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";
|
|
39200
39416
|
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";
|
|
39201
39417
|
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";
|
|
@@ -39207,17 +39423,18 @@ var init_three_module = __esm({
|
|
|
39207
39423
|
lightmap_pars_fragment = "#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif";
|
|
39208
39424
|
lights_lambert_fragment = "LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;";
|
|
39209
39425
|
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";
|
|
39210
|
-
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";
|
|
39426
|
+
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>";
|
|
39211
39427
|
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";
|
|
39212
39428
|
lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
|
|
39213
39429
|
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";
|
|
39214
39430
|
lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;";
|
|
39215
39431
|
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";
|
|
39216
39432
|
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";
|
|
39217
|
-
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}";
|
|
39218
|
-
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";
|
|
39433
|
+
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}";
|
|
39434
|
+
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";
|
|
39219
39435
|
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";
|
|
39220
39436
|
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";
|
|
39437
|
+
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";
|
|
39221
39438
|
logdepthbuf_fragment = "#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif";
|
|
39222
39439
|
logdepthbuf_pars_fragment = "#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif";
|
|
39223
39440
|
logdepthbuf_pars_vertex = "#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif";
|
|
@@ -39234,7 +39451,7 @@ var init_three_module = __esm({
|
|
|
39234
39451
|
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";
|
|
39235
39452
|
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";
|
|
39236
39453
|
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;";
|
|
39237
|
-
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";
|
|
39454
|
+
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";
|
|
39238
39455
|
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";
|
|
39239
39456
|
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";
|
|
39240
39457
|
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";
|
|
@@ -39253,7 +39470,7 @@ var init_three_module = __esm({
|
|
|
39253
39470
|
roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif";
|
|
39254
39471
|
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";
|
|
39255
39472
|
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";
|
|
39256
|
-
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";
|
|
39473
|
+
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";
|
|
39257
39474
|
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}";
|
|
39258
39475
|
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";
|
|
39259
39476
|
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";
|
|
@@ -39272,7 +39489,7 @@ var init_three_module = __esm({
|
|
|
39272
39489
|
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}";
|
|
39273
39490
|
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}";
|
|
39274
39491
|
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}";
|
|
39275
|
-
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
|
|
39492
|
+
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}";
|
|
39276
39493
|
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}";
|
|
39277
39494
|
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}";
|
|
39278
39495
|
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}";
|
|
@@ -39360,6 +39577,7 @@ var init_three_module = __esm({
|
|
|
39360
39577
|
lights_fragment_begin,
|
|
39361
39578
|
lights_fragment_maps,
|
|
39362
39579
|
lights_fragment_end,
|
|
39580
|
+
lightprobes_pars_fragment,
|
|
39363
39581
|
logdepthbuf_fragment,
|
|
39364
39582
|
logdepthbuf_pars_fragment,
|
|
39365
39583
|
logdepthbuf_pars_vertex,
|
|
@@ -39463,7 +39681,6 @@ var init_three_module = __esm({
|
|
|
39463
39681
|
envmap: {
|
|
39464
39682
|
envMap: { value: null },
|
|
39465
39683
|
envMapRotation: { value: /* @__PURE__ */ new Matrix3() },
|
|
39466
|
-
flipEnvMap: { value: -1 },
|
|
39467
39684
|
reflectivity: { value: 1 },
|
|
39468
39685
|
// basic, lambert, phong
|
|
39469
39686
|
ior: { value: 1.5 },
|
|
@@ -39582,7 +39799,11 @@ var init_three_module = __esm({
|
|
|
39582
39799
|
height: {}
|
|
39583
39800
|
} },
|
|
39584
39801
|
ltc_1: { value: null },
|
|
39585
|
-
ltc_2: { value: null }
|
|
39802
|
+
ltc_2: { value: null },
|
|
39803
|
+
probesSH: { value: null },
|
|
39804
|
+
probesMin: { value: /* @__PURE__ */ new Vector3() },
|
|
39805
|
+
probesMax: { value: /* @__PURE__ */ new Vector3() },
|
|
39806
|
+
probesResolution: { value: /* @__PURE__ */ new Vector3() }
|
|
39586
39807
|
},
|
|
39587
39808
|
points: {
|
|
39588
39809
|
diffuse: { value: /* @__PURE__ */ new Color(16777215) },
|
|
@@ -39783,7 +40004,6 @@ var init_three_module = __esm({
|
|
|
39783
40004
|
backgroundCube: {
|
|
39784
40005
|
uniforms: {
|
|
39785
40006
|
envMap: { value: null },
|
|
39786
|
-
flipEnvMap: { value: -1 },
|
|
39787
40007
|
backgroundBlurriness: { value: 0 },
|
|
39788
40008
|
backgroundIntensity: { value: 1 },
|
|
39789
40009
|
backgroundRotation: { value: /* @__PURE__ */ new Matrix3() }
|
|
@@ -39887,8 +40107,9 @@ var init_three_module = __esm({
|
|
|
39887
40107
|
fragmentShader: ShaderChunk.meshphysical_frag
|
|
39888
40108
|
};
|
|
39889
40109
|
_rgb = { r: 0, b: 0, g: 0 };
|
|
39890
|
-
_e1$1 = /* @__PURE__ */ new Euler();
|
|
39891
40110
|
_m1$12 = /* @__PURE__ */ new Matrix4();
|
|
40111
|
+
_m$1 = /* @__PURE__ */ new Matrix3();
|
|
40112
|
+
_m$1.set(-1, 0, 0, 0, 1, 0, 0, 0, 1);
|
|
39892
40113
|
LOD_MIN = 4;
|
|
39893
40114
|
EXTRA_LOD_SIGMA = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582];
|
|
39894
40115
|
MAX_SAMPLES = 20;
|
|
@@ -41232,8 +41453,9 @@ void main() {
|
|
|
41232
41453
|
};
|
|
41233
41454
|
}
|
|
41234
41455
|
};
|
|
41235
|
-
_e1 = /* @__PURE__ */ new Euler();
|
|
41236
41456
|
_m12 = /* @__PURE__ */ new Matrix4();
|
|
41457
|
+
_m = /* @__PURE__ */ new Matrix3();
|
|
41458
|
+
_m.set(-1, 0, 0, 0, 1, 0, 0, 0, 1);
|
|
41237
41459
|
DATA = new Uint16Array([
|
|
41238
41460
|
12469,
|
|
41239
41461
|
15057,
|
|
@@ -41796,6 +42018,7 @@ void main() {
|
|
|
41796
42018
|
]);
|
|
41797
42019
|
const uintClearColor = new Uint32Array(4);
|
|
41798
42020
|
const intClearColor = new Int32Array(4);
|
|
42021
|
+
const objectPosition = new Vector3();
|
|
41799
42022
|
let currentRenderList = null;
|
|
41800
42023
|
let currentRenderState = null;
|
|
41801
42024
|
const renderListStack = [];
|
|
@@ -41826,6 +42049,7 @@ void main() {
|
|
|
41826
42049
|
this.transmissionResolutionScale = 1;
|
|
41827
42050
|
const _this = this;
|
|
41828
42051
|
let _isContextLost = false;
|
|
42052
|
+
let _nodesHandler = null;
|
|
41829
42053
|
this._outputColorSpace = SRGBColorSpace;
|
|
41830
42054
|
let _currentActiveCubeFace = 0;
|
|
41831
42055
|
let _currentActiveMipmapLevel = 0;
|
|
@@ -41849,8 +42073,8 @@ void main() {
|
|
|
41849
42073
|
let _clippingEnabled = false;
|
|
41850
42074
|
let _localClippingEnabled = false;
|
|
41851
42075
|
const _projScreenMatrix3 = new Matrix4();
|
|
41852
|
-
const
|
|
41853
|
-
const
|
|
42076
|
+
const _vector3 = new Vector3();
|
|
42077
|
+
const _vector42 = new Vector4();
|
|
41854
42078
|
const _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };
|
|
41855
42079
|
let _renderBackground = false;
|
|
41856
42080
|
function getTargetPixelRatio() {
|
|
@@ -41994,13 +42218,13 @@ void main() {
|
|
|
41994
42218
|
};
|
|
41995
42219
|
this.setEffects = function(effects) {
|
|
41996
42220
|
if (_outputBufferType === UnsignedByteType) {
|
|
41997
|
-
|
|
42221
|
+
error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");
|
|
41998
42222
|
return;
|
|
41999
42223
|
}
|
|
42000
42224
|
if (effects) {
|
|
42001
42225
|
for (let i3 = 0; i3 < effects.length; i3++) {
|
|
42002
42226
|
if (effects[i3].isOutputPass === true) {
|
|
42003
|
-
|
|
42227
|
+
warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");
|
|
42004
42228
|
break;
|
|
42005
42229
|
}
|
|
42006
42230
|
}
|
|
@@ -42091,6 +42315,7 @@ void main() {
|
|
|
42091
42315
|
}
|
|
42092
42316
|
if (depth2) {
|
|
42093
42317
|
bits |= _gl.DEPTH_BUFFER_BIT;
|
|
42318
|
+
this.state.buffers.depth.setMask(true);
|
|
42094
42319
|
}
|
|
42095
42320
|
if (stencil2) {
|
|
42096
42321
|
bits |= _gl.STENCIL_BUFFER_BIT;
|
|
@@ -42109,6 +42334,10 @@ void main() {
|
|
|
42109
42334
|
this.clearStencil = function() {
|
|
42110
42335
|
this.clear(false, false, true);
|
|
42111
42336
|
};
|
|
42337
|
+
this.setNodesHandler = function(nodesHandler) {
|
|
42338
|
+
nodesHandler.setRenderer(this);
|
|
42339
|
+
_nodesHandler = nodesHandler;
|
|
42340
|
+
};
|
|
42112
42341
|
this.dispose = function() {
|
|
42113
42342
|
canvas.removeEventListener("webglcontextlost", onContextLost, false);
|
|
42114
42343
|
canvas.removeEventListener("webglcontextrestored", onContextRestore, false);
|
|
@@ -42231,23 +42460,18 @@ void main() {
|
|
|
42231
42460
|
renderer.setMode(_gl.TRIANGLES);
|
|
42232
42461
|
}
|
|
42233
42462
|
if (object.isBatchedMesh) {
|
|
42234
|
-
if (
|
|
42235
|
-
|
|
42236
|
-
|
|
42237
|
-
|
|
42238
|
-
|
|
42239
|
-
|
|
42240
|
-
|
|
42241
|
-
|
|
42242
|
-
|
|
42243
|
-
const uniforms = properties.get(material).currentProgram.getUniforms();
|
|
42244
|
-
for (let i3 = 0; i3 < drawCount2; i3++) {
|
|
42245
|
-
uniforms.setValue(_gl, "_gl_DrawID", i3);
|
|
42246
|
-
renderer.render(starts[i3] / bytesPerElement, counts[i3]);
|
|
42247
|
-
}
|
|
42248
|
-
} else {
|
|
42249
|
-
renderer.renderMultiDraw(object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount);
|
|
42463
|
+
if (!extensions2.get("WEBGL_multi_draw")) {
|
|
42464
|
+
const starts = object._multiDrawStarts;
|
|
42465
|
+
const counts = object._multiDrawCounts;
|
|
42466
|
+
const drawCount2 = object._multiDrawCount;
|
|
42467
|
+
const bytesPerElement = index ? attributes.get(index).bytesPerElement : 1;
|
|
42468
|
+
const uniforms = properties.get(material).currentProgram.getUniforms();
|
|
42469
|
+
for (let i3 = 0; i3 < drawCount2; i3++) {
|
|
42470
|
+
uniforms.setValue(_gl, "_gl_DrawID", i3);
|
|
42471
|
+
renderer.render(starts[i3] / bytesPerElement, counts[i3]);
|
|
42250
42472
|
}
|
|
42473
|
+
} else {
|
|
42474
|
+
renderer.renderMultiDraw(object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount);
|
|
42251
42475
|
}
|
|
42252
42476
|
} else if (object.isInstancedMesh) {
|
|
42253
42477
|
renderer.renderInstances(drawStart, drawCount, object.count);
|
|
@@ -42368,6 +42592,9 @@ void main() {
|
|
|
42368
42592
|
return;
|
|
42369
42593
|
}
|
|
42370
42594
|
if (_isContextLost === true) return;
|
|
42595
|
+
if (_nodesHandler !== null) {
|
|
42596
|
+
_nodesHandler.renderStart(scene, camera);
|
|
42597
|
+
}
|
|
42371
42598
|
const isXRPresenting = xr.enabled === true && xr.isPresenting === true;
|
|
42372
42599
|
const useOutput = output !== null && (_currentRenderTarget === null || isXRPresenting) && output.begin(_this, _currentRenderTarget);
|
|
42373
42600
|
if (scene.matrixWorldAutoUpdate === true) scene.updateMatrixWorld();
|
|
@@ -42379,6 +42606,7 @@ void main() {
|
|
|
42379
42606
|
if (scene.isScene === true) scene.onBeforeRender(_this, scene, camera, _currentRenderTarget);
|
|
42380
42607
|
currentRenderState = renderStates.get(scene, renderStateStack.length);
|
|
42381
42608
|
currentRenderState.init(camera);
|
|
42609
|
+
currentRenderState.state.textureUnits = textures.getTextureUnits();
|
|
42382
42610
|
renderStateStack.push(currentRenderState);
|
|
42383
42611
|
_projScreenMatrix3.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);
|
|
42384
42612
|
_frustum2.setFromProjectionMatrix(_projScreenMatrix3, WebGLCoordinateSystem, camera.reversedDepth);
|
|
@@ -42446,6 +42674,7 @@ void main() {
|
|
|
42446
42674
|
renderStateStack.pop();
|
|
42447
42675
|
if (renderStateStack.length > 0) {
|
|
42448
42676
|
currentRenderState = renderStateStack[renderStateStack.length - 1];
|
|
42677
|
+
textures.setTextureUnits(currentRenderState.state.textureUnits);
|
|
42449
42678
|
if (_clippingEnabled === true) clipping.setGlobalState(_this.clippingPlanes, currentRenderState.state.camera);
|
|
42450
42679
|
} else {
|
|
42451
42680
|
currentRenderState = null;
|
|
@@ -42456,6 +42685,9 @@ void main() {
|
|
|
42456
42685
|
} else {
|
|
42457
42686
|
currentRenderList = null;
|
|
42458
42687
|
}
|
|
42688
|
+
if (_nodesHandler !== null) {
|
|
42689
|
+
_nodesHandler.renderEnd();
|
|
42690
|
+
}
|
|
42459
42691
|
};
|
|
42460
42692
|
function projectObject(object, camera, groupOrder, sortObjects) {
|
|
42461
42693
|
if (object.visible === false) return;
|
|
@@ -42465,6 +42697,8 @@ void main() {
|
|
|
42465
42697
|
groupOrder = object.renderOrder;
|
|
42466
42698
|
} else if (object.isLOD) {
|
|
42467
42699
|
if (object.autoUpdate === true) object.update(camera);
|
|
42700
|
+
} else if (object.isLightProbeGrid) {
|
|
42701
|
+
currentRenderState.pushLightProbeGrid(object);
|
|
42468
42702
|
} else if (object.isLight) {
|
|
42469
42703
|
currentRenderState.pushLight(object);
|
|
42470
42704
|
if (object.castShadow) {
|
|
@@ -42473,12 +42707,12 @@ void main() {
|
|
|
42473
42707
|
} else if (object.isSprite) {
|
|
42474
42708
|
if (!object.frustumCulled || _frustum2.intersectsSprite(object)) {
|
|
42475
42709
|
if (sortObjects) {
|
|
42476
|
-
|
|
42710
|
+
_vector42.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix3);
|
|
42477
42711
|
}
|
|
42478
42712
|
const geometry = objects.update(object);
|
|
42479
42713
|
const material = object.material;
|
|
42480
42714
|
if (material.visible) {
|
|
42481
|
-
currentRenderList.push(object, geometry, material, groupOrder,
|
|
42715
|
+
currentRenderList.push(object, geometry, material, groupOrder, _vector42.z, null);
|
|
42482
42716
|
}
|
|
42483
42717
|
}
|
|
42484
42718
|
} else if (object.isMesh || object.isLine || object.isPoints) {
|
|
@@ -42488,12 +42722,12 @@ void main() {
|
|
|
42488
42722
|
if (sortObjects) {
|
|
42489
42723
|
if (object.boundingSphere !== void 0) {
|
|
42490
42724
|
if (object.boundingSphere === null) object.computeBoundingSphere();
|
|
42491
|
-
|
|
42725
|
+
_vector42.copy(object.boundingSphere.center);
|
|
42492
42726
|
} else {
|
|
42493
42727
|
if (geometry.boundingSphere === null) geometry.computeBoundingSphere();
|
|
42494
|
-
|
|
42728
|
+
_vector42.copy(geometry.boundingSphere.center);
|
|
42495
42729
|
}
|
|
42496
|
-
|
|
42730
|
+
_vector42.applyMatrix4(object.matrixWorld).applyMatrix4(_projScreenMatrix3);
|
|
42497
42731
|
}
|
|
42498
42732
|
if (Array.isArray(material)) {
|
|
42499
42733
|
const groups = geometry.groups;
|
|
@@ -42501,11 +42735,11 @@ void main() {
|
|
|
42501
42735
|
const group = groups[i3];
|
|
42502
42736
|
const groupMaterial = material[group.materialIndex];
|
|
42503
42737
|
if (groupMaterial && groupMaterial.visible) {
|
|
42504
|
-
currentRenderList.push(object, geometry, groupMaterial, groupOrder,
|
|
42738
|
+
currentRenderList.push(object, geometry, groupMaterial, groupOrder, _vector42.z, group);
|
|
42505
42739
|
}
|
|
42506
42740
|
}
|
|
42507
42741
|
} else if (material.visible) {
|
|
42508
|
-
currentRenderList.push(object, geometry, material, groupOrder,
|
|
42742
|
+
currentRenderList.push(object, geometry, material, groupOrder, _vector42.z, null);
|
|
42509
42743
|
}
|
|
42510
42744
|
}
|
|
42511
42745
|
}
|
|
@@ -42631,7 +42865,7 @@ void main() {
|
|
|
42631
42865
|
const lights = currentRenderState.state.lights;
|
|
42632
42866
|
const shadowsArray = currentRenderState.state.shadowsArray;
|
|
42633
42867
|
const lightsStateVersion = lights.state.version;
|
|
42634
|
-
const parameters2 = programCache.getParameters(material, lights.state, shadowsArray, scene, object);
|
|
42868
|
+
const parameters2 = programCache.getParameters(material, lights.state, shadowsArray, scene, object, currentRenderState.state.lightProbeGridArray);
|
|
42635
42869
|
const programCacheKey = programCache.getProgramCacheKey(parameters2);
|
|
42636
42870
|
let programs = materialProperties.programs;
|
|
42637
42871
|
materialProperties.environment = material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ? scene.environment : null;
|
|
@@ -42652,6 +42886,9 @@ void main() {
|
|
|
42652
42886
|
}
|
|
42653
42887
|
} else {
|
|
42654
42888
|
parameters2.uniforms = programCache.getUniforms(material);
|
|
42889
|
+
if (_nodesHandler !== null && material.isNodeMaterial) {
|
|
42890
|
+
_nodesHandler.build(material, object, parameters2);
|
|
42891
|
+
}
|
|
42655
42892
|
material.onBeforeCompile(parameters2, _this);
|
|
42656
42893
|
program = programCache.acquireProgram(parameters2, programCacheKey);
|
|
42657
42894
|
programs.set(programCacheKey, program);
|
|
@@ -42682,6 +42919,7 @@ void main() {
|
|
|
42682
42919
|
uniforms.spotLightMap.value = lights.state.spotLightMap;
|
|
42683
42920
|
uniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix;
|
|
42684
42921
|
}
|
|
42922
|
+
materialProperties.lightProbeGrid = currentRenderState.state.lightProbeGridArray.length > 0;
|
|
42685
42923
|
materialProperties.currentProgram = program;
|
|
42686
42924
|
materialProperties.uniformsList = null;
|
|
42687
42925
|
return program;
|
|
@@ -42712,12 +42950,24 @@ void main() {
|
|
|
42712
42950
|
materialProperties.vertexTangents = parameters2.vertexTangents;
|
|
42713
42951
|
materialProperties.toneMapping = parameters2.toneMapping;
|
|
42714
42952
|
}
|
|
42953
|
+
function findLightProbeGrid(volumes, object) {
|
|
42954
|
+
if (volumes.length === 0) return null;
|
|
42955
|
+
if (volumes.length === 1) {
|
|
42956
|
+
return volumes[0].texture !== null ? volumes[0] : null;
|
|
42957
|
+
}
|
|
42958
|
+
objectPosition.setFromMatrixPosition(object.matrixWorld);
|
|
42959
|
+
for (let i3 = 0, l2 = volumes.length; i3 < l2; i3++) {
|
|
42960
|
+
const v = volumes[i3];
|
|
42961
|
+
if (v.texture !== null && v.boundingBox.containsPoint(objectPosition)) return v;
|
|
42962
|
+
}
|
|
42963
|
+
return null;
|
|
42964
|
+
}
|
|
42715
42965
|
function setProgram(camera, scene, geometry, material, object) {
|
|
42716
42966
|
if (scene.isScene !== true) scene = _emptyScene;
|
|
42717
42967
|
textures.resetTextureUnits();
|
|
42718
42968
|
const fog = scene.fog;
|
|
42719
42969
|
const environment = material.isMeshStandardMaterial || material.isMeshLambertMaterial || material.isMeshPhongMaterial ? scene.environment : null;
|
|
42720
|
-
const colorSpace = _currentRenderTarget === null ? _this.outputColorSpace : _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace :
|
|
42970
|
+
const colorSpace = _currentRenderTarget === null ? _this.outputColorSpace : _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace : ColorManagement.workingColorSpace;
|
|
42721
42971
|
const usePMREM = material.isMeshStandardMaterial || material.isMeshLambertMaterial && !material.envMap || material.isMeshPhongMaterial && !material.envMap;
|
|
42722
42972
|
const envMap = environments.get(material.envMap || environment, usePMREM);
|
|
42723
42973
|
const vertexAlphas = material.vertexColors === true && !!geometry.attributes.color && geometry.attributes.color.itemSize === 4;
|
|
@@ -42791,6 +43041,8 @@ void main() {
|
|
|
42791
43041
|
needsProgramChange = true;
|
|
42792
43042
|
} else if (materialProperties.morphTargetsCount !== morphTargetsCount) {
|
|
42793
43043
|
needsProgramChange = true;
|
|
43044
|
+
} else if (!!materialProperties.lightProbeGrid !== currentRenderState.state.lightProbeGridArray.length > 0) {
|
|
43045
|
+
needsProgramChange = true;
|
|
42794
43046
|
}
|
|
42795
43047
|
} else {
|
|
42796
43048
|
needsProgramChange = true;
|
|
@@ -42799,6 +43051,9 @@ void main() {
|
|
|
42799
43051
|
let program = materialProperties.currentProgram;
|
|
42800
43052
|
if (needsProgramChange === true) {
|
|
42801
43053
|
program = getProgram(material, scene, object);
|
|
43054
|
+
if (_nodesHandler && material.isNodeMaterial) {
|
|
43055
|
+
_nodesHandler.onUpdateProgram(material, program, materialProperties);
|
|
43056
|
+
}
|
|
42802
43057
|
}
|
|
42803
43058
|
let refreshProgram = false;
|
|
42804
43059
|
let refreshMaterial = false;
|
|
@@ -42813,6 +43068,13 @@ void main() {
|
|
|
42813
43068
|
_currentMaterialId = material.id;
|
|
42814
43069
|
refreshMaterial = true;
|
|
42815
43070
|
}
|
|
43071
|
+
if (materialProperties.needsLights) {
|
|
43072
|
+
const objectVolume = findLightProbeGrid(currentRenderState.state.lightProbeGridArray, object);
|
|
43073
|
+
if (materialProperties.lightProbeGrid !== objectVolume) {
|
|
43074
|
+
materialProperties.lightProbeGrid = objectVolume;
|
|
43075
|
+
refreshMaterial = true;
|
|
43076
|
+
}
|
|
43077
|
+
}
|
|
42816
43078
|
if (refreshProgram || _currentCamera !== camera) {
|
|
42817
43079
|
const reversedDepthBuffer2 = state2.buffers.depth.getReversed();
|
|
42818
43080
|
if (reversedDepthBuffer2 && camera.reversedDepth !== true) {
|
|
@@ -42823,7 +43085,7 @@ void main() {
|
|
|
42823
43085
|
p_uniforms.setValue(_gl, "viewMatrix", camera.matrixWorldInverse);
|
|
42824
43086
|
const uCamPos = p_uniforms.map.cameraPosition;
|
|
42825
43087
|
if (uCamPos !== void 0) {
|
|
42826
|
-
uCamPos.setValue(_gl,
|
|
43088
|
+
uCamPos.setValue(_gl, _vector3.setFromMatrixPosition(camera.matrixWorld));
|
|
42827
43089
|
}
|
|
42828
43090
|
if (capabilities.logarithmicDepthBuffer) {
|
|
42829
43091
|
p_uniforms.setValue(
|
|
@@ -42894,6 +43156,13 @@ void main() {
|
|
|
42894
43156
|
materials.refreshFogUniforms(m_uniforms, fog);
|
|
42895
43157
|
}
|
|
42896
43158
|
materials.refreshMaterialUniforms(m_uniforms, material, _pixelRatio, _height, currentRenderState.state.transmissionRenderTarget[camera.id]);
|
|
43159
|
+
if (materialProperties.needsLights && materialProperties.lightProbeGrid) {
|
|
43160
|
+
const volume = materialProperties.lightProbeGrid;
|
|
43161
|
+
m_uniforms.probesSH.value = volume.texture;
|
|
43162
|
+
m_uniforms.probesMin.value.copy(volume.boundingBox.min);
|
|
43163
|
+
m_uniforms.probesMax.value.copy(volume.boundingBox.max);
|
|
43164
|
+
m_uniforms.probesResolution.value.copy(volume.resolution);
|
|
43165
|
+
}
|
|
42897
43166
|
WebGLUniforms.upload(_gl, getUniformList(materialProperties), m_uniforms, textures);
|
|
42898
43167
|
}
|
|
42899
43168
|
if (material.isShaderMaterial && material.uniformsNeedUpdate === true) {
|
|
@@ -42906,7 +43175,7 @@ void main() {
|
|
|
42906
43175
|
p_uniforms.setValue(_gl, "modelViewMatrix", object.modelViewMatrix);
|
|
42907
43176
|
p_uniforms.setValue(_gl, "normalMatrix", object.normalMatrix);
|
|
42908
43177
|
p_uniforms.setValue(_gl, "modelMatrix", object.matrixWorld);
|
|
42909
|
-
if (material.
|
|
43178
|
+
if (material.uniformsGroups !== void 0) {
|
|
42910
43179
|
const groups = material.uniformsGroups;
|
|
42911
43180
|
for (let i3 = 0, l2 = groups.length; i3 < l2; i3++) {
|
|
42912
43181
|
const group = groups[i3];
|
|
@@ -43175,19 +43444,20 @@ void main() {
|
|
|
43175
43444
|
textures.setTexture2D(dstTexture, 0);
|
|
43176
43445
|
glTarget = _gl.TEXTURE_2D;
|
|
43177
43446
|
}
|
|
43178
|
-
|
|
43179
|
-
|
|
43180
|
-
|
|
43181
|
-
|
|
43182
|
-
const
|
|
43183
|
-
const
|
|
43184
|
-
const
|
|
43185
|
-
const
|
|
43186
|
-
|
|
43187
|
-
|
|
43188
|
-
|
|
43189
|
-
|
|
43190
|
-
|
|
43447
|
+
state2.activeTexture(_gl.TEXTURE0);
|
|
43448
|
+
state2.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY);
|
|
43449
|
+
state2.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha);
|
|
43450
|
+
state2.pixelStorei(_gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment);
|
|
43451
|
+
const currentUnpackRowLen = state2.getParameter(_gl.UNPACK_ROW_LENGTH);
|
|
43452
|
+
const currentUnpackImageHeight = state2.getParameter(_gl.UNPACK_IMAGE_HEIGHT);
|
|
43453
|
+
const currentUnpackSkipPixels = state2.getParameter(_gl.UNPACK_SKIP_PIXELS);
|
|
43454
|
+
const currentUnpackSkipRows = state2.getParameter(_gl.UNPACK_SKIP_ROWS);
|
|
43455
|
+
const currentUnpackSkipImages = state2.getParameter(_gl.UNPACK_SKIP_IMAGES);
|
|
43456
|
+
state2.pixelStorei(_gl.UNPACK_ROW_LENGTH, image.width);
|
|
43457
|
+
state2.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, image.height);
|
|
43458
|
+
state2.pixelStorei(_gl.UNPACK_SKIP_PIXELS, minX);
|
|
43459
|
+
state2.pixelStorei(_gl.UNPACK_SKIP_ROWS, minY);
|
|
43460
|
+
state2.pixelStorei(_gl.UNPACK_SKIP_IMAGES, minZ);
|
|
43191
43461
|
const isSrc3D = srcTexture.isDataArrayTexture || srcTexture.isData3DTexture;
|
|
43192
43462
|
const isDst3D = dstTexture.isDataArrayTexture || dstTexture.isData3DTexture;
|
|
43193
43463
|
if (srcTexture.isDepthTexture) {
|
|
@@ -43251,11 +43521,11 @@ void main() {
|
|
|
43251
43521
|
}
|
|
43252
43522
|
}
|
|
43253
43523
|
}
|
|
43254
|
-
|
|
43255
|
-
|
|
43256
|
-
|
|
43257
|
-
|
|
43258
|
-
|
|
43524
|
+
state2.pixelStorei(_gl.UNPACK_ROW_LENGTH, currentUnpackRowLen);
|
|
43525
|
+
state2.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight);
|
|
43526
|
+
state2.pixelStorei(_gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels);
|
|
43527
|
+
state2.pixelStorei(_gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows);
|
|
43528
|
+
state2.pixelStorei(_gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages);
|
|
43259
43529
|
if (dstLevel === 0 && dstTexture.generateMipmaps) {
|
|
43260
43530
|
_gl.generateMipmap(glTarget);
|
|
43261
43531
|
}
|
|
@@ -43320,15 +43590,15 @@ void main() {
|
|
|
43320
43590
|
}
|
|
43321
43591
|
});
|
|
43322
43592
|
|
|
43323
|
-
// ../../node_modules/.bun/use-sync-external-store@1.6.0+
|
|
43593
|
+
// ../../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
|
|
43324
43594
|
var require_use_sync_external_store_shim_development = __commonJS({
|
|
43325
|
-
"../../node_modules/.bun/use-sync-external-store@1.6.0+
|
|
43595
|
+
"../../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) {
|
|
43326
43596
|
(function() {
|
|
43327
43597
|
function is2(x2, y) {
|
|
43328
43598
|
return x2 === y && (0 !== x2 || 1 / x2 === 1 / y) || x2 !== x2 && y !== y;
|
|
43329
43599
|
}
|
|
43330
43600
|
function useSyncExternalStore$2(subscribe3, getSnapshot2) {
|
|
43331
|
-
didWarnOld18Alpha || void 0 ===
|
|
43601
|
+
didWarnOld18Alpha || void 0 === React100.startTransition || (didWarnOld18Alpha = true, console.error(
|
|
43332
43602
|
"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."
|
|
43333
43603
|
));
|
|
43334
43604
|
var value = getSnapshot2();
|
|
@@ -43338,7 +43608,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
43338
43608
|
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
43339
43609
|
), didWarnUncachedGetSnapshot = true);
|
|
43340
43610
|
}
|
|
43341
|
-
cachedValue =
|
|
43611
|
+
cachedValue = useState86({
|
|
43342
43612
|
inst: { value, getSnapshot: getSnapshot2 }
|
|
43343
43613
|
});
|
|
43344
43614
|
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
|
|
@@ -43376,31 +43646,31 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
43376
43646
|
return getSnapshot2();
|
|
43377
43647
|
}
|
|
43378
43648
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
43379
|
-
var
|
|
43380
|
-
exports$1.useSyncExternalStore = void 0 !==
|
|
43649
|
+
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;
|
|
43650
|
+
exports$1.useSyncExternalStore = void 0 !== React100.useSyncExternalStore ? React100.useSyncExternalStore : shim;
|
|
43381
43651
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
43382
43652
|
})();
|
|
43383
43653
|
}
|
|
43384
43654
|
});
|
|
43385
43655
|
|
|
43386
|
-
// ../../node_modules/.bun/use-sync-external-store@1.6.0+
|
|
43656
|
+
// ../../node_modules/.bun/use-sync-external-store@1.6.0+3f10a4be4e334a9b/node_modules/use-sync-external-store/shim/index.js
|
|
43387
43657
|
var require_shim = __commonJS({
|
|
43388
|
-
"../../node_modules/.bun/use-sync-external-store@1.6.0+
|
|
43658
|
+
"../../node_modules/.bun/use-sync-external-store@1.6.0+3f10a4be4e334a9b/node_modules/use-sync-external-store/shim/index.js"(exports$1, module) {
|
|
43389
43659
|
{
|
|
43390
43660
|
module.exports = require_use_sync_external_store_shim_development();
|
|
43391
43661
|
}
|
|
43392
43662
|
}
|
|
43393
43663
|
});
|
|
43394
43664
|
|
|
43395
|
-
// ../../node_modules/.bun/use-sync-external-store@1.6.0+
|
|
43665
|
+
// ../../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
|
|
43396
43666
|
var require_with_selector_development = __commonJS({
|
|
43397
|
-
"../../node_modules/.bun/use-sync-external-store@1.6.0+
|
|
43667
|
+
"../../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) {
|
|
43398
43668
|
(function() {
|
|
43399
43669
|
function is2(x2, y) {
|
|
43400
43670
|
return x2 === y && (0 !== x2 || 1 / x2 === 1 / y) || x2 !== x2 && y !== y;
|
|
43401
43671
|
}
|
|
43402
43672
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
43403
|
-
var
|
|
43673
|
+
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;
|
|
43404
43674
|
exports$1.useSyncExternalStoreWithSelector = function(subscribe3, getSnapshot2, getServerSnapshot2, selector, isEqual) {
|
|
43405
43675
|
var instRef = useRef73(null);
|
|
43406
43676
|
if (null === instRef.current) {
|
|
@@ -43458,19 +43728,19 @@ var require_with_selector_development = __commonJS({
|
|
|
43458
43728
|
}
|
|
43459
43729
|
});
|
|
43460
43730
|
|
|
43461
|
-
// ../../node_modules/.bun/use-sync-external-store@1.6.0+
|
|
43731
|
+
// ../../node_modules/.bun/use-sync-external-store@1.6.0+3f10a4be4e334a9b/node_modules/use-sync-external-store/shim/with-selector.js
|
|
43462
43732
|
var require_with_selector = __commonJS({
|
|
43463
|
-
"../../node_modules/.bun/use-sync-external-store@1.6.0+
|
|
43733
|
+
"../../node_modules/.bun/use-sync-external-store@1.6.0+3f10a4be4e334a9b/node_modules/use-sync-external-store/shim/with-selector.js"(exports$1, module) {
|
|
43464
43734
|
{
|
|
43465
43735
|
module.exports = require_with_selector_development();
|
|
43466
43736
|
}
|
|
43467
43737
|
}
|
|
43468
43738
|
});
|
|
43469
43739
|
|
|
43470
|
-
// ../../node_modules/.bun/zustand@5.0.11+
|
|
43740
|
+
// ../../node_modules/.bun/zustand@5.0.11+5e3d5174673d7dcb/node_modules/zustand/esm/vanilla.mjs
|
|
43471
43741
|
var createStoreImpl, createStore;
|
|
43472
43742
|
var init_vanilla = __esm({
|
|
43473
|
-
"../../node_modules/.bun/zustand@5.0.11+
|
|
43743
|
+
"../../node_modules/.bun/zustand@5.0.11+5e3d5174673d7dcb/node_modules/zustand/esm/vanilla.mjs"() {
|
|
43474
43744
|
createStoreImpl = (createState) => {
|
|
43475
43745
|
let state2;
|
|
43476
43746
|
const listeners = /* @__PURE__ */ new Set();
|
|
@@ -43508,7 +43778,7 @@ function useStoreWithEqualityFn(api, selector = identity, equalityFn) {
|
|
|
43508
43778
|
}
|
|
43509
43779
|
var import_with_selector, useSyncExternalStoreWithSelector, identity, createWithEqualityFnImpl, createWithEqualityFn;
|
|
43510
43780
|
var init_traditional = __esm({
|
|
43511
|
-
"../../node_modules/.bun/zustand@5.0.11+
|
|
43781
|
+
"../../node_modules/.bun/zustand@5.0.11+5e3d5174673d7dcb/node_modules/zustand/esm/traditional.mjs"() {
|
|
43512
43782
|
import_with_selector = __toESM(require_with_selector(), 1);
|
|
43513
43783
|
init_vanilla();
|
|
43514
43784
|
({ useSyncExternalStoreWithSelector } = import_with_selector.default);
|
|
@@ -43523,7 +43793,7 @@ var init_traditional = __esm({
|
|
|
43523
43793
|
}
|
|
43524
43794
|
});
|
|
43525
43795
|
|
|
43526
|
-
// ../../node_modules/.bun/suspend-react@0.1.3+
|
|
43796
|
+
// ../../node_modules/.bun/suspend-react@0.1.3+3f10a4be4e334a9b/node_modules/suspend-react/index.js
|
|
43527
43797
|
function shallowEqualArrays(arrA, arrB, equal = (a2, b2) => a2 === b2) {
|
|
43528
43798
|
if (arrA === arrB) return true;
|
|
43529
43799
|
if (!arrA || !arrB) return false;
|
|
@@ -43571,7 +43841,7 @@ function query(fn, keys2 = null, preload2 = false, config = {}) {
|
|
|
43571
43841
|
}
|
|
43572
43842
|
var isPromise, globalCache, suspend, preload, clear;
|
|
43573
43843
|
var init_suspend_react = __esm({
|
|
43574
|
-
"../../node_modules/.bun/suspend-react@0.1.3+
|
|
43844
|
+
"../../node_modules/.bun/suspend-react@0.1.3+3f10a4be4e334a9b/node_modules/suspend-react/index.js"() {
|
|
43575
43845
|
isPromise = (promise) => typeof promise === "object" && typeof promise.then === "function";
|
|
43576
43846
|
globalCache = [];
|
|
43577
43847
|
suspend = (fn, keys2, config) => query(fn, keys2, false, config);
|
|
@@ -43924,7 +44194,7 @@ function x() {
|
|
|
43924
44194
|
}
|
|
43925
44195
|
var a, m, p, b;
|
|
43926
44196
|
var init_dist = __esm({
|
|
43927
|
-
"../../node_modules/.bun/its-fine@2.0.0+
|
|
44197
|
+
"../../node_modules/.bun/its-fine@2.0.0+b2e33729a97476bf/node_modules/its-fine/dist/index.js"() {
|
|
43928
44198
|
a = /* @__PURE__ */ l(/* @__PURE__ */ React10__namespace.createContext(null));
|
|
43929
44199
|
m = class extends React10__namespace.Component {
|
|
43930
44200
|
render() {
|
|
@@ -44240,6 +44510,35 @@ function releaseInternalPointerCapture(capturedMap, obj, captures, pointerId) {
|
|
|
44240
44510
|
}
|
|
44241
44511
|
}
|
|
44242
44512
|
}
|
|
44513
|
+
function swapInteractivity(store, object, newObject) {
|
|
44514
|
+
const {
|
|
44515
|
+
internal
|
|
44516
|
+
} = store.getState();
|
|
44517
|
+
for (let i3 = 0; i3 < internal.interaction.length; i3++) {
|
|
44518
|
+
if (internal.interaction[i3] === object) internal.interaction[i3] = newObject;
|
|
44519
|
+
}
|
|
44520
|
+
for (let i3 = 0; i3 < internal.initialHits.length; i3++) {
|
|
44521
|
+
if (internal.initialHits[i3] === object) internal.initialHits[i3] = newObject;
|
|
44522
|
+
}
|
|
44523
|
+
internal.hovered.forEach((value, key) => {
|
|
44524
|
+
if (value.eventObject === object || value.object === object) {
|
|
44525
|
+
internal.hovered.delete(key);
|
|
44526
|
+
const next = {
|
|
44527
|
+
...value,
|
|
44528
|
+
eventObject: value.eventObject === object ? newObject : value.eventObject,
|
|
44529
|
+
object: value.object === object ? newObject : value.object
|
|
44530
|
+
};
|
|
44531
|
+
internal.hovered.set(makeId(next), next);
|
|
44532
|
+
}
|
|
44533
|
+
});
|
|
44534
|
+
internal.capturedMap.forEach((captures) => {
|
|
44535
|
+
const captureData = captures.get(object);
|
|
44536
|
+
if (captureData) {
|
|
44537
|
+
captures.delete(object);
|
|
44538
|
+
captures.set(newObject, captureData);
|
|
44539
|
+
}
|
|
44540
|
+
});
|
|
44541
|
+
}
|
|
44243
44542
|
function removeInteractivity(store, object) {
|
|
44244
44543
|
const {
|
|
44245
44544
|
internal
|
|
@@ -50635,10 +50934,10 @@ This ensures that you're testing the behavior the user would see in the browser.
|
|
|
50635
50934
|
if ((ye & Zn) === Jn) {
|
|
50636
50935
|
var n = e2.tag;
|
|
50637
50936
|
if (n === 3 || n === 1 || n === 0 || n === 11 || n === 14 || n === 15) {
|
|
50638
|
-
if (n = G(e2) || "ReactComponent",
|
|
50639
|
-
if (
|
|
50640
|
-
|
|
50641
|
-
} else
|
|
50937
|
+
if (n = G(e2) || "ReactComponent", _m2 !== null) {
|
|
50938
|
+
if (_m2.has(n)) return;
|
|
50939
|
+
_m2.add(n);
|
|
50940
|
+
} else _m2 = /* @__PURE__ */ new Set([n]);
|
|
50642
50941
|
B(e2, function() {
|
|
50643
50942
|
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.");
|
|
50644
50943
|
});
|
|
@@ -51860,7 +52159,7 @@ Check the top-level render call using <` + i3 + ">.");
|
|
|
51860
52159
|
var bp = Symbol.for;
|
|
51861
52160
|
pm = bp("selector.component"), hm = bp("selector.has_pseudo_class"), mm = bp("selector.role"), gm = bp("selector.test_id"), ym = bp("selector.text");
|
|
51862
52161
|
}
|
|
51863
|
-
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,
|
|
52162
|
+
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;
|
|
51864
52163
|
try {
|
|
51865
52164
|
var o0 = Object.preventExtensions({});
|
|
51866
52165
|
} catch {
|
|
@@ -52317,9 +52616,11 @@ function swapInstances() {
|
|
|
52317
52616
|
if (parent) {
|
|
52318
52617
|
var _instance$props$objec, _instance$props$args;
|
|
52319
52618
|
const target = catalogue[toPascalCase(instance.type)];
|
|
52619
|
+
const prevObject = instance.object;
|
|
52320
52620
|
instance.object = (_instance$props$objec = instance.props.object) != null ? _instance$props$objec : new target(...(_instance$props$args = instance.props.args) != null ? _instance$props$args : []);
|
|
52321
52621
|
instance.object.__r3f = instance;
|
|
52322
52622
|
setFiberRef(fiber, instance.object);
|
|
52623
|
+
swapInteractivity(findInitialRoot(instance), prevObject, instance.object);
|
|
52323
52624
|
applyProps(instance.object, instance.props);
|
|
52324
52625
|
if (instance.props.attach) {
|
|
52325
52626
|
attach(parent, instance);
|
|
@@ -52903,8 +53204,8 @@ function createPointerEvents(store) {
|
|
|
52903
53204
|
};
|
|
52904
53205
|
}
|
|
52905
53206
|
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;
|
|
52906
|
-
var
|
|
52907
|
-
"../../node_modules/.bun/@react-three+fiber@9.6.
|
|
53207
|
+
var init_events_b389eeca_esm = __esm({
|
|
53208
|
+
"../../node_modules/.bun/@react-three+fiber@9.6.1+26134fee8850b5e9/node_modules/@react-three/fiber/dist/events-b389eeca.esm.js"() {
|
|
52908
53209
|
init_three_module();
|
|
52909
53210
|
init_traditional();
|
|
52910
53211
|
init_suspend_react();
|
|
@@ -53228,7 +53529,7 @@ var init_events_760a1017_esm = __esm({
|
|
|
53228
53529
|
e = 2;
|
|
53229
53530
|
packageData = {
|
|
53230
53531
|
name: "@react-three/fiber",
|
|
53231
|
-
version: "9.6.
|
|
53532
|
+
version: "9.6.1",
|
|
53232
53533
|
description: "A React renderer for Threejs",
|
|
53233
53534
|
keywords: [
|
|
53234
53535
|
"react",
|
|
@@ -53622,13 +53923,13 @@ function E(n) {
|
|
|
53622
53923
|
}
|
|
53623
53924
|
var k, D;
|
|
53624
53925
|
var init_dist2 = __esm({
|
|
53625
|
-
"../../node_modules/.bun/react-use-measure@2.1.7+
|
|
53926
|
+
"../../node_modules/.bun/react-use-measure@2.1.7+21ccd8898788a04d/node_modules/react-use-measure/dist/index.js"() {
|
|
53626
53927
|
k = ["x", "y", "top", "bottom", "left", "right", "width", "height"];
|
|
53627
53928
|
D = (n, t2) => k.every((o3) => n[o3] === t2[o3]);
|
|
53628
53929
|
}
|
|
53629
53930
|
});
|
|
53630
53931
|
|
|
53631
|
-
// ../../node_modules/.bun/@react-three+fiber@9.6.
|
|
53932
|
+
// ../../node_modules/.bun/@react-three+fiber@9.6.1+26134fee8850b5e9/node_modules/@react-three/fiber/dist/react-three-fiber.esm.js
|
|
53632
53933
|
var react_three_fiber_esm_exports = {};
|
|
53633
53934
|
__export(react_three_fiber_esm_exports, {
|
|
53634
53935
|
Canvas: () => Canvas,
|
|
@@ -53797,9 +54098,9 @@ function Canvas(props) {
|
|
|
53797
54098
|
});
|
|
53798
54099
|
}
|
|
53799
54100
|
var init_react_three_fiber_esm = __esm({
|
|
53800
|
-
"../../node_modules/.bun/@react-three+fiber@9.6.
|
|
53801
|
-
|
|
53802
|
-
|
|
54101
|
+
"../../node_modules/.bun/@react-three+fiber@9.6.1+26134fee8850b5e9/node_modules/@react-three/fiber/dist/react-three-fiber.esm.js"() {
|
|
54102
|
+
init_events_b389eeca_esm();
|
|
54103
|
+
init_events_b389eeca_esm();
|
|
53803
54104
|
init_three_module();
|
|
53804
54105
|
init_dist2();
|
|
53805
54106
|
init_dist();
|
|
@@ -53871,7 +54172,7 @@ function isRefObject(ref) {
|
|
|
53871
54172
|
}
|
|
53872
54173
|
var v1, v2, v3, v4, epsilon, getCameraCSSMatrix, getObjectCSSMatrix, Html;
|
|
53873
54174
|
var init_Html = __esm({
|
|
53874
|
-
"../../node_modules/.bun/@react-three+drei@10.7.7+
|
|
54175
|
+
"../../node_modules/.bun/@react-three+drei@10.7.7+20209eb6acc591f5/node_modules/@react-three/drei/web/Html.js"() {
|
|
53875
54176
|
init_extends();
|
|
53876
54177
|
init_three_module();
|
|
53877
54178
|
init_react_three_fiber_esm();
|
|
@@ -54188,16 +54489,16 @@ var init_Html = __esm({
|
|
|
54188
54489
|
}
|
|
54189
54490
|
});
|
|
54190
54491
|
|
|
54191
|
-
// ../../node_modules/.bun/three-stdlib@2.36.1+
|
|
54492
|
+
// ../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/_polyfill/constants.js
|
|
54192
54493
|
var version;
|
|
54193
54494
|
var init_constants = __esm({
|
|
54194
|
-
"../../node_modules/.bun/three-stdlib@2.36.1+
|
|
54495
|
+
"../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/_polyfill/constants.js"() {
|
|
54195
54496
|
init_three_module();
|
|
54196
54497
|
version = /* @__PURE__ */ (() => parseInt(REVISION.replace(/\D+/g, "")))();
|
|
54197
54498
|
}
|
|
54198
54499
|
});
|
|
54199
54500
|
|
|
54200
|
-
// ../../node_modules/.bun/three-stdlib@2.36.1+
|
|
54501
|
+
// ../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/utils/BufferGeometryUtils.js
|
|
54201
54502
|
function toTrianglesDrawMode(geometry, drawMode) {
|
|
54202
54503
|
if (drawMode === TrianglesDrawMode) {
|
|
54203
54504
|
console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.");
|
|
@@ -54257,15 +54558,15 @@ function toTrianglesDrawMode(geometry, drawMode) {
|
|
|
54257
54558
|
}
|
|
54258
54559
|
}
|
|
54259
54560
|
var init_BufferGeometryUtils = __esm({
|
|
54260
|
-
"../../node_modules/.bun/three-stdlib@2.36.1+
|
|
54561
|
+
"../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/utils/BufferGeometryUtils.js"() {
|
|
54261
54562
|
init_three_module();
|
|
54262
54563
|
}
|
|
54263
54564
|
});
|
|
54264
54565
|
|
|
54265
|
-
// ../../node_modules/.bun/three-stdlib@2.36.1+
|
|
54566
|
+
// ../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/controls/EventDispatcher.js
|
|
54266
54567
|
var __defProp2, __defNormalProp, __publicField, EventDispatcher2;
|
|
54267
54568
|
var init_EventDispatcher = __esm({
|
|
54268
|
-
"../../node_modules/.bun/three-stdlib@2.36.1+
|
|
54569
|
+
"../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/controls/EventDispatcher.js"() {
|
|
54269
54570
|
__defProp2 = Object.defineProperty;
|
|
54270
54571
|
__defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
54271
54572
|
__publicField = (obj, key, value) => {
|
|
@@ -54342,10 +54643,10 @@ var init_EventDispatcher = __esm({
|
|
|
54342
54643
|
}
|
|
54343
54644
|
});
|
|
54344
54645
|
|
|
54345
|
-
// ../../node_modules/.bun/three-stdlib@2.36.1+
|
|
54646
|
+
// ../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/controls/OrbitControls.js
|
|
54346
54647
|
var __defProp3, __defNormalProp2, __publicField2, _ray2, _plane, TILT_LIMIT, moduloWrapAround, OrbitControls;
|
|
54347
54648
|
var init_OrbitControls = __esm({
|
|
54348
|
-
"../../node_modules/.bun/three-stdlib@2.36.1+
|
|
54649
|
+
"../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/controls/OrbitControls.js"() {
|
|
54349
54650
|
init_three_module();
|
|
54350
54651
|
init_EventDispatcher();
|
|
54351
54652
|
__defProp3 = Object.defineProperty;
|
|
@@ -55181,7 +55482,7 @@ var init_OrbitControls = __esm({
|
|
|
55181
55482
|
}
|
|
55182
55483
|
});
|
|
55183
55484
|
|
|
55184
|
-
// ../../node_modules/.bun/three-stdlib@2.36.1+
|
|
55485
|
+
// ../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/_polyfill/LoaderUtils.js
|
|
55185
55486
|
function decodeText(array) {
|
|
55186
55487
|
if (typeof TextDecoder !== "undefined") {
|
|
55187
55488
|
return new TextDecoder().decode(array);
|
|
@@ -55197,11 +55498,11 @@ function decodeText(array) {
|
|
|
55197
55498
|
}
|
|
55198
55499
|
}
|
|
55199
55500
|
var init_LoaderUtils = __esm({
|
|
55200
|
-
"../../node_modules/.bun/three-stdlib@2.36.1+
|
|
55501
|
+
"../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/_polyfill/LoaderUtils.js"() {
|
|
55201
55502
|
}
|
|
55202
55503
|
});
|
|
55203
55504
|
|
|
55204
|
-
// ../../node_modules/.bun/three-stdlib@2.36.1+
|
|
55505
|
+
// ../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/loaders/GLTFLoader.js
|
|
55205
55506
|
function GLTFRegistry() {
|
|
55206
55507
|
let objects = {};
|
|
55207
55508
|
return {
|
|
@@ -55447,7 +55748,7 @@ function addPrimitiveAttributes(geometry, primitiveDef, parser) {
|
|
|
55447
55748
|
}
|
|
55448
55749
|
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;
|
|
55449
55750
|
var init_GLTFLoader = __esm({
|
|
55450
|
-
"../../node_modules/.bun/three-stdlib@2.36.1+
|
|
55751
|
+
"../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/loaders/GLTFLoader.js"() {
|
|
55451
55752
|
init_three_module();
|
|
55452
55753
|
init_BufferGeometryUtils();
|
|
55453
55754
|
init_constants();
|
|
@@ -57829,7 +58130,7 @@ var init_GLTFLoader = __esm({
|
|
|
57829
58130
|
}
|
|
57830
58131
|
});
|
|
57831
58132
|
|
|
57832
|
-
// ../../node_modules/.bun/three-stdlib@2.36.1+
|
|
58133
|
+
// ../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/loaders/DRACOLoader.js
|
|
57833
58134
|
function DRACOWorker() {
|
|
57834
58135
|
let decoderConfig;
|
|
57835
58136
|
let decoderPending;
|
|
@@ -57957,7 +58258,7 @@ function DRACOWorker() {
|
|
|
57957
58258
|
}
|
|
57958
58259
|
var _taskCache, DRACOLoader;
|
|
57959
58260
|
var init_DRACOLoader = __esm({
|
|
57960
|
-
"../../node_modules/.bun/three-stdlib@2.36.1+
|
|
58261
|
+
"../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/loaders/DRACOLoader.js"() {
|
|
57961
58262
|
init_three_module();
|
|
57962
58263
|
_taskCache = /* @__PURE__ */ new WeakMap();
|
|
57963
58264
|
DRACOLoader = class extends Loader {
|
|
@@ -58174,10 +58475,10 @@ var init_DRACOLoader = __esm({
|
|
|
58174
58475
|
}
|
|
58175
58476
|
});
|
|
58176
58477
|
|
|
58177
|
-
// ../../node_modules/.bun/three-stdlib@2.36.1+
|
|
58478
|
+
// ../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/libs/MeshoptDecoder.js
|
|
58178
58479
|
var generated, MeshoptDecoder;
|
|
58179
58480
|
var init_MeshoptDecoder = __esm({
|
|
58180
|
-
"../../node_modules/.bun/three-stdlib@2.36.1+
|
|
58481
|
+
"../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/libs/MeshoptDecoder.js"() {
|
|
58181
58482
|
MeshoptDecoder = () => {
|
|
58182
58483
|
if (generated)
|
|
58183
58484
|
return generated;
|
|
@@ -58398,9 +58699,9 @@ var init_MeshoptDecoder = __esm({
|
|
|
58398
58699
|
}
|
|
58399
58700
|
});
|
|
58400
58701
|
|
|
58401
|
-
// ../../node_modules/.bun/three-stdlib@2.36.1+
|
|
58702
|
+
// ../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/index.js
|
|
58402
58703
|
var init_three_stdlib = __esm({
|
|
58403
|
-
"../../node_modules/.bun/three-stdlib@2.36.1+
|
|
58704
|
+
"../../node_modules/.bun/three-stdlib@2.36.1+7b565cd016fb14f9/node_modules/three-stdlib/index.js"() {
|
|
58404
58705
|
init_OrbitControls();
|
|
58405
58706
|
init_GLTFLoader();
|
|
58406
58707
|
init_DRACOLoader();
|
|
@@ -58426,7 +58727,7 @@ function extensions(useDraco = true, useMeshopt = true, extendLoader) {
|
|
|
58426
58727
|
}
|
|
58427
58728
|
var dracoLoader, decoderPath, useGLTF;
|
|
58428
58729
|
var init_Gltf = __esm({
|
|
58429
|
-
"../../node_modules/.bun/@react-three+drei@10.7.7+
|
|
58730
|
+
"../../node_modules/.bun/@react-three+drei@10.7.7+20209eb6acc591f5/node_modules/@react-three/drei/core/Gltf.js"() {
|
|
58430
58731
|
init_extends();
|
|
58431
58732
|
init_three_stdlib();
|
|
58432
58733
|
init_react_three_fiber_esm();
|
|
@@ -58442,7 +58743,7 @@ var init_Gltf = __esm({
|
|
|
58442
58743
|
});
|
|
58443
58744
|
var OrbitControls2;
|
|
58444
58745
|
var init_OrbitControls2 = __esm({
|
|
58445
|
-
"../../node_modules/.bun/@react-three+drei@10.7.7+
|
|
58746
|
+
"../../node_modules/.bun/@react-three+drei@10.7.7+20209eb6acc591f5/node_modules/@react-three/drei/core/OrbitControls.js"() {
|
|
58446
58747
|
init_extends();
|
|
58447
58748
|
init_react_three_fiber_esm();
|
|
58448
58749
|
init_three_stdlib();
|
|
@@ -58520,12 +58821,12 @@ var init_OrbitControls2 = __esm({
|
|
|
58520
58821
|
}
|
|
58521
58822
|
});
|
|
58522
58823
|
var init_camera_controls_module = __esm({
|
|
58523
|
-
"../../node_modules/.bun/camera-controls@3.1.2+
|
|
58824
|
+
"../../node_modules/.bun/camera-controls@3.1.2+7b565cd016fb14f9/node_modules/camera-controls/dist/camera-controls.module.js"() {
|
|
58524
58825
|
}
|
|
58525
58826
|
});
|
|
58526
58827
|
var Center;
|
|
58527
58828
|
var init_Center = __esm({
|
|
58528
|
-
"../../node_modules/.bun/@react-three+drei@10.7.7+
|
|
58829
|
+
"../../node_modules/.bun/@react-three+drei@10.7.7+20209eb6acc591f5/node_modules/@react-three/drei/core/Center.js"() {
|
|
58529
58830
|
init_extends();
|
|
58530
58831
|
init_three_module();
|
|
58531
58832
|
Center = /* @__PURE__ */ React10__namespace.forwardRef(function Center2({
|
|
@@ -58590,9 +58891,9 @@ var init_Center = __esm({
|
|
|
58590
58891
|
}
|
|
58591
58892
|
});
|
|
58592
58893
|
|
|
58593
|
-
// ../../node_modules/.bun/@react-three+drei@10.7.7+
|
|
58894
|
+
// ../../node_modules/.bun/@react-three+drei@10.7.7+20209eb6acc591f5/node_modules/@react-three/drei/index.js
|
|
58594
58895
|
var init_drei = __esm({
|
|
58595
|
-
"../../node_modules/.bun/@react-three+drei@10.7.7+
|
|
58896
|
+
"../../node_modules/.bun/@react-three+drei@10.7.7+20209eb6acc591f5/node_modules/@react-three/drei/index.js"() {
|
|
58596
58897
|
init_Html();
|
|
58597
58898
|
init_Gltf();
|
|
58598
58899
|
init_OrbitControls2();
|
|
@@ -73790,6 +74091,13 @@ function hasDistinctScriptFonts(fonts) {
|
|
|
73790
74091
|
}
|
|
73791
74092
|
return Boolean(fonts.eastAsia) && fonts.eastAsia !== base || Boolean(fonts.complexScript) && fonts.complexScript !== base || Boolean(fonts.symbol) && fonts.symbol !== base;
|
|
73792
74093
|
}
|
|
74094
|
+
function sanitizeMathMl(markup) {
|
|
74095
|
+
const purify = DOMPurify__default.default;
|
|
74096
|
+
if (typeof purify.sanitize !== "function") {
|
|
74097
|
+
return markup;
|
|
74098
|
+
}
|
|
74099
|
+
return purify.sanitize(markup, { USE_PROFILES: { mathMl: true, svg: true } });
|
|
74100
|
+
}
|
|
73793
74101
|
function renderScriptAwareText(text2, needsScriptFonts, scriptFonts, baseFontFamily, keyPrefix) {
|
|
73794
74102
|
if (!needsScriptFonts || !text2) {
|
|
73795
74103
|
return text2;
|
|
@@ -73880,14 +74188,15 @@ function renderSegmentContent(elementId, segmentIndex, textValue, lines, needsSc
|
|
|
73880
74188
|
}
|
|
73881
74189
|
function renderEquationSegment(elementId, segmentIndex, equationXml, equationNumber) {
|
|
73882
74190
|
const mathml = convertOmmlToMathMl(equationXml);
|
|
73883
|
-
const
|
|
74191
|
+
const safeMathml = mathml ? sanitizeMathMl(mathml) : "";
|
|
74192
|
+
const equationContent = safeMathml ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
73884
74193
|
"span",
|
|
73885
74194
|
{
|
|
73886
74195
|
className: "inline-block align-middle",
|
|
73887
74196
|
style: {
|
|
73888
74197
|
fontFamily: '"Cambria Math", "STIX Two Math", serif'
|
|
73889
74198
|
},
|
|
73890
|
-
dangerouslySetInnerHTML: { __html:
|
|
74199
|
+
dangerouslySetInnerHTML: { __html: safeMathml }
|
|
73891
74200
|
}
|
|
73892
74201
|
) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-block px-1 py-0.5 rounded text-xs bg-gray-200/20 text-gray-400 italic", children: "Equation" });
|
|
73893
74202
|
if (equationNumber) {
|
|
@@ -86244,7 +86553,7 @@ function ResizeHandle({
|
|
|
86244
86553
|
}
|
|
86245
86554
|
);
|
|
86246
86555
|
}
|
|
86247
|
-
function
|
|
86556
|
+
function SlideThumbnailImpl({
|
|
86248
86557
|
slide,
|
|
86249
86558
|
templateElements,
|
|
86250
86559
|
canvasSize
|
|
@@ -86482,6 +86791,37 @@ function ThumbnailTable({
|
|
|
86482
86791
|
}
|
|
86483
86792
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center text-[10px] text-muted-foreground pointer-events-none", children: "Table" });
|
|
86484
86793
|
}
|
|
86794
|
+
function arePropsEqual(prev, next) {
|
|
86795
|
+
if (prev.slide.id !== next.slide.id) {
|
|
86796
|
+
return false;
|
|
86797
|
+
}
|
|
86798
|
+
if (prev.slide.isDirty !== next.slide.isDirty) {
|
|
86799
|
+
return false;
|
|
86800
|
+
}
|
|
86801
|
+
if (prev.slide.hidden !== next.slide.hidden) {
|
|
86802
|
+
return false;
|
|
86803
|
+
}
|
|
86804
|
+
if (prev.slide.elements !== next.slide.elements) {
|
|
86805
|
+
return false;
|
|
86806
|
+
}
|
|
86807
|
+
if (prev.slide.backgroundColor !== next.slide.backgroundColor) {
|
|
86808
|
+
return false;
|
|
86809
|
+
}
|
|
86810
|
+
if (prev.slide.backgroundImage !== next.slide.backgroundImage) {
|
|
86811
|
+
return false;
|
|
86812
|
+
}
|
|
86813
|
+
if (prev.slide.backgroundGradient !== next.slide.backgroundGradient) {
|
|
86814
|
+
return false;
|
|
86815
|
+
}
|
|
86816
|
+
if (prev.templateElements !== next.templateElements) {
|
|
86817
|
+
return false;
|
|
86818
|
+
}
|
|
86819
|
+
if (prev.canvasSize.width !== next.canvasSize.width || prev.canvasSize.height !== next.canvasSize.height) {
|
|
86820
|
+
return false;
|
|
86821
|
+
}
|
|
86822
|
+
return true;
|
|
86823
|
+
}
|
|
86824
|
+
var SlideThumbnail = React10__namespace.default.memo(SlideThumbnailImpl, arePropsEqual);
|
|
86485
86825
|
function ContextMenu({
|
|
86486
86826
|
contextMenuState,
|
|
86487
86827
|
mode,
|
|
@@ -90215,7 +90555,7 @@ function BendingProcessRenderer({
|
|
|
90215
90555
|
}
|
|
90216
90556
|
);
|
|
90217
90557
|
}
|
|
90218
|
-
function
|
|
90558
|
+
function SmartArtRendererImpl({
|
|
90219
90559
|
element: element2,
|
|
90220
90560
|
className = ""
|
|
90221
90561
|
}) {
|
|
@@ -90326,6 +90666,30 @@ function renderLayout(layoutType, element2, nodes, palette, style) {
|
|
|
90326
90666
|
}
|
|
90327
90667
|
return /* @__PURE__ */ jsxRuntime.jsx(ListRenderer, { element: element2, nodes, palette, style });
|
|
90328
90668
|
}
|
|
90669
|
+
function arePropsEqual2(prev, next) {
|
|
90670
|
+
if (prev.className !== next.className) {
|
|
90671
|
+
return false;
|
|
90672
|
+
}
|
|
90673
|
+
if (prev.element.id !== next.element.id) {
|
|
90674
|
+
return false;
|
|
90675
|
+
}
|
|
90676
|
+
if (prev.element.type !== next.element.type) {
|
|
90677
|
+
return false;
|
|
90678
|
+
}
|
|
90679
|
+
if (prev.element.width !== next.element.width || prev.element.height !== next.element.height) {
|
|
90680
|
+
return false;
|
|
90681
|
+
}
|
|
90682
|
+
if (prev.element.x !== next.element.x || prev.element.y !== next.element.y) {
|
|
90683
|
+
return false;
|
|
90684
|
+
}
|
|
90685
|
+
const prevData = prev.element.type === "smartArt" ? prev.element.smartArtData : void 0;
|
|
90686
|
+
const nextData = next.element.type === "smartArt" ? next.element.smartArtData : void 0;
|
|
90687
|
+
if (prevData !== nextData) {
|
|
90688
|
+
return false;
|
|
90689
|
+
}
|
|
90690
|
+
return true;
|
|
90691
|
+
}
|
|
90692
|
+
var SmartArtRenderer = React10__namespace.default.memo(SmartArtRendererImpl, arePropsEqual2);
|
|
90329
90693
|
function ZoomElementRenderer({
|
|
90330
90694
|
element: element2,
|
|
90331
90695
|
slides,
|
|
@@ -93364,7 +93728,7 @@ function SectionBlock({
|
|
|
93364
93728
|
)
|
|
93365
93729
|
] });
|
|
93366
93730
|
}
|
|
93367
|
-
function
|
|
93731
|
+
function SlideCardImpl({
|
|
93368
93732
|
slide,
|
|
93369
93733
|
index,
|
|
93370
93734
|
isActive,
|
|
@@ -93418,6 +93782,49 @@ function SlideCard({
|
|
|
93418
93782
|
}
|
|
93419
93783
|
);
|
|
93420
93784
|
}
|
|
93785
|
+
function arePropsEqual3(prev, next) {
|
|
93786
|
+
if (prev.slide.id !== next.slide.id) {
|
|
93787
|
+
return false;
|
|
93788
|
+
}
|
|
93789
|
+
if (prev.slide.isDirty !== next.slide.isDirty) {
|
|
93790
|
+
return false;
|
|
93791
|
+
}
|
|
93792
|
+
if (prev.slide.hidden !== next.slide.hidden) {
|
|
93793
|
+
return false;
|
|
93794
|
+
}
|
|
93795
|
+
if (prev.slide.elements !== next.slide.elements) {
|
|
93796
|
+
return false;
|
|
93797
|
+
}
|
|
93798
|
+
if (prev.index !== next.index) {
|
|
93799
|
+
return false;
|
|
93800
|
+
}
|
|
93801
|
+
if (prev.isActive !== next.isActive) {
|
|
93802
|
+
return false;
|
|
93803
|
+
}
|
|
93804
|
+
if (prev.isDragTarget !== next.isDragTarget) {
|
|
93805
|
+
return false;
|
|
93806
|
+
}
|
|
93807
|
+
if (prev.isSelected !== next.isSelected) {
|
|
93808
|
+
return false;
|
|
93809
|
+
}
|
|
93810
|
+
if (prev.selectedCount !== next.selectedCount) {
|
|
93811
|
+
return false;
|
|
93812
|
+
}
|
|
93813
|
+
if (prev.selectionOrder !== next.selectionOrder) {
|
|
93814
|
+
return false;
|
|
93815
|
+
}
|
|
93816
|
+
if (prev.canEdit !== next.canEdit) {
|
|
93817
|
+
return false;
|
|
93818
|
+
}
|
|
93819
|
+
if (prev.canvasSize.width !== next.canvasSize.width || prev.canvasSize.height !== next.canvasSize.height) {
|
|
93820
|
+
return false;
|
|
93821
|
+
}
|
|
93822
|
+
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) {
|
|
93823
|
+
return false;
|
|
93824
|
+
}
|
|
93825
|
+
return true;
|
|
93826
|
+
}
|
|
93827
|
+
var SlideCard = React10__namespace.default.memo(SlideCardImpl, arePropsEqual3);
|
|
93421
93828
|
function SorterContextMenu({
|
|
93422
93829
|
x: x2,
|
|
93423
93830
|
y,
|
|
@@ -94211,6 +94618,14 @@ function getCurrentParagraphIndex(editorEl, segments) {
|
|
|
94211
94618
|
}
|
|
94212
94619
|
return paraIdx;
|
|
94213
94620
|
}
|
|
94621
|
+
var CSS_VALUE_SAFE = /^[a-zA-Z0-9 _,.\-+#'%/]{1,100}$/;
|
|
94622
|
+
function isCssValueSafe(value) {
|
|
94623
|
+
if (value === void 0 || value === null) {
|
|
94624
|
+
return false;
|
|
94625
|
+
}
|
|
94626
|
+
const str = String(value);
|
|
94627
|
+
return str.length > 0 && CSS_VALUE_SAFE.test(str);
|
|
94628
|
+
}
|
|
94214
94629
|
function deriveStyleFromElement(element2, inheritedStyle) {
|
|
94215
94630
|
const style = { ...inheritedStyle };
|
|
94216
94631
|
const tagName = element2.tagName.toLowerCase();
|
|
@@ -94343,17 +94758,17 @@ function segmentsToEditorHtml(segments) {
|
|
|
94343
94758
|
if (segment.style.strikethrough) {
|
|
94344
94759
|
inlineStyles.push("text-decoration:line-through");
|
|
94345
94760
|
}
|
|
94346
|
-
if (segment.style.color) {
|
|
94761
|
+
if (segment.style.color && isCssValueSafe(segment.style.color)) {
|
|
94347
94762
|
inlineStyles.push(`color:${segment.style.color}`);
|
|
94348
94763
|
}
|
|
94349
|
-
if (segment.style.fontSize) {
|
|
94350
|
-
inlineStyles.push(`font-size:${segment.style.fontSize}pt`);
|
|
94764
|
+
if (segment.style.fontSize && Number.isFinite(Number(segment.style.fontSize))) {
|
|
94765
|
+
inlineStyles.push(`font-size:${Number(segment.style.fontSize)}pt`);
|
|
94351
94766
|
}
|
|
94352
|
-
if (segment.style.fontFamily) {
|
|
94767
|
+
if (segment.style.fontFamily && isCssValueSafe(segment.style.fontFamily)) {
|
|
94353
94768
|
inlineStyles.push(`font-family:${segment.style.fontFamily}`);
|
|
94354
94769
|
}
|
|
94355
94770
|
const text2 = escapeHtml(segment.text);
|
|
94356
|
-
if (segment.style.hyperlink) {
|
|
94771
|
+
if (segment.style.hyperlink && isUrlSafe(segment.style.hyperlink)) {
|
|
94357
94772
|
const href = escapeHtml(segment.style.hyperlink);
|
|
94358
94773
|
return `<a href="${href}" style="color:#4a9eff;text-decoration:underline;cursor:pointer" data-hyperlink="${href}">${text2}</a>`;
|
|
94359
94774
|
}
|
|
@@ -94436,7 +94851,8 @@ function renderRichNotesSegments(segments) {
|
|
|
94436
94851
|
if (segment.style.fontFamily) {
|
|
94437
94852
|
style.fontFamily = segment.style.fontFamily;
|
|
94438
94853
|
}
|
|
94439
|
-
if (segment.style.hyperlink) {
|
|
94854
|
+
if (segment.style.hyperlink && isUrlSafe(segment.style.hyperlink)) {
|
|
94855
|
+
const safeHref = segment.style.hyperlink;
|
|
94440
94856
|
style.color = "#4a9eff";
|
|
94441
94857
|
style.textDecoration = "underline";
|
|
94442
94858
|
style.cursor = "pointer";
|
|
@@ -94444,11 +94860,11 @@ function renderRichNotesSegments(segments) {
|
|
|
94444
94860
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
94445
94861
|
"a",
|
|
94446
94862
|
{
|
|
94447
|
-
href:
|
|
94863
|
+
href: safeHref,
|
|
94448
94864
|
style,
|
|
94449
94865
|
onClick: (e2) => {
|
|
94450
94866
|
e2.preventDefault();
|
|
94451
|
-
|
|
94867
|
+
safeOpenUrl(safeHref);
|
|
94452
94868
|
},
|
|
94453
94869
|
children: segment.text
|
|
94454
94870
|
},
|
|
@@ -95000,7 +95416,7 @@ function useSlideNotes({
|
|
|
95000
95416
|
const href = target.getAttribute("data-hyperlink") || target.getAttribute("href");
|
|
95001
95417
|
if (href && (e2.ctrlKey || e2.metaKey)) {
|
|
95002
95418
|
e2.preventDefault();
|
|
95003
|
-
|
|
95419
|
+
safeOpenUrl(href);
|
|
95004
95420
|
}
|
|
95005
95421
|
}, []);
|
|
95006
95422
|
return {
|
|
@@ -96673,7 +97089,7 @@ function renderNotesSegments(segments) {
|
|
|
96673
97089
|
return React10__namespace.default.createElement("span", { key: `seg-${index}`, style }, segment.text);
|
|
96674
97090
|
});
|
|
96675
97091
|
}
|
|
96676
|
-
function
|
|
97092
|
+
function ScaledSlidePreviewImpl({
|
|
96677
97093
|
slide,
|
|
96678
97094
|
templateElements,
|
|
96679
97095
|
canvasSize,
|
|
@@ -96820,6 +97236,40 @@ function ScaledSlidePreview({
|
|
|
96820
97236
|
}
|
|
96821
97237
|
);
|
|
96822
97238
|
}
|
|
97239
|
+
function arePropsEqual4(prev, next) {
|
|
97240
|
+
if (prev.slide.id !== next.slide.id) {
|
|
97241
|
+
return false;
|
|
97242
|
+
}
|
|
97243
|
+
if (prev.slide.isDirty !== next.slide.isDirty) {
|
|
97244
|
+
return false;
|
|
97245
|
+
}
|
|
97246
|
+
if (prev.slide.hidden !== next.slide.hidden) {
|
|
97247
|
+
return false;
|
|
97248
|
+
}
|
|
97249
|
+
if (prev.slide.elements !== next.slide.elements) {
|
|
97250
|
+
return false;
|
|
97251
|
+
}
|
|
97252
|
+
if (prev.slide.backgroundColor !== next.slide.backgroundColor) {
|
|
97253
|
+
return false;
|
|
97254
|
+
}
|
|
97255
|
+
if (prev.slide.backgroundImage !== next.slide.backgroundImage) {
|
|
97256
|
+
return false;
|
|
97257
|
+
}
|
|
97258
|
+
if (prev.slide.backgroundGradient !== next.slide.backgroundGradient) {
|
|
97259
|
+
return false;
|
|
97260
|
+
}
|
|
97261
|
+
if (prev.templateElements !== next.templateElements) {
|
|
97262
|
+
return false;
|
|
97263
|
+
}
|
|
97264
|
+
if (prev.canvasSize.width !== next.canvasSize.width || prev.canvasSize.height !== next.canvasSize.height) {
|
|
97265
|
+
return false;
|
|
97266
|
+
}
|
|
97267
|
+
if (prev.className !== next.className) {
|
|
97268
|
+
return false;
|
|
97269
|
+
}
|
|
97270
|
+
return true;
|
|
97271
|
+
}
|
|
97272
|
+
var ScaledSlidePreview = React10__namespace.default.memo(ScaledSlidePreviewImpl, arePropsEqual4);
|
|
96823
97273
|
function PresenterView({
|
|
96824
97274
|
slides,
|
|
96825
97275
|
currentSlideIndex,
|
|
@@ -111123,6 +111573,13 @@ function convertOmmlToLatex(omml) {
|
|
|
111123
111573
|
}
|
|
111124
111574
|
return ommlChildrenToLatex(oMath);
|
|
111125
111575
|
}
|
|
111576
|
+
function sanitizeMathMl2(markup) {
|
|
111577
|
+
const purify = DOMPurify__default.default;
|
|
111578
|
+
if (typeof purify.sanitize !== "function") {
|
|
111579
|
+
return markup;
|
|
111580
|
+
}
|
|
111581
|
+
return purify.sanitize(markup, { USE_PROFILES: { mathMl: true, svg: true } });
|
|
111582
|
+
}
|
|
111126
111583
|
var TEMPLATES = [
|
|
111127
111584
|
{
|
|
111128
111585
|
label: "Fraction",
|
|
@@ -111188,7 +111645,8 @@ var TEMPLATES = [
|
|
|
111188
111645
|
var TEMPLATE_MATHML = TEMPLATES.map((tmpl) => {
|
|
111189
111646
|
try {
|
|
111190
111647
|
const tmplOmml = convertLatexToOmml(tmpl.latex);
|
|
111191
|
-
|
|
111648
|
+
const raw = convertOmmlToMathMl(tmplOmml);
|
|
111649
|
+
return raw ? sanitizeMathMl2(raw) : "";
|
|
111192
111650
|
} catch {
|
|
111193
111651
|
return "";
|
|
111194
111652
|
}
|
|
@@ -111200,7 +111658,7 @@ function MathMlPreview({ mathml }) {
|
|
|
111200
111658
|
return;
|
|
111201
111659
|
}
|
|
111202
111660
|
if (mathml) {
|
|
111203
|
-
containerRef.current.innerHTML = mathml;
|
|
111661
|
+
containerRef.current.innerHTML = sanitizeMathMl2(mathml);
|
|
111204
111662
|
} else {
|
|
111205
111663
|
containerRef.current.innerHTML = "";
|
|
111206
111664
|
}
|
|
@@ -111228,6 +111686,7 @@ function EquationEditorDialog({
|
|
|
111228
111686
|
return convertOmmlToLatex(existingOmml);
|
|
111229
111687
|
}, [existingOmml]);
|
|
111230
111688
|
const [latex, setLatex] = React10.useState(initialLatex);
|
|
111689
|
+
const deferredLatex = React10.useDeferredValue(latex);
|
|
111231
111690
|
const textareaRef = React10.useRef(null);
|
|
111232
111691
|
React10.useEffect(() => {
|
|
111233
111692
|
if (isOpen) {
|
|
@@ -111236,17 +111695,17 @@ function EquationEditorDialog({
|
|
|
111236
111695
|
}
|
|
111237
111696
|
}, [isOpen, initialLatex]);
|
|
111238
111697
|
const { mathml, omml } = React10.useMemo(() => {
|
|
111239
|
-
if (!
|
|
111698
|
+
if (!deferredLatex.trim()) {
|
|
111240
111699
|
return { mathml: "", omml: {} };
|
|
111241
111700
|
}
|
|
111242
111701
|
try {
|
|
111243
|
-
const ommlObj = convertLatexToOmml(
|
|
111702
|
+
const ommlObj = convertLatexToOmml(deferredLatex);
|
|
111244
111703
|
const mathmlStr = convertOmmlToMathMl(ommlObj);
|
|
111245
111704
|
return { mathml: mathmlStr, omml: ommlObj };
|
|
111246
111705
|
} catch {
|
|
111247
111706
|
return { mathml: "", omml: {} };
|
|
111248
111707
|
}
|
|
111249
|
-
}, [
|
|
111708
|
+
}, [deferredLatex]);
|
|
111250
111709
|
const handleInsert = React10.useCallback(() => {
|
|
111251
111710
|
if (!latex.trim()) {
|
|
111252
111711
|
return;
|
|
@@ -114010,6 +114469,7 @@ function useEditorHistory(input) {
|
|
|
114010
114469
|
const historyFutureRef = React10.useRef([]);
|
|
114011
114470
|
const lastHistorySnapshotRef = React10.useRef(null);
|
|
114012
114471
|
const lastHistorySerializedRef = React10.useRef("");
|
|
114472
|
+
const lastCheapHashRef = React10.useRef("");
|
|
114013
114473
|
const isApplyingHistoryRef = React10.useRef(false);
|
|
114014
114474
|
const unlockHistoryTimerRef = React10.useRef(null);
|
|
114015
114475
|
const [canUndo, setCanUndo] = React10.useState(false);
|
|
@@ -114151,15 +114611,21 @@ function useEditorHistory(input) {
|
|
|
114151
114611
|
if (hasActivePointerInteraction()) {
|
|
114152
114612
|
return;
|
|
114153
114613
|
}
|
|
114614
|
+
const cheapHash = `${slides.length}|${activeSlideIndex}|${canvasSize.width}x${canvasSize.height}|${slides.map((s) => `${s.id}:${s.elements.length}`).join("/")}`;
|
|
114615
|
+
if (cheapHash === lastCheapHashRef.current) {
|
|
114616
|
+
return;
|
|
114617
|
+
}
|
|
114154
114618
|
const snapshot2 = buildHistorySnapshot();
|
|
114155
114619
|
const serialized = JSON.stringify(snapshot2);
|
|
114156
114620
|
if (serialized === lastHistorySerializedRef.current) {
|
|
114621
|
+
lastCheapHashRef.current = cheapHash;
|
|
114157
114622
|
return;
|
|
114158
114623
|
}
|
|
114159
114624
|
const previousSnapshot = lastHistorySnapshotRef.current;
|
|
114160
114625
|
if (!previousSnapshot) {
|
|
114161
114626
|
lastHistorySnapshotRef.current = cloneHistorySnapshot(snapshot2);
|
|
114162
114627
|
lastHistorySerializedRef.current = serialized;
|
|
114628
|
+
lastCheapHashRef.current = cheapHash;
|
|
114163
114629
|
updateHistoryAvailability();
|
|
114164
114630
|
return;
|
|
114165
114631
|
}
|
|
@@ -114170,13 +114636,18 @@ function useEditorHistory(input) {
|
|
|
114170
114636
|
historyFutureRef.current = [];
|
|
114171
114637
|
lastHistorySnapshotRef.current = cloneHistorySnapshot(snapshot2);
|
|
114172
114638
|
lastHistorySerializedRef.current = serialized;
|
|
114639
|
+
lastCheapHashRef.current = cheapHash;
|
|
114173
114640
|
updateHistoryAvailability();
|
|
114174
114641
|
}, [
|
|
114642
|
+
activeSlideIndex,
|
|
114175
114643
|
buildHistorySnapshot,
|
|
114644
|
+
canvasSize.height,
|
|
114645
|
+
canvasSize.width,
|
|
114176
114646
|
error2,
|
|
114177
114647
|
hasActivePointerInteraction,
|
|
114178
114648
|
loading2,
|
|
114179
114649
|
pointerCommitNonce,
|
|
114650
|
+
slides,
|
|
114180
114651
|
updateHistoryAvailability
|
|
114181
114652
|
]);
|
|
114182
114653
|
return {
|
|
@@ -117869,6 +118340,7 @@ var DB_NAME2 = "pptx-viewer-audience";
|
|
|
117869
118340
|
var DB_VERSION2 = 1;
|
|
117870
118341
|
var STORE_NAME2 = "content";
|
|
117871
118342
|
var CONTENT_KEY = "pptx-bytes";
|
|
118343
|
+
var MAX_CONTENT_AGE_MS = 5 * 60 * 1e3;
|
|
117872
118344
|
function openDb() {
|
|
117873
118345
|
return new Promise((resolve2, reject) => {
|
|
117874
118346
|
const request = indexedDB.open(DB_NAME2, DB_VERSION2);
|
|
@@ -117888,7 +118360,8 @@ async function storeAudienceContent(content) {
|
|
|
117888
118360
|
const tx = db.transaction(STORE_NAME2, "readwrite");
|
|
117889
118361
|
const store = tx.objectStore(STORE_NAME2);
|
|
117890
118362
|
const bytes = content instanceof Uint8Array ? content : new Uint8Array(content);
|
|
117891
|
-
|
|
118363
|
+
const record = { bytes, createdAt: Date.now() };
|
|
118364
|
+
store.put(record, CONTENT_KEY);
|
|
117892
118365
|
tx.oncomplete = () => {
|
|
117893
118366
|
db.close();
|
|
117894
118367
|
resolve2();
|
|
@@ -117909,13 +118382,24 @@ async function loadAudienceContent() {
|
|
|
117909
118382
|
request.onsuccess = () => {
|
|
117910
118383
|
db.close();
|
|
117911
118384
|
const result = request.result;
|
|
117912
|
-
if (result
|
|
117913
|
-
|
|
117914
|
-
|
|
117915
|
-
|
|
117916
|
-
|
|
117917
|
-
|
|
118385
|
+
if (result && typeof result === "object" && "bytes" in result && "createdAt" in result) {
|
|
118386
|
+
const record = result;
|
|
118387
|
+
const age = Date.now() - record.createdAt;
|
|
118388
|
+
if (age > MAX_CONTENT_AGE_MS) {
|
|
118389
|
+
resolve2(null);
|
|
118390
|
+
return;
|
|
118391
|
+
}
|
|
118392
|
+
const raw = record.bytes;
|
|
118393
|
+
if (raw instanceof Uint8Array) {
|
|
118394
|
+
resolve2(raw);
|
|
118395
|
+
} else if (raw instanceof ArrayBuffer) {
|
|
118396
|
+
resolve2(new Uint8Array(raw));
|
|
118397
|
+
} else {
|
|
118398
|
+
resolve2(null);
|
|
118399
|
+
}
|
|
118400
|
+
return;
|
|
117918
118401
|
}
|
|
118402
|
+
resolve2(null);
|
|
117919
118403
|
};
|
|
117920
118404
|
request.onerror = () => {
|
|
117921
118405
|
db.close();
|
|
@@ -117948,14 +118432,34 @@ async function clearAudienceContent() {
|
|
|
117948
118432
|
var PRESENTER_CHANNEL_NAME = "pptx-viewer-presenter";
|
|
117949
118433
|
var AUDIENCE_HASH = "#pptx-audience";
|
|
117950
118434
|
var PRESENTER_MSG_ORIGIN = "pptx-viewer-presenter";
|
|
118435
|
+
var AUDIENCE_NONCE_KEY = "nonce";
|
|
118436
|
+
function generateSessionId() {
|
|
118437
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
118438
|
+
return crypto.randomUUID();
|
|
118439
|
+
}
|
|
118440
|
+
return `s${Date.now().toString(36)}${Math.random().toString(36).slice(2, 10)}`;
|
|
118441
|
+
}
|
|
118442
|
+
function parseAudienceNonce() {
|
|
118443
|
+
const hash = window.location.hash;
|
|
118444
|
+
if (!hash.startsWith(AUDIENCE_HASH)) {
|
|
118445
|
+
return null;
|
|
118446
|
+
}
|
|
118447
|
+
const trailing = hash.slice(AUDIENCE_HASH.length);
|
|
118448
|
+
if (!trailing) {
|
|
118449
|
+
return null;
|
|
118450
|
+
}
|
|
118451
|
+
const params2 = new URLSearchParams(trailing.replace(/^[&;?]/, ""));
|
|
118452
|
+
return params2.get(AUDIENCE_NONCE_KEY);
|
|
118453
|
+
}
|
|
117951
118454
|
function isAudienceTab() {
|
|
117952
|
-
return window.location.hash
|
|
118455
|
+
return window.location.hash.startsWith(AUDIENCE_HASH);
|
|
117953
118456
|
}
|
|
117954
118457
|
function usePresenterWindow(input) {
|
|
117955
118458
|
const { currentSlideIndex, isPresenterMode, content } = input;
|
|
117956
118459
|
const audienceWindowRef = React10.useRef(null);
|
|
117957
118460
|
const channelRef = React10.useRef(null);
|
|
117958
118461
|
const pollTimerRef = React10.useRef(null);
|
|
118462
|
+
const sessionIdRef = React10.useRef("");
|
|
117959
118463
|
const getChannel2 = React10.useCallback(() => {
|
|
117960
118464
|
if (!channelRef.current) {
|
|
117961
118465
|
channelRef.current = new BroadcastChannel(PRESENTER_CHANNEL_NAME);
|
|
@@ -117967,10 +118471,14 @@ function usePresenterWindow(input) {
|
|
|
117967
118471
|
}, []);
|
|
117968
118472
|
const syncSlideToAudience = React10.useCallback(
|
|
117969
118473
|
(slideIndex) => {
|
|
118474
|
+
if (!sessionIdRef.current) {
|
|
118475
|
+
return;
|
|
118476
|
+
}
|
|
117970
118477
|
const msg = {
|
|
117971
118478
|
origin: PRESENTER_MSG_ORIGIN,
|
|
117972
118479
|
type: "presenter-slide-change",
|
|
117973
|
-
slideIndex
|
|
118480
|
+
slideIndex,
|
|
118481
|
+
sessionId: sessionIdRef.current
|
|
117974
118482
|
};
|
|
117975
118483
|
try {
|
|
117976
118484
|
getChannel2().postMessage(msg);
|
|
@@ -117980,13 +118488,16 @@ function usePresenterWindow(input) {
|
|
|
117980
118488
|
[getChannel2]
|
|
117981
118489
|
);
|
|
117982
118490
|
const closeAudienceWindow = React10.useCallback(() => {
|
|
117983
|
-
|
|
117984
|
-
|
|
117985
|
-
|
|
117986
|
-
|
|
117987
|
-
|
|
117988
|
-
|
|
117989
|
-
|
|
118491
|
+
if (sessionIdRef.current) {
|
|
118492
|
+
try {
|
|
118493
|
+
const exitMsg = {
|
|
118494
|
+
origin: PRESENTER_MSG_ORIGIN,
|
|
118495
|
+
type: "presenter-exit",
|
|
118496
|
+
sessionId: sessionIdRef.current
|
|
118497
|
+
};
|
|
118498
|
+
getChannel2().postMessage(exitMsg);
|
|
118499
|
+
} catch {
|
|
118500
|
+
}
|
|
117990
118501
|
}
|
|
117991
118502
|
const win = audienceWindowRef.current;
|
|
117992
118503
|
if (win && !win.closed) {
|
|
@@ -117996,6 +118507,7 @@ function usePresenterWindow(input) {
|
|
|
117996
118507
|
}
|
|
117997
118508
|
}
|
|
117998
118509
|
audienceWindowRef.current = null;
|
|
118510
|
+
sessionIdRef.current = "";
|
|
117999
118511
|
if (pollTimerRef.current !== null) {
|
|
118000
118512
|
clearInterval(pollTimerRef.current);
|
|
118001
118513
|
pollTimerRef.current = null;
|
|
@@ -118006,20 +118518,53 @@ function usePresenterWindow(input) {
|
|
|
118006
118518
|
if (isAudienceWindowOpen()) {
|
|
118007
118519
|
closeAudienceWindow();
|
|
118008
118520
|
}
|
|
118009
|
-
|
|
118010
|
-
|
|
118011
|
-
}
|
|
118012
|
-
const url = new URL(window.location.href);
|
|
118013
|
-
url.hash = AUDIENCE_HASH;
|
|
118014
|
-
const win = window.open(url.toString(), "_blank");
|
|
118015
|
-
if (!win) {
|
|
118521
|
+
const blankWin = window.open("about:blank", "_blank");
|
|
118522
|
+
if (!blankWin) {
|
|
118016
118523
|
return false;
|
|
118017
118524
|
}
|
|
118018
|
-
audienceWindowRef.current =
|
|
118525
|
+
audienceWindowRef.current = blankWin;
|
|
118526
|
+
const sessionId = generateSessionId();
|
|
118527
|
+
sessionIdRef.current = sessionId;
|
|
118528
|
+
const audienceUrl = new URL(window.location.href);
|
|
118529
|
+
const params2 = new URLSearchParams();
|
|
118530
|
+
params2.set(AUDIENCE_NONCE_KEY, sessionId);
|
|
118531
|
+
audienceUrl.hash = `${AUDIENCE_HASH}&${params2.toString()}`;
|
|
118532
|
+
const navigateOrClose = (ok) => {
|
|
118533
|
+
const win = audienceWindowRef.current;
|
|
118534
|
+
if (!win || win.closed) {
|
|
118535
|
+
return;
|
|
118536
|
+
}
|
|
118537
|
+
if (!ok) {
|
|
118538
|
+
try {
|
|
118539
|
+
win.close();
|
|
118540
|
+
} catch {
|
|
118541
|
+
}
|
|
118542
|
+
audienceWindowRef.current = null;
|
|
118543
|
+
sessionIdRef.current = "";
|
|
118544
|
+
return;
|
|
118545
|
+
}
|
|
118546
|
+
try {
|
|
118547
|
+
win.location.replace(audienceUrl.toString());
|
|
118548
|
+
} catch {
|
|
118549
|
+
try {
|
|
118550
|
+
win.close();
|
|
118551
|
+
} catch {
|
|
118552
|
+
}
|
|
118553
|
+
audienceWindowRef.current = null;
|
|
118554
|
+
sessionIdRef.current = "";
|
|
118555
|
+
}
|
|
118556
|
+
};
|
|
118557
|
+
if (content) {
|
|
118558
|
+
void storeAudienceContent(content).then(() => navigateOrClose(true)).catch(() => navigateOrClose(false));
|
|
118559
|
+
} else {
|
|
118560
|
+
navigateOrClose(true);
|
|
118561
|
+
}
|
|
118019
118562
|
window.setTimeout(() => syncSlideToAudience(currentSlideIndex), 1500);
|
|
118020
118563
|
pollTimerRef.current = setInterval(() => {
|
|
118021
|
-
|
|
118564
|
+
const win = audienceWindowRef.current;
|
|
118565
|
+
if (!win || win.closed) {
|
|
118022
118566
|
audienceWindowRef.current = null;
|
|
118567
|
+
sessionIdRef.current = "";
|
|
118023
118568
|
if (pollTimerRef.current !== null) {
|
|
118024
118569
|
clearInterval(pollTimerRef.current);
|
|
118025
118570
|
pollTimerRef.current = null;
|
|
@@ -118047,6 +118592,13 @@ function usePresenterWindow(input) {
|
|
|
118047
118592
|
closeAudienceWindow();
|
|
118048
118593
|
}
|
|
118049
118594
|
}, [isPresenterMode, closeAudienceWindow]);
|
|
118595
|
+
React10.useEffect(() => {
|
|
118596
|
+
const handleBeforeUnload = () => {
|
|
118597
|
+
void clearAudienceContent();
|
|
118598
|
+
};
|
|
118599
|
+
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
118600
|
+
return () => window.removeEventListener("beforeunload", handleBeforeUnload);
|
|
118601
|
+
}, []);
|
|
118050
118602
|
return {
|
|
118051
118603
|
openAudienceWindow,
|
|
118052
118604
|
closeAudienceWindow,
|
|
@@ -118084,6 +118636,7 @@ function useAudienceMode(input) {
|
|
|
118084
118636
|
if (!isAudienceTab()) {
|
|
118085
118637
|
return;
|
|
118086
118638
|
}
|
|
118639
|
+
const expectedSessionId = parseAudienceNonce();
|
|
118087
118640
|
let channel;
|
|
118088
118641
|
try {
|
|
118089
118642
|
channel = new BroadcastChannel(PRESENTER_CHANNEL_NAME);
|
|
@@ -118095,6 +118648,9 @@ function useAudienceMode(input) {
|
|
|
118095
118648
|
if (!data || data.origin !== PRESENTER_MSG_ORIGIN) {
|
|
118096
118649
|
return;
|
|
118097
118650
|
}
|
|
118651
|
+
if (expectedSessionId && data.sessionId !== expectedSessionId) {
|
|
118652
|
+
return;
|
|
118653
|
+
}
|
|
118098
118654
|
if (data.type === "presenter-slide-change") {
|
|
118099
118655
|
onSetActiveSlideIndex(data.slideIndex);
|
|
118100
118656
|
}
|
|
@@ -119028,6 +119584,12 @@ function useTouchGestures(input) {
|
|
|
119028
119584
|
callbacksRef.current = callbacks;
|
|
119029
119585
|
const scaleRef = React10.useRef(currentScale);
|
|
119030
119586
|
scaleRef.current = currentScale;
|
|
119587
|
+
const [targetVersion, setTargetVersion] = React10.useState(0);
|
|
119588
|
+
const lastTargetRef = React10.useRef(null);
|
|
119589
|
+
if (targetRef.current !== lastTargetRef.current) {
|
|
119590
|
+
lastTargetRef.current = targetRef.current;
|
|
119591
|
+
queueMicrotask(() => setTargetVersion((v) => v + 1));
|
|
119592
|
+
}
|
|
119031
119593
|
React10.useEffect(() => {
|
|
119032
119594
|
const el = targetRef.current;
|
|
119033
119595
|
if (!el || !enabled) {
|
|
@@ -119116,7 +119678,7 @@ function useTouchGestures(input) {
|
|
|
119116
119678
|
el.removeEventListener("touchcancel", handleTouchCancel);
|
|
119117
119679
|
cancelLongPress();
|
|
119118
119680
|
};
|
|
119119
|
-
}, [targetRef, enabled]);
|
|
119681
|
+
}, [targetRef, enabled, targetVersion]);
|
|
119120
119682
|
}
|
|
119121
119683
|
|
|
119122
119684
|
// src/viewer/utils/dom-helpers.ts
|
|
@@ -119137,11 +119699,31 @@ function safeConfirm(message) {
|
|
|
119137
119699
|
return false;
|
|
119138
119700
|
}
|
|
119139
119701
|
}
|
|
119702
|
+
function sanitizeDownloadFilename(input) {
|
|
119703
|
+
if (typeof input !== "string" || input.trim().length === 0) {
|
|
119704
|
+
return "presentation.pptx";
|
|
119705
|
+
}
|
|
119706
|
+
let cleaned = input.replace(/[\x00-\x1f\x7f"\\/:*?<>|]/g, "_").replace(/\.\./g, "__").replace(/^\.+/, "").trim();
|
|
119707
|
+
if (cleaned.length === 0) {
|
|
119708
|
+
return "presentation.pptx";
|
|
119709
|
+
}
|
|
119710
|
+
if (cleaned.length > 200) {
|
|
119711
|
+
const dot = cleaned.lastIndexOf(".");
|
|
119712
|
+
if (dot > 0 && cleaned.length - dot <= 16) {
|
|
119713
|
+
const ext = cleaned.slice(dot);
|
|
119714
|
+
cleaned = cleaned.slice(0, 200 - ext.length) + ext;
|
|
119715
|
+
} else {
|
|
119716
|
+
cleaned = cleaned.slice(0, 200);
|
|
119717
|
+
}
|
|
119718
|
+
}
|
|
119719
|
+
return cleaned;
|
|
119720
|
+
}
|
|
119140
119721
|
function downloadBlob(blob, filename) {
|
|
119722
|
+
const safeName = sanitizeDownloadFilename(filename);
|
|
119141
119723
|
const url = URL.createObjectURL(blob);
|
|
119142
119724
|
const a2 = document.createElement("a");
|
|
119143
119725
|
a2.href = url;
|
|
119144
|
-
a2.download =
|
|
119726
|
+
a2.download = safeName;
|
|
119145
119727
|
document.body.appendChild(a2);
|
|
119146
119728
|
a2.click();
|
|
119147
119729
|
setTimeout(() => {
|
|
@@ -119572,27 +120154,82 @@ function openAutosaveDb2() {
|
|
|
119572
120154
|
req.onerror = () => reject(req.error);
|
|
119573
120155
|
});
|
|
119574
120156
|
}
|
|
119575
|
-
async function
|
|
120157
|
+
async function deleteOldestAutosaveEntry() {
|
|
119576
120158
|
const db = await openAutosaveDb2();
|
|
119577
|
-
return new Promise((resolve2
|
|
119578
|
-
|
|
119579
|
-
|
|
119580
|
-
|
|
119581
|
-
|
|
119582
|
-
|
|
119583
|
-
|
|
119584
|
-
|
|
119585
|
-
|
|
119586
|
-
|
|
119587
|
-
|
|
119588
|
-
|
|
119589
|
-
|
|
119590
|
-
|
|
119591
|
-
|
|
119592
|
-
|
|
119593
|
-
|
|
120159
|
+
return new Promise((resolve2) => {
|
|
120160
|
+
try {
|
|
120161
|
+
const tx = db.transaction(STORE_NAME3, "readwrite");
|
|
120162
|
+
const store = tx.objectStore(STORE_NAME3);
|
|
120163
|
+
let oldestKey = null;
|
|
120164
|
+
let oldestTimestamp = Infinity;
|
|
120165
|
+
const cursorReq = store.openCursor();
|
|
120166
|
+
cursorReq.onsuccess = () => {
|
|
120167
|
+
const cursor = cursorReq.result;
|
|
120168
|
+
if (cursor) {
|
|
120169
|
+
const value = cursor.value;
|
|
120170
|
+
if (typeof value.timestamp === "number" && value.timestamp < oldestTimestamp) {
|
|
120171
|
+
oldestTimestamp = value.timestamp;
|
|
120172
|
+
oldestKey = cursor.primaryKey;
|
|
120173
|
+
}
|
|
120174
|
+
cursor.continue();
|
|
120175
|
+
} else if (oldestKey !== null) {
|
|
120176
|
+
store.delete(oldestKey);
|
|
120177
|
+
}
|
|
120178
|
+
};
|
|
120179
|
+
tx.oncomplete = () => {
|
|
120180
|
+
db.close();
|
|
120181
|
+
resolve2(oldestKey !== null);
|
|
120182
|
+
};
|
|
120183
|
+
tx.onerror = () => {
|
|
120184
|
+
db.close();
|
|
120185
|
+
resolve2(false);
|
|
120186
|
+
};
|
|
120187
|
+
} catch {
|
|
120188
|
+
try {
|
|
120189
|
+
db.close();
|
|
120190
|
+
} catch {
|
|
120191
|
+
}
|
|
120192
|
+
resolve2(false);
|
|
120193
|
+
}
|
|
119594
120194
|
});
|
|
119595
120195
|
}
|
|
120196
|
+
function putAutosaveRecord(filePath, data) {
|
|
120197
|
+
return openAutosaveDb2().then(
|
|
120198
|
+
(db) => new Promise((resolve2, reject) => {
|
|
120199
|
+
const tx = db.transaction(STORE_NAME3, "readwrite");
|
|
120200
|
+
const store = tx.objectStore(STORE_NAME3);
|
|
120201
|
+
store.put({
|
|
120202
|
+
key: filePath,
|
|
120203
|
+
data,
|
|
120204
|
+
timestamp: Date.now(),
|
|
120205
|
+
size: data.byteLength
|
|
120206
|
+
});
|
|
120207
|
+
tx.oncomplete = () => {
|
|
120208
|
+
db.close();
|
|
120209
|
+
resolve2(true);
|
|
120210
|
+
};
|
|
120211
|
+
tx.onerror = () => {
|
|
120212
|
+
db.close();
|
|
120213
|
+
reject(tx.error);
|
|
120214
|
+
};
|
|
120215
|
+
})
|
|
120216
|
+
);
|
|
120217
|
+
}
|
|
120218
|
+
async function saveToIndexedDb(filePath, data) {
|
|
120219
|
+
try {
|
|
120220
|
+
return await putAutosaveRecord(filePath, data);
|
|
120221
|
+
} catch (err) {
|
|
120222
|
+
const errName = err instanceof Error || err instanceof DOMException ? err.name : "";
|
|
120223
|
+
if (errName !== "QuotaExceededError") {
|
|
120224
|
+
throw err;
|
|
120225
|
+
}
|
|
120226
|
+
const deleted = await deleteOldestAutosaveEntry();
|
|
120227
|
+
if (!deleted) {
|
|
120228
|
+
throw err;
|
|
120229
|
+
}
|
|
120230
|
+
return putAutosaveRecord(filePath, data);
|
|
120231
|
+
}
|
|
120232
|
+
}
|
|
119596
120233
|
function useAutosave(input) {
|
|
119597
120234
|
const {
|
|
119598
120235
|
isDirty,
|
|
@@ -119709,6 +120346,25 @@ function collectReferencedFontFamilies(slides) {
|
|
|
119709
120346
|
}
|
|
119710
120347
|
return families;
|
|
119711
120348
|
}
|
|
120349
|
+
var FONT_NAME_UNSAFE_CHARS = /["\\\n\r;}<>]/;
|
|
120350
|
+
var FONT_FORMAT_ALLOWED = /* @__PURE__ */ new Set([
|
|
120351
|
+
"truetype",
|
|
120352
|
+
"opentype",
|
|
120353
|
+
"woff",
|
|
120354
|
+
"woff2",
|
|
120355
|
+
"svg",
|
|
120356
|
+
"embedded-opentype"
|
|
120357
|
+
]);
|
|
120358
|
+
var FONT_DATA_URL_PATTERN = /^data:font\/[a-z0-9+.-]+(?:;charset=[a-z0-9-]+)?;base64,[A-Za-z0-9+/=]+$/i;
|
|
120359
|
+
function isFontDataUrlSafe(url) {
|
|
120360
|
+
if (typeof url !== "string" || url.length === 0) {
|
|
120361
|
+
return false;
|
|
120362
|
+
}
|
|
120363
|
+
if (url.startsWith("blob:")) {
|
|
120364
|
+
return true;
|
|
120365
|
+
}
|
|
120366
|
+
return FONT_DATA_URL_PATTERN.test(url);
|
|
120367
|
+
}
|
|
119712
120368
|
function useFontInjection({ embeddedFonts, slides }) {
|
|
119713
120369
|
React10.useEffect(() => {
|
|
119714
120370
|
if (!embeddedFonts.length) {
|
|
@@ -119716,17 +120372,28 @@ function useFontInjection({ embeddedFonts, slides }) {
|
|
|
119716
120372
|
}
|
|
119717
120373
|
const styleEl = document.createElement("style");
|
|
119718
120374
|
styleEl.id = EMBEDDED_FONTS_STYLE_ID;
|
|
119719
|
-
const cssRules = embeddedFonts.
|
|
120375
|
+
const cssRules = embeddedFonts.flatMap((font) => {
|
|
120376
|
+
if (typeof font.name !== "string" || font.name.length === 0 || FONT_NAME_UNSAFE_CHARS.test(font.name)) {
|
|
120377
|
+
return [];
|
|
120378
|
+
}
|
|
120379
|
+
if (!isFontDataUrlSafe(font.dataUrl)) {
|
|
120380
|
+
return [];
|
|
120381
|
+
}
|
|
120382
|
+
const fontFormat = font.format ?? "truetype";
|
|
120383
|
+
if (!FONT_FORMAT_ALLOWED.has(fontFormat)) {
|
|
120384
|
+
return [];
|
|
120385
|
+
}
|
|
119720
120386
|
const fontWeight = font.bold ? "700" : "400";
|
|
119721
120387
|
const fontStyleCss = font.italic ? "italic" : "normal";
|
|
119722
|
-
|
|
119723
|
-
|
|
120388
|
+
return [
|
|
120389
|
+
`@font-face {
|
|
119724
120390
|
font-family: "${font.name}";
|
|
119725
120391
|
src: url("${font.dataUrl}") format("${fontFormat}");
|
|
119726
120392
|
font-weight: ${fontWeight};
|
|
119727
120393
|
font-style: ${fontStyleCss};
|
|
119728
120394
|
font-display: swap;
|
|
119729
|
-
}
|
|
120395
|
+
}`
|
|
120396
|
+
];
|
|
119730
120397
|
}).join("\n");
|
|
119731
120398
|
styleEl.textContent = cssRules;
|
|
119732
120399
|
document.head.appendChild(styleEl);
|
|
@@ -119755,7 +120422,7 @@ function useFontInjection({ embeddedFonts, slides }) {
|
|
|
119755
120422
|
const linkEl = document.createElement("link");
|
|
119756
120423
|
linkEl.id = GOOGLE_FONTS_LINK_ID;
|
|
119757
120424
|
linkEl.rel = "stylesheet";
|
|
119758
|
-
linkEl.href = `https://fonts.googleapis.com/css2?${googleFamilies.map((f) => `family=${GOOGLE_FONTS_AVAILABLE[f]}`).join("&")}&display=swap`;
|
|
120425
|
+
linkEl.href = `https://fonts.googleapis.com/css2?${googleFamilies.map((f) => `family=${encodeURIComponent(GOOGLE_FONTS_AVAILABLE[f])}`).join("&")}&display=swap`;
|
|
119759
120426
|
document.head.appendChild(linkEl);
|
|
119760
120427
|
return () => {
|
|
119761
120428
|
const existing = document.getElementById(GOOGLE_FONTS_LINK_ID);
|
|
@@ -119771,13 +120438,18 @@ function useFontInjection({ embeddedFonts, slides }) {
|
|
|
119771
120438
|
}
|
|
119772
120439
|
const styleEl = document.createElement("style");
|
|
119773
120440
|
styleEl.id = SYMBOL_FONTS_STYLE_ID;
|
|
119774
|
-
const rules = neededSymbolFonts.
|
|
119775
|
-
(font
|
|
120441
|
+
const rules = neededSymbolFonts.flatMap((font) => {
|
|
120442
|
+
if (typeof font !== "string" || FONT_NAME_UNSAFE_CHARS.test(font)) {
|
|
120443
|
+
return [];
|
|
120444
|
+
}
|
|
120445
|
+
return [
|
|
120446
|
+
`@font-face {
|
|
119776
120447
|
font-family: "${font}";
|
|
119777
120448
|
src: local("${font}"), local("${font} Regular");
|
|
119778
120449
|
font-display: swap;
|
|
119779
120450
|
}`
|
|
119780
|
-
|
|
120451
|
+
];
|
|
120452
|
+
}).join("\n");
|
|
119781
120453
|
styleEl.textContent = rules;
|
|
119782
120454
|
document.head.appendChild(styleEl);
|
|
119783
120455
|
return () => {
|
|
@@ -119920,16 +120592,17 @@ function useLoadContent({
|
|
|
119920
120592
|
`[pptx] Large file detected (${fileSizeMB.toFixed(1)} MB). Loading may use significant memory.`
|
|
119921
120593
|
);
|
|
119922
120594
|
}
|
|
119923
|
-
|
|
119924
|
-
handlerRef.current.dispose();
|
|
119925
|
-
handlerRef.current = null;
|
|
119926
|
-
}
|
|
120595
|
+
const previousHandler = handlerRef.current;
|
|
119927
120596
|
const handler = new pptxViewerCore.PptxHandler();
|
|
119928
120597
|
const parsed = await handler.load(buffer);
|
|
119929
120598
|
if (cancelled || token !== renderTokenRef.current) {
|
|
119930
120599
|
handler.dispose();
|
|
119931
120600
|
return;
|
|
119932
120601
|
}
|
|
120602
|
+
if (previousHandler) {
|
|
120603
|
+
previousHandler.dispose();
|
|
120604
|
+
}
|
|
120605
|
+
handlerRef.current = null;
|
|
119933
120606
|
const mediaElements = [];
|
|
119934
120607
|
for (const slide of parsed.slides) {
|
|
119935
120608
|
collectMediaElements(slide.elements, mediaElements);
|
|
@@ -119974,6 +120647,7 @@ function useLoadContent({
|
|
|
119974
120647
|
})
|
|
119975
120648
|
);
|
|
119976
120649
|
const { paths: imagePaths, refs: imageRefs } = collectImagePaths(parsed.slides);
|
|
120650
|
+
let nextSlides = parsed.slides;
|
|
119977
120651
|
if (imagePaths.size > 0) {
|
|
119978
120652
|
const resolvedMap = /* @__PURE__ */ new Map();
|
|
119979
120653
|
await Promise.all(
|
|
@@ -119987,15 +120661,47 @@ function useLoadContent({
|
|
|
119987
120661
|
}
|
|
119988
120662
|
})
|
|
119989
120663
|
);
|
|
120664
|
+
const elementPatches = /* @__PURE__ */ new Map();
|
|
119990
120665
|
for (const ref of imageRefs) {
|
|
119991
120666
|
const url = resolvedMap.get(ref.path);
|
|
119992
|
-
if (url) {
|
|
119993
|
-
|
|
120667
|
+
if (!url) {
|
|
120668
|
+
continue;
|
|
119994
120669
|
}
|
|
120670
|
+
const id2 = ref.element.id;
|
|
120671
|
+
const existing = elementPatches.get(id2) ?? {};
|
|
120672
|
+
existing[ref.field] = url;
|
|
120673
|
+
elementPatches.set(id2, existing);
|
|
120674
|
+
}
|
|
120675
|
+
if (elementPatches.size > 0) {
|
|
120676
|
+
const patchElements = (elements) => {
|
|
120677
|
+
let mutated = false;
|
|
120678
|
+
const next = elements.map((el) => {
|
|
120679
|
+
let updated = el;
|
|
120680
|
+
const patch = elementPatches.get(el.id);
|
|
120681
|
+
if (patch) {
|
|
120682
|
+
updated = { ...el, ...patch };
|
|
120683
|
+
}
|
|
120684
|
+
if (updated.type === "group" && updated.children?.length) {
|
|
120685
|
+
const newChildren = patchElements(updated.children);
|
|
120686
|
+
if (newChildren !== updated.children) {
|
|
120687
|
+
updated = { ...updated, children: newChildren };
|
|
120688
|
+
}
|
|
120689
|
+
}
|
|
120690
|
+
if (updated !== el) {
|
|
120691
|
+
mutated = true;
|
|
120692
|
+
}
|
|
120693
|
+
return updated;
|
|
120694
|
+
});
|
|
120695
|
+
return mutated ? next : elements;
|
|
120696
|
+
};
|
|
120697
|
+
nextSlides = parsed.slides.map((s) => {
|
|
120698
|
+
const newElements = patchElements(s.elements);
|
|
120699
|
+
return newElements === s.elements ? s : { ...s, elements: newElements };
|
|
120700
|
+
});
|
|
119995
120701
|
}
|
|
119996
120702
|
}
|
|
119997
120703
|
handlerRef.current = handler;
|
|
119998
|
-
setSlides(
|
|
120704
|
+
setSlides(nextSlides);
|
|
119999
120705
|
setTemplateElementsBySlideId({});
|
|
120000
120706
|
setCanvasSize({
|
|
120001
120707
|
width: parsed.width ?? DEFAULT_CANVAS_WIDTH,
|
|
@@ -121169,7 +121875,19 @@ function injectFontFaces(svg, fontFaces) {
|
|
|
121169
121875
|
if (!fontFaces.length) {
|
|
121170
121876
|
return svg;
|
|
121171
121877
|
}
|
|
121172
|
-
const
|
|
121878
|
+
const safeFontFaces = fontFaces.filter((f) => {
|
|
121879
|
+
if (f.css.toLowerCase().includes("</style")) {
|
|
121880
|
+
console.warn(
|
|
121881
|
+
`[export-svg] Dropping @font-face entry for "${f.family}" containing "</style" \u2014 would break out of the <style> block.`
|
|
121882
|
+
);
|
|
121883
|
+
return false;
|
|
121884
|
+
}
|
|
121885
|
+
return true;
|
|
121886
|
+
});
|
|
121887
|
+
if (!safeFontFaces.length) {
|
|
121888
|
+
return svg;
|
|
121889
|
+
}
|
|
121890
|
+
const styleBlock = `<style type="text/css">${safeFontFaces.map((f) => f.css).join("\n")}</style>`;
|
|
121173
121891
|
if (svg.includes("<defs>")) {
|
|
121174
121892
|
return svg.replace("<defs>", `<defs>${styleBlock}`);
|
|
121175
121893
|
}
|
|
@@ -121495,7 +122213,7 @@ function useExportHandlers(input) {
|
|
|
121495
122213
|
activeSlideIndexForGuides,
|
|
121496
122214
|
modalControls
|
|
121497
122215
|
});
|
|
121498
|
-
const handleExportPng = async () => {
|
|
122216
|
+
const handleExportPng = React10.useCallback(async () => {
|
|
121499
122217
|
const stageEl = canvasStageRef.current;
|
|
121500
122218
|
if (!stageEl) {
|
|
121501
122219
|
return;
|
|
@@ -121507,8 +122225,8 @@ function useExportHandlers(input) {
|
|
|
121507
122225
|
} catch (err) {
|
|
121508
122226
|
console.error("[PowerPointViewer] PNG export failed:", err);
|
|
121509
122227
|
}
|
|
121510
|
-
};
|
|
121511
|
-
const handleExportPdf = async () => {
|
|
122228
|
+
}, [canvasStageRef, activeSlideIndex, activeSlide?.backgroundColor]);
|
|
122229
|
+
const handleExportPdf = React10.useCallback(async () => {
|
|
121512
122230
|
if (!canvasStageRef.current) {
|
|
121513
122231
|
return;
|
|
121514
122232
|
}
|
|
@@ -121549,8 +122267,8 @@ function useExportHandlers(input) {
|
|
|
121549
122267
|
exportAbortRef.current = null;
|
|
121550
122268
|
setExportModalOpen(false);
|
|
121551
122269
|
}
|
|
121552
|
-
};
|
|
121553
|
-
const handleExportNotesPdf = async () => {
|
|
122270
|
+
}, [canvasStageRef, slides.length, setActiveSlideIndex, activeSlideIndex]);
|
|
122271
|
+
const handleExportNotesPdf = React10.useCallback(async () => {
|
|
121554
122272
|
if (!canvasStageRef.current) {
|
|
121555
122273
|
return;
|
|
121556
122274
|
}
|
|
@@ -121593,8 +122311,8 @@ function useExportHandlers(input) {
|
|
|
121593
122311
|
exportAbortRef.current = null;
|
|
121594
122312
|
setExportModalOpen(false);
|
|
121595
122313
|
}
|
|
121596
|
-
};
|
|
121597
|
-
const handleCopySlideAsImage = async () => {
|
|
122314
|
+
}, [canvasStageRef, slides, setActiveSlideIndex, activeSlideIndex]);
|
|
122315
|
+
const handleCopySlideAsImage = React10.useCallback(async () => {
|
|
121598
122316
|
const stageEl = canvasStageRef.current;
|
|
121599
122317
|
if (!stageEl) {
|
|
121600
122318
|
return;
|
|
@@ -121606,8 +122324,8 @@ function useExportHandlers(input) {
|
|
|
121606
122324
|
} catch (err) {
|
|
121607
122325
|
console.error("[PowerPointViewer] Copy slide as image failed:", err);
|
|
121608
122326
|
}
|
|
121609
|
-
};
|
|
121610
|
-
const handleExportVideo = async () => {
|
|
122327
|
+
}, [canvasStageRef, activeSlide?.backgroundColor]);
|
|
122328
|
+
const handleExportVideo = React10.useCallback(async () => {
|
|
121611
122329
|
if (!canvasStageRef.current) {
|
|
121612
122330
|
return;
|
|
121613
122331
|
}
|
|
@@ -121649,8 +122367,8 @@ function useExportHandlers(input) {
|
|
|
121649
122367
|
exportAbortRef.current = null;
|
|
121650
122368
|
setExportModalOpen(false);
|
|
121651
122369
|
}
|
|
121652
|
-
};
|
|
121653
|
-
const handleExportGif = async () => {
|
|
122370
|
+
}, [canvasStageRef, slides.length, setActiveSlideIndex, activeSlideIndex]);
|
|
122371
|
+
const handleExportGif = React10.useCallback(async () => {
|
|
121654
122372
|
if (!canvasStageRef.current) {
|
|
121655
122373
|
return;
|
|
121656
122374
|
}
|
|
@@ -121688,7 +122406,7 @@ function useExportHandlers(input) {
|
|
|
121688
122406
|
exportAbortRef.current = null;
|
|
121689
122407
|
setExportModalOpen(false);
|
|
121690
122408
|
}
|
|
121691
|
-
};
|
|
122409
|
+
}, [canvasStageRef, slides.length, setActiveSlideIndex, activeSlideIndex]);
|
|
121692
122410
|
const handleCancelExport = React10.useCallback(() => {
|
|
121693
122411
|
exportAbortRef.current?.abort();
|
|
121694
122412
|
exportAbortRef.current = null;
|
|
@@ -121714,6 +122432,15 @@ function useExportHandlers(input) {
|
|
|
121714
122432
|
exportStatusMessage
|
|
121715
122433
|
};
|
|
121716
122434
|
}
|
|
122435
|
+
function escapeHtmlAttr(value) {
|
|
122436
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
122437
|
+
}
|
|
122438
|
+
function safeDataImageSrc(src) {
|
|
122439
|
+
if (typeof src !== "string" || !src.startsWith("data:image/")) {
|
|
122440
|
+
return "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNgAAIAAAUAAen63NgAAAAASUVORK5CYII=";
|
|
122441
|
+
}
|
|
122442
|
+
return escapeHtmlAttr(src);
|
|
122443
|
+
}
|
|
121717
122444
|
function openPrintWindow(title, bodyHtml, orientation, colorFilter, frameSlides) {
|
|
121718
122445
|
const printWindow = window.open("", "_blank", "noopener,noreferrer");
|
|
121719
122446
|
if (!printWindow) {
|
|
@@ -121896,7 +122623,7 @@ function usePrintHandlers(input) {
|
|
|
121896
122623
|
const slideImages = slideIndices.map((idx) => allImages[idx]).filter(Boolean);
|
|
121897
122624
|
if (settings.printWhat === "slides") {
|
|
121898
122625
|
const bodyHtml = slideImages.map(
|
|
121899
|
-
(img, i3) => `<section class="page slide-page"><img class="slide-img" src="${img}" alt="Slide ${slideIndices[i3] + 1}" /></section>`
|
|
122626
|
+
(img, i3) => `<section class="page slide-page"><img class="slide-img" src="${safeDataImageSrc(img)}" alt="Slide ${slideIndices[i3] + 1}" /></section>`
|
|
121900
122627
|
).join("");
|
|
121901
122628
|
openPrintWindow(
|
|
121902
122629
|
"Slides",
|
|
@@ -121912,7 +122639,7 @@ function usePrintHandlers(input) {
|
|
|
121912
122639
|
const idx = slideIndices[i3];
|
|
121913
122640
|
const notes = slides[idx]?.notes?.trim() || "";
|
|
121914
122641
|
return `<section class="page notes-page">
|
|
121915
|
-
<img class="notes-slide" src="${img}" alt="Slide ${idx + 1}" />
|
|
122642
|
+
<img class="notes-slide" src="${safeDataImageSrc(img)}" alt="Slide ${idx + 1}" />
|
|
121916
122643
|
<div class="notes-text">${escapeHtml2(notes)}</div>
|
|
121917
122644
|
</section>`;
|
|
121918
122645
|
}).join("");
|
|
@@ -121944,14 +122671,14 @@ function usePrintHandlers(input) {
|
|
|
121944
122671
|
if (isThreePerPage) {
|
|
121945
122672
|
const rows = Array.from({ length: spp }, (_, cellIndex) => {
|
|
121946
122673
|
const img = pageImgs[cellIndex];
|
|
121947
|
-
const slideCell = img ? `<div class="handout-cell"><img src="${img}" alt="Slide ${slideIndices[i3 + cellIndex] + 1}" /></div>` : `<div class="handout-cell"></div>`;
|
|
122674
|
+
const slideCell = img ? `<div class="handout-cell"><img src="${safeDataImageSrc(img)}" alt="Slide ${slideIndices[i3 + cellIndex] + 1}" /></div>` : `<div class="handout-cell"></div>`;
|
|
121948
122675
|
return `<div class="handout-row-3">${slideCell}${buildNoteLines()}</div>`;
|
|
121949
122676
|
}).join("");
|
|
121950
122677
|
pages.push(`<section class="page"><div class="handout-grid-3">${rows}</div></section>`);
|
|
121951
122678
|
} else {
|
|
121952
122679
|
const cells = Array.from({ length: spp }, (_, cellIndex) => {
|
|
121953
122680
|
const img = pageImgs[cellIndex];
|
|
121954
|
-
return img ? `<div class="handout-cell"><img src="${img}" alt="Slide ${slideIndices[i3 + cellIndex] + 1}" /></div>` : `<div class="handout-cell"></div>`;
|
|
122681
|
+
return img ? `<div class="handout-cell"><img src="${safeDataImageSrc(img)}" alt="Slide ${slideIndices[i3 + cellIndex] + 1}" /></div>` : `<div class="handout-cell"></div>`;
|
|
121955
122682
|
}).join("");
|
|
121956
122683
|
pages.push(
|
|
121957
122684
|
`<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>`
|
|
@@ -124482,7 +125209,7 @@ scheduler/cjs/scheduler.development.js:
|
|
|
124482
125209
|
* LICENSE file in the root directory of this source tree.
|
|
124483
125210
|
*)
|
|
124484
125211
|
|
|
124485
|
-
@react-three/fiber/dist/events-
|
|
125212
|
+
@react-three/fiber/dist/events-b389eeca.esm.js:
|
|
124486
125213
|
(**
|
|
124487
125214
|
* @license React
|
|
124488
125215
|
* react-reconciler-constants.production.js
|