diff --git a/src/_polyfill/constants.ts b/src/_polyfill/constants.ts index 290855de..1237ca1f 100644 --- a/src/_polyfill/constants.ts +++ b/src/_polyfill/constants.ts @@ -1,6 +1,3 @@ import { REVISION } from 'three' -let _version: any = /* @__PURE__ */ REVISION.replace(/\D+/g, '') -_version = /* @__PURE__ */ parseInt(_version) - -export const version = _version as number +export const version = parseInt(REVISION.replace(/\D+/g, '')) diff --git a/src/animation/CCDIKSolver.js b/src/animation/CCDIKSolver.js index 75fff7e4..0e5650a0 100644 --- a/src/animation/CCDIKSolver.js +++ b/src/animation/CCDIKSolver.js @@ -13,17 +13,17 @@ import { Vector3, } from 'three' -const _q = /* @__PURE__ */ new Quaternion() -const _targetPos = /* @__PURE__ */ new Vector3() -const _targetVec = /* @__PURE__ */ new Vector3() -const _effectorPos = /* @__PURE__ */ new Vector3() -const _effectorVec = /* @__PURE__ */ new Vector3() -const _linkPos = /* @__PURE__ */ new Vector3() -const _invLinkQ = /* @__PURE__ */ new Quaternion() -const _linkScale = /* @__PURE__ */ new Vector3() -const _axis = /* @__PURE__ */ new Vector3() -const _vector = /* @__PURE__ */ new Vector3() -const _matrix = /* @__PURE__ */ new Matrix4() +const _q = new Quaternion() +const _targetPos = new Vector3() +const _targetVec = new Vector3() +const _effectorPos = new Vector3() +const _effectorVec = new Vector3() +const _linkPos = new Vector3() +const _invLinkQ = new Quaternion() +const _linkScale = new Vector3() +const _axis = new Vector3() +const _vector = new Vector3() +const _matrix = new Matrix4() /** * CCD Algorithm diff --git a/src/animation/MMDAnimationHelper.js b/src/animation/MMDAnimationHelper.js index 396c7424..8ec13284 100644 --- a/src/animation/MMDAnimationHelper.js +++ b/src/animation/MMDAnimationHelper.js @@ -861,7 +861,7 @@ class AudioManager { } } -const _q = /* @__PURE__ */ new Quaternion() +const _q = new Quaternion() /** * Solver for Grant (Fuyo in Japanese. I just google translated because diff --git a/src/animation/MMDPhysics.js b/src/animation/MMDPhysics.js index 22ea4ea2..c11992cc 100644 --- a/src/animation/MMDPhysics.js +++ b/src/animation/MMDPhysics.js @@ -1001,10 +1001,10 @@ class Constraint { } } -const _position = /* @__PURE__ */ new Vector3() -const _quaternion = /* @__PURE__ */ new Quaternion() -const _scale = /* @__PURE__ */ new Vector3() -const _matrixWorldInv = /* @__PURE__ */ new Matrix4() +const _position = new Vector3() +const _quaternion = new Quaternion() +const _scale = new Vector3() +const _matrixWorldInv = new Matrix4() class MMDPhysicsHelper extends Object3D { /** diff --git a/src/controls/ArcballControls.ts b/src/controls/ArcballControls.ts index f32b4eb5..3a45773c 100644 --- a/src/controls/ArcballControls.ts +++ b/src/controls/ArcballControls.ts @@ -67,8 +67,8 @@ const _center = { //transformation matrices for gizmos and camera const _transformation: Transformation = { - camera: /* @__PURE__ */ new Matrix4(), - gizmos: /* @__PURE__ */ new Matrix4(), + camera: new Matrix4(), + gizmos: new Matrix4(), } //events diff --git a/src/controls/FirstPersonControls.ts b/src/controls/FirstPersonControls.ts index 8ef3db73..79fdd5de 100644 --- a/src/controls/FirstPersonControls.ts +++ b/src/controls/FirstPersonControls.ts @@ -1,6 +1,6 @@ import { MathUtils, Spherical, Vector3, EventDispatcher, Camera } from 'three' -const targetPosition = /* @__PURE__ */ new Vector3() +const targetPosition = new Vector3() export class FirstPersonControls extends EventDispatcher { public object: Camera diff --git a/src/controls/OrbitControls.ts b/src/controls/OrbitControls.ts index ccb3d742..a4d73372 100644 --- a/src/controls/OrbitControls.ts +++ b/src/controls/OrbitControls.ts @@ -13,8 +13,8 @@ import { Plane, } from 'three' -const _ray = /* @__PURE__ */ new Ray() -const _plane = /* @__PURE__ */ new Plane() +const _ray = new Ray() +const _plane = new Plane() const TILT_LIMIT = Math.cos(70 * (Math.PI / 180)) // This set of controls performs orbiting, dollying (zooming), and panning. diff --git a/src/controls/PointerLockControls.ts b/src/controls/PointerLockControls.ts index 5548e716..9170daf6 100644 --- a/src/controls/PointerLockControls.ts +++ b/src/controls/PointerLockControls.ts @@ -1,7 +1,7 @@ import { Euler, Camera, EventDispatcher, Vector3 } from 'three' -const _euler = /* @__PURE__ */ new Euler(0, 0, 0, 'YXZ') -const _vector = /* @__PURE__ */ new Vector3() +const _euler = new Euler(0, 0, 0, 'YXZ') +const _vector = new Vector3() const _changeEvent = { type: 'change' } const _lockEvent = { type: 'lock' } const _unlockEvent = { type: 'unlock' } diff --git a/src/csm/CSM.js b/src/csm/CSM.js index ce5359af..afa6cdee 100644 --- a/src/csm/CSM.js +++ b/src/csm/CSM.js @@ -2,10 +2,10 @@ import { Vector2, Vector3, DirectionalLight, MathUtils, ShaderChunk, Matrix4, Bo import { CSMFrustum } from './CSMFrustum' import { CSMShader } from './CSMShader' -const _cameraToLightMatrix = /* @__PURE__ */ new Matrix4() -const _lightSpaceFrustum = /* @__PURE__ */ new CSMFrustum() -const _center = /* @__PURE__ */ new Vector3() -const _bbox = /* @__PURE__ */ new Box3() +const _cameraToLightMatrix = new Matrix4() +const _lightSpaceFrustum = new CSMFrustum() +const _center = new Vector3() +const _bbox = new Box3() const _uniformArray = [] const _logArray = [] diff --git a/src/csm/CSMFrustum.js b/src/csm/CSMFrustum.js index 3e375417..ab8f7d15 100644 --- a/src/csm/CSMFrustum.js +++ b/src/csm/CSMFrustum.js @@ -1,6 +1,6 @@ import { Vector3, Matrix4 } from 'three' -const inverseProjectionMatrix = /* @__PURE__ */ new Matrix4() +const inverseProjectionMatrix = new Matrix4() class CSMFrustum { constructor(data) { diff --git a/src/deprecated/Geometry.js b/src/deprecated/Geometry.js index 32148cd1..d4d5afc2 100644 --- a/src/deprecated/Geometry.js +++ b/src/deprecated/Geometry.js @@ -14,9 +14,9 @@ import { Vector3, } from 'three' -const _m1 = /* @__PURE__ */ new Matrix4() -const _obj = /* @__PURE__ */ new Object3D() -const _offset = /* @__PURE__ */ new Vector3() +const _m1 = new Matrix4() +const _obj = new Object3D() +const _offset = new Vector3() class Geometry extends EventDispatcher { static createBufferGeometryFromObject(object) { diff --git a/src/geometries/RoundedBoxGeometry.js b/src/geometries/RoundedBoxGeometry.js index 3a10f247..80c5f35b 100644 --- a/src/geometries/RoundedBoxGeometry.js +++ b/src/geometries/RoundedBoxGeometry.js @@ -1,6 +1,6 @@ import { BoxGeometry, Vector3 } from 'three' -const tempNormal = /* @__PURE__ */ new Vector3() +const tempNormal = new Vector3() function getUv(faceDirVector, normal, uvAxis, projectionAxis, radius, sideLength) { const totArcLength = (2 * Math.PI * radius) / 4 diff --git a/src/helpers/VertexNormalsHelper.js b/src/helpers/VertexNormalsHelper.js index b586a130..18e8addb 100644 --- a/src/helpers/VertexNormalsHelper.js +++ b/src/helpers/VertexNormalsHelper.js @@ -1,8 +1,8 @@ import { BufferGeometry, Float32BufferAttribute, LineSegments, LineBasicMaterial, Matrix3, Vector3 } from 'three' -const _v1 = /* @__PURE__ */ new Vector3() -const _v2 = /* @__PURE__ */ new Vector3() -const _normalMatrix = /* @__PURE__ */ new Matrix3() +const _v1 = new Vector3() +const _v2 = new Vector3() +const _normalMatrix = new Matrix3() class VertexNormalsHelper extends LineSegments { constructor(object, size = 1, color = 0xff0000) { diff --git a/src/helpers/VertexTangentsHelper.js b/src/helpers/VertexTangentsHelper.js index a9af184a..42d50ee5 100644 --- a/src/helpers/VertexTangentsHelper.js +++ b/src/helpers/VertexTangentsHelper.js @@ -1,7 +1,7 @@ import { BufferGeometry, Float32BufferAttribute, LineSegments, LineBasicMaterial, Vector3 } from 'three' -const _v1 = /* @__PURE__ */ new Vector3() -const _v2 = /* @__PURE__ */ new Vector3() +const _v1 = new Vector3() +const _v2 = new Vector3() class VertexTangentsHelper extends LineSegments { constructor(object, size = 1, color = 0x00ffff) { diff --git a/src/interactive/InteractiveGroup.js b/src/interactive/InteractiveGroup.js index 263e979b..704f4ffb 100644 --- a/src/interactive/InteractiveGroup.js +++ b/src/interactive/InteractiveGroup.js @@ -1,6 +1,6 @@ import { Group, Matrix4, Raycaster, Vector2 } from 'three' -const _pointer = /* @__PURE__ */ new Vector2() +const _pointer = new Vector2() const _event = { type: '', data: _pointer } class InteractiveGroup extends Group { diff --git a/src/interactive/SelectionBox.js b/src/interactive/SelectionBox.js index dda5dd6e..4db0205e 100644 --- a/src/interactive/SelectionBox.js +++ b/src/interactive/SelectionBox.js @@ -1,24 +1,24 @@ import { Frustum, Vector3 } from 'three' -const frustum = /* @__PURE__ */ new Frustum() -const center = /* @__PURE__ */ new Vector3() +const frustum = new Frustum() +const center = new Vector3() -const tmpPoint = /* @__PURE__ */ new Vector3() +const tmpPoint = new Vector3() -const vecNear = /* @__PURE__ */ new Vector3() -const vecTopLeft = /* @__PURE__ */ new Vector3() -const vecTopRight = /* @__PURE__ */ new Vector3() -const vecDownRight = /* @__PURE__ */ new Vector3() -const vecDownLeft = /* @__PURE__ */ new Vector3() +const vecNear = new Vector3() +const vecTopLeft = new Vector3() +const vecTopRight = new Vector3() +const vecDownRight = new Vector3() +const vecDownLeft = new Vector3() -const vecFarTopLeft = /* @__PURE__ */ new Vector3() -const vecFarTopRight = /* @__PURE__ */ new Vector3() -const vecFarDownRight = /* @__PURE__ */ new Vector3() -const vecFarDownLeft = /* @__PURE__ */ new Vector3() +const vecFarTopLeft = new Vector3() +const vecFarTopRight = new Vector3() +const vecFarDownRight = new Vector3() +const vecFarDownLeft = new Vector3() -const vectemp1 = /* @__PURE__ */ new Vector3() -const vectemp2 = /* @__PURE__ */ new Vector3() -const vectemp3 = /* @__PURE__ */ new Vector3() +const vectemp1 = new Vector3() +const vectemp2 = new Vector3() +const vectemp3 = new Vector3() class SelectionBox { constructor(camera, scene, deep) { diff --git a/src/libs/chevrotain.js b/src/libs/chevrotain.js index 4d8c0e48..8e23804d 100644 --- a/src/libs/chevrotain.js +++ b/src/libs/chevrotain.js @@ -1,4 +1,4 @@ -const { CstParser, Lexer, createToken } = /* @__PURE__ */ (() => { +const { CstParser, Lexer, createToken } = (() => { /** Detect free variable `global` from Node.js. */ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global diff --git a/src/lines/LineSegments2.js b/src/lines/LineSegments2.js index d1542c51..f9feecf0 100644 --- a/src/lines/LineSegments2.js +++ b/src/lines/LineSegments2.js @@ -13,21 +13,21 @@ import { import { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry' import { LineMaterial } from '../lines/LineMaterial' -const _start = /* @__PURE__ */ new Vector3() -const _end = /* @__PURE__ */ new Vector3() +const _start = new Vector3() +const _end = new Vector3() -const _start4 = /* @__PURE__ */ new Vector4() -const _end4 = /* @__PURE__ */ new Vector4() +const _start4 = new Vector4() +const _end4 = new Vector4() -const _ssOrigin = /* @__PURE__ */ new Vector4() -const _ssOrigin3 = /* @__PURE__ */ new Vector3() -const _mvMatrix = /* @__PURE__ */ new Matrix4() -const _line = /* @__PURE__ */ new Line3() -const _closestPoint = /* @__PURE__ */ new Vector3() +const _ssOrigin = new Vector4() +const _ssOrigin3 = new Vector3() +const _mvMatrix = new Matrix4() +const _line = new Line3() +const _closestPoint = new Vector3() -const _box = /* @__PURE__ */ new Box3() -const _sphere = /* @__PURE__ */ new Sphere() -const _clipToWorldVector = /* @__PURE__ */ new Vector4() +const _box = new Box3() +const _sphere = new Sphere() +const _clipToWorldVector = new Vector4() let _ray, _instanceStart, _instanceEnd, _lineWidth diff --git a/src/lines/LineSegmentsGeometry.js b/src/lines/LineSegmentsGeometry.js index 7813d0d4..1579c309 100644 --- a/src/lines/LineSegmentsGeometry.js +++ b/src/lines/LineSegmentsGeometry.js @@ -9,8 +9,8 @@ import { WireframeGeometry, } from 'three' -const _box = /* @__PURE__ */ new Box3() -const _vector = /* @__PURE__ */ new Vector3() +const _box = new Box3() +const _vector = new Vector3() class LineSegmentsGeometry extends InstancedBufferGeometry { constructor() { diff --git a/src/lines/Wireframe.js b/src/lines/Wireframe.js index 09766dab..2e193dd4 100644 --- a/src/lines/Wireframe.js +++ b/src/lines/Wireframe.js @@ -2,8 +2,8 @@ import { InstancedInterleavedBuffer, InterleavedBufferAttribute, Mesh, Vector3 } import { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry' import { LineMaterial } from '../lines/LineMaterial' -const _start = /* @__PURE__ */ new Vector3() -const _end = /* @__PURE__ */ new Vector3() +const _start = new Vector3() +const _end = new Vector3() class Wireframe extends Mesh { constructor(geometry = new LineSegmentsGeometry(), material = new LineMaterial({ color: Math.random() * 0xffffff })) { diff --git a/src/loaders/EXRLoader.js b/src/loaders/EXRLoader.js index 43355fe4..f6b7e9ed 100644 --- a/src/loaders/EXRLoader.js +++ b/src/loaders/EXRLoader.js @@ -83,7 +83,7 @@ import { unzlibSync } from 'fflate' // // End of OpenEXR license ------------------------------------------------- -const hasColorSpace = 'colorSpace' in /* @__PURE__ */ new Texture() +const hasColorSpace = 'colorSpace' in new Texture() class EXRLoader extends DataTextureLoader { constructor(manager) { diff --git a/src/loaders/FBXLoader.js b/src/loaders/FBXLoader.js index 3e18c5fb..7410e737 100644 --- a/src/loaders/FBXLoader.js +++ b/src/loaders/FBXLoader.js @@ -3116,8 +3116,8 @@ function getData(polygonVertexIndex, polygonIndex, vertexIndex, infoObject) { return slice(dataArray, infoObject.buffer, from, to) } -const tempEuler = /* @__PURE__ */ new Euler() -const tempVec = /* @__PURE__ */ new Vector3() +const tempEuler = new Euler() +const tempVec = new Vector3() // generate transformation from FBX transform data // ref: https://help.autodesk.com/view/FBX/2017/ENU/?guid=__files_GUID_10CDD63C_79C1_4F2D_BB28_AD2BE65A02ED_htm diff --git a/src/loaders/GLTFLoader.js b/src/loaders/GLTFLoader.js index d7639680..74a3a121 100644 --- a/src/loaders/GLTFLoader.js +++ b/src/loaders/GLTFLoader.js @@ -1560,7 +1560,7 @@ class GLTFCubicSplineInterpolant extends Interpolant { } } -const _q = /* @__PURE__ */ new Quaternion() +const _q = new Quaternion() class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant { interpolate_(i1, t0, t, t1) { @@ -1890,7 +1890,7 @@ function getImageURIMimeType(uri) { return 'image/png' } -const _identityMatrix = /* @__PURE__ */ new Matrix4() +const _identityMatrix = new Matrix4() /* GLTF PARSER */ diff --git a/src/loaders/LDrawLoader.js b/src/loaders/LDrawLoader.js index 8f79ac7f..41c39c67 100644 --- a/src/loaders/LDrawLoader.js +++ b/src/loaders/LDrawLoader.js @@ -40,8 +40,8 @@ const FILE_LOCATION_NOT_FOUND = 6 const MAIN_COLOUR_CODE = '16' const MAIN_EDGE_COLOUR_CODE = '24' -const _tempVec0 = /* @__PURE__ */ new Vector3() -const _tempVec1 = /* @__PURE__ */ new Vector3() +const _tempVec0 = new Vector3() +const _tempVec1 = new Vector3() class LDrawConditionalLineMaterial extends ShaderMaterial { constructor(parameters) { @@ -180,7 +180,7 @@ function generateFaceNormals(faces) { } } -const _ray = /* @__PURE__ */ new Ray() +const _ray = new Ray() function smoothNormals(faces, lineSegments, checkSubSegments = false) { // NOTE: 1e2 is pretty coarse but was chosen to quantize the resulting value because // it allows edges to be smoothed as expected (see minifig arms). diff --git a/src/loaders/OBJLoader.js b/src/loaders/OBJLoader.js index 82ffde04..f5a5ffce 100644 --- a/src/loaders/OBJLoader.js +++ b/src/loaders/OBJLoader.js @@ -23,12 +23,12 @@ const _material_use_pattern = /^usemtl / // usemap map_name const _map_use_pattern = /^usemap / -const _vA = /* @__PURE__ */ new Vector3() -const _vB = /* @__PURE__ */ new Vector3() -const _vC = /* @__PURE__ */ new Vector3() +const _vA = new Vector3() +const _vB = new Vector3() +const _vC = new Vector3() -const _ab = /* @__PURE__ */ new Vector3() -const _cb = /* @__PURE__ */ new Vector3() +const _ab = new Vector3() +const _cb = new Vector3() function ParserState() { const state = { diff --git a/src/loaders/TiltLoader.js b/src/loaders/TiltLoader.js index 5ce41e4d..d8f1c5e6 100644 --- a/src/loaders/TiltLoader.js +++ b/src/loaders/TiltLoader.js @@ -370,7 +370,7 @@ const shaders = () => ({ Light: { uniforms: { mainTex: { - value: /* @__PURE__ */ new TextureLoader().setPath('./textures/tiltbrush/').loader.load('Light.webp'), + value: new TextureLoader().setPath('./textures/tiltbrush/').loader.load('Light.webp'), }, alphaTest: { value: 0.067 }, emission_gain: { value: 0.45 }, diff --git a/src/loaders/XLoader.js b/src/loaders/XLoader.js index 15a38d4a..49ff0616 100644 --- a/src/loaders/XLoader.js +++ b/src/loaders/XLoader.js @@ -20,7 +20,7 @@ import { Vector3, } from 'three' -var XLoader = /* @__PURE__ */ (function () { +var XLoader = (function () { var classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function') diff --git a/src/math/Capsule.js b/src/math/Capsule.js index 63a0c956..bf2d12e1 100644 --- a/src/math/Capsule.js +++ b/src/math/Capsule.js @@ -1,8 +1,8 @@ import { Vector3 } from 'three' -const _v1 = /* @__PURE__ */ new Vector3() -const _v2 = /* @__PURE__ */ new Vector3() -const _v3 = /* @__PURE__ */ new Vector3() +const _v1 = new Vector3() +const _v2 = new Vector3() +const _v3 = new Vector3() const EPS = 1e-10 diff --git a/src/math/ConvexHull.js b/src/math/ConvexHull.js index d7cad8c6..bc345894 100644 --- a/src/math/ConvexHull.js +++ b/src/math/ConvexHull.js @@ -7,11 +7,11 @@ import { Line3, Plane, Triangle, Vector3 } from 'three' const Visible = 0 const Deleted = 1 -const _v1 = /* @__PURE__ */ new Vector3() -const _line3 = /* @__PURE__ */ new Line3() -const _plane = /* @__PURE__ */ new Plane() -const _closestPoint = /* @__PURE__ */ new Vector3() -const _triangle = /* @__PURE__ */ new Triangle() +const _v1 = new Vector3() +const _line3 = new Line3() +const _plane = new Plane() +const _closestPoint = new Vector3() +const _triangle = new Triangle() class ConvexHull { constructor() { diff --git a/src/math/ImprovedNoise.js b/src/math/ImprovedNoise.js index f0d6981a..d48fa581 100644 --- a/src/math/ImprovedNoise.js +++ b/src/math/ImprovedNoise.js @@ -20,7 +20,7 @@ function init() { return _p } -const _p = /* @__PURE__ */ init() +const _p = init() function fade(t) { return t * t * t * (t * (t * 6 - 15) + 10) diff --git a/src/math/MeshSurfaceSampler.js b/src/math/MeshSurfaceSampler.js index 51778207..274736c4 100644 --- a/src/math/MeshSurfaceSampler.js +++ b/src/math/MeshSurfaceSampler.js @@ -11,8 +11,8 @@ import { Triangle, Vector3 } from 'three' * - https://stackoverflow.com/a/4322940/1314762 */ -const _face = /* @__PURE__ */ new Triangle() -const _color = /* @__PURE__ */ new Vector3() +const _face = new Triangle() +const _color = new Vector3() class MeshSurfaceSampler { constructor(mesh) { diff --git a/src/math/OBB.js b/src/math/OBB.js index b82b7514..c50b8032 100644 --- a/src/math/OBB.js +++ b/src/math/OBB.js @@ -4,13 +4,13 @@ import { Box3, MathUtils, Matrix4, Matrix3, Ray, Vector3 } from 'three' const a = { c: null, // center - u: [/* @__PURE__ */ new Vector3(), /* @__PURE__ */ new Vector3(), /* @__PURE__ */ new Vector3()], // basis vectors + u: [new Vector3(), new Vector3(), new Vector3()], // basis vectors e: [], // half width } const b = { c: null, // center - u: [/* @__PURE__ */ new Vector3(), /* @__PURE__ */ new Vector3(), /* @__PURE__ */ new Vector3()], // basis vectors + u: [new Vector3(), new Vector3(), new Vector3()], // basis vectors e: [], // half width } @@ -18,17 +18,17 @@ const R = [[], [], []] const AbsR = [[], [], []] const t = [] -const xAxis = /* @__PURE__ */ new Vector3() -const yAxis = /* @__PURE__ */ new Vector3() -const zAxis = /* @__PURE__ */ new Vector3() -const v1 = /* @__PURE__ */ new Vector3() -const size = /* @__PURE__ */ new Vector3() -const closestPoint = /* @__PURE__ */ new Vector3() -const rotationMatrix = /* @__PURE__ */ new Matrix3() -const aabb = /* @__PURE__ */ new Box3() -const matrix = /* @__PURE__ */ new Matrix4() -const inverse = /* @__PURE__ */ new Matrix4() -const localRay = /* @__PURE__ */ new Ray() +const xAxis = new Vector3() +const yAxis = new Vector3() +const zAxis = new Vector3() +const v1 = new Vector3() +const size = new Vector3() +const closestPoint = new Vector3() +const rotationMatrix = new Matrix3() +const aabb = new Box3() +const matrix = new Matrix4() +const inverse = new Matrix4() +const localRay = new Ray() // OBB @@ -361,6 +361,6 @@ class OBB { } } -const obb = /* @__PURE__ */ new OBB() +const obb = new OBB() export { OBB } diff --git a/src/math/Octree.js b/src/math/Octree.js index 9882264b..1a332e59 100644 --- a/src/math/Octree.js +++ b/src/math/Octree.js @@ -1,13 +1,13 @@ import { Box3, Line3, Plane, Sphere, Triangle, Vector3 } from 'three' import { Capsule } from '../math/Capsule' -const _v1 = /* @__PURE__ */ new Vector3() -const _v2 = /* @__PURE__ */ new Vector3() -const _plane = /* @__PURE__ */ new Plane() -const _line1 = /* @__PURE__ */ new Line3() -const _line2 = /* @__PURE__ */ new Line3() -const _sphere = /* @__PURE__ */ new Sphere() -const _capsule = /* @__PURE__ */ new Capsule() +const _v1 = new Vector3() +const _v2 = new Vector3() +const _plane = new Plane() +const _line1 = new Line3() +const _line2 = new Line3() +const _sphere = new Sphere() +const _capsule = new Capsule() class Octree { constructor(box) { diff --git a/src/misc/ConvexObjectBreaker.js b/src/misc/ConvexObjectBreaker.js index 48f92287..76d72c63 100644 --- a/src/misc/ConvexObjectBreaker.js +++ b/src/misc/ConvexObjectBreaker.js @@ -30,7 +30,7 @@ import { ConvexGeometry } from '../geometries/ConvexGeometry' * */ -const _v1 = /* @__PURE__ */ new Vector3() +const _v1 = new Vector3() class ConvexObjectBreaker { constructor(minSizeForBreak = 1.4, smallDelta = 0.0001) { diff --git a/src/misc/Gyroscope.js b/src/misc/Gyroscope.js index 570f40d3..0ab3fb72 100644 --- a/src/misc/Gyroscope.js +++ b/src/misc/Gyroscope.js @@ -1,12 +1,12 @@ import { Object3D, Quaternion, Vector3 } from 'three' -const _translationObject = /* @__PURE__ */ new Vector3() -const _quaternionObject = /* @__PURE__ */ new Quaternion() -const _scaleObject = /* @__PURE__ */ new Vector3() +const _translationObject = new Vector3() +const _quaternionObject = new Quaternion() +const _scaleObject = new Vector3() -const _translationWorld = /* @__PURE__ */ new Vector3() -const _quaternionWorld = /* @__PURE__ */ new Quaternion() -const _scaleWorld = /* @__PURE__ */ new Vector3() +const _translationWorld = new Vector3() +const _quaternionWorld = new Quaternion() +const _scaleWorld = new Vector3() class Gyroscope extends Object3D { constructor() { diff --git a/src/modifiers/CurveModifier.ts b/src/modifiers/CurveModifier.ts index af5397eb..84d00332 100644 --- a/src/modifiers/CurveModifier.ts +++ b/src/modifiers/CurveModifier.ts @@ -251,7 +251,7 @@ export class Flow { this.uniforms.pathOffset.value += amount } } -const matrix = /* @__PURE__ */ new Matrix4() +const matrix = new Matrix4() /** * A helper class for creating instanced versions of flow, where the instances are placed on the curve. diff --git a/src/modifiers/SimplifyModifier.ts b/src/modifiers/SimplifyModifier.ts index d9d0348d..f5ae4779 100644 --- a/src/modifiers/SimplifyModifier.ts +++ b/src/modifiers/SimplifyModifier.ts @@ -1,8 +1,8 @@ import { BufferGeometry, Float32BufferAttribute, Vector3 } from 'three' import * as BufferGeometryUtils from '../utils/BufferGeometryUtils' -const cb = /* @__PURE__ */ new Vector3() -const ab = /* @__PURE__ */ new Vector3() +const cb = new Vector3() +const ab = new Vector3() function pushIfUnique(array: TItem[], object: TItem): void { if (array.indexOf(object) === -1) array.push(object) diff --git a/src/objects/Lensflare.js b/src/objects/Lensflare.js index cdef0141..70a698b1 100644 --- a/src/objects/Lensflare.js +++ b/src/objects/Lensflare.js @@ -17,21 +17,15 @@ import { Vector4, } from 'three' -const geometry = /* @__PURE__ */ new BufferGeometry() +const geometry = new BufferGeometry() -const float32Array = /* @__PURE__ */ new Float32Array([-1, -1, 0, 0, 0, 1, -1, 0, 1, 0, 1, 1, 0, 1, 1, -1, 1, 0, 0, 1]) +const float32Array = new Float32Array([-1, -1, 0, 0, 0, 1, -1, 0, 1, 0, 1, 1, 0, 1, 1, -1, 1, 0, 0, 1]) -const interleavedBuffer = /* @__PURE__ */ new InterleavedBuffer(float32Array, 5) +const interleavedBuffer = new InterleavedBuffer(float32Array, 5) -/* @__PURE__ */ geometry.setIndex([0, 1, 2, 0, 2, 3]) -/* @__PURE__ */ geometry.setAttribute( - 'position', - /* @__PURE__ */ new InterleavedBufferAttribute(interleavedBuffer, 3, 0, false), -) -/* @__PURE__ */ geometry.setAttribute( - 'uv', - /* @__PURE__ */ new InterleavedBufferAttribute(interleavedBuffer, 2, 3, false), -) +geometry.setIndex([0, 1, 2, 0, 2, 3]) +geometry.setAttribute('position', new InterleavedBufferAttribute(interleavedBuffer, 3, 0, false)) +geometry.setAttribute('uv', new InterleavedBufferAttribute(interleavedBuffer, 2, 3, false)) class Lensflare extends Mesh { static Geometry = geometry diff --git a/src/objects/ReflectorForSSRPass.js b/src/objects/ReflectorForSSRPass.js index c201a598..a03e7a82 100644 --- a/src/objects/ReflectorForSSRPass.js +++ b/src/objects/ReflectorForSSRPass.js @@ -26,16 +26,16 @@ class ReflectorForSSRPass extends Mesh { color: { value: null }, tDiffuse: { value: null }, tDepth: { value: null }, - textureMatrix: { value: /* @__PURE__ */ new Matrix4() }, + textureMatrix: { value: new Matrix4() }, maxDistance: { value: 180 }, opacity: { value: 0.5 }, fresnelCoe: { value: null }, virtualCameraNear: { value: null }, virtualCameraFar: { value: null }, - virtualCameraProjectionMatrix: { value: /* @__PURE__ */ new Matrix4() }, - virtualCameraMatrixWorld: { value: /* @__PURE__ */ new Matrix4() }, - virtualCameraProjectionMatrixInverse: { value: /* @__PURE__ */ new Matrix4() }, - resolution: { value: /* @__PURE__ */ new Vector2() }, + virtualCameraProjectionMatrix: { value: new Matrix4() }, + virtualCameraMatrixWorld: { value: new Matrix4() }, + virtualCameraProjectionMatrixInverse: { value: new Matrix4() }, + resolution: { value: new Vector2() }, }, vertexShader: /* glsl */ ` diff --git a/src/objects/ShadowMesh.js b/src/objects/ShadowMesh.js index 38f91193..41075b36 100644 --- a/src/objects/ShadowMesh.js +++ b/src/objects/ShadowMesh.js @@ -4,7 +4,7 @@ import { Matrix4, Mesh, MeshBasicMaterial, EqualStencilFunc, IncrementStencilOp * A shadow Mesh that follows a shadow-casting Mesh in the scene, but is confined to a single plane. */ -const _shadowMatrix = /* @__PURE__ */ new Matrix4() +const _shadowMatrix = new Matrix4() class ShadowMesh extends Mesh { constructor(mesh) { diff --git a/src/objects/Sky.ts b/src/objects/Sky.ts index 3896574d..80c206a2 100644 --- a/src/objects/Sky.ts +++ b/src/objects/Sky.ts @@ -7,8 +7,8 @@ const SkyShader = { rayleigh: { value: 1 }, mieCoefficient: { value: 0.005 }, mieDirectionalG: { value: 0.8 }, - sunPosition: { value: /* @__PURE__ */ new Vector3() }, - up: { value: /* @__PURE__ */ new Vector3(0, 1, 0) }, + sunPosition: { value: new Vector3() }, + up: { value: new Vector3(0, 1, 0) }, }, vertexShader: /* glsl */ ` @@ -173,11 +173,11 @@ const SkyShader = { `, } -const material = /* @__PURE__ */ new ShaderMaterial({ +const material = new ShaderMaterial({ name: 'SkyShader', fragmentShader: SkyShader.fragmentShader, vertexShader: SkyShader.vertexShader, - uniforms: /* @__PURE__ */ UniformsUtils.clone(SkyShader.uniforms), + uniforms: UniformsUtils.clone(SkyShader.uniforms), side: BackSide, depthWrite: false, }) diff --git a/src/objects/Water2.js b/src/objects/Water2.js index 6c94189c..4b73e8f2 100644 --- a/src/objects/Water2.js +++ b/src/objects/Water2.js @@ -53,7 +53,7 @@ class Water2 extends Mesh { }, config: { - value: /* @__PURE__ */ new Vector4(), + value: new Vector4(), }, }, diff --git a/src/postprocessing/UnrealBloomPass.js b/src/postprocessing/UnrealBloomPass.js index 1ff2b789..25e854c6 100644 --- a/src/postprocessing/UnrealBloomPass.js +++ b/src/postprocessing/UnrealBloomPass.js @@ -23,8 +23,8 @@ import { LuminosityHighPassShader } from '../shaders/LuminosityHighPassShader' * - https://docs.unrealengine.com/latest/INT/Engine/Rendering/PostProcessEffects/Bloom/ */ class UnrealBloomPass extends Pass { - static BlurDirectionX = /* @__PURE__ */ new Vector2(1.0, 0.0) - static BlurDirectionY = /* @__PURE__ */ new Vector2(0.0, 1.0) + static BlurDirectionX = new Vector2(1.0, 0.0) + static BlurDirectionY = new Vector2(0.0, 1.0) constructor(resolution, strength, radius, threshold) { super() diff --git a/src/renderers/CSS2DRenderer.js b/src/renderers/CSS2DRenderer.js index f0aa059e..7caf2532 100644 --- a/src/renderers/CSS2DRenderer.js +++ b/src/renderers/CSS2DRenderer.js @@ -35,11 +35,11 @@ class CSS2DObject extends Object3D { } } -const _vector = /* @__PURE__ */ new Vector3() -const _viewMatrix = /* @__PURE__ */ new Matrix4() -const _viewProjectionMatrix = /* @__PURE__ */ new Matrix4() -const _a = /* @__PURE__ */ new Vector3() -const _b = /* @__PURE__ */ new Vector3() +const _vector = new Vector3() +const _viewMatrix = new Matrix4() +const _viewProjectionMatrix = new Matrix4() +const _a = new Vector3() +const _b = new Vector3() class CSS2DRenderer { constructor(parameters = {}) { diff --git a/src/renderers/CSS3DRenderer.js b/src/renderers/CSS3DRenderer.js index d4a7f9ae..100b3395 100644 --- a/src/renderers/CSS3DRenderer.js +++ b/src/renderers/CSS3DRenderer.js @@ -4,9 +4,9 @@ import { Matrix4, Object3D, Quaternion, Vector3 } from 'three' * Based on http://www.emagix.net/academic/mscs-project/item/camera-sync-with-css3-and-webgl-threejs */ -const _position = /* @__PURE__ */ new Vector3() -const _quaternion = /* @__PURE__ */ new Quaternion() -const _scale = /* @__PURE__ */ new Vector3() +const _position = new Vector3() +const _quaternion = new Quaternion() +const _scale = new Vector3() class CSS3DObject extends Object3D { constructor(element = document.createElement('div')) { @@ -59,8 +59,8 @@ class CSS3DSprite extends CSS3DObject { // -const _matrix = /* @__PURE__ */ new Matrix4() -const _matrix2 = /* @__PURE__ */ new Matrix4() +const _matrix = new Matrix4() +const _matrix2 = new Matrix4() class CSS3DRenderer { constructor(parameters = {}) { diff --git a/src/shaders/BokehShader2.ts b/src/shaders/BokehShader2.ts index 6868400f..f9734ebe 100644 --- a/src/shaders/BokehShader2.ts +++ b/src/shaders/BokehShader2.ts @@ -78,7 +78,7 @@ export const BokehShader2: { pentagon: { value: 0 }, shaderFocus: { value: 1 }, - focusCoords: { value: /* @__PURE__ */ new Vector2() }, + focusCoords: { value: new Vector2() }, }, vertexShader: [ diff --git a/src/shaders/ColorCorrectionShader.ts b/src/shaders/ColorCorrectionShader.ts index f52afb49..2e63a4b3 100644 --- a/src/shaders/ColorCorrectionShader.ts +++ b/src/shaders/ColorCorrectionShader.ts @@ -7,9 +7,9 @@ import { Vector3 } from 'three' export const ColorCorrectionShader = { uniforms: { tDiffuse: { value: null }, - powRGB: { value: /* @__PURE__ */ new Vector3(2, 2, 2) }, - mulRGB: { value: /* @__PURE__ */ new Vector3(1, 1, 1) }, - addRGB: { value: /* @__PURE__ */ new Vector3(0, 0, 0) }, + powRGB: { value: new Vector3(2, 2, 2) }, + mulRGB: { value: new Vector3(1, 1, 1) }, + addRGB: { value: new Vector3(0, 0, 0) }, }, vertexShader: [ diff --git a/src/shaders/ColorifyShader.ts b/src/shaders/ColorifyShader.ts index e1ffa16a..68f74c5f 100644 --- a/src/shaders/ColorifyShader.ts +++ b/src/shaders/ColorifyShader.ts @@ -7,7 +7,7 @@ import { Color } from 'three' export const ColorifyShader = { uniforms: { tDiffuse: { value: null }, - color: { value: /* @__PURE__ */ new Color(0xffffff) }, + color: { value: new Color(0xffffff) }, }, vertexShader: [ diff --git a/src/shaders/ConvolutionShader.ts b/src/shaders/ConvolutionShader.ts index 8574f1b2..3d1c5126 100644 --- a/src/shaders/ConvolutionShader.ts +++ b/src/shaders/ConvolutionShader.ts @@ -32,7 +32,7 @@ export const ConvolutionShader: IConvolutionShader = { uniforms: { tDiffuse: { value: null }, - uImageIncrement: { value: /* @__PURE__ */ new Vector2(0.001953125, 0.0) }, + uImageIncrement: { value: new Vector2(0.001953125, 0.0) }, cKernel: { value: [] }, }, diff --git a/src/shaders/DepthLimitedBlurShader.ts b/src/shaders/DepthLimitedBlurShader.ts index 9ba6f8fa..2e962893 100644 --- a/src/shaders/DepthLimitedBlurShader.ts +++ b/src/shaders/DepthLimitedBlurShader.ts @@ -33,8 +33,8 @@ export const DepthLimitedBlurShader: IDepthLimitedBlurShader = { }, uniforms: { tDiffuse: { value: null }, - size: { value: /* @__PURE__ */ new Vector2(512, 512) }, - sampleUvOffsets: { value: [/* @__PURE__ */ new Vector2(0, 0)] }, + size: { value: new Vector2(512, 512) }, + sampleUvOffsets: { value: [new Vector2(0, 0)] }, sampleWeights: { value: [1.0] }, tDepth: { value: null }, cameraNear: { value: 10 }, diff --git a/src/shaders/DotScreenShader.ts b/src/shaders/DotScreenShader.ts index 5f5c9ba7..aa01e7b1 100644 --- a/src/shaders/DotScreenShader.ts +++ b/src/shaders/DotScreenShader.ts @@ -9,8 +9,8 @@ import { Vector2 } from 'three' export const DotScreenShader = { uniforms: { tDiffuse: { value: null }, - tSize: { value: /* @__PURE__ */ new Vector2(256, 256) }, - center: { value: /* @__PURE__ */ new Vector2(0.5, 0.5) }, + tSize: { value: new Vector2(256, 256) }, + center: { value: new Vector2(0.5, 0.5) }, angle: { value: 1.57 }, scale: { value: 1.0 }, }, diff --git a/src/shaders/FXAAShader.ts b/src/shaders/FXAAShader.ts index ec0e60b9..795b5677 100644 --- a/src/shaders/FXAAShader.ts +++ b/src/shaders/FXAAShader.ts @@ -10,7 +10,7 @@ import { Vector2 } from 'three' export const FXAAShader = { uniforms: { tDiffuse: { value: null }, - resolution: { value: /* @__PURE__ */ new Vector2(1 / 1024, 1 / 512) }, + resolution: { value: new Vector2(1 / 1024, 1 / 512) }, }, vertexShader: [ diff --git a/src/shaders/FreiChenShader.ts b/src/shaders/FreiChenShader.ts index 632915d6..4a0e2ea7 100644 --- a/src/shaders/FreiChenShader.ts +++ b/src/shaders/FreiChenShader.ts @@ -10,7 +10,7 @@ import { Vector2 } from 'three' export const FreiChenShader = { uniforms: { tDiffuse: { value: null }, - aspect: { value: /* @__PURE__ */ new Vector2(512, 512) }, + aspect: { value: new Vector2(512, 512) }, }, vertexShader: [ diff --git a/src/shaders/GodRaysShader.ts b/src/shaders/GodRaysShader.ts index 48baa1e5..6cfa2629 100644 --- a/src/shaders/GodRaysShader.ts +++ b/src/shaders/GodRaysShader.ts @@ -73,7 +73,7 @@ export const GodRaysGenerateShader = { value: 1.0, }, vSunPositionScreenSpace: { - value: /* @__PURE__ */ new Vector3(), + value: new Vector3(), }, }, @@ -235,7 +235,7 @@ export const GodRaysCombineShader = { export const GodRaysFakeSunShader = { uniforms: { vSunPositionScreenSpace: { - value: /* @__PURE__ */ new Vector3(), + value: new Vector3(), }, fAspect: { @@ -243,11 +243,11 @@ export const GodRaysFakeSunShader = { }, sunColor: { - value: /* @__PURE__ */ new Color(0xffee00), + value: new Color(0xffee00), }, bgColor: { - value: /* @__PURE__ */ new Color(0x000000), + value: new Color(0x000000), }, }, diff --git a/src/shaders/LuminosityHighPassShader.ts b/src/shaders/LuminosityHighPassShader.ts index 2bbd713c..88709b49 100644 --- a/src/shaders/LuminosityHighPassShader.ts +++ b/src/shaders/LuminosityHighPassShader.ts @@ -12,7 +12,7 @@ export const LuminosityHighPassShader = { tDiffuse: { value: null }, luminosityThreshold: { value: 1.0 }, smoothWidth: { value: 1.0 }, - defaultColor: { value: /* @__PURE__ */ new Color(0x000000) }, + defaultColor: { value: new Color(0x000000) }, defaultOpacity: { value: 0.0 }, }, diff --git a/src/shaders/NormalMapShader.ts b/src/shaders/NormalMapShader.ts index 92963499..56258ad7 100644 --- a/src/shaders/NormalMapShader.ts +++ b/src/shaders/NormalMapShader.ts @@ -8,8 +8,8 @@ import { Vector2 } from 'three' export const NormalMapShader = { uniforms: { heightMap: { value: null }, - resolution: { value: /* @__PURE__ */ new Vector2(512, 512) }, - scale: { value: /* @__PURE__ */ new Vector2(1, 1) }, + resolution: { value: new Vector2(512, 512) }, + scale: { value: new Vector2(1, 1) }, height: { value: 0.05 }, }, diff --git a/src/shaders/SAOShader.ts b/src/shaders/SAOShader.ts index 8add68db..69b1546c 100644 --- a/src/shaders/SAOShader.ts +++ b/src/shaders/SAOShader.ts @@ -43,12 +43,12 @@ export const SAOShader: ISAOShader = { tDepth: { value: null }, tDiffuse: { value: null }, tNormal: { value: null }, - size: { value: /* @__PURE__ */ new Vector2(512, 512) }, + size: { value: new Vector2(512, 512) }, cameraNear: { value: 1 }, cameraFar: { value: 100 }, - cameraProjectionMatrix: { value: /* @__PURE__ */ new Matrix4() }, - cameraInverseProjectionMatrix: { value: /* @__PURE__ */ new Matrix4() }, + cameraProjectionMatrix: { value: new Matrix4() }, + cameraInverseProjectionMatrix: { value: new Matrix4() }, scale: { value: 1.0 }, intensity: { value: 0.1 }, diff --git a/src/shaders/SMAAShader.ts b/src/shaders/SMAAShader.ts index 23484a7a..95813a82 100644 --- a/src/shaders/SMAAShader.ts +++ b/src/shaders/SMAAShader.ts @@ -13,7 +13,7 @@ export const SMAAEdgesShader = { uniforms: { tDiffuse: { value: null }, - resolution: { value: /* @__PURE__ */ new Vector2(1 / 1024, 1 / 512) }, + resolution: { value: new Vector2(1 / 1024, 1 / 512) }, }, vertexShader: [ @@ -117,7 +117,7 @@ export const SMAAWeightsShader = { tDiffuse: { value: null }, tArea: { value: null }, tSearch: { value: null }, - resolution: { value: /* @__PURE__ */ new Vector2(1 / 1024, 1 / 512) }, + resolution: { value: new Vector2(1 / 1024, 1 / 512) }, }, vertexShader: [ @@ -357,7 +357,7 @@ export const SMAABlendShader = { uniforms: { tDiffuse: { value: null }, tColor: { value: null }, - resolution: { value: /* @__PURE__ */ new Vector2(1 / 1024, 1 / 512) }, + resolution: { value: new Vector2(1 / 1024, 1 / 512) }, }, vertexShader: [ diff --git a/src/shaders/SSAOShader.ts b/src/shaders/SSAOShader.ts index 8a54d07c..98475a18 100644 --- a/src/shaders/SSAOShader.ts +++ b/src/shaders/SSAOShader.ts @@ -21,9 +21,9 @@ export const SSAOShader = { kernel: { value: null }, cameraNear: { value: null }, cameraFar: { value: null }, - resolution: { value: /* @__PURE__ */ new Vector2() }, - cameraProjectionMatrix: { value: /* @__PURE__ */ new Matrix4() }, - cameraInverseProjectionMatrix: { value: /* @__PURE__ */ new Matrix4() }, + resolution: { value: new Vector2() }, + cameraProjectionMatrix: { value: new Matrix4() }, + cameraInverseProjectionMatrix: { value: new Matrix4() }, kernelRadius: { value: 8 }, minDistance: { value: 0.005 }, maxDistance: { value: 0.05 }, @@ -227,7 +227,7 @@ export const SSAODepthShader = { export const SSAOBlurShader = { uniforms: { tDiffuse: { value: null }, - resolution: { value: /* @__PURE__ */ new Vector2() }, + resolution: { value: new Vector2() }, }, vertexShader: [ diff --git a/src/shaders/SSRShader.ts b/src/shaders/SSRShader.ts index fe073f1f..a212b977 100644 --- a/src/shaders/SSRShader.ts +++ b/src/shaders/SSRShader.ts @@ -21,9 +21,9 @@ export const SSRShader = { tDepth: { value: null }, cameraNear: { value: null }, cameraFar: { value: null }, - resolution: { value: /* @__PURE__ */ new Vector2() }, - cameraProjectionMatrix: { value: /* @__PURE__ */ new Matrix4() }, - cameraInverseProjectionMatrix: { value: /* @__PURE__ */ new Matrix4() }, + resolution: { value: new Vector2() }, + cameraProjectionMatrix: { value: new Matrix4() }, + cameraInverseProjectionMatrix: { value: new Matrix4() }, opacity: { value: 0.5 }, maxDistance: { value: 180 }, cameraRange: { value: 0 }, @@ -278,7 +278,7 @@ export const SSRDepthShader = { export const SSRBlurShader = { uniforms: { tDiffuse: { value: null }, - resolution: { value: /* @__PURE__ */ new Vector2() }, + resolution: { value: new Vector2() }, opacity: { value: 0.5 }, }, diff --git a/src/shaders/SobelOperatorShader.ts b/src/shaders/SobelOperatorShader.ts index c4bd0b9e..2401781f 100644 --- a/src/shaders/SobelOperatorShader.ts +++ b/src/shaders/SobelOperatorShader.ts @@ -10,7 +10,7 @@ import { Vector2 } from 'three' export const SobelOperatorShader = { uniforms: { tDiffuse: { value: null }, - resolution: { value: /* @__PURE__ */ new Vector2() }, + resolution: { value: new Vector2() }, }, vertexShader: [ diff --git a/src/shaders/SubsurfaceScatteringShader.ts b/src/shaders/SubsurfaceScatteringShader.ts index 1f0324f8..e4b1f804 100644 --- a/src/shaders/SubsurfaceScatteringShader.ts +++ b/src/shaders/SubsurfaceScatteringShader.ts @@ -22,11 +22,11 @@ function get() { ) _SubsurfaceScatteringShader = { - uniforms: /* @__PURE__ */ UniformsUtils.merge([ + uniforms: UniformsUtils.merge([ ShaderLib['phong'].uniforms, { thicknessMap: { value: null }, - thicknessColor: { value: /* @__PURE__ */ new Color(0xffffff) }, + thicknessColor: { value: new Color(0xffffff) }, thicknessDistortion: { value: 0.1 }, thicknessAmbient: { value: 0.0 }, thicknessAttenuation: { value: 0.1 }, diff --git a/src/shaders/ToonShader.ts b/src/shaders/ToonShader.ts index c0d8975d..d541f81c 100644 --- a/src/shaders/ToonShader.ts +++ b/src/shaders/ToonShader.ts @@ -11,12 +11,12 @@ import { Color, Vector3 } from 'three' export const ToonShader1 = { uniforms: { - uDirLightPos: { value: /* @__PURE__ */ new Vector3() }, - uDirLightColor: { value: /* @__PURE__ */ new Color(0xeeeeee) }, + uDirLightPos: { value: new Vector3() }, + uDirLightColor: { value: new Color(0xeeeeee) }, - uAmbientLightColor: { value: /* @__PURE__ */ new Color(0x050505) }, + uAmbientLightColor: { value: new Color(0x050505) }, - uBaseColor: { value: /* @__PURE__ */ new Color(0xffffff) }, + uBaseColor: { value: new Color(0xffffff) }, }, vertexShader: [ @@ -79,16 +79,16 @@ export const ToonShader1 = { export const ToonShader2 = { uniforms: { - uDirLightPos: { value: /* @__PURE__ */ new Vector3() }, - uDirLightColor: { value: /* @__PURE__ */ new Color(0xeeeeee) }, + uDirLightPos: { value: new Vector3() }, + uDirLightColor: { value: new Color(0xeeeeee) }, - uAmbientLightColor: { value: /* @__PURE__ */ new Color(0x050505) }, + uAmbientLightColor: { value: new Color(0x050505) }, - uBaseColor: { value: /* @__PURE__ */ new Color(0xeeeeee) }, - uLineColor1: { value: /* @__PURE__ */ new Color(0x808080) }, - uLineColor2: { value: /* @__PURE__ */ new Color(0x000000) }, - uLineColor3: { value: /* @__PURE__ */ new Color(0x000000) }, - uLineColor4: { value: /* @__PURE__ */ new Color(0x000000) }, + uBaseColor: { value: new Color(0xeeeeee) }, + uLineColor1: { value: new Color(0x808080) }, + uLineColor2: { value: new Color(0x000000) }, + uLineColor3: { value: new Color(0x000000) }, + uLineColor4: { value: new Color(0x000000) }, }, vertexShader: [ @@ -141,16 +141,16 @@ export const ToonShader2 = { export const ToonShaderHatching = { uniforms: { - uDirLightPos: { value: /* @__PURE__ */ new Vector3() }, - uDirLightColor: { value: /* @__PURE__ */ new Color(0xeeeeee) }, + uDirLightPos: { value: new Vector3() }, + uDirLightColor: { value: new Color(0xeeeeee) }, - uAmbientLightColor: { value: /* @__PURE__ */ new Color(0x050505) }, + uAmbientLightColor: { value: new Color(0x050505) }, - uBaseColor: { value: /* @__PURE__ */ new Color(0xffffff) }, - uLineColor1: { value: /* @__PURE__ */ new Color(0x000000) }, - uLineColor2: { value: /* @__PURE__ */ new Color(0x000000) }, - uLineColor3: { value: /* @__PURE__ */ new Color(0x000000) }, - uLineColor4: { value: /* @__PURE__ */ new Color(0x000000) }, + uBaseColor: { value: new Color(0xffffff) }, + uLineColor1: { value: new Color(0x000000) }, + uLineColor2: { value: new Color(0x000000) }, + uLineColor3: { value: new Color(0x000000) }, + uLineColor4: { value: new Color(0x000000) }, }, vertexShader: [ @@ -231,13 +231,13 @@ export const ToonShaderHatching = { export const ToonShaderDotted = { uniforms: { - uDirLightPos: { value: /* @__PURE__ */ new Vector3() }, - uDirLightColor: { value: /* @__PURE__ */ new Color(0xeeeeee) }, + uDirLightPos: { value: new Vector3() }, + uDirLightColor: { value: new Color(0xeeeeee) }, - uAmbientLightColor: { value: /* @__PURE__ */ new Color(0x050505) }, + uAmbientLightColor: { value: new Color(0x050505) }, - uBaseColor: { value: /* @__PURE__ */ new Color(0xffffff) }, - uLineColor1: { value: /* @__PURE__ */ new Color(0x000000) }, + uBaseColor: { value: new Color(0xffffff) }, + uLineColor1: { value: new Color(0x000000) }, }, vertexShader: [ diff --git a/src/shaders/TriangleBlurShader.ts b/src/shaders/TriangleBlurShader.ts index 5f7864d0..e24c0838 100644 --- a/src/shaders/TriangleBlurShader.ts +++ b/src/shaders/TriangleBlurShader.ts @@ -13,7 +13,7 @@ import { Vector2 } from 'three' export const TriangleBlurShader = { uniforms: { texture: { value: null }, - delta: { value: /* @__PURE__ */ new Vector2(1, 1) }, + delta: { value: new Vector2(1, 1) }, }, vertexShader: [ diff --git a/src/shaders/VolumeShader.ts b/src/shaders/VolumeShader.ts index 770c4e78..eb321679 100644 --- a/src/shaders/VolumeShader.ts +++ b/src/shaders/VolumeShader.ts @@ -8,10 +8,10 @@ import { Vector2, Vector3 } from 'three' export const VolumeRenderShader1 = { uniforms: { - u_size: { value: /* @__PURE__ */ new Vector3(1, 1, 1) }, + u_size: { value: new Vector3(1, 1, 1) }, u_renderstyle: { value: 0 }, u_renderthreshold: { value: 0.5 }, - u_clim: { value: /* @__PURE__ */ new Vector2(1, 1) }, + u_clim: { value: new Vector2(1, 1) }, u_data: { value: null }, u_cmdata: { value: null }, }, diff --git a/src/utils/RoughnessMipmapper.js b/src/utils/RoughnessMipmapper.js index 6b58a42b..46e58c7c 100644 --- a/src/utils/RoughnessMipmapper.js +++ b/src/utils/RoughnessMipmapper.js @@ -17,11 +17,11 @@ import { WebGLRenderTarget, } from 'three' -var _mipmapMaterial = /* @__PURE__ */ _getMipmapMaterial() +var _mipmapMaterial = _getMipmapMaterial() -var _mesh = /* @__PURE__ */ new Mesh(/* @__PURE__ */ new PlaneGeometry(2, 2), _mipmapMaterial) +var _mesh = new Mesh(new PlaneGeometry(2, 2), _mipmapMaterial) -var _flatCamera = /* @__PURE__ */ new OrthographicCamera(0, 1, 0, 1, 0, 1) +var _flatCamera = new OrthographicCamera(0, 1, 0, 1, 0, 1) var _tempTarget = null diff --git a/src/webxr/OculusHandPointerModel.js b/src/webxr/OculusHandPointerModel.js index 00e044a5..4881455c 100644 --- a/src/webxr/OculusHandPointerModel.js +++ b/src/webxr/OculusHandPointerModel.js @@ -13,8 +13,8 @@ const POINTER_LENGTH = 0.035 const POINTER_SEGMENTS = 16 const POINTER_RINGS = 12 const POINTER_HEMISPHERE_ANGLE = 110 -const YAXIS = /* @__PURE__ */ new THREE.Vector3(0, 1, 0) -const ZAXIS = /* @__PURE__ */ new THREE.Vector3(0, 0, 1) +const YAXIS = new THREE.Vector3(0, 1, 0) +const ZAXIS = new THREE.Vector3(0, 0, 1) const CURSOR_RADIUS = 0.02 const CURSOR_MAX_DISTANCE = 1.5 diff --git a/src/webxr/VRButton.ts b/src/webxr/VRButton.ts index 8d14c500..d2936308 100644 --- a/src/webxr/VRButton.ts +++ b/src/webxr/VRButton.ts @@ -145,4 +145,6 @@ class VRButton { } } +VRButton.registerSessionGrantedListener() + export { VRButton } diff --git a/src/webxr/XRHandPrimitiveModel.js b/src/webxr/XRHandPrimitiveModel.js index 9f072dcb..9e98456a 100644 --- a/src/webxr/XRHandPrimitiveModel.js +++ b/src/webxr/XRHandPrimitiveModel.js @@ -8,8 +8,8 @@ import { Vector3, } from 'three' -const _matrix = /* @__PURE__ */ /* @__PURE__ */ new Matrix4() -const _vector = /* @__PURE__ */ new Vector3() +const _matrix = new Matrix4() +const _vector = new Vector3() class XRHandPrimitiveModel { constructor(handModel, controller, path, handedness, options) { diff --git a/vite.config.ts b/vite.config.ts index 1885e31b..8eef045d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -6,6 +6,7 @@ export default defineConfig({ build: { minify: false, target: 'es2018', + sourcemap: true, lib: { formats: ['cjs', 'es'], entry: 'src/index.ts', @@ -21,29 +22,19 @@ export default defineConfig({ renderChunk: { order: 'post', async handler(code) { - function annotate(statement?: babel.types.Expression | null): void { - if (statement?.type !== 'CallExpression' && statement?.type !== 'NewExpression') return - if (!statement.leadingComments) statement.leadingComments = [] - statement.leadingComments.push({ - type: 'CommentBlock', - value: ' @__PURE__ ', - }) + function annotate(path: babel.NodePath): void { + if (!path.getFunctionParent()) { + path.addComment('leading', '@__PURE__') + } } + return babel.transform(code, { + sourceMaps: true, plugins: [ { visitor: { - Program(path) { - for (const statement of path.node.body) { - if (babel.types.isExpressionStatement(statement)) { - annotate(statement.expression) - } else if (babel.types.isVariableDeclaration(statement)) { - for (const declaration of statement.declarations) { - annotate(declaration.init) - } - } - } - }, + CallExpression: annotate, + NewExpression: annotate, }, }, ],