Skip to content

Commit

Permalink
feat: update three to 133 & copy @types/three/examples/*.d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
deepkolos committed Oct 13, 2021
1 parent a089566 commit 2f45f26
Show file tree
Hide file tree
Showing 415 changed files with 18,380 additions and 11,869 deletions.
2,441 changes: 1,179 additions & 1,262 deletions build/three.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/three.min.js

Large diffs are not rendered by default.

8,648 changes: 4,284 additions & 4,364 deletions build/three.module.js

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions config/platfromize.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,8 @@ export function injectPlatformCode() {
);
// 淘宝小程序ios下对于不支持的扩展返回undefined
code = code.replace(
`if ( extension === null ) {`,
`
extension = extension || null;
if ( extension === null ) {`,
`const extension = getExtension( name );`,
`const extension = getExtension( name ) || null;`,
);
}

Expand Down
12 changes: 11 additions & 1 deletion config/post-jsm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fs = require('fs');
const path = require('path');
const fastGlob = require('fast-glob');

const p = s => path.resolve(__dirname, s);
const constants = fs.readFileSync(p('../three/src/constants.js'), {
Expand All @@ -12,7 +13,6 @@ fs.copyFileSync(
p('../examples/jsm/libs/opentype.module.js'),
);


if (REVISION <= 127) {
fs.copyFileSync(
p('../tools/TGALoader.js'),
Expand All @@ -25,3 +25,13 @@ fs.copyFileSync(
p('../tools/zstddec.module.js'),
p('../examples/jsm/libs/zstddec.module.js'),
);

// 把的examples.d.ts复制到examples目录下
fastGlob
.sync('./node_modules/@types/three/examples/jsm/**/*.d.ts')
.forEach(file => {
fs.copyFileSync(
p('.' + file),
p(file.replace('./node_modules/@types/three/', '../')),
);
});
3 changes: 2 additions & 1 deletion config/rollup.config.three-origin.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ export function glconstants() {
MAX_SAMPLES: 36183,
READ_FRAMEBUFFER: 36008,
DRAW_FRAMEBUFFER: 36009,
SAMPLE_ALPHA_TO_COVERAGE: 32926
SAMPLE_ALPHA_TO_COVERAGE: 32926,
SRGB8_ALPHA8: 35907
};

