update with upstream
This commit is contained in:
parent
116c1a3951
commit
4c5c7df4a7
|
@ -55,10 +55,10 @@ Three.js powered Minecraft skin viewer.
|
|||
skinViewer.loadPanorama("img/panorama1.png");
|
||||
|
||||
// Change camera FOV
|
||||
skinViewer.fov = 70;
|
||||
skinViewer.fov = 40;
|
||||
|
||||
// Zoom out
|
||||
skinViewer.zoom = 0.5;
|
||||
skinViewer.zoom = 0.77;
|
||||
|
||||
// Control objects with your mouse!
|
||||
let control = skinview3d.createOrbitControls(skinViewer);
|
||||
|
|
|
@ -114,11 +114,11 @@
|
|||
<h1>Viewport</h1>
|
||||
<div>
|
||||
<label class="control">Width: <input id="canvas_width" type="number" value="300" size="4"></label>
|
||||
<label class="control">Height: <input id="canvas_height" type="number" value="300" size="4"></label>
|
||||
<label class="control">Height: <input id="canvas_height" type="number" value="400" size="4"></label>
|
||||
</div>
|
||||
<div>
|
||||
<label class="control">FOV: <input id="fov" type="number" value="70" step="1" min="1" max="179" size="2"></label>
|
||||
<label class="control">Zoom: <input id="zoom" type="number" value="0.90" step="0.01" min="0.01" max="2.00" size="4"></label>
|
||||
<label class="control">FOV: <input id="fov" type="number" value="40" step="1" min="1" max="179" size="2"></label>
|
||||
<label class="control">Zoom: <input id="zoom" type="number" value="0.77" step="0.01" min="0.01" max="2.00" size="4"></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -38,8 +38,8 @@
|
|||
"bundles"
|
||||
],
|
||||
"dependencies": {
|
||||
"@james090500/skinview-utils": "github:james090500/skinview-utils",
|
||||
"@types/three": "^0.136.1",
|
||||
"skinview-utils": "^0.7.0",
|
||||
"three": "^0.136.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
10
src/model.ts
10
src/model.ts
|
@ -1,4 +1,4 @@
|
|||
import { ModelType } from "skinview-utils";
|
||||
import { ModelType } from "@james090500/skinview-utils";
|
||||
import { BoxGeometry, BufferAttribute, DoubleSide, FrontSide, Group, Mesh, MeshStandardMaterial, Object3D, Texture, Vector2 } from "three";
|
||||
|
||||
function setUVs(box: BoxGeometry, u: number, v: number, width: number, height: number, depth: number, textureWidth: number, textureHeight: number): void {
|
||||
|
@ -377,23 +377,21 @@ export class PlayerObject extends Group {
|
|||
|
||||
this.skin = new SkinObject(skinTexture);
|
||||
this.skin.name = "skin";
|
||||
this.skin.position.y = 8;
|
||||
this.skin.position.y = 5
|
||||
this.add(this.skin);
|
||||
|
||||
this.cape = new CapeObject(capeTexture);
|
||||
this.cape.name = "cape";
|
||||
this.cape.position.y = 8;
|
||||
this.cape.position.y = 5;
|
||||
this.cape.position.z = -2;
|
||||
this.cape.position.y = -2;
|
||||
this.cape.rotation.x = 10.8 * Math.PI / 180;
|
||||
this.cape.rotation.y = Math.PI;
|
||||
this.add(this.cape);
|
||||
|
||||
this.elytra = new ElytraObject(capeTexture);
|
||||
this.elytra.name = "elytra";
|
||||
this.elytra.position.y = 8;
|
||||
this.elytra.position.y = 5;
|
||||
this.elytra.position.z = -2;
|
||||
this.elytra.position.y = -2;
|
||||
this.elytra.visible = false;
|
||||
this.add(this.elytra);
|
||||
|
||||
|
|
|
@ -48,7 +48,6 @@ export interface SkinViewerOptions {
|
|||
skin?: RemoteImage | TextureSource;
|
||||
model?: ModelType | "auto-detect";
|
||||
cape?: RemoteImage | TextureSource;
|
||||
ears?: RemoteImage | TextureSource;
|
||||
|
||||
/**
|
||||
* If you want to show the ears drawn on the current skin, set this to "current-skin".
|
||||
|
@ -125,6 +124,7 @@ export class SkinViewer {
|
|||
private readonly skinTexture: Texture;
|
||||
private readonly capeTexture: Texture;
|
||||
private readonly earsTexture: Texture;
|
||||
private capeImage: TextureSource | undefined;
|
||||
private backgroundTexture: Texture | null = null;
|
||||
|
||||
private _disposed: boolean = false;
|
||||
|
@ -270,7 +270,7 @@ export class SkinViewer {
|
|||
}
|
||||
|
||||
if (options.ears === true || options.ears == "load-only") {
|
||||
loadEarsToCanvasFromSkin(this.earsCanvas, source);
|
||||
loadEarsToCanvas(this.earsCanvas, source);
|
||||
this.earsTexture.needsUpdate = true;
|
||||
if (options.ears === true) {
|
||||
this.playerObject.ears.visible = true;
|
||||
|
@ -315,31 +315,6 @@ export class SkinViewer {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Ears
|
||||
*/
|
||||
loadEars(empty: null): void;
|
||||
loadEars<S extends TextureSource | RemoteImage>(
|
||||
source: S,
|
||||
options?: LoadOptions
|
||||
): S extends TextureSource ? void : Promise<void>;
|
||||
loadEars(
|
||||
source: TextureSource | RemoteImage | null,
|
||||
options: LoadOptions = {}
|
||||
): void | Promise<void> {
|
||||
if (source === null) {
|
||||
this.resetEars();
|
||||
} else if (isTextureSource(source)) {
|
||||
loadEarsToCanvas(this.earsCanvas, source);
|
||||
this.earTexture.needsUpdate = true;
|
||||
this.playerObject.ears.visible = true;
|
||||
} else {
|
||||
return loadImage(source).then(image => this.loadEars(image, options)).catch(e => {
|
||||
console.log(e);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected resetSkin(): void {
|
||||
this.playerObject.skin.visible = false;
|
||||
}
|
||||
|
@ -363,7 +338,7 @@ export class SkinViewer {
|
|||
|
||||
} else if (isTextureSource(source)) {
|
||||
if (options.textureType === "skin") {
|
||||
loadEarsToCanvasFromSkin(this.earsCanvas, source);
|
||||
loadEarsToCanvas(this.earsCanvas, source);
|
||||
} else {
|
||||
loadEarsToCanvas(this.earsCanvas, source);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue