minerender 2.1.0-alpha.30 → 2.1.0-alpha.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.d.mts +7 -1
- package/dist/browser/index.d.ts +7 -1
- package/dist/browser/index.js +100 -45
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +96 -41
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +3731 -937
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +7 -1
- package/dist/node/index.d.ts +7 -1
- package/dist/node/index.js +101 -45
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +96 -41
- package/dist/node/index.mjs.map +1 -1
- package/package.json +3 -1
package/dist/browser/index.d.mts
CHANGED
|
@@ -1577,6 +1577,11 @@ type SkinGeometries = Record<SkinPart, TripleArray>;
|
|
|
1577
1577
|
declare const classicSkinGeometries: SkinGeometries;
|
|
1578
1578
|
declare const slimSkinGeometries: SkinGeometries;
|
|
1579
1579
|
|
|
1580
|
+
declare class SkinImage {
|
|
1581
|
+
static getData(src: string): Promise<ImageData>;
|
|
1582
|
+
private static decodePng;
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1580
1585
|
type SkinTextureCoordinates = Record<SkinPart, ModelFaces>;
|
|
1581
1586
|
declare const classicSkinTextureCoordinates: Readonly<SkinTextureCoordinates>;
|
|
1582
1587
|
declare const slimSkinTextureCoordinates: Readonly<SkinTextureCoordinates>;
|
|
@@ -1592,6 +1597,7 @@ declare class SkinTextures {
|
|
|
1592
1597
|
private static createMaterial;
|
|
1593
1598
|
private static isSlim;
|
|
1594
1599
|
private static normalizeLegacy;
|
|
1600
|
+
private static makeBaseOpaque;
|
|
1595
1601
|
}
|
|
1596
1602
|
|
|
1597
1603
|
declare class Skins {
|
|
@@ -1741,4 +1747,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
1741
1747
|
*/
|
|
1742
1748
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
1743
1749
|
|
|
1744
|
-
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, ArchiveAssetSource, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Block, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, BrowserCache, BrowserEnv, CUBE_FACES, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type ElementFace, type ElementRotation, Entities, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FromTo, Geometries, GuiLight, GuiObject, type GuiObjectOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelTextures, type ListAsset, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResponseParser, SKIN_PARTS, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, type Serializable, type SkinGeometries, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createImage, estimateBytesUsed, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, probeImageSize, registerBrowserEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
|
|
1750
|
+
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, ArchiveAssetSource, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Block, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, BrowserCache, BrowserEnv, CUBE_FACES, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type ElementFace, type ElementRotation, Entities, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FromTo, Geometries, GuiLight, GuiObject, type GuiObjectOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelTextures, type ListAsset, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResponseParser, SKIN_PARTS, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createImage, estimateBytesUsed, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, probeImageSize, registerBrowserEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -1577,6 +1577,11 @@ type SkinGeometries = Record<SkinPart, TripleArray>;
|
|
|
1577
1577
|
declare const classicSkinGeometries: SkinGeometries;
|
|
1578
1578
|
declare const slimSkinGeometries: SkinGeometries;
|
|
1579
1579
|
|
|
1580
|
+
declare class SkinImage {
|
|
1581
|
+
static getData(src: string): Promise<ImageData>;
|
|
1582
|
+
private static decodePng;
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1580
1585
|
type SkinTextureCoordinates = Record<SkinPart, ModelFaces>;
|
|
1581
1586
|
declare const classicSkinTextureCoordinates: Readonly<SkinTextureCoordinates>;
|
|
1582
1587
|
declare const slimSkinTextureCoordinates: Readonly<SkinTextureCoordinates>;
|
|
@@ -1592,6 +1597,7 @@ declare class SkinTextures {
|
|
|
1592
1597
|
private static createMaterial;
|
|
1593
1598
|
private static isSlim;
|
|
1594
1599
|
private static normalizeLegacy;
|
|
1600
|
+
private static makeBaseOpaque;
|
|
1595
1601
|
}
|
|
1596
1602
|
|
|
1597
1603
|
declare class Skins {
|
|
@@ -1741,4 +1747,4 @@ declare class BrowserCache extends PersistentCache<LocalForage> {
|
|
|
1741
1747
|
*/
|
|
1742
1748
|
declare function probeImageSize(data: Uint8Array): ImageSizeInfo;
|
|
1743
1749
|
|
|
1744
|
-
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, ArchiveAssetSource, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Block, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, BrowserCache, BrowserEnv, CUBE_FACES, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type ElementFace, type ElementRotation, Entities, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FromTo, Geometries, GuiLight, GuiObject, type GuiObjectOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelTextures, type ListAsset, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResponseParser, SKIN_PARTS, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, type Serializable, type SkinGeometries, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createImage, estimateBytesUsed, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, probeImageSize, registerBrowserEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
|
|
1750
|
+
export { AXES, type AnimationFrame, type AnimationMeta, type AnimatorFunction, ArchiveAssetSource, type ArchiveEntry, type ArchiveProxy, AssetKey, AssetLoadError, AssetLoader, AssetParser, AssetSource, type AssetType, Assets, Axis, BUILTIN_ENTITY, BUILTIN_GENERATED, BasicAssetKey, type BasicMinecraftAsset, BatchedExecutor, type BedrockBone, type BedrockCube, type BedrockEntityDescription, type BedrockEntityFile, type BedrockGeometry, type BedrockGeometryFile, type Block, type BlockInfo, type BlockModel, type BlockModelTextures, BlockObject, type BlockObjectOptions, type BlockState, type BlockStateMultipart, type BlockStateProperties, type BlockStateProperty, type BlockStatePropertyDefaults, type BlockStatePropertyValue, type BlockStateVariant, type BlockStateVariants, BlockStates, BlockTints, type BoxGeometryKey, BrowserArchiveProxy, BrowserCache, BrowserEnv, CUBE_FACES, type CacheKey, Caching, type CameraOptions, CanvasImage, type CapeLayout, Chunk, type CompatCanvas, type CompatImage, type ComposerOptions, type ControlsOptions, CubeFace, CubeFaceIndex, DEFAULT_ELEMENTS, DEFAULT_NAMESPACE, DEFAULT_ROOT, DEFAULT_UV, DISPLAY_POSITIONS, type DebugOptions, type DeepPartial, DefaultBlockStates, DisplayPosition, DisplayTransforms, type Disposable, type DoubleArray, type ElementFace, type ElementRotation, Entities, type EntityModel, type EntityModelCube, type EntityModelFile, type EntityModelLayer, type EntityModelOptions, type EntityModelPart, EntityObject, type EntityObjectOptions, Env, type EnvProvider, type ExtractableImageData, type FromTo, Geometries, GuiLight, GuiObject, type GuiObjectOptions, HostedAssetSource, type IModelTextures, ITEM_GENERATED, type ImageInfo, ImageLoader, type ImageSizeInfo, InstanceManager, InstanceReference, type Instanceable, type ItemModel, type ItemModelTextures, type ListAsset, MapControls, type MaterialKey, Materials, type Maybe, type MeshKey, Meshes, MineRenderError, MineRenderScene, type MineRenderSceneOptions, MineRenderWorld, type MinecraftAsset, MinecraftCubeTexture, MinecraftFaceUV, type MinecraftTextureMeta, type Model, type ModelDisplay, type ModelElement, type ModelFaces, ModelGenerator, ModelMerger, ModelObject, type ModelObjectOptions, ModelTextures, Models, type MultiBlockBlock, type MultiBlockStructure, type MultipartCondition, type NBTAsset, NBTHelper, OrbitControls, PersistentCache, type QuadArray, type RawImageKey, type RenderOptions, Renderer, type RendererOptions, type RequestConfig, RequestError, type RequestResponse, Requests, type ResponseParser, SKIN_PARTS, SceneInspector, SceneObject, type SceneObjectOptions, SceneStats, SceneStatsDisplay, SchematicParser, type Serializable, type SkinGeometries, SkinImage, SkinObject, type SkinObjectOptions, SkinPart, type SkinTexture, type SkinTextureCoordinates, SkinTextures, Skins, type StructureNBT, StructureParser, type TextureAsset, TextureAtlas, type TextureKey, TextureLoader, Textures, Ticker, type TickerFunction, TintColors, type Transformable, type TripleArray, UVMapper, WrappedImage, addBox3WireframeToObject, addWireframeToMesh, addWireframeToObject, applyElementRotation, applyGenericRotation, axisToVec3, base64decode, base64encode, capeTextureSizes, captureException, changeEvent, clampRotationDegrees, classicSkinGeometries, classicSkinTextureCoordinates, computeMorphedAttributes, createCanvas, createImage, estimateBytesUsed, interleaveAttributes, isAssetKey, isBasicAssetKey, isBlockObject, isDisposable, isDoubleArray, isEntityObject, isInstanceManager, isInstanceReference, isInstanceable, isInstancedMesh, isMesh, isMineRenderScene, isModelObject, isObject3D, isOrthographicCamera, isPerspectiveCamera, isQuadArray, isSceneObject, isTransformable, isTripleArray, isVector3, md5, mergeBufferAttributes, mergeBufferGeometries, mergeVertices, prefix, probeImageSize, registerBrowserEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
|
package/dist/browser/index.js
CHANGED
|
@@ -193,6 +193,7 @@ __export(index_browser_exports, {
|
|
|
193
193
|
SceneStats: () => SceneStats,
|
|
194
194
|
SceneStatsDisplay: () => SceneStatsDisplay,
|
|
195
195
|
SchematicParser: () => SchematicParser,
|
|
196
|
+
SkinImage: () => SkinImage,
|
|
196
197
|
SkinObject: () => SkinObject,
|
|
197
198
|
SkinPart: () => SkinPart,
|
|
198
199
|
SkinTextures: () => SkinTextures,
|
|
@@ -482,19 +483,19 @@ function isDisposable(obj) {
|
|
|
482
483
|
var import_three2 = require("three");
|
|
483
484
|
|
|
484
485
|
// src/util/util.ts
|
|
485
|
-
var
|
|
486
|
+
var import_crypto_js = __toESM(require("crypto-js"));
|
|
486
487
|
var changeEvent = { type: "change" };
|
|
487
488
|
function md5(str) {
|
|
488
|
-
return
|
|
489
|
+
return import_crypto_js.default.MD5(str).toString(import_crypto_js.default.enc.Hex);
|
|
489
490
|
}
|
|
490
491
|
function sha1(str) {
|
|
491
|
-
return
|
|
492
|
+
return import_crypto_js.default.SHA1(str).toString(import_crypto_js.default.enc.Hex);
|
|
492
493
|
}
|
|
493
494
|
function sha256(str) {
|
|
494
|
-
return
|
|
495
|
+
return import_crypto_js.default.SHA256(str).toString(import_crypto_js.default.enc.Hex);
|
|
495
496
|
}
|
|
496
497
|
function sha512(str) {
|
|
497
|
-
return
|
|
498
|
+
return import_crypto_js.default.SHA512(str).toString(import_crypto_js.default.enc.Hex);
|
|
498
499
|
}
|
|
499
500
|
function base64encode(str) {
|
|
500
501
|
if (typeof btoa !== "undefined") {
|
|
@@ -5578,17 +5579,17 @@ var baseSkinCoordinates = {
|
|
|
5578
5579
|
},
|
|
5579
5580
|
up: {
|
|
5580
5581
|
uv: [
|
|
5581
|
-
4,
|
|
5582
|
-
36,
|
|
5583
5582
|
8,
|
|
5583
|
+
36,
|
|
5584
|
+
4,
|
|
5584
5585
|
32
|
|
5585
5586
|
]
|
|
5586
5587
|
},
|
|
5587
5588
|
down: {
|
|
5588
5589
|
uv: [
|
|
5589
|
-
8,
|
|
5590
|
-
32,
|
|
5591
5590
|
12,
|
|
5591
|
+
32,
|
|
5592
|
+
8,
|
|
5592
5593
|
36
|
|
5593
5594
|
],
|
|
5594
5595
|
rotation: 180
|
|
@@ -5644,13 +5645,13 @@ var slimSkinTextureCoordinates = {
|
|
|
5644
5645
|
|
|
5645
5646
|
// src/skin/SkinGeometries.ts
|
|
5646
5647
|
var box8inner = [8, 8, 8];
|
|
5647
|
-
var box8outer = [
|
|
5648
|
+
var box8outer = [9, 9, 9];
|
|
5648
5649
|
var box8_12_4inner = [8, 12, 4];
|
|
5649
|
-
var box8_12_4outer = [8.
|
|
5650
|
+
var box8_12_4outer = [8.5, 12.5, 4.5];
|
|
5650
5651
|
var box4_12_4inner = [4, 12, 4];
|
|
5651
|
-
var box4_12_4outer = [4.
|
|
5652
|
+
var box4_12_4outer = [4.5, 12.5, 4.5];
|
|
5652
5653
|
var box3_12_4inner = [3, 12, 4];
|
|
5653
|
-
var box3_12_4outer = [3.
|
|
5654
|
+
var box3_12_4outer = [3.5, 12.5, 4.5];
|
|
5654
5655
|
var box10_16_1 = [10, 16, 1];
|
|
5655
5656
|
var baseSkinGeometries = {
|
|
5656
5657
|
head: box8inner,
|
|
@@ -5684,9 +5685,54 @@ var import_ts_deepmerge7 = __toESM(require_dist());
|
|
|
5684
5685
|
|
|
5685
5686
|
// src/skin/SkinTextures.ts
|
|
5686
5687
|
var import_three18 = require("three");
|
|
5688
|
+
|
|
5689
|
+
// src/skin/SkinImage.ts
|
|
5690
|
+
var SkinImage = class {
|
|
5691
|
+
static async getData(src) {
|
|
5692
|
+
const key = serializeImageKey({ src });
|
|
5693
|
+
return await Caching.imageDataCache.get(`skin:${key}`, async () => {
|
|
5694
|
+
const info = await ImageLoader.getInfo(src);
|
|
5695
|
+
if (info.type !== "png") return ImageLoader.getData(src);
|
|
5696
|
+
try {
|
|
5697
|
+
return await this.decodePng(info.data);
|
|
5698
|
+
} catch (error) {
|
|
5699
|
+
Caching.rawImageCache.invalidate(key);
|
|
5700
|
+
throw error;
|
|
5701
|
+
}
|
|
5702
|
+
});
|
|
5703
|
+
}
|
|
5704
|
+
static async decodePng(bytes) {
|
|
5705
|
+
const { decode, convertIndexedToRgb } = await import("fast-png");
|
|
5706
|
+
const png = decode(bytes);
|
|
5707
|
+
let { data, channels, depth } = png;
|
|
5708
|
+
if (channels === 1 && (png.palette || depth < 8)) {
|
|
5709
|
+
const max = (1 << depth) - 1;
|
|
5710
|
+
const palette = png.palette ?? Array.from({ length: max + 1 }, (_, value) => {
|
|
5711
|
+
const gray = value * 255 / max;
|
|
5712
|
+
return [gray, gray, gray, png.transparency?.[0] === value ? 0 : 255];
|
|
5713
|
+
});
|
|
5714
|
+
data = convertIndexedToRgb({ ...png, palette });
|
|
5715
|
+
channels = palette[0].length;
|
|
5716
|
+
depth = 8;
|
|
5717
|
+
}
|
|
5718
|
+
const pixels = new Uint8ClampedArray(png.width * png.height * 4);
|
|
5719
|
+
for (let pixel = 0; pixel < png.width * png.height; pixel++) {
|
|
5720
|
+
const source = pixel * channels;
|
|
5721
|
+
const target = pixel * 4;
|
|
5722
|
+
const sample = (channel) => depth === 16 ? data[source + channel] >>> 8 : data[source + channel];
|
|
5723
|
+
pixels[target] = sample(0);
|
|
5724
|
+
pixels[target + 1] = sample(channels < 3 ? 0 : 1);
|
|
5725
|
+
pixels[target + 2] = sample(channels < 3 ? 0 : 2);
|
|
5726
|
+
pixels[target + 3] = channels % 2 === 0 ? sample(channels - 1) : png.transparency?.every((value, channel) => data[source + channel] === value) ? 0 : 255;
|
|
5727
|
+
}
|
|
5728
|
+
return { width: png.width, height: png.height, data: pixels, colorSpace: "srgb" };
|
|
5729
|
+
}
|
|
5730
|
+
};
|
|
5731
|
+
|
|
5732
|
+
// src/skin/SkinTextures.ts
|
|
5687
5733
|
var SkinTextures = class {
|
|
5688
5734
|
static async get(src, legacy) {
|
|
5689
|
-
const image = await
|
|
5735
|
+
const image = await SkinImage.getData(src);
|
|
5690
5736
|
const scale = image.width / 64;
|
|
5691
5737
|
if (!Number.isInteger(scale) || scale < 1 || image.height !== image.width && image.height !== image.width / 2) {
|
|
5692
5738
|
throw new MineRenderError(`Invalid skin dimensions ${image.width}x${image.height}; expected 64x64 or 64x32, or an integer-scaled equivalent`);
|
|
@@ -5699,12 +5745,13 @@ var SkinTextures = class {
|
|
|
5699
5745
|
const key = `skin:${serializeImageKey({ src })}:${isLegacy}`;
|
|
5700
5746
|
const material = Caching.materialCache.get(key, () => {
|
|
5701
5747
|
const pixels = isLegacy ? this.normalizeLegacy(image, scale) : new Uint8Array(image.data);
|
|
5748
|
+
this.makeBaseOpaque(pixels, image.width, scale);
|
|
5702
5749
|
return this.createMaterial(pixels, image.width, image.width);
|
|
5703
5750
|
});
|
|
5704
5751
|
return { material, slim, legacy: isLegacy };
|
|
5705
5752
|
}
|
|
5706
5753
|
static async getCape(src, layout = "minecraft") {
|
|
5707
|
-
const image = await
|
|
5754
|
+
const image = await SkinImage.getData(src);
|
|
5708
5755
|
const scale = image.width / 64;
|
|
5709
5756
|
if (layout === "minecraft" && (!Number.isInteger(scale) || scale < 1 || image.height !== image.width / 2)) {
|
|
5710
5757
|
throw new MineRenderError(`Invalid cape dimensions ${image.width}x${image.height}; expected 64x32 or an integer-scaled equivalent`);
|
|
@@ -5718,7 +5765,7 @@ var SkinTextures = class {
|
|
|
5718
5765
|
texture.colorSpace = import_three18.SRGBColorSpace;
|
|
5719
5766
|
texture.flipY = true;
|
|
5720
5767
|
texture.needsUpdate = true;
|
|
5721
|
-
return new import_three18.MeshBasicMaterial({ map: texture, transparent, side: transparent ? import_three18.DoubleSide : import_three18.FrontSide, alphaTest: transparent ? 0.
|
|
5768
|
+
return new import_three18.MeshBasicMaterial({ map: texture, transparent, side: transparent ? import_three18.DoubleSide : import_three18.FrontSide, alphaTest: transparent ? 0.1 : 0 });
|
|
5722
5769
|
}
|
|
5723
5770
|
static isSlim(image, scale) {
|
|
5724
5771
|
for (const [x, y] of [[46, 52], [54, 20]]) {
|
|
@@ -5761,18 +5808,22 @@ var SkinTextures = class {
|
|
|
5761
5808
|
if (pixels[(y * image.width + x) * 4 + 3] < 128) clearHat = false;
|
|
5762
5809
|
}
|
|
5763
5810
|
}
|
|
5764
|
-
|
|
5765
|
-
for (let
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
pixels[alpha] = 255;
|
|
5769
|
-
} else if (clearHat && x >= 32 * scale && y < 32 * scale) {
|
|
5770
|
-
pixels[alpha] = 0;
|
|
5811
|
+
if (clearHat) {
|
|
5812
|
+
for (let y = 0; y < 32 * scale; y++) {
|
|
5813
|
+
for (let x = 32 * scale; x < image.width; x++) {
|
|
5814
|
+
pixels[(y * image.width + x) * 4 + 3] = 0;
|
|
5771
5815
|
}
|
|
5772
5816
|
}
|
|
5773
5817
|
}
|
|
5774
5818
|
return pixels;
|
|
5775
5819
|
}
|
|
5820
|
+
static makeBaseOpaque(pixels, width, scale) {
|
|
5821
|
+
for (const [x0, y0, x1, y1] of [[0, 0, 32, 16], [0, 16, 64, 32], [16, 48, 48, 64]]) {
|
|
5822
|
+
for (let y = y0 * scale; y < y1 * scale; y++) {
|
|
5823
|
+
for (let x = x0 * scale; x < x1 * scale; x++) pixels[(y * width + x) * 4 + 3] = 255;
|
|
5824
|
+
}
|
|
5825
|
+
}
|
|
5826
|
+
}
|
|
5776
5827
|
};
|
|
5777
5828
|
|
|
5778
5829
|
// src/skin/CapeLayout.ts
|
|
@@ -5794,12 +5845,13 @@ var SkinObject = class extends SceneObject {
|
|
|
5794
5845
|
this.slim = this.options.slim ?? false;
|
|
5795
5846
|
}
|
|
5796
5847
|
async init() {
|
|
5848
|
+
const cape = this.getGroupByName("cape" /* CAPE */);
|
|
5797
5849
|
this.createMeshes();
|
|
5850
|
+
if (cape) this.getGroupByName("body" /* BODY */).attach(cape);
|
|
5798
5851
|
}
|
|
5799
5852
|
removeMeshes() {
|
|
5800
5853
|
}
|
|
5801
5854
|
createMeshes() {
|
|
5802
|
-
console.log("#createMeshes");
|
|
5803
5855
|
const mat = this.skinMaterial ?? Materials.MISSING_TEXTURE;
|
|
5804
5856
|
{
|
|
5805
5857
|
const headGroup = this.createAndAddGroup("head", 0, 28, 0, "y" /* Y */, -4);
|
|
@@ -5809,45 +5861,48 @@ var SkinObject = class extends SceneObject {
|
|
|
5809
5861
|
const hat = this.createAndAddMesh("hat", headGroup, hatGeo, mat, "y" /* Y */, 4);
|
|
5810
5862
|
}
|
|
5811
5863
|
{
|
|
5812
|
-
const bodyGroup = this.createAndAddGroup("body", 0,
|
|
5864
|
+
const bodyGroup = this.createAndAddGroup("body", 0, 24, 0);
|
|
5813
5865
|
const bodyGeo = this.getBoxGeometry("body" /* BODY */);
|
|
5814
|
-
const body = this.createAndAddMesh("body", bodyGroup, bodyGeo, mat);
|
|
5866
|
+
const body = this.createAndAddMesh("body", bodyGroup, bodyGeo, mat, "y" /* Y */, -6);
|
|
5815
5867
|
const jacketGeo = this.getBoxGeometry("jacket" /* JACKET */);
|
|
5816
|
-
const jacket = this.createAndAddMesh("jacket", bodyGroup, jacketGeo, mat);
|
|
5868
|
+
const jacket = this.createAndAddMesh("jacket", bodyGroup, jacketGeo, mat, "y" /* Y */, -6);
|
|
5817
5869
|
}
|
|
5818
5870
|
{
|
|
5819
5871
|
{
|
|
5820
|
-
const leftArmGroup = this.createAndAddGroup("leftArm",
|
|
5872
|
+
const leftArmGroup = this.createAndAddGroup("leftArm", -5, 22, 0);
|
|
5821
5873
|
const leftArmGeo = this.getBoxGeometry("leftArm" /* LEFT_ARM */);
|
|
5822
5874
|
const leftArm = this.createAndAddMesh("leftArm", leftArmGroup, leftArmGeo, mat, "y" /* Y */, -4);
|
|
5875
|
+
leftArm.position.x = this.slim ? -0.5 : -1;
|
|
5823
5876
|
const leftSleeveGeo = this.getBoxGeometry("leftSleeve" /* LEFT_SLEEVE */);
|
|
5824
5877
|
const leftSleeve = this.createAndAddMesh("leftSleeve", leftArmGroup, leftSleeveGeo, mat, "y" /* Y */, -4);
|
|
5878
|
+
leftSleeve.position.x = this.slim ? -0.5 : -1;
|
|
5825
5879
|
}
|
|
5826
5880
|
{
|
|
5827
|
-
const rightArmGroup = this.createAndAddGroup("rightArm",
|
|
5881
|
+
const rightArmGroup = this.createAndAddGroup("rightArm", 5, 22, 0);
|
|
5828
5882
|
const rightArmGeo = this.getBoxGeometry("rightArm" /* RIGHT_ARM */);
|
|
5829
5883
|
const rightArm = this.createAndAddMesh("rightArm", rightArmGroup, rightArmGeo, mat, "y" /* Y */, -4);
|
|
5884
|
+
rightArm.position.x = this.slim ? 0.5 : 1;
|
|
5830
5885
|
const rightSleeveGeo = this.getBoxGeometry("rightSleeve" /* RIGHT_SLEEVE */);
|
|
5831
5886
|
const rightSleeve = this.createAndAddMesh("rightSleeve", rightArmGroup, rightSleeveGeo, mat, "y" /* Y */, -4);
|
|
5887
|
+
rightSleeve.position.x = this.slim ? 0.5 : 1;
|
|
5832
5888
|
}
|
|
5833
5889
|
}
|
|
5834
5890
|
{
|
|
5835
5891
|
{
|
|
5836
|
-
const leftLegGroup = this.createAndAddGroup("leftLeg", -
|
|
5892
|
+
const leftLegGroup = this.createAndAddGroup("leftLeg", -1.9, 12, 0);
|
|
5837
5893
|
const leftLegGeo = this.getBoxGeometry("leftLeg" /* LEFT_LEG */);
|
|
5838
|
-
const leftLeg = this.createAndAddMesh("leftLeg", leftLegGroup, leftLegGeo, mat, "y" /* Y */, -
|
|
5894
|
+
const leftLeg = this.createAndAddMesh("leftLeg", leftLegGroup, leftLegGeo, mat, "y" /* Y */, -6);
|
|
5839
5895
|
const leftTrousersGeo = this.getBoxGeometry("leftTrousers" /* LEFT_TROUSERS */);
|
|
5840
|
-
const leftTrousers = this.createAndAddMesh("leftTrousers", leftLegGroup, leftTrousersGeo, mat, "y" /* Y */, -
|
|
5896
|
+
const leftTrousers = this.createAndAddMesh("leftTrousers", leftLegGroup, leftTrousersGeo, mat, "y" /* Y */, -6);
|
|
5841
5897
|
}
|
|
5842
5898
|
{
|
|
5843
|
-
const rightLegGroup = this.createAndAddGroup("rightLeg",
|
|
5899
|
+
const rightLegGroup = this.createAndAddGroup("rightLeg", 1.9, 12, 0);
|
|
5844
5900
|
const rightLegGeo = this.getBoxGeometry("rightLeg" /* RIGHT_LEG */);
|
|
5845
|
-
const rightLeg = this.createAndAddMesh("rightLeg", rightLegGroup, rightLegGeo, mat, "y" /* Y */, -
|
|
5901
|
+
const rightLeg = this.createAndAddMesh("rightLeg", rightLegGroup, rightLegGeo, mat, "y" /* Y */, -6);
|
|
5846
5902
|
const rightTrousersGeo = this.getBoxGeometry("rightTrousers" /* RIGHT_TROUSERS */);
|
|
5847
|
-
const rightTrousers = this.createAndAddMesh("rightTrousers", rightLegGroup, rightTrousersGeo, mat, "y" /* Y */, -
|
|
5903
|
+
const rightTrousers = this.createAndAddMesh("rightTrousers", rightLegGroup, rightTrousersGeo, mat, "y" /* Y */, -6);
|
|
5848
5904
|
}
|
|
5849
5905
|
}
|
|
5850
|
-
console.log("#createMeshes done");
|
|
5851
5906
|
}
|
|
5852
5907
|
async setSkinTexture(src) {
|
|
5853
5908
|
if (typeof src === "undefined") return;
|
|
@@ -5872,7 +5927,7 @@ var SkinObject = class extends SceneObject {
|
|
|
5872
5927
|
const load = ++this.capeLoad;
|
|
5873
5928
|
if (src === void 0) {
|
|
5874
5929
|
const group = this.getGroupByName("cape" /* CAPE */);
|
|
5875
|
-
|
|
5930
|
+
group?.removeFromParent();
|
|
5876
5931
|
this.notifyDirty();
|
|
5877
5932
|
return;
|
|
5878
5933
|
}
|
|
@@ -5890,7 +5945,9 @@ var SkinObject = class extends SceneObject {
|
|
|
5890
5945
|
mesh.material = material;
|
|
5891
5946
|
mesh.geometry = geometry;
|
|
5892
5947
|
} else {
|
|
5893
|
-
const
|
|
5948
|
+
const body = this.getGroupByName("body" /* BODY */);
|
|
5949
|
+
const group = this.createGroup("cape" /* CAPE */, 0, body ? 0 : 24, 2);
|
|
5950
|
+
(body ?? this).add(group);
|
|
5894
5951
|
group.rotation.set(toRadians(-6), Math.PI, 0);
|
|
5895
5952
|
const cape = this.createAndAddMesh("cape" /* CAPE */, group, geometry, material);
|
|
5896
5953
|
cape.position.set(0, -8, -0.5);
|
|
@@ -5905,15 +5962,14 @@ var SkinObject = class extends SceneObject {
|
|
|
5905
5962
|
updateSlim(slim) {
|
|
5906
5963
|
if (slim === this.slim) return;
|
|
5907
5964
|
this.slim = slim;
|
|
5965
|
+
const offset = slim ? 0.5 : -0.5;
|
|
5908
5966
|
for (const part of ["leftArm" /* LEFT_ARM */, "leftSleeve" /* LEFT_SLEEVE */, "rightArm" /* RIGHT_ARM */, "rightSleeve" /* RIGHT_SLEEVE */]) {
|
|
5909
5967
|
const mesh = this.getMeshByName(part);
|
|
5910
|
-
if (mesh)
|
|
5968
|
+
if (mesh) {
|
|
5969
|
+
mesh.geometry = this.getBoxGeometry(part);
|
|
5970
|
+
mesh.position.x += part === "leftArm" /* LEFT_ARM */ || part === "leftSleeve" /* LEFT_SLEEVE */ ? offset : -offset;
|
|
5971
|
+
}
|
|
5911
5972
|
}
|
|
5912
|
-
const offset = slim ? 0.5 : -0.5;
|
|
5913
|
-
const leftArm = this.getGroupByName("leftArm" /* LEFT_ARM */);
|
|
5914
|
-
const rightArm = this.getGroupByName("rightArm" /* RIGHT_ARM */);
|
|
5915
|
-
if (leftArm) leftArm.position.x += offset;
|
|
5916
|
-
if (rightArm) rightArm.position.x -= offset;
|
|
5917
5973
|
this.notifyDirty();
|
|
5918
5974
|
}
|
|
5919
5975
|
/** Select the texture layout, or pass undefined to detect it from image dimensions. */
|
|
@@ -5929,7 +5985,6 @@ var SkinObject = class extends SceneObject {
|
|
|
5929
5985
|
}
|
|
5930
5986
|
//TODO: layer toggles
|
|
5931
5987
|
getBoxGeometry(part) {
|
|
5932
|
-
console.log("slim", this.slim);
|
|
5933
5988
|
const coordinates = this.slim ? slimSkinTextureCoordinates : classicSkinTextureCoordinates;
|
|
5934
5989
|
const geometries = this.slim ? slimSkinGeometries : classicSkinGeometries;
|
|
5935
5990
|
return this._getBoxGeometryFromDimensions(geometries[part], coordinates[part], [64, 64], [64, 64]);
|