Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

skinview3d

Package Overview
Dependencies
Maintainers
3
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

skinview3d - npm Package Compare versions

Comparing version 2.0.0-beta.1 to 2.0.0

32

libs/model.js

@@ -15,16 +15,12 @@ import { BoxGeometry, DoubleSide, FrontSide, Group, Mesh, MeshBasicMaterial, Vector2 } from "three";

const back = toFaceVertices(u + width + depth * 2, v + depth, u + width * 2 + depth * 2, v + height + depth);
box.faceVertexUvs[0] = [
[right[3], right[0], right[2]],
[right[0], right[1], right[2]],
[left[3], left[0], left[2]],
[left[0], left[1], left[2]],
[top[3], top[0], top[2]],
[top[0], top[1], top[2]],
[bottom[0], bottom[3], bottom[1]],
[bottom[3], bottom[2], bottom[1]],
[front[3], front[0], front[2]],
[front[0], front[1], front[2]],
[back[3], back[0], back[2]],
[back[0], back[1], back[2]]
];
const uvAttr = box.attributes.uv;
uvAttr.copyVector2sArray([
right[3], right[2], right[0], right[1],
left[3], left[2], left[0], left[1],
top[3], top[2], top[0], top[1],
bottom[0], bottom[1], bottom[3], bottom[2],
front[3], front[2], front[0], front[1],
back[3], back[2], back[0], back[1]
]);
uvAttr.needsUpdate = true;
}

@@ -104,4 +100,2 @@ function setSkinUVs(box, u, v, width, height, depth) {

setSkinUVs(rightArmBox, 40, 16, this.slim ? 3 : 4, 12, 4);
rightArmBox.uvsNeedUpdate = true;
rightArmBox.elementsNeedUpdate = true;
});

@@ -115,4 +109,2 @@ const rightArm2Box = new BoxGeometry();

setSkinUVs(rightArm2Box, 40, 32, this.slim ? 3 : 4, 12, 4);
rightArm2Box.uvsNeedUpdate = true;
rightArm2Box.elementsNeedUpdate = true;
});

@@ -139,4 +131,2 @@ const rightArmPivot = new Group();

setSkinUVs(leftArmBox, 32, 48, this.slim ? 3 : 4, 12, 4);
leftArmBox.uvsNeedUpdate = true;
leftArmBox.elementsNeedUpdate = true;
});

@@ -150,4 +140,2 @@ const leftArm2Box = new BoxGeometry();

setSkinUVs(leftArm2Box, 48, 48, this.slim ? 3 : 4, 12, 4);
leftArm2Box.uvsNeedUpdate = true;
leftArm2Box.elementsNeedUpdate = true;
});

@@ -154,0 +142,0 @@ const leftArmPivot = new Group();

@@ -1,2 +0,2 @@

import { CapeContainer, ModelType, SkinContainer, RemoteImage, TextureSource } from "skinview-utils";
import { ModelType, RemoteImage, TextureSource } from "skinview-utils";
import { PerspectiveCamera, Scene, WebGLRenderer } from "three";