return {
Expand Down
12 changes: 5 additions & 7 deletions examples/jsm/WebGL.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
export namespace WEBGL {

export function isWebGLAvailable(): boolean;
export function isWebGL2Available(): boolean;
export function getWebGLErrorMessage(): HTMLElement;
export function getWebGL2ErrorMessage(): HTMLElement;
export function getErrorMessage( version: number ): HTMLElement;

function isWebGLAvailable(): boolean;
function isWebGL2Available(): boolean;
function getWebGLErrorMessage(): HTMLElement;
function getWebGL2ErrorMessage(): HTMLElement;
function getErrorMessage(version: number): HTMLElement;
}
27 changes: 11 additions & 16 deletions examples/jsm/animation/AnimationClipCreator.d.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import {
AnimationClip,
Vector3
} from '../../../src/Three';

export class AnimationClipCreator {

constructor();

static CreateRotationAnimation( period: number, axis: string ): AnimationClip;
static CreateScaleAxisAnimation( period: number, axis: string ): AnimationClip;
static CreateShakeAnimation( duration: number, shakeScale: Vector3 ): AnimationClip;
static CreatePulsationAnimation( duration: number, pulseScale: number ): AnimationClip;
static CreateVisibilityAnimation( duration: number ): AnimationClip;
static CreateMaterialColorAnimation( duration: number, colors: number[] ): AnimationClip;

import { AnimationClip, Vector3 } from '../../../src/Three';

export interface AnimationClipCreator {
CreateRotationAnimation(period: number, axis: string): AnimationClip;
CreateScaleAxisAnimation(period: number, axis: string): AnimationClip;
CreateShakeAnimation(duration: number, shakeScale: Vector3): AnimationClip;
CreatePulsationAnimation(duration: number, pulseScale: number): AnimationClip;
CreateVisibilityAnimation(duration: number): AnimationClip;
CreateMaterialColorAnimation(duration: number, colors: number[]): AnimationClip;
}

export const AnimationClipCreator: AnimationClipCreator;
36 changes: 16 additions & 20 deletions examples/jsm/animation/CCDIKSolver.d.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
import {
SkinnedMesh,
} from '../../../src/Three';
import { Object3D, SkinnedMesh } from '../../../src/Three';

// tslint:disable-next-line:interface-name
export interface IKS {
effector: number;
iteration: number;
links: {
enabled: boolean;
index: number;
}
maxAngle: number;
target: number;
effector: number;
iteration: number;
links: {
enabled: boolean;
index: number;
};
maxAngle: number;
target: number;
}

export class CCDIKSolver {
constructor(mesh: SkinnedMesh, iks: IKS[]);

constructor( mesh: SkinnedMesh, iks: IKS[] );

update(): this;
createHelper(): CCDIKHelper;

update(): this;
updateOne(iks: IKS): this;
createHelper(): CCDIKHelper;
}

export class CCDIKHelper {

constructor( mesh: SkinnedMesh, iks: IKS[] );

export class CCDIKHelper extends Object3D {
constructor(mesh: SkinnedMesh, iks: IKS[]);
}
146 changes: 79 additions & 67 deletions examples/jsm/animation/MMDAnimationHelper.d.ts
Original file line number Diff line number Diff line change
@@ -1,91 +1,103 @@
import {
AnimationClip,
Audio,
Camera,
Mesh,
Object3D,
SkinnedMesh
AnimationClip,
Audio,
Camera,
Mesh,
Object3D,
Quaternion,
SkinnedMesh,
Bone,
AnimationMixer,
} from '../../../src/Three';

import { CCDIKSolver } from './CCDIKSolver';
import { MMDPhysics } from './MMDPhysics';

export interface MMDAnimationHelperParameter {
sync?: boolean;
afterglow?: number;
resetPhysicsOnLoop?: boolean;
sync?: boolean | undefined;
afterglow?: number | undefined;
resetPhysicsOnLoop?: boolean | undefined;
}

export interface MMDAnimationHelperAddParameter {
animation?: AnimationClip | AnimationClip[];
physics?: boolean;
warmup?: number;
unitStep?: number;
maxStepNum?: number;
gravity?: number;
delayTime?: number;
animation?: AnimationClip | AnimationClip[] | undefined;
physics?: boolean | undefined;
warmup?: number | undefined;
unitStep?: number | undefined;
maxStepNum?: number | undefined;
gravity?: number | undefined;
delayTime?: number | undefined;
}

export interface MMDAnimationHelperPoseParameter {
resetPose?: boolean;
ik?: boolean;
grant?: boolean;
resetPose?: boolean | undefined;
ik?: boolean | undefined;
grant?: boolean | undefined;
}

export class MMDAnimationHelper {

constructor( params?: MMDAnimationHelperParameter );
meshes: Mesh[];
camera: Camera | null;
cameraTarget: Object3D;
audio: Audio;
audioManager: AudioManager;
configuration: {
sync: boolean;
afterglow: number;
resetPhysicsOnLoop: boolean;
};
enabled: {
animation: boolean;
ik: boolean;
grant: boolean;
physics: boolean;
cameraAnimation: boolean;
};
onBeforePhysics: ( mesh: SkinnedMesh ) => void;
sharedPhysics: boolean;
masterPhysics: null;

add( object: SkinnedMesh | Camera | Audio, params?: MMDAnimationHelperAddParameter ): this;
remove( object: SkinnedMesh | Camera | Audio ): this;
update( delta: number ): this;
pose( mesh: SkinnedMesh, vpd: object, params?: MMDAnimationHelperPoseParameter ): this;
enable( key: string, enabled: boolean ): this;
createGrantSolver( mesh: SkinnedMesh ): GrantSolver;
export interface MMDAnimationHelperMixer {
looped: boolean;
mixer?: AnimationMixer | undefined;
ikSolver: CCDIKSolver;
grantSolver: GrantSolver;
physics?: MMDPhysics | undefined;
duration?: number | undefined;
}

export class MMDAnimationHelper {
constructor(params?: MMDAnimationHelperParameter);
meshes: SkinnedMesh[];
camera: Camera | null;
cameraTarget: Object3D;
audio: Audio;
audioManager: AudioManager;
configuration: {
sync: boolean;
afterglow: number;
resetPhysicsOnLoop: boolean;
};
enabled: {
animation: boolean;
ik: boolean;
grant: boolean;
physics: boolean;
cameraAnimation: boolean;
};
objects: WeakMap<SkinnedMesh | Camera | AudioManager, MMDAnimationHelperMixer>;
onBeforePhysics: (mesh: SkinnedMesh) => void;
sharedPhysics: boolean;
masterPhysics: null;

add(object: SkinnedMesh | Camera | Audio, params?: MMDAnimationHelperAddParameter): this;
remove(object: SkinnedMesh | Camera | Audio): this;
update(delta: number): this;
pose(mesh: SkinnedMesh, vpd: object, params?: MMDAnimationHelperPoseParameter): this;
enable(key: string, enabled: boolean): this;
createGrantSolver(mesh: SkinnedMesh): GrantSolver;
}

export interface AudioManagerParameter {
delayTime?: number;
delayTime?: number | undefined;
}

export class AudioManager {

constructor( audio: Audio, params?: AudioManagerParameter );
audio: Audio;
elapsedTime: number;
currentTime: number;
delayTime: number;
audioDuration: number;
duration: number;

control( delta: number ): this;

constructor(audio: Audio, params?: AudioManagerParameter);
audio: Audio;
elapsedTime: number;
currentTime: number;
delayTime: number;
audioDuration: number;
duration: number;

control(delta: number): this;
}

export class GrantSolver {
constructor(mesh: SkinnedMesh, grants: object[]);
mesh: SkinnedMesh;
grants: object[];

constructor( mesh: SkinnedMesh, grants: object[] );
mesh: SkinnedMesh;
grants: object[];

update(): this;

update(): this;
updateOne(gran: object[]): this;
addGrantRotation(bone: Bone, q: Quaternion, ratio: number): this;
}
Loading

0 comments on commit 2f45f26

Please sign in to comment.