minerender 2.1.0-alpha.114 → 2.1.0-alpha.115
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/browser/index.d.mts +138 -6
- package/dist/browser/index.d.ts +138 -6
- package/dist/browser/index.js +507 -117
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +452 -62
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +459 -19
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +138 -6
- package/dist/node/index.d.ts +138 -6
- package/dist/node/index.js +509 -117
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +452 -62
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -4768,7 +4768,7 @@ var MineRender = (() => {
|
|
|
4768
4768
|
}
|
|
4769
4769
|
throw new Error(`THREE.TextureUtils: Unknown texture type ${type}.`);
|
|
4770
4770
|
}
|
|
4771
|
-
var REVISION, MOUSE, TOUCH, CullFaceNone, CullFaceBack, CullFaceFront, PCFShadowMap, PCFSoftShadowMap, VSMShadowMap, FrontSide, BackSide, DoubleSide, NoBlending, NormalBlending, AdditiveBlending, SubtractiveBlending, MultiplyBlending, CustomBlending, 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, UVMapping, CubeReflectionMapping, CubeRefractionMapping, EquirectangularReflectionMapping, EquirectangularRefractionMapping, CubeUVReflectionMapping, RepeatWrapping, ClampToEdgeWrapping, MirroredRepeatWrapping, NearestFilter, NearestMipmapNearestFilter, NearestMipmapLinearFilter, LinearFilter, LinearMipmapNearestFilter, LinearMipmapLinearFilter, UnsignedByteType, ByteType, ShortType, UnsignedShortType, IntType, UnsignedIntType, FloatType, HalfFloatType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedInt101111Type, AlphaFormat, RGBFormat, RGBAFormat, DepthFormat, DepthStencilFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, R11_EAC_Format, SIGNED_R11_EAC_Format, 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, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolateBezier, ZeroCurvatureEnding, ZeroSlopeEnding, WrapAroundEnding, TrianglesDrawMode, TriangleStripDrawMode, TriangleFanDrawMode, BasicDepthPacking, TangentSpaceNormalMap, ObjectSpaceNormalMap, NoColorSpace, SRGBColorSpace, LinearSRGBColorSpace, LinearTransfer, SRGBTransfer, KeepStencilOp, AlwaysStencilFunc, NeverCompare, LessCompare, EqualCompare, LessEqualCompare, GreaterCompare, NotEqualCompare, GreaterEqualCompare, AlwaysCompare, StaticDrawUsage, GLSL3, WebGLCoordinateSystem, WebGPUCoordinateSystem, _cache, _setConsoleFunction, ReversedDepthFuncs, EventDispatcher, _lut, _seed, DEG2RAD, RAD2DEG, MathUtils, _Vector2, Vector2, Quaternion, _Vector3, Vector3, _vector$c, _quaternion$5, _Matrix3, Matrix3, _m3, LINEAR_REC709_TO_XYZ, XYZ_TO_LINEAR_REC709, ColorManagement, _canvas, ImageUtils, _sourceId, TextureSource, _textureId, _tempVec3, Texture, _Vector4, Vector4, RenderTarget, WebGLRenderTarget, DataArrayTexture, Data3DTexture, _Matrix4, 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, 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, _vector$a, _vector2$1, _id$2, BufferAttribute, Uint16BufferAttribute, Uint32BufferAttribute, Float32BufferAttribute, _box$3, _v1$3, _v2$2, Sphere, _id$1, _m1, _obj, _offset, _box$2, _boxMorphTargets, _vector$9, BufferGeometry, InterleavedBuffer, _vector$8, InterleavedBufferAttribute, _vector1, _vector2, _normalMatrix, Plane, _materialId, Material, _vector$7, _segCenter, _segDir, _diff, Ray, MeshBasicMaterial, _inverseMatrix$3, _ray$3, _sphere$6, _sphereHitAt, _vA, _vB, _vC, _tempA, _morphA, _intersectionPoint, _intersectionPointWorld, Mesh, DataTexture, InstancedBufferAttribute, _instanceLocalMatrix, _instanceWorldMatrix, _instanceIntersects, _box3, _identity, _mesh$1, _sphere$4, InstancedMesh, _sphere$3, _defaultSpriteCenter, _vector$6, Frustum, LineBasicMaterial, _vStart, _vEnd, _inverseMatrix$1, _ray$1, _sphere$1, _intersectPointOnRay, _intersectPointOnSegment, Line, _start, _end, LineSegments, CompressedTexture, CubeTexture, CanvasTexture, DepthTexture, CubeDepthTexture, ExternalTexture, BoxGeometry, _v0, _v1$1, _normal, _triangle, EdgesGeometry, PlaneGeometry, UniformsUtils, default_vertex, default_fragment, ShaderMaterial, RawShaderMaterial, MeshStandardMaterial, MeshDepthMaterial, MeshDistanceMaterial, Interpolant, CubicInterpolant, LinearInterpolant, DiscreteInterpolant, BezierInterpolant, KeyframeTrack, BooleanKeyframeTrack, ColorKeyframeTrack, NumberKeyframeTrack, QuaternionLinearInterpolant, QuaternionKeyframeTrack, StringKeyframeTrack, VectorKeyframeTrack, LoadingManager, DefaultLoadingManager, Loader, _position$2, _quaternion$2, _scale$2, Camera, _v3$1, _minTarget, _maxTarget, PerspectiveCamera, OrthographicCamera, fov, aspect, CubeCamera, ArrayCamera, _RESERVED_CHARS_RE, _reservedRe, _wordChar, _wordCharOrDot, _directoryRe, _nodeRe, _objectRe, _propertyRe, _trackRe, _supportedObjectNames, Composite, PropertyBinding, _controlInterpolantsResultBuffer, Uniform, _matrix, Raycaster, Spherical, _Matrix2, Matrix2, _vector$4, Box2, GridHelper, AxesHelper;
|
|
4771
|
+
var REVISION, MOUSE, TOUCH, CullFaceNone, CullFaceBack, CullFaceFront, PCFShadowMap, PCFSoftShadowMap, VSMShadowMap, FrontSide, BackSide, DoubleSide, NoBlending, NormalBlending, AdditiveBlending, SubtractiveBlending, MultiplyBlending, CustomBlending, 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, UVMapping, CubeReflectionMapping, CubeRefractionMapping, EquirectangularReflectionMapping, EquirectangularRefractionMapping, CubeUVReflectionMapping, RepeatWrapping, ClampToEdgeWrapping, MirroredRepeatWrapping, NearestFilter, NearestMipmapNearestFilter, NearestMipmapLinearFilter, LinearFilter, LinearMipmapNearestFilter, LinearMipmapLinearFilter, UnsignedByteType, ByteType, ShortType, UnsignedShortType, IntType, UnsignedIntType, FloatType, HalfFloatType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedInt101111Type, AlphaFormat, RGBFormat, RGBAFormat, DepthFormat, DepthStencilFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, R11_EAC_Format, SIGNED_R11_EAC_Format, 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, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolateBezier, ZeroCurvatureEnding, ZeroSlopeEnding, WrapAroundEnding, TrianglesDrawMode, TriangleStripDrawMode, TriangleFanDrawMode, BasicDepthPacking, TangentSpaceNormalMap, ObjectSpaceNormalMap, NoColorSpace, SRGBColorSpace, LinearSRGBColorSpace, LinearTransfer, SRGBTransfer, KeepStencilOp, AlwaysStencilFunc, NeverCompare, LessCompare, EqualCompare, LessEqualCompare, GreaterCompare, NotEqualCompare, GreaterEqualCompare, AlwaysCompare, StaticDrawUsage, GLSL3, WebGLCoordinateSystem, WebGPUCoordinateSystem, _cache, _setConsoleFunction, ReversedDepthFuncs, EventDispatcher, _lut, _seed, DEG2RAD, RAD2DEG, MathUtils, _Vector2, Vector2, Quaternion, _Vector3, Vector3, _vector$c, _quaternion$5, _Matrix3, Matrix3, _m3, LINEAR_REC709_TO_XYZ, XYZ_TO_LINEAR_REC709, ColorManagement, _canvas, ImageUtils, _sourceId, TextureSource, _textureId, _tempVec3, Texture, _Vector4, Vector4, RenderTarget, WebGLRenderTarget, DataArrayTexture, Data3DTexture, _Matrix4, 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, 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, _vector$a, _vector2$1, _id$2, BufferAttribute, Uint16BufferAttribute, Uint32BufferAttribute, Float32BufferAttribute, _box$3, _v1$3, _v2$2, Sphere, _id$1, _m1, _obj, _offset, _box$2, _boxMorphTargets, _vector$9, BufferGeometry, InterleavedBuffer, _vector$8, InterleavedBufferAttribute, _vector1, _vector2, _normalMatrix, Plane, _materialId, Material, _vector$7, _segCenter, _segDir, _diff, Ray, MeshBasicMaterial, _inverseMatrix$3, _ray$3, _sphere$6, _sphereHitAt, _vA, _vB, _vC, _tempA, _morphA, _intersectionPoint, _intersectionPointWorld, Mesh, DataTexture, InstancedBufferAttribute, _instanceLocalMatrix, _instanceWorldMatrix, _instanceIntersects, _box3, _identity, _mesh$1, _sphere$4, InstancedMesh, _sphere$3, _defaultSpriteCenter, _vector$6, Frustum, LineBasicMaterial, _vStart, _vEnd, _inverseMatrix$1, _ray$1, _sphere$1, _intersectPointOnRay, _intersectPointOnSegment, Line, _start, _end, LineSegments, CompressedTexture, CubeTexture, CanvasTexture, DepthTexture, CubeDepthTexture, ExternalTexture, BoxGeometry, _v0, _v1$1, _normal, _triangle, EdgesGeometry, PlaneGeometry, UniformsUtils, default_vertex, default_fragment, ShaderMaterial, RawShaderMaterial, MeshStandardMaterial, MeshDepthMaterial, MeshDistanceMaterial, Interpolant, CubicInterpolant, LinearInterpolant, DiscreteInterpolant, BezierInterpolant, KeyframeTrack, BooleanKeyframeTrack, ColorKeyframeTrack, NumberKeyframeTrack, QuaternionLinearInterpolant, QuaternionKeyframeTrack, StringKeyframeTrack, VectorKeyframeTrack, LoadingManager, DefaultLoadingManager, Loader, _position$2, _quaternion$2, _scale$2, Camera, _v3$1, _minTarget, _maxTarget, PerspectiveCamera, OrthographicCamera, fov, aspect, CubeCamera, ArrayCamera, _RESERVED_CHARS_RE, _reservedRe, _wordChar, _wordCharOrDot, _directoryRe, _nodeRe, _objectRe, _propertyRe, _trackRe, _supportedObjectNames, Composite, PropertyBinding, _controlInterpolantsResultBuffer, Uniform, _matrix, Raycaster, Spherical, _Matrix2, Matrix2, _vector$4, Box2, GridHelper, AxesHelper, Controls;
|
|
4772
4772
|
var init_three_core = __esm({
|
|
4773
4773
|
"../../node_modules/three/build/three.core.js"() {
|
|
4774
4774
|
init_dirname();
|
|
@@ -21500,6 +21500,53 @@ var MineRender = (() => {
|
|
|
21500
21500
|
this.material.dispose();
|
|
21501
21501
|
}
|
|
21502
21502
|
};
|
|
21503
|
+
Controls = class extends EventDispatcher {
|
|
21504
|
+
/**
|
|
21505
|
+
* Constructs a new controls instance.
|
|
21506
|
+
*
|
|
21507
|
+
* @param {Object3D} object - The object that is managed by the controls.
|
|
21508
|
+
* @param {?HTMLElement} domElement - The HTML element used for event listeners.
|
|
21509
|
+
*/
|
|
21510
|
+
constructor(object4, domElement = null) {
|
|
21511
|
+
super();
|
|
21512
|
+
this.object = object4;
|
|
21513
|
+
this.domElement = domElement;
|
|
21514
|
+
this.enabled = true;
|
|
21515
|
+
this.state = -1;
|
|
21516
|
+
this.keys = {};
|
|
21517
|
+
this.mouseButtons = { LEFT: null, MIDDLE: null, RIGHT: null };
|
|
21518
|
+
this.touches = { ONE: null, TWO: null };
|
|
21519
|
+
}
|
|
21520
|
+
/**
|
|
21521
|
+
* Connects the controls to the DOM. This method has so called "side effects" since
|
|
21522
|
+
* it adds the module's event listeners to the DOM.
|
|
21523
|
+
*
|
|
21524
|
+
* @param {HTMLElement} element - The DOM element to connect to.
|
|
21525
|
+
*/
|
|
21526
|
+
connect(element) {
|
|
21527
|
+
if (this.domElement !== null) this.disconnect();
|
|
21528
|
+
this.domElement = element;
|
|
21529
|
+
}
|
|
21530
|
+
/**
|
|
21531
|
+
* Disconnects the controls from the DOM.
|
|
21532
|
+
*/
|
|
21533
|
+
disconnect() {
|
|
21534
|
+
}
|
|
21535
|
+
/**
|
|
21536
|
+
* Call this method if you no longer want use to the controls. It frees all internal
|
|
21537
|
+
* resources and removes all event listeners.
|
|
21538
|
+
*/
|
|
21539
|
+
dispose() {
|
|
21540
|
+
}
|
|
21541
|
+
/**
|
|
21542
|
+
* Controls should implement this method if they have to update their internal state
|
|
21543
|
+
* per simulation step.
|
|
21544
|
+
*
|
|
21545
|
+
* @param {number} [delta] - The time delta in seconds.
|
|
21546
|
+
*/
|
|
21547
|
+
update() {
|
|
21548
|
+
}
|
|
21549
|
+
};
|
|
21503
21550
|
if (typeof __THREE_DEVTOOLS__ !== "undefined") {
|
|
21504
21551
|
__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register", { detail: {
|
|
21505
21552
|
revision: REVISION
|
|
@@ -95365,6 +95412,7 @@ ${shader.fragmentShader}`.replace(
|
|
|
95365
95412
|
EntityObject: () => EntityObject,
|
|
95366
95413
|
Env: () => Env,
|
|
95367
95414
|
FluidModelObject: () => FluidModelObject,
|
|
95415
|
+
FlyControls: () => FlyControls,
|
|
95368
95416
|
Fonts: () => Fonts,
|
|
95369
95417
|
GUI_CONTAINER_LAYOUTS: () => GUI_CONTAINER_LAYOUTS,
|
|
95370
95418
|
Geometries: () => Geometries,
|
|
@@ -95467,6 +95515,7 @@ ${shader.fragmentShader}`.replace(
|
|
|
95467
95515
|
isDisposable: () => isDisposable,
|
|
95468
95516
|
isDoubleArray: () => isDoubleArray,
|
|
95469
95517
|
isEntityObject: () => isEntityObject,
|
|
95518
|
+
isFlyControls: () => isFlyControls,
|
|
95470
95519
|
isGuiObject: () => isGuiObject,
|
|
95471
95520
|
isInstanceManager: () => isInstanceManager,
|
|
95472
95521
|
isInstanceReference: () => isInstanceReference,
|
|
@@ -101366,6 +101415,324 @@ property list uchar int vertex_index
|
|
|
101366
101415
|
init_buffer2();
|
|
101367
101416
|
init_process2();
|
|
101368
101417
|
|
|
101418
|
+
// src/renderer/FlyControls.ts
|
|
101419
|
+
init_dirname();
|
|
101420
|
+
init_buffer2();
|
|
101421
|
+
init_process2();
|
|
101422
|
+
init_three_module();
|
|
101423
|
+
var VANILLA_FLY_SPEED = 10.89;
|
|
101424
|
+
var PITCH_LIMIT = Math.PI / 2;
|
|
101425
|
+
var MOVE_EPSILON = 1e-6;
|
|
101426
|
+
var _euler = new Euler(0, 0, 0, "YXZ");
|
|
101427
|
+
var _forward = new Vector3();
|
|
101428
|
+
var _right = new Vector3();
|
|
101429
|
+
var _targetVelocity = new Vector3();
|
|
101430
|
+
var FlyControls = class extends Controls {
|
|
101431
|
+
constructor(camera, domElement) {
|
|
101432
|
+
super(camera, domElement ?? null);
|
|
101433
|
+
this.isFlyControls = true;
|
|
101434
|
+
/** Horizontal and vertical speed in scene units per second; vanilla creative flight by default. */
|
|
101435
|
+
this.movementSpeed = 16 * VANILLA_FLY_SPEED;
|
|
101436
|
+
/** Speed multiplier while the sprint key is held. */
|
|
101437
|
+
this.sprintMultiplier = 2;
|
|
101438
|
+
/** Radians per pixel of pointer movement. */
|
|
101439
|
+
this.lookSpeed = 2e-3;
|
|
101440
|
+
/** Smooth acceleration and deceleration, approximating vanilla flight momentum. */
|
|
101441
|
+
this.enableDamping = true;
|
|
101442
|
+
/** Portion of the remaining velocity change applied per 60 Hz frame (0–1) when damping is enabled. */
|
|
101443
|
+
this.dampingFactor = 0.25;
|
|
101444
|
+
/** Capture the pointer on click so the mouse turns the camera without dragging; dragging works regardless. */
|
|
101445
|
+
this.pointerLock = true;
|
|
101446
|
+
/** Scroll the wheel to change `movementSpeed` within `speedRange`. */
|
|
101447
|
+
this.enableWheelSpeed = true;
|
|
101448
|
+
/** Minimum and maximum `movementSpeed` reachable with the wheel. */
|
|
101449
|
+
this.speedRange = [16, 16 * 500];
|
|
101450
|
+
/** Touch joystick travel in CSS pixels for full speed. */
|
|
101451
|
+
this.joystickRadius = 64;
|
|
101452
|
+
/** Key bindings by `KeyboardEvent.code`. */
|
|
101453
|
+
this.keys = {
|
|
101454
|
+
forward: ["KeyW", "ArrowUp"],
|
|
101455
|
+
back: ["KeyS", "ArrowDown"],
|
|
101456
|
+
left: ["KeyA", "ArrowLeft"],
|
|
101457
|
+
right: ["KeyD", "ArrowRight"],
|
|
101458
|
+
up: ["Space"],
|
|
101459
|
+
down: ["ShiftLeft", "ShiftRight"],
|
|
101460
|
+
sprint: ["ControlLeft", "ControlRight"]
|
|
101461
|
+
};
|
|
101462
|
+
this._pressed = /* @__PURE__ */ new Set();
|
|
101463
|
+
this._velocity = new Vector3();
|
|
101464
|
+
this._lastPosition = new Vector3();
|
|
101465
|
+
this._lastQuaternion = new Quaternion();
|
|
101466
|
+
this._position0 = new Vector3();
|
|
101467
|
+
this._quaternion0 = new Quaternion();
|
|
101468
|
+
this._dragMoved = false;
|
|
101469
|
+
this._locked = false;
|
|
101470
|
+
this._onKeyDown = (event) => this.handleKey(event, true);
|
|
101471
|
+
this._onKeyUp = (event) => this.handleKey(event, false);
|
|
101472
|
+
this._onPointerDown = (event) => this.handlePointerDown(event);
|
|
101473
|
+
this._onPointerMove = (event) => this.handlePointerMove(event);
|
|
101474
|
+
this._onPointerUp = (event) => this.handlePointerUp(event);
|
|
101475
|
+
this._onPointerLockChange = () => this.handlePointerLockChange();
|
|
101476
|
+
this._onContextMenu = (event) => event.preventDefault();
|
|
101477
|
+
this._onWheel = (event) => this.handleWheel(event);
|
|
101478
|
+
this._onBlur = () => this.releaseKeys();
|
|
101479
|
+
this._lastPosition.copy(camera.position);
|
|
101480
|
+
this._lastQuaternion.copy(camera.quaternion);
|
|
101481
|
+
this.saveState();
|
|
101482
|
+
if (domElement) this.connect(domElement);
|
|
101483
|
+
}
|
|
101484
|
+
connect(element) {
|
|
101485
|
+
super.connect(element);
|
|
101486
|
+
const document2 = element.ownerDocument;
|
|
101487
|
+
document2.addEventListener("keydown", this._onKeyDown);
|
|
101488
|
+
document2.addEventListener("keyup", this._onKeyUp);
|
|
101489
|
+
document2.addEventListener("pointerlockchange", this._onPointerLockChange);
|
|
101490
|
+
document2.defaultView?.addEventListener("blur", this._onBlur);
|
|
101491
|
+
element.addEventListener("pointerdown", this._onPointerDown);
|
|
101492
|
+
element.addEventListener("pointermove", this._onPointerMove);
|
|
101493
|
+
element.addEventListener("pointerup", this._onPointerUp);
|
|
101494
|
+
element.addEventListener("pointercancel", this._onPointerUp);
|
|
101495
|
+
element.addEventListener("contextmenu", this._onContextMenu);
|
|
101496
|
+
element.addEventListener("wheel", this._onWheel, { passive: false });
|
|
101497
|
+
element.addEventListener("blur", this._onBlur);
|
|
101498
|
+
element.style.touchAction = "none";
|
|
101499
|
+
if (element.tabIndex < 0) element.tabIndex = 0;
|
|
101500
|
+
}
|
|
101501
|
+
disconnect() {
|
|
101502
|
+
const element = this.domElement;
|
|
101503
|
+
if (!element) return;
|
|
101504
|
+
const document2 = element.ownerDocument;
|
|
101505
|
+
document2.removeEventListener("keydown", this._onKeyDown);
|
|
101506
|
+
document2.removeEventListener("keyup", this._onKeyUp);
|
|
101507
|
+
document2.removeEventListener("pointerlockchange", this._onPointerLockChange);
|
|
101508
|
+
document2.defaultView?.removeEventListener("blur", this._onBlur);
|
|
101509
|
+
element.removeEventListener("pointerdown", this._onPointerDown);
|
|
101510
|
+
element.removeEventListener("pointermove", this._onPointerMove);
|
|
101511
|
+
element.removeEventListener("pointerup", this._onPointerUp);
|
|
101512
|
+
element.removeEventListener("pointercancel", this._onPointerUp);
|
|
101513
|
+
element.removeEventListener("contextmenu", this._onContextMenu);
|
|
101514
|
+
element.removeEventListener("wheel", this._onWheel);
|
|
101515
|
+
element.removeEventListener("blur", this._onBlur);
|
|
101516
|
+
element.style.touchAction = "auto";
|
|
101517
|
+
this.unlock();
|
|
101518
|
+
this._locked = false;
|
|
101519
|
+
this.releaseKeys();
|
|
101520
|
+
this._dragPointer = void 0;
|
|
101521
|
+
this._joystick = void 0;
|
|
101522
|
+
}
|
|
101523
|
+
dispose() {
|
|
101524
|
+
this.disconnect();
|
|
101525
|
+
}
|
|
101526
|
+
/** Whether mouse look currently owns the pointer. */
|
|
101527
|
+
get locked() {
|
|
101528
|
+
return this._locked;
|
|
101529
|
+
}
|
|
101530
|
+
/** Requests pointer capture; browsers only allow this from a user gesture. */
|
|
101531
|
+
lock() {
|
|
101532
|
+
const element = this.domElement;
|
|
101533
|
+
if (!element || this._locked || typeof element.requestPointerLock !== "function") return;
|
|
101534
|
+
try {
|
|
101535
|
+
const result = element.requestPointerLock();
|
|
101536
|
+
if (result instanceof Promise) result.catch(() => void 0);
|
|
101537
|
+
} catch {
|
|
101538
|
+
}
|
|
101539
|
+
}
|
|
101540
|
+
/** Releases a captured pointer. */
|
|
101541
|
+
unlock() {
|
|
101542
|
+
const document2 = this.domElement?.ownerDocument;
|
|
101543
|
+
if (document2?.pointerLockElement && document2.pointerLockElement === this.domElement) {
|
|
101544
|
+
document2.exitPointerLock();
|
|
101545
|
+
}
|
|
101546
|
+
}
|
|
101547
|
+
/** Stores the camera pose that {@link reset} restores. */
|
|
101548
|
+
saveState() {
|
|
101549
|
+
this._position0.copy(this.object.position);
|
|
101550
|
+
this._quaternion0.copy(this.object.quaternion);
|
|
101551
|
+
}
|
|
101552
|
+
/** Restores the saved camera pose and stops movement. */
|
|
101553
|
+
reset() {
|
|
101554
|
+
this.object.position.copy(this._position0);
|
|
101555
|
+
this.object.quaternion.copy(this._quaternion0);
|
|
101556
|
+
this._velocity.set(0, 0, 0);
|
|
101557
|
+
this.notifyChange();
|
|
101558
|
+
}
|
|
101559
|
+
/** Horizontal yaw in radians, where zero looks toward -Z. */
|
|
101560
|
+
get yaw() {
|
|
101561
|
+
return _euler.setFromQuaternion(this.object.quaternion).y;
|
|
101562
|
+
}
|
|
101563
|
+
/** Vertical pitch in radians, positive looking up. */
|
|
101564
|
+
get pitch() {
|
|
101565
|
+
return _euler.setFromQuaternion(this.object.quaternion).x;
|
|
101566
|
+
}
|
|
101567
|
+
/** Turns the camera; pitch is clamped to straight up and down. */
|
|
101568
|
+
setRotation(yaw, pitch) {
|
|
101569
|
+
_euler.set(MathUtils.clamp(pitch, -PITCH_LIMIT, PITCH_LIMIT), yaw, 0);
|
|
101570
|
+
this.object.quaternion.setFromEuler(_euler);
|
|
101571
|
+
this.notifyChange();
|
|
101572
|
+
}
|
|
101573
|
+
/** Points the camera at a position without rolling it. */
|
|
101574
|
+
lookAt(target) {
|
|
101575
|
+
_forward.copy(target).sub(this.object.position);
|
|
101576
|
+
if (_forward.lengthSq() < MOVE_EPSILON) return;
|
|
101577
|
+
_forward.normalize();
|
|
101578
|
+
this.setRotation(Math.atan2(-_forward.x, -_forward.z), Math.asin(MathUtils.clamp(_forward.y, -1, 1)));
|
|
101579
|
+
}
|
|
101580
|
+
/** Whether an action's key is held. */
|
|
101581
|
+
isPressed(action) {
|
|
101582
|
+
return this._pressed.has(action);
|
|
101583
|
+
}
|
|
101584
|
+
/**
|
|
101585
|
+
* Advances movement by `delta` seconds (measured since the previous call when omitted)
|
|
101586
|
+
* and dispatches `change` when the camera moved.
|
|
101587
|
+
*/
|
|
101588
|
+
update(delta) {
|
|
101589
|
+
if (delta === void 0) {
|
|
101590
|
+
const now = typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
101591
|
+
delta = this._lastTime === void 0 ? 0 : (now - this._lastTime) / 1e3;
|
|
101592
|
+
this._lastTime = now;
|
|
101593
|
+
}
|
|
101594
|
+
if (!this.enabled) {
|
|
101595
|
+
this._velocity.set(0, 0, 0);
|
|
101596
|
+
return;
|
|
101597
|
+
}
|
|
101598
|
+
if (delta > 0) this.move(delta);
|
|
101599
|
+
this.notifyChange();
|
|
101600
|
+
}
|
|
101601
|
+
move(delta) {
|
|
101602
|
+
const camera = this.object;
|
|
101603
|
+
let forward = (this._pressed.has("forward") ? 1 : 0) - (this._pressed.has("back") ? 1 : 0);
|
|
101604
|
+
let strafe = (this._pressed.has("right") ? 1 : 0) - (this._pressed.has("left") ? 1 : 0);
|
|
101605
|
+
const climb = (this._pressed.has("up") ? 1 : 0) - (this._pressed.has("down") ? 1 : 0);
|
|
101606
|
+
const joystick = this._joystick;
|
|
101607
|
+
if (joystick) {
|
|
101608
|
+
const radius = Math.max(this.joystickRadius, 1);
|
|
101609
|
+
forward = MathUtils.clamp(forward + (joystick.originY - joystick.y) / radius, -1, 1);
|
|
101610
|
+
strafe = MathUtils.clamp(strafe + (joystick.x - joystick.originX) / radius, -1, 1);
|
|
101611
|
+
}
|
|
101612
|
+
_euler.setFromQuaternion(camera.quaternion);
|
|
101613
|
+
const yaw = _euler.y;
|
|
101614
|
+
_forward.set(-Math.sin(yaw), 0, -Math.cos(yaw));
|
|
101615
|
+
_right.set(Math.cos(yaw), 0, -Math.sin(yaw));
|
|
101616
|
+
_targetVelocity.set(0, 0, 0);
|
|
101617
|
+
if (forward || strafe || climb) {
|
|
101618
|
+
_targetVelocity.addScaledVector(_forward, forward).addScaledVector(_right, strafe);
|
|
101619
|
+
if (_targetVelocity.lengthSq() > 1) _targetVelocity.normalize();
|
|
101620
|
+
_targetVelocity.y = climb;
|
|
101621
|
+
const speed = this.movementSpeed * (this._pressed.has("sprint") ? this.sprintMultiplier : 1);
|
|
101622
|
+
_targetVelocity.multiplyScalar(speed);
|
|
101623
|
+
}
|
|
101624
|
+
if (this.enableDamping) {
|
|
101625
|
+
const blend = 1 - Math.pow(1 - MathUtils.clamp(this.dampingFactor, 0, 1), delta * 60);
|
|
101626
|
+
this._velocity.lerp(_targetVelocity, blend);
|
|
101627
|
+
if (_targetVelocity.lengthSq() === 0 && this._velocity.lengthSq() < MOVE_EPSILON) this._velocity.set(0, 0, 0);
|
|
101628
|
+
} else {
|
|
101629
|
+
this._velocity.copy(_targetVelocity);
|
|
101630
|
+
}
|
|
101631
|
+
camera.position.addScaledVector(this._velocity, delta);
|
|
101632
|
+
}
|
|
101633
|
+
notifyChange() {
|
|
101634
|
+
const camera = this.object;
|
|
101635
|
+
if (this._lastPosition.distanceToSquared(camera.position) > MOVE_EPSILON || 8 * (1 - this._lastQuaternion.dot(camera.quaternion)) > MOVE_EPSILON) {
|
|
101636
|
+
this._lastPosition.copy(camera.position);
|
|
101637
|
+
this._lastQuaternion.copy(camera.quaternion);
|
|
101638
|
+
this.dispatchEvent({ type: "change" });
|
|
101639
|
+
}
|
|
101640
|
+
}
|
|
101641
|
+
releaseKeys() {
|
|
101642
|
+
this._pressed.clear();
|
|
101643
|
+
}
|
|
101644
|
+
handleKey(event, down) {
|
|
101645
|
+
const action = this.actionFor(event.code);
|
|
101646
|
+
if (!action) return;
|
|
101647
|
+
const ownsInput = this.enabled && (this._locked || event.target === this.domElement);
|
|
101648
|
+
if (down && !ownsInput) return;
|
|
101649
|
+
const pressed = this._pressed.has(action);
|
|
101650
|
+
if (down) this._pressed.add(action);
|
|
101651
|
+
else this._pressed.delete(action);
|
|
101652
|
+
if (ownsInput || this.enabled && pressed) event.preventDefault();
|
|
101653
|
+
}
|
|
101654
|
+
actionFor(code2) {
|
|
101655
|
+
for (const action in this.keys) {
|
|
101656
|
+
if (this.keys[action].includes(code2)) return action;
|
|
101657
|
+
}
|
|
101658
|
+
return void 0;
|
|
101659
|
+
}
|
|
101660
|
+
handlePointerDown(event) {
|
|
101661
|
+
const element = this.domElement;
|
|
101662
|
+
if (!this.enabled || !element) return;
|
|
101663
|
+
element.focus?.({ preventScroll: true });
|
|
101664
|
+
if (this._locked) return;
|
|
101665
|
+
if (event.pointerType === "touch" && !this._joystick && this.onJoystickSide(event)) {
|
|
101666
|
+
this._joystick = { id: event.pointerId, originX: event.clientX, originY: event.clientY, x: event.clientX, y: event.clientY };
|
|
101667
|
+
element.setPointerCapture?.(event.pointerId);
|
|
101668
|
+
return;
|
|
101669
|
+
}
|
|
101670
|
+
if (this._dragPointer !== void 0) return;
|
|
101671
|
+
if (event.pointerType === "mouse" && event.button !== 0 && event.button !== 2) return;
|
|
101672
|
+
this._dragPointer = event.pointerId;
|
|
101673
|
+
this._dragMoved = false;
|
|
101674
|
+
element.setPointerCapture?.(event.pointerId);
|
|
101675
|
+
}
|
|
101676
|
+
onJoystickSide(event) {
|
|
101677
|
+
const rect = this.domElement?.getBoundingClientRect?.();
|
|
101678
|
+
return !!rect && event.clientX < rect.left + rect.width / 2;
|
|
101679
|
+
}
|
|
101680
|
+
handlePointerMove(event) {
|
|
101681
|
+
if (!this.enabled) return;
|
|
101682
|
+
const joystick = this._joystick;
|
|
101683
|
+
if (joystick && event.pointerId === joystick.id) {
|
|
101684
|
+
joystick.x = event.clientX;
|
|
101685
|
+
joystick.y = event.clientY;
|
|
101686
|
+
return;
|
|
101687
|
+
}
|
|
101688
|
+
if (!this._locked && event.pointerId !== this._dragPointer) return;
|
|
101689
|
+
const dx = event.movementX ?? 0;
|
|
101690
|
+
const dy = event.movementY ?? 0;
|
|
101691
|
+
if (!dx && !dy) return;
|
|
101692
|
+
this._dragMoved = true;
|
|
101693
|
+
this.turn(dx, dy);
|
|
101694
|
+
}
|
|
101695
|
+
handlePointerUp(event) {
|
|
101696
|
+
if (this._joystick?.id === event.pointerId) {
|
|
101697
|
+
this._joystick = void 0;
|
|
101698
|
+
this.domElement?.releasePointerCapture?.(event.pointerId);
|
|
101699
|
+
return;
|
|
101700
|
+
}
|
|
101701
|
+
if (event.pointerId !== this._dragPointer) return;
|
|
101702
|
+
this._dragPointer = void 0;
|
|
101703
|
+
this.domElement?.releasePointerCapture?.(event.pointerId);
|
|
101704
|
+
if (this.enabled && this.pointerLock && !this._dragMoved && event.pointerType === "mouse" && event.button === 0) {
|
|
101705
|
+
this.lock();
|
|
101706
|
+
}
|
|
101707
|
+
}
|
|
101708
|
+
handleWheel(event) {
|
|
101709
|
+
if (!this.enabled || !this.enableWheelSpeed) return;
|
|
101710
|
+
event.preventDefault();
|
|
101711
|
+
const steps = event.deltaMode === 0 ? event.deltaY / 100 : event.deltaY;
|
|
101712
|
+
const [min, max2] = this.speedRange;
|
|
101713
|
+
this.movementSpeed = MathUtils.clamp(this.movementSpeed * Math.pow(1.15, -steps), Math.min(min, max2), Math.max(min, max2));
|
|
101714
|
+
}
|
|
101715
|
+
handlePointerLockChange() {
|
|
101716
|
+
const document2 = this.domElement?.ownerDocument;
|
|
101717
|
+
const locked = !!document2 && document2.pointerLockElement === this.domElement;
|
|
101718
|
+
if (locked === this._locked) return;
|
|
101719
|
+
this._locked = locked;
|
|
101720
|
+
if (!locked) this.releaseKeys();
|
|
101721
|
+
this.dispatchEvent({ type: locked ? "lock" : "unlock" });
|
|
101722
|
+
}
|
|
101723
|
+
turn(dx, dy) {
|
|
101724
|
+
_euler.setFromQuaternion(this.object.quaternion);
|
|
101725
|
+
_euler.y -= dx * this.lookSpeed;
|
|
101726
|
+
_euler.x = MathUtils.clamp(_euler.x - dy * this.lookSpeed, -PITCH_LIMIT, PITCH_LIMIT);
|
|
101727
|
+
_euler.z = 0;
|
|
101728
|
+
this.object.quaternion.setFromEuler(_euler);
|
|
101729
|
+
this.notifyChange();
|
|
101730
|
+
}
|
|
101731
|
+
};
|
|
101732
|
+
function isFlyControls(obj) {
|
|
101733
|
+
return obj?.isFlyControls === true;
|
|
101734
|
+
}
|
|
101735
|
+
|
|
101369
101736
|
// src/renderer/MineRenderScene.ts
|
|
101370
101737
|
init_dirname();
|
|
101371
101738
|
init_buffer2();
|
|
@@ -105204,20 +105571,77 @@ gl_FragDepth=readDepth(vUv);
|
|
|
105204
105571
|
}
|
|
105205
105572
|
createControls() {
|
|
105206
105573
|
if (!this.options.controls?.enabled) return void 0;
|
|
105207
|
-
|
|
105208
|
-
|
|
105209
|
-
|
|
105574
|
+
return this.createControlsFor(this.options.controls.mode ?? "orbit", this.initialTarget());
|
|
105575
|
+
}
|
|
105576
|
+
initialTarget() {
|
|
105210
105577
|
const target = this.options.camera.lookingAt;
|
|
105211
|
-
if (isVector3(target))
|
|
105578
|
+
if (isVector3(target)) return target.clone();
|
|
105579
|
+
if (isTripleArray(target)) return new Vector3(target[0], target[1], target[2]);
|
|
105580
|
+
return new Vector3();
|
|
105581
|
+
}
|
|
105582
|
+
createControlsFor(mode2, target) {
|
|
105583
|
+
let controls;
|
|
105584
|
+
if (mode2 === "fly") {
|
|
105585
|
+
controls = new FlyControls(this.camera, this.renderer.domElement);
|
|
105586
|
+
controls.lookAt(target);
|
|
105587
|
+
controls.saveState();
|
|
105588
|
+
} else {
|
|
105589
|
+
const position = this.camera.position.clone();
|
|
105590
|
+
controls = new OrbitControls(this.camera, this.renderer.domElement);
|
|
105591
|
+
this.camera.position.copy(position);
|
|
105212
105592
|
controls.target.copy(target);
|
|
105213
|
-
|
|
105214
|
-
controls.
|
|
105593
|
+
controls.update();
|
|
105594
|
+
controls.saveState();
|
|
105215
105595
|
}
|
|
105216
|
-
|
|
105217
|
-
controls.saveState();
|
|
105596
|
+
this._controlsTime = void 0;
|
|
105218
105597
|
this.registerEventDispatcher(controls);
|
|
105219
105598
|
return controls;
|
|
105220
105599
|
}
|
|
105600
|
+
/**
|
|
105601
|
+
* Replaces renderer-owned controls with the selected mode, keeping the camera where it is.
|
|
105602
|
+
* Switching to orbit controls targets the point the camera looks at, at the previous orbit distance.
|
|
105603
|
+
* Returns the new controls, or undefined when controls were disabled at construction or after disposal.
|
|
105604
|
+
*/
|
|
105605
|
+
setControlsMode(mode2) {
|
|
105606
|
+
const current = this._controls;
|
|
105607
|
+
if (this._disposed || !current) return void 0;
|
|
105608
|
+
if (this.controlsMode === mode2) return current;
|
|
105609
|
+
let target;
|
|
105610
|
+
if (isFlyControls(current)) {
|
|
105611
|
+
const distance = this._orbitDistance ?? (this.camera.position.distanceTo(this.initialTarget()) || 1);
|
|
105612
|
+
target = new Vector3(0, 0, -distance).applyQuaternion(this.camera.quaternion).add(this.camera.position);
|
|
105613
|
+
} else {
|
|
105614
|
+
target = current.target.clone();
|
|
105615
|
+
this._orbitDistance = this.camera.position.distanceTo(target);
|
|
105616
|
+
}
|
|
105617
|
+
const enabled = current.enabled;
|
|
105618
|
+
this.disposeControls(current);
|
|
105619
|
+
this._controls = this.createControlsFor(mode2, target);
|
|
105620
|
+
this._controls.enabled = enabled;
|
|
105621
|
+
this.dirty = true;
|
|
105622
|
+
return this._controls;
|
|
105623
|
+
}
|
|
105624
|
+
disposeControls(controls) {
|
|
105625
|
+
this._controls = void 0;
|
|
105626
|
+
this.unregisterEventDispatcher(controls);
|
|
105627
|
+
controls.enabled = false;
|
|
105628
|
+
controls.dispose();
|
|
105629
|
+
}
|
|
105630
|
+
/** Advances owned controls; without a frame time, flight movement does not progress. */
|
|
105631
|
+
updateControls(time) {
|
|
105632
|
+
const controls = this._controls;
|
|
105633
|
+
if (!controls?.enabled) {
|
|
105634
|
+
this._controlsTime = void 0;
|
|
105635
|
+
return;
|
|
105636
|
+
}
|
|
105637
|
+
if (!isFlyControls(controls)) {
|
|
105638
|
+
controls.update();
|
|
105639
|
+
return;
|
|
105640
|
+
}
|
|
105641
|
+
const previous = this._controlsTime;
|
|
105642
|
+
if (time !== void 0) this._controlsTime = time;
|
|
105643
|
+
controls.update(time === void 0 || previous === void 0 ? 0 : (time - previous) / 1e3);
|
|
105644
|
+
}
|
|
105221
105645
|
//</editor-fold>
|
|
105222
105646
|
init() {
|
|
105223
105647
|
if (this._disposed) return;
|
|
@@ -105294,6 +105718,12 @@ gl_FragDepth=readDepth(vUv);
|
|
|
105294
105718
|
events.add(changeEvent2);
|
|
105295
105719
|
dispatcher.addEventListener(changeEvent2, this._changeListener);
|
|
105296
105720
|
}
|
|
105721
|
+
unregisterEventDispatcher(dispatcher) {
|
|
105722
|
+
const events = this._eventDispatchers.get(dispatcher);
|
|
105723
|
+
if (!events) return;
|
|
105724
|
+
for (const event of events) dispatcher.removeEventListener(event, this._changeListener);
|
|
105725
|
+
this._eventDispatchers.delete(dispatcher);
|
|
105726
|
+
}
|
|
105297
105727
|
/** Updates the camera and canvas size. Width and height are in CSS pixels. */
|
|
105298
105728
|
resize(width, height) {
|
|
105299
105729
|
if (this._disposed) return;
|
|
@@ -105370,6 +105800,7 @@ gl_FragDepth=readDepth(vUv);
|
|
|
105370
105800
|
this.renderer.setAnimationLoop(null);
|
|
105371
105801
|
}
|
|
105372
105802
|
this._nextFrameTime = void 0;
|
|
105803
|
+
this._controlsTime = void 0;
|
|
105373
105804
|
for (const subscription of this._frameCallbacks.values()) subscription.previous = void 0;
|
|
105374
105805
|
}
|
|
105375
105806
|
/**
|
|
@@ -105399,10 +105830,7 @@ gl_FragDepth=readDepth(vUv);
|
|
|
105399
105830
|
}
|
|
105400
105831
|
this._element = void 0;
|
|
105401
105832
|
if (this._controls) {
|
|
105402
|
-
|
|
105403
|
-
this._controls = void 0;
|
|
105404
|
-
controls.enabled = false;
|
|
105405
|
-
controls.dispose();
|
|
105833
|
+
this.disposeControls(this._controls);
|
|
105406
105834
|
}
|
|
105407
105835
|
this.scene.clear();
|
|
105408
105836
|
for (const helper of this._debugHelpers) {
|
|
@@ -105419,9 +105847,7 @@ gl_FragDepth=readDepth(vUv);
|
|
|
105419
105847
|
}
|
|
105420
105848
|
animate(t5 = performance.now()) {
|
|
105421
105849
|
if (!this._running) return;
|
|
105422
|
-
|
|
105423
|
-
this._controls.update();
|
|
105424
|
-
}
|
|
105850
|
+
this.updateControls(t5);
|
|
105425
105851
|
if (!this._running) return;
|
|
105426
105852
|
if (!this.dirty && !this.options.render.renderAlways && !this._frameCallbacks.size && !this._videoExporter) return;
|
|
105427
105853
|
const interval = this._frameInterval;
|
|
@@ -105458,7 +105884,7 @@ gl_FragDepth=readDepth(vUv);
|
|
|
105458
105884
|
/** Draws a fresh frame without starting the animation loop or invoking frame callbacks. */
|
|
105459
105885
|
renderOnce() {
|
|
105460
105886
|
if (this._disposed) throw new Error("Cannot render a disposed renderer");
|
|
105461
|
-
|
|
105887
|
+
this.updateControls();
|
|
105462
105888
|
this.drawFrame();
|
|
105463
105889
|
}
|
|
105464
105890
|
/**
|
|
@@ -105488,7 +105914,7 @@ gl_FragDepth=readDepth(vUv);
|
|
|
105488
105914
|
try {
|
|
105489
105915
|
if (!wasRunning) this.start();
|
|
105490
105916
|
this._videoExporter = exporter;
|
|
105491
|
-
|
|
105917
|
+
this.updateControls();
|
|
105492
105918
|
this.drawFrame();
|
|
105493
105919
|
} catch (error2) {
|
|
105494
105920
|
exporter.cancel(error2);
|
|
@@ -105539,6 +105965,19 @@ gl_FragDepth=readDepth(vUv);
|
|
|
105539
105965
|
get controls() {
|
|
105540
105966
|
return this._controls;
|
|
105541
105967
|
}
|
|
105968
|
+
/** Renderer-owned OrbitControls, or undefined in fly mode or without controls. */
|
|
105969
|
+
get orbitControls() {
|
|
105970
|
+
return this._controls && !isFlyControls(this._controls) ? this._controls : void 0;
|
|
105971
|
+
}
|
|
105972
|
+
/** Renderer-owned {@link FlyControls}, or undefined in orbit mode or without controls. */
|
|
105973
|
+
get flyControls() {
|
|
105974
|
+
return isFlyControls(this._controls) ? this._controls : void 0;
|
|
105975
|
+
}
|
|
105976
|
+
/** The active renderer-owned controls mode, or undefined without controls. */
|
|
105977
|
+
get controlsMode() {
|
|
105978
|
+
if (!this._controls) return void 0;
|
|
105979
|
+
return isFlyControls(this._controls) ? "fly" : "orbit";
|
|
105980
|
+
}
|
|
105542
105981
|
///
|
|
105543
105982
|
};
|
|
105544
105983
|
_Renderer.DEFAULT_OPTIONS = (0, import_ts_deepmerge9.default)({}, {
|
|
@@ -105572,7 +106011,8 @@ gl_FragDepth=readDepth(vUv);
|
|
|
105572
106011
|
enabled: true
|
|
105573
106012
|
},
|
|
105574
106013
|
controls: {
|
|
105575
|
-
enabled: false
|
|
106014
|
+
enabled: false,
|
|
106015
|
+
mode: "orbit"
|
|
105576
106016
|
},
|
|
105577
106017
|
debug: {
|
|
105578
106018
|
grid: false,
|