Add detectModel option to allow turning auto-detection off
This commit is contained in:
parent
670647109a
commit
25805bfa59
|
@ -21,6 +21,10 @@
|
||||||
skinUrl: "./1_8_texturemap_redux.png"
|
skinUrl: "./1_8_texturemap_redux.png"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// By default, the skin model is automatically detected. You can turn it off in this way:
|
||||||
|
// skinViewer.detectModel = false;
|
||||||
|
// skinViewer.playerObject.skin.slim = true;
|
||||||
|
|
||||||
let control = new skinview3d.createOrbitControls(skinViewer);
|
let control = new skinview3d.createOrbitControls(skinViewer);
|
||||||
skinViewer.animation = new skinview3d.CompositeAnimation();
|
skinViewer.animation = new skinview3d.CompositeAnimation();
|
||||||
|
|
||||||
|
|
|
@ -123,6 +123,7 @@ class SkinViewer {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
this.domElement = options.domElement;
|
this.domElement = options.domElement;
|
||||||
this.animation = options.animation || null;
|
this.animation = options.animation || null;
|
||||||
|
this.detectModel = options.animation !== false; // true by default
|
||||||
this.animationPaused = false;
|
this.animationPaused = false;
|
||||||
this.animationTime = 0;
|
this.animationTime = 0;
|
||||||
this.disposed = false;
|
this.disposed = false;
|
||||||
|
@ -189,7 +190,9 @@ class SkinViewer {
|
||||||
skinContext.drawImage(this.skinImg, 0, 0, this.skinCanvas.width, this.skinCanvas.height);
|
skinContext.drawImage(this.skinImg, 0, 0, this.skinCanvas.width, this.skinCanvas.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.playerObject.skin.slim = isSlimSkin(skinContext, this.skinCanvas.width);
|
if (this.detectModel) {
|
||||||
|
this.playerObject.skin.slim = isSlimSkin(skinContext, this.skinCanvas.width);
|
||||||
|
}
|
||||||
|
|
||||||
this.skinTexture.needsUpdate = true;
|
this.skinTexture.needsUpdate = true;
|
||||||
this.layer1Material.needsUpdate = true;
|
this.layer1Material.needsUpdate = true;
|
||||||
|
|
|
@ -9,6 +9,7 @@ export interface SkinViewerOptions {
|
||||||
capeUrl?: string;
|
capeUrl?: string;
|
||||||
width?: number;
|
width?: number;
|
||||||
height?: number;
|
height?: number;
|
||||||
|
detectModel?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SkinViewer {
|
export class SkinViewer {
|
||||||
|
@ -21,6 +22,7 @@ export class SkinViewer {
|
||||||
public animation: Animation;
|
public animation: Animation;
|
||||||
public animationPaused: boolean;
|
public animationPaused: boolean;
|
||||||
public animationTime: number;
|
public animationTime: number;
|
||||||
|
public detectModel: boolean;
|
||||||
public readonly playerObject: PlayerObject;
|
public readonly playerObject: PlayerObject;
|
||||||
public readonly scene: THREE.Scene;
|
public readonly scene: THREE.Scene;
|
||||||
public readonly camera: THREE.PerspectiveCamera;
|
public readonly camera: THREE.PerspectiveCamera;
|
||||||
|
|
Loading…
Reference in New Issue