This commit is contained in:
yushijinhun 2020-01-31 23:35:42 +08:00
parent b8bbde4e7b
commit b3858b598f
No known key found for this signature in database
GPG Key ID: 5BC167F73EA558E4
16 changed files with 6 additions and 2687 deletions

22
dist/animation.d.ts vendored
View File

@ -1,22 +0,0 @@
import { PlayerObject } from "./model";
export interface IAnimation {
play(player: PlayerObject, time: number): void;
}
export declare type AnimationFn = (player: PlayerObject, time: number) => void;
export declare type Animation = AnimationFn | IAnimation;
export declare function invokeAnimation(animation: Animation, player: PlayerObject, time: number): void;
export interface AnimationHandle {
paused: boolean;
speed: number;
readonly animation: Animation;
reset(): void;
remove(): void;
}
export declare class CompositeAnimation implements IAnimation {
readonly handles: Set<AnimationHandle & IAnimation>;
add(animation: Animation): AnimationHandle;
play(player: PlayerObject, time: number): void;
}
export declare const WalkingAnimation: Animation;
export declare const RunningAnimation: Animation;
export declare const RotatingAnimation: Animation;

33
dist/model.d.ts vendored
View File

@ -1,33 +0,0 @@
import * as THREE from "three";
/**
* Notice that innerLayer and outerLayer may NOT be the direct children of the Group.
*/
export declare class BodyPart extends THREE.Group {
readonly innerLayer: THREE.Object3D;
readonly outerLayer: THREE.Object3D;
constructor(innerLayer: THREE.Object3D, outerLayer: THREE.Object3D);
}
export declare class SkinObject extends THREE.Group {
readonly head: BodyPart;
readonly body: BodyPart;
readonly rightArm: BodyPart;
readonly leftArm: BodyPart;
readonly rightLeg: BodyPart;
readonly leftLeg: BodyPart;
private modelListeners;
private _slim;
constructor(layer1Material: THREE.MeshBasicMaterial, layer2Material: THREE.MeshBasicMaterial);
slim: boolean;
private getBodyParts;
setInnerLayerVisible(value: boolean): void;
setOuterLayerVisible(value: boolean): void;
}
export declare class CapeObject extends THREE.Group {
readonly cape: THREE.Mesh;
constructor(capeMaterial: THREE.MeshBasicMaterial);
}
export declare class PlayerObject extends THREE.Group {
readonly skin: SkinObject;
readonly cape: CapeObject;
constructor(layer1Material: THREE.MeshBasicMaterial, layer2Material: THREE.MeshBasicMaterial, capeMaterial: THREE.MeshBasicMaterial);
}

View File

@ -1,123 +0,0 @@
import * as THREE from "three";
import { SkinViewer } from "./viewer";
export declare class OrbitControls extends THREE.EventDispatcher {
/**
* @preserve
* The code was originally from https://github.com/mrdoob/three.js/blob/d45a042cf962e9b1aa9441810ba118647b48aacb/examples/js/controls/OrbitControls.js
*/
/**
* @license
* Copyright (C) 2010-2017 three.js authors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
* @author qiao / https://github.com/qiao
* @author mrdoob / http://mrdoob.com
* @author alteredq / http://alteredqualia.com/
* @author WestLangley / http://github.com/WestLangley
* @author erich666 / http://erichaines.com
*/
object: THREE.Camera;
domElement: HTMLElement | HTMLDocument;
window: Window;
enabled: boolean;
target: THREE.Vector3;
enableZoom: boolean;
zoomSpeed: number;
minDistance: number;
maxDistance: number;
enableRotate: boolean;
rotateSpeed: number;
enablePan: boolean;
keyPanSpeed: number;
autoRotate: boolean;
autoRotateSpeed: number;
minZoom: number;
maxZoom: number;
minPolarAngle: number;
maxPolarAngle: number;
minAzimuthAngle: number;
maxAzimuthAngle: number;
enableKeys: boolean;
keys: {
LEFT: number;
UP: number;
RIGHT: number;
BOTTOM: number;
};
mouseButtons: {
ORBIT: THREE.MOUSE;
ZOOM: THREE.MOUSE;
PAN: THREE.MOUSE;
};
enableDamping: boolean;
dampingFactor: number;
private spherical;
private sphericalDelta;
private scale;
private target0;
private position0;
private zoom0;
private state;
private panOffset;
private zoomChanged;
private rotateStart;
private rotateEnd;
private rotateDelta;
private panStart;
private panEnd;
private panDelta;
private dollyStart;
private dollyEnd;
private dollyDelta;
private updateLastPosition;
private updateOffset;
private updateQuat;
private updateLastQuaternion;
private updateQuatInverse;
private panLeftV;
private panUpV;
private panInternalOffset;
private onContextMenu;
private onMouseUp;
private onMouseDown;
private onMouseMove;
private onMouseWheel;
private onTouchStart;
private onTouchEnd;
private onTouchMove;
private onKeyDown;
constructor(object: THREE.Camera, domElement?: HTMLElement, domWindow?: Window);
update(): boolean;
panLeft(distance: number, objectMatrix: any): void;
panUp(distance: number, objectMatrix: any): void;
pan(deltaX: number, deltaY: number): void;
dollyIn(dollyScale: any): void;
dollyOut(dollyScale: any): void;
getAutoRotationAngle(): number;
getZoomScale(): number;
rotateLeft(angle: number): void;
rotateUp(angle: number): void;
getPolarAngle(): number;
getAzimuthalAngle(): number;
dispose(): void;
reset(): void;
}
export declare function createOrbitControls(skinViewer: SkinViewer): OrbitControls;