@@ -43,3 +43,3 @@ import { RootAnimation } from "./animation.js";

}
declare class SkinViewer {
export declare class SkinViewer {
readonly canvas: HTMLCanvasElement;

@@ -58,6 +58,8 @@ readonly scene: Scene;

constructor(options?: SkinViewerOptions);
protected skinLoaded(model: ModelType, options?: LoadOptions): void;
protected capeLoaded(options?: CapeLoadOptions): void;
protected resetSkin(): void;
protected resetCape(): void;
loadSkin(empty: null): void;
loadSkin<S extends TextureSource | RemoteImage>(source: S, model?: ModelType | "auto-detect", options?: LoadOptions): S extends TextureSource ? void : Promise<void>;
resetSkin(): void;
loadCape(empty: null): void;
loadCape<S extends TextureSource | RemoteImage>(source: S, options?: CapeLoadOptions): S extends TextureSource ? void : Promise<void>;
resetCape(): void;
private draw;

@@ -84,4 +86,1 @@ /**

}
interface SkinViewer extends SkinContainer<LoadOptions>, CapeContainer<CapeLoadOptions> {
}
export { SkinViewer };

@@ -1,6 +0,6 @@

import { applyMixins, CapeContainer, SkinContainer } from "skinview-utils";
import { inferModelType, isTextureSource, loadCapeToCanvas, loadImage, loadSkinToCanvas } from "skinview-utils";
import { NearestFilter, PerspectiveCamera, Scene, Texture, Vector2, WebGLRenderer } from "three";
import { RootAnimation } from "./animation.js";
import { PlayerObject } from "./model.js";
class SkinViewer {
export class SkinViewer {
constructor(options = {}) {

@@ -55,14 +55,18 @@ this.animations = new RootAnimation();

}
skinLoaded(model, options = {}) {
this.skinTexture.needsUpdate = true;
this.playerObject.skin.modelType = model;
if (options.makeVisible !== false) {
this.playerObject.skin.visible = true;
loadSkin(source, model = "auto-detect", options = {}) {
if (source === null) {
this.resetSkin();
}
}
capeLoaded(options = {}) {
this.capeTexture.needsUpdate = true;
if (options.makeVisible !== false) {
this.playerObject.backEquipment = options.backEquipment === undefined ? "cape" : options.backEquipment;
else if (isTextureSource(source)) {
loadSkinToCanvas(this.skinCanvas, source);
const actualModel = model === "auto-detect" ? inferModelType(this.skinCanvas) : model;
this.skinTexture.needsUpdate = true;
this.playerObject.skin.modelType = actualModel;
if (options.makeVisible !== false) {
this.playerObject.skin.visible = true;
}
}
else {
return loadImage(source).then(image => this.loadSkin(image, model, options));
}
}

@@ -72,2 +76,17 @@ resetSkin() {

}
loadCape(source, options = {}) {
if (source === null) {
this.resetCape();
}
else if (isTextureSource(source)) {
loadCapeToCanvas(this.capeCanvas, source);
this.capeTexture.needsUpdate = true;
if (options.makeVisible !== false) {
this.playerObject.backEquipment = options.backEquipment === undefined ? "cape" : options.backEquipment;
}
}
else {
return loadImage(source).then(image => this.loadCape(image, options));
}
}
resetCape() {

@@ -133,4 +152,2 @@ this.playerObject.backEquipment = null;

}
applyMixins(SkinViewer, [SkinContainer, CapeContainer]);
export { SkinViewer };
//# sourceMappingURL=viewer.js.map
{
"name": "skinview3d",
"version": "2.0.0-beta.1",
"version": "2.0.0",
"description": "Three.js powered Minecraft skin viewer",

@@ -41,19 +41,19 @@ "main": "libs/skinview3d.js",

"dependencies": {
"skinview-utils": "^0.5.9",
"three": "^0.121.1"
"skinview-utils": "^0.6.0",
"three": "^0.125.2"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^9.0.0",
"@rollup/plugin-typescript": "^6.0.0",
"@typescript-eslint/eslint-plugin": "^4.4.0",
"@typescript-eslint/parser": "^4.4.0",
"@yushijinhun/three-minifier-rollup": "^0.2.0-alpha.2",
"eslint": "^7.11.0",
"@rollup/plugin-node-resolve": "^11.2.0",
"@rollup/plugin-typescript": "^8.2.0",
"@typescript-eslint/eslint-plugin": "^4.15.1",
"@typescript-eslint/parser": "^4.15.1",
"@yushijinhun/three-minifier-rollup": "^0.2.0",
"eslint": "^7.20.0",
"local-web-server": "^4.2.1",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
"rollup": "^2.29.0",
"rollup": "^2.39.0",
"rollup-plugin-terser": "^7.0.2",
"typescript": "^4.0.3"
"typescript": "^4.1.5"
}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc