Skip to content

Commit

Permalink
Merge branch 'main' into fix/ts-cts
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyJasonBennett committed Jan 15, 2025
2 parents 13ef7bc + 7555435 commit efd21a0
Show file tree
Hide file tree
Showing 172 changed files with 12,715 additions and 11,680 deletions.
17 changes: 5 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ jobs:
run: yarn build
- name: Check for SSR compat
run: node dist/index.cjs && node dist/index.js
- name: Check NPM config
run: npx publint@latest dist
# TODO: upgrade Nodes
# - name: Check NPM config
# run: npx publint@latest dist
release:
needs: test
runs-on: ubuntu-latest
Expand All @@ -51,17 +52,9 @@ jobs:
- name: Check build health
run: yarn build
- name: 🚀 Release
uses: cycjimmy/semantic-release-action@v2
uses: cycjimmy/semantic-release-action@v4
with:
semantic_version: 17
extra_plugins: |
@semantic-release/git
branches: |
[
'main',
{name: 'beta', prerelease: true},
{name: 'alpha', prerelease: true}
]
semantic_version: 24
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
8 changes: 1 addition & 7 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
branches: ['main', { name: 'beta', prerelease: true }, { name: 'alpha', prerelease: true }],
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
Expand All @@ -9,12 +10,5 @@ module.exports = {
},
],
'@semantic-release/github',
[
'@semantic-release/git',
{
assets: ['package.json'],
message: 'chore(release): ${nextRelease.version}',
},
],
],
}
36 changes: 20 additions & 16 deletions src/_polyfill/CapsuleGeometry.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
import { Path, LatheGeometry } from 'three'

class CapsuleGeometry extends LatheGeometry {
constructor(radius = 1, length = 1, capSegments = 4, radialSegments = 8) {
const path = new Path()
path.absarc(0, -length / 2, radius, Math.PI * 1.5, 0)
path.absarc(0, length / 2, radius, 0, Math.PI * 0.5)
const CapsuleGeometry = /* @__PURE__ */ (() => {
class CapsuleGeometry extends LatheGeometry {
constructor(radius = 1, length = 1, capSegments = 4, radialSegments = 8) {
const path = new Path()
path.absarc(0, -length / 2, radius, Math.PI * 1.5, 0)
path.absarc(0, length / 2, radius, 0, Math.PI * 0.5)

super(path.getPoints(capSegments), radialSegments)
super(path.getPoints(capSegments), radialSegments)

this.type = 'CapsuleGeometry'
this.type = 'CapsuleGeometry'

this.parameters = {
radius: radius,
height: length,
capSegments: capSegments,
radialSegments: radialSegments,
this.parameters = {
radius: radius,
height: length,
capSegments: capSegments,
radialSegments: radialSegments,
}
}
}

static fromJSON(data) {
return new CapsuleGeometry(data.radius, data.length, data.capSegments, data.radialSegments)
static fromJSON(data) {
return new CapsuleGeometry(data.radius, data.length, data.capSegments, data.radialSegments)
}
}
}

return CapsuleGeometry
})()

export { CapsuleGeometry }
25 changes: 25 additions & 0 deletions src/_polyfill/LoaderUtils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export function decodeText(array) {
if (typeof TextDecoder !== 'undefined') {
return new TextDecoder().decode(array)
}

// Avoid the String.fromCharCode.apply(null, array) shortcut, which
// throws a "maximum call stack size exceeded" error for large arrays.

let s = ''

for (let i = 0, il = array.length; i < il; i++) {
// Implicitly assumes little-endian.
s += String.fromCharCode(array[i])
}

try {
// merges multi-byte utf-8 characters.

return decodeURIComponent(escape(s))
} catch (e) {
// see https://github.com/mrdoob/three.js/issues/16358

return s
}
}
2 changes: 1 addition & 1 deletion src/_polyfill/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { REVISION } from 'three'

export const version = parseInt(REVISION.replace(/\D+/g, ''))
export const version = /* @__PURE__ */ (() => parseInt(REVISION.replace(/\D+/g, '')))()
7 changes: 7 additions & 0 deletions src/_polyfill/uv1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { version } from "./constants";

/** uv2 renamed to uv1 in r125
*
* https://github.com/mrdoob/three.js/pull/25943
*/
export const UV1 = version >= 125 ? 'uv1' : 'uv2'
26 changes: 13 additions & 13 deletions src/animation/AnimationClipCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
VectorKeyframeTrack,
} from 'three'

class AnimationClipCreator {
static CreateRotationAnimation(period, axis = 'x') {
const AnimationClipCreator = {
CreateRotationAnimation(period, axis = 'x') {
const times = [0, period],
values = [0, 360]

Expand All @@ -17,9 +17,9 @@ class AnimationClipCreator {
const track = new NumberKeyframeTrack(trackName, times, values)

return new AnimationClip(null, period, [track])
}
},

static CreateScaleAxisAnimation(period, axis = 'x') {
CreateScaleAxisAnimation(period, axis = 'x') {
const times = [0, period],
values = [0, 1]

Expand All @@ -28,9 +28,9 @@ class AnimationClipCreator {
const track = new NumberKeyframeTrack(trackName, times, values)

return new AnimationClip(null, period, [track])
}
},

static CreateShakeAnimation(duration, shakeScale) {
CreateShakeAnimation(duration, shakeScale) {
const times = [],
values = [],
tmp = new Vector3()
Expand All @@ -49,9 +49,9 @@ class AnimationClipCreator {
const track = new VectorKeyframeTrack(trackName, times, values)

return new AnimationClip(null, duration, [track])
}
},

static CreatePulsationAnimation(duration, pulseScale) {
CreatePulsationAnimation(duration, pulseScale) {
const times = [],
values = [],
tmp = new Vector3()
Expand All @@ -68,9 +68,9 @@ class AnimationClipCreator {
const track = new VectorKeyframeTrack(trackName, times, values)

return new AnimationClip(null, duration, [track])
}
},

static CreateVisibilityAnimation(duration) {
CreateVisibilityAnimation(duration) {
const times = [0, duration / 2, duration],
values = [true, false, true]

Expand All @@ -79,9 +79,9 @@ class AnimationClipCreator {
const track = new BooleanKeyframeTrack(trackName, times, values)

return new AnimationClip(null, duration, [track])
}
},

static CreateMaterialColorAnimation(duration, colors) {
CreateMaterialColorAnimation(duration, colors) {
const times = [],
values = [],
timeStep = duration / colors.length
Expand All @@ -98,7 +98,7 @@ class AnimationClipCreator {
const track = new ColorKeyframeTrack(trackName, times, values)

return new AnimationClip(null, duration, [track])
}
},
}

export { AnimationClipCreator }
22 changes: 11 additions & 11 deletions src/animation/CCDIKSolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ import {
Vector3,
} from 'three'

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()
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()

/**
* CCD Algorithm
Expand Down
2 changes: 1 addition & 1 deletion src/animation/MMDAnimationHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ class AudioManager {
}
}

const _q = new Quaternion()
const _q = /* @__PURE__ */ new Quaternion()

/**
* Solver for Grant (Fuyo in Japanese. I just google translated because
Expand Down
8 changes: 4 additions & 4 deletions src/animation/MMDPhysics.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Bone, Euler, Matrix4, Object3D, Quaternion, SkinnedMesh, Vector3 } from 'three'
import { Bone, Euler, Matrix4, MeshBasicMaterial, Object3D, Quaternion, SkinnedMesh, Vector3 } from 'three'

export interface MMDPhysicsParameter {
unitStep?: number | undefined
Expand Down Expand Up @@ -110,10 +110,10 @@ export class Constraint {
}

export class MMDPhysicsHelper extends Object3D {
mesh: THREE.SkinnedMesh
mesh: SkinnedMesh
physics: MMDPhysics
materials: [THREE.MeshBasicMaterial, THREE.MeshBasicMaterial, THREE.MeshBasicMaterial]
materials: [MeshBasicMaterial, MeshBasicMaterial, MeshBasicMaterial]

constructor(mesh: THREE.SkinnedMesh, physics: MMDPhysics)
constructor(mesh: SkinnedMesh, physics: MMDPhysics)
dispose(): void
}
8 changes: 4 additions & 4 deletions src/animation/MMDPhysics.js
Original file line number Diff line number Diff line change
Expand Up @@ -1001,10 +1001,10 @@ class Constraint {
}
}

const _position = new Vector3()
const _quaternion = new Quaternion()
const _scale = new Vector3()
const _matrixWorldInv = new Matrix4()
const _position = /* @__PURE__ */ new Vector3()
const _quaternion = /* @__PURE__ */ new Quaternion()
const _scale = /* @__PURE__ */ new Vector3()
const _matrixWorldInv = /* @__PURE__ */ new Matrix4()

class MMDPhysicsHelper extends Object3D {
/**
Expand Down
11 changes: 6 additions & 5 deletions src/controls/ArcballControls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ import {
OrthographicCamera,
Mesh,
Material,
EventDispatcher,
} from 'three'
import { EventDispatcher } from './EventDispatcher'
import { StandardControlsEventMap } from './StandardControlsEventMap'

type Camera = OrthographicCamera | PerspectiveCamera
type Operation = 'PAN' | 'ROTATE' | 'ZOOM' | 'FOV'
Expand Down Expand Up @@ -67,8 +68,8 @@ const _center = {

//transformation matrices for gizmos and camera
const _transformation: Transformation = {
camera: new Matrix4(),
gizmos: new Matrix4(),
camera: /* @__PURE__ */ new Matrix4(),
gizmos: /* @__PURE__ */ new Matrix4(),
}

//events
Expand All @@ -82,7 +83,7 @@ const _endEvent = { type: 'end' }
* @param {HTMLElement=null} domElement Renderer's dom element
* @param {Scene=null} scene The scene to be rendered
*/
class ArcballControls extends EventDispatcher {
class ArcballControls extends EventDispatcher<StandardControlsEventMap> {
private camera: OrthographicCamera | PerspectiveCamera | null
private domElement: HTMLElement | null | undefined
private scene: Scene | null | undefined
Expand Down Expand Up @@ -190,7 +191,7 @@ class ArcballControls extends EventDispatcher {
public minZoom: number
public maxZoom: number

private target: Vector3
readonly target: Vector3
private _currentTarget: Vector3

private _tbRadius: number
Expand Down
6 changes: 4 additions & 2 deletions src/controls/DeviceOrientationControls.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { Camera, Euler, EventDispatcher, MathUtils, Quaternion, Vector3 } from 'three'
import { Camera, Euler, MathUtils, Quaternion, Vector3 } from 'three'
import { EventDispatcher } from './EventDispatcher'
import { StandardControlsEventMap } from './StandardControlsEventMap'

/**
* W3C Device Orientation control (http://w3c.github.io/deviceorientation/spec-source-orientation.html)
*/

class DeviceOrientationControls extends EventDispatcher {
class DeviceOrientationControls extends EventDispatcher<StandardControlsEventMap> {
public object: Camera

private changeEvent = { type: 'change' }
Expand Down
32 changes: 30 additions & 2 deletions src/controls/DragControls.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
import { Camera, EventDispatcher, Intersection, Matrix4, Object3D, Plane, Raycaster, Vector2, Vector3 } from 'three'
import { Camera, Intersection, Matrix4, Object3D, Plane, Raycaster, Vector2, Vector3 } from 'three'
import { EventDispatcher } from './EventDispatcher'

export interface DragControlsEventMap {
/**
* Fires when the pointer is moved onto a 3D object, or onto one of its children.
*/
hoveron: { object: Object3D };

/**
* Fires when the pointer is moved out of a 3D object.
*/
hoveroff: { object: Object3D };

/**
* Fires when the user starts to drag a 3D object.
*/
dragstart: { object: Object3D };

/**
* Fires when the user drags a 3D object.
*/
drag: { object: Object3D };

/**
* Fires when the user has finished dragging a 3D object.
*/
dragend: { object: Object3D };
}

class DragControls extends EventDispatcher {
class DragControls extends EventDispatcher<DragControlsEventMap> {
public enabled = true
public transformGroup = false

Expand Down
Loading

0 comments on commit efd21a0

Please sign in to comment.