code cleanup

This commit is contained in:
yushijinhun 2020-05-29 16:34:58 +08:00
parent e15ed531f1
commit 5b101d93af
No known key found for this signature in database
GPG Key ID: 5BC167F73EA558E4
3 changed files with 5 additions and 7 deletions

View File

@ -102,7 +102,7 @@ export class CompositeAnimation implements IAnimation {
export class RootAnimation extends CompositeAnimation implements AnimationHandle { export class RootAnimation extends CompositeAnimation implements AnimationHandle {
speed: number = 1.0; speed: number = 1.0;
progress: number = 0.0; progress: number = 0.0;
readonly clock: Clock = new Clock(true); private readonly clock: Clock = new Clock(true);
get animation(): RootAnimation { get animation(): RootAnimation {
return this; return this;

View File

@ -19,7 +19,6 @@ function toCapeVertices(x1: number, y1: number, x2: number, y2: number): Array<V
} }
function setVertices(box: BoxGeometry, top: Array<Vector2>, bottom: Array<Vector2>, left: Array<Vector2>, front: Array<Vector2>, right: Array<Vector2>, back: Array<Vector2>): void { function setVertices(box: BoxGeometry, top: Array<Vector2>, bottom: Array<Vector2>, left: Array<Vector2>, front: Array<Vector2>, right: Array<Vector2>, back: Array<Vector2>): void {
box.faceVertexUvs[0] = []; box.faceVertexUvs[0] = [];
box.faceVertexUvs[0][0] = [right[3], right[0], right[2]]; box.faceVertexUvs[0][0] = [right[3], right[0], right[2]];
box.faceVertexUvs[0][1] = [right[0], right[1], right[2]]; box.faceVertexUvs[0][1] = [right[0], right[1], right[2]];

View File

@ -4,8 +4,11 @@ import { RootAnimation } from "./animation.js";
import { PlayerObject } from "./model.js"; import { PlayerObject } from "./model.js";
export type LoadOptions = { export type LoadOptions = {
/**
* Whether to make the object visible after the texture is loaded. (default: true)
*/
makeVisible?: boolean; makeVisible?: boolean;
}; }
function toMakeVisible(options?: LoadOptions): boolean { function toMakeVisible(options?: LoadOptions): boolean {
if (options && options.makeVisible === false) { if (options && options.makeVisible === false) {
@ -15,7 +18,6 @@ function toMakeVisible(options?: LoadOptions): boolean {
} }
class SkinViewer { class SkinViewer {
readonly scene: Scene; readonly scene: Scene;
readonly camera: PerspectiveCamera; readonly camera: PerspectiveCamera;
readonly renderer: WebGLRenderer; readonly renderer: WebGLRenderer;
@ -29,8 +31,6 @@ class SkinViewer {
private _disposed: boolean = false; private _disposed: boolean = false;
private _renderPaused: boolean = false; private _renderPaused: boolean = false;
private _skinSet: boolean = false;
private _capeSet: boolean = false;
constructor(readonly domElement: Node) { constructor(readonly domElement: Node) {
// texture // texture
@ -44,7 +44,6 @@ class SkinViewer {
this.capeTexture.magFilter = NearestFilter; this.capeTexture.magFilter = NearestFilter;
this.capeTexture.minFilter = NearestFilter; this.capeTexture.minFilter = NearestFilter;
// scene
this.scene = new Scene(); this.scene = new Scene();
// Use smaller fov to avoid distortion // Use smaller fov to avoid distortion