View File

@ -1,5 +0,0 @@
export { SkinObject, BodyPart, CapeObject, PlayerObject } from "./model";
export { SkinViewer, SkinViewerOptions } from "./viewer";
export { OrbitControls, createOrbitControls } from "./orbit_controls";
export { IAnimation, AnimationFn, Animation, invokeAnimation, AnimationHandle, CompositeAnimation, WalkingAnimation, RunningAnimation, RotatingAnimation } from "./animation";
export { isSlimSkin } from "./utils";

1234
dist/skinview3d.js vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

3
dist/utils.d.ts vendored
View File

@ -1,3 +0,0 @@
export declare function loadSkinToCanvas(canvas: HTMLCanvasElement, image: HTMLImageElement): void;
export declare function loadCapeToCanvas(canvas: HTMLCanvasElement, image: HTMLImageElement): void;
export declare function isSlimSkin(canvasOrImage: HTMLCanvasElement | HTMLImageElement): boolean;

39
dist/viewer.d.ts vendored
View File

@ -1,39 +0,0 @@
import * as THREE from "three";
import { PlayerObject } from "./model";
export interface SkinViewerOptions {
domElement: Node;
animation?: Animation;
skinUrl?: string;
capeUrl?: string;
width?: number;
height?: number;
detectModel?: boolean;
}
export declare class SkinViewer {
readonly domElement: Node;
animation: Animation | null;
detectModel: boolean;
animationPaused: boolean;
animationTime: number;
disposed: boolean;
readonly skinImg: HTMLImageElement;
readonly skinCanvas: HTMLCanvasElement;
readonly skinTexture: THREE.Texture;
readonly capeImg: HTMLImageElement;
readonly capeCanvas: HTMLCanvasElement;
readonly capeTexture: THREE.Texture;
readonly layer1Material: THREE.MeshBasicMaterial;
readonly layer2Material: THREE.MeshBasicMaterial;
readonly capeMaterial: THREE.MeshBasicMaterial;
readonly scene: THREE.Scene;
readonly camera: THREE.PerspectiveCamera;
readonly renderer: THREE.WebGLRenderer;
readonly playerObject: PlayerObject;
constructor(options: SkinViewerOptions);
setSize(width: any, height: any): void;
dispose(): void;
skinUrl: string;
capeUrl: string;
width: number;
height: number;
}

View File

@ -127,8 +127,7 @@
</select> </select>
</div> </div>
</div> </div>
<script type="text/javascript" src="https://unpkg.com/three@0.112.1/build/three.min.js"></script> <script type="text/javascript" src="js/dist/skinview3d.bundle.js"></script>
<script type="text/javascript" src="js/dist/skinview3d.min.js"></script>
<script type="text/javascript" src="js/example.js"></script> <script type="text/javascript" src="js/example.js"></script>
<script> <script>
initSkinViewer(); initSkinViewer();

2
js/dist/revision vendored
View File

@ -1 +1 @@
0cddbd51a893ec8b937dd431e0cdb14428e6375a 9baa4d998925d48ebc5d5aa5016c577e8f40728a

2
js/dist/skinview3d.bundle.js vendored Normal file

File diff suppressed because one or more lines are too long

1
js/dist/skinview3d.bundle.js.map vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -32,6 +32,6 @@ npm run build
echo "> Copying build outputs" echo "> Copying build outputs"
cd -- $original_dir cd -- $original_dir
rm -rf -- $output_dir rm -rf -- $output_dir
cp -r -- "$checkout_dir/dist" $output_dir cp -r -- "$checkout_dir/bundles" "$output_dir"
echo "$master_revision" > $revision_file echo "$master_revision" > $revision_file
echo "> New revison of build outputs: $master_revision" echo "> New revison of build outputs: $master_revision"