minerender 2.1.0-alpha.30 → 2.1.0-alpha.31
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 +95 -40
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +95 -40
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +3684 -890
- 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 +96 -40
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +95 -40
- package/dist/node/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/node/index.d.mts
CHANGED
|
@@ -1578,6 +1578,11 @@ type SkinGeometries = Record<SkinPart, TripleArray>;
|
|
|
1578
1578
|
declare const classicSkinGeometries: SkinGeometries;
|
|
1579
1579
|
declare const slimSkinGeometries: SkinGeometries;
|
|
1580
1580
|
|
|
1581
|
+
declare class SkinImage {
|
|
1582
|
+
static getData(src: string): Promise<ImageData>;
|
|
1583
|
+
private static decodePng;
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1581
1586
|
type SkinTextureCoordinates = Record<SkinPart, ModelFaces>;
|
|
1582
1587
|
declare const classicSkinTextureCoordinates: Readonly<SkinTextureCoordinates>;
|
|
1583
1588
|
declare const slimSkinTextureCoordinates: Readonly<SkinTextureCoordinates>;
|
|
@@ -1593,6 +1598,7 @@ declare class SkinTextures {
|
|
|
1593
1598
|
private static createMaterial;
|
|
1594
1599
|
private static isSlim;
|
|
1595
1600
|
private static normalizeLegacy;
|
|
1601
|
+
private static makeBaseOpaque;
|
|
1596
1602
|
}
|
|
1597
1603
|
|
|
1598
1604
|
declare class Skins {
|
|
@@ -1744,4 +1750,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
1744
1750
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
1745
1751
|
}
|
|
1746
1752
|
|
|
1747
|
-
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, 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, NodeCache, NodeEnv, 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, registerNodeEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
|
|
1753
|
+
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, 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, NodeCache, NodeEnv, 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, registerNodeEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1578,6 +1578,11 @@ type SkinGeometries = Record<SkinPart, TripleArray>;
|
|
|
1578
1578
|
declare const classicSkinGeometries: SkinGeometries;
|
|
1579
1579
|
declare const slimSkinGeometries: SkinGeometries;
|
|
1580
1580
|
|
|
1581
|
+
declare class SkinImage {
|
|
1582
|
+
static getData(src: string): Promise<ImageData>;
|
|
1583
|
+
private static decodePng;
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1581
1586
|
type SkinTextureCoordinates = Record<SkinPart, ModelFaces>;
|
|
1582
1587
|
declare const classicSkinTextureCoordinates: Readonly<SkinTextureCoordinates>;
|
|
1583
1588
|
declare const slimSkinTextureCoordinates: Readonly<SkinTextureCoordinates>;
|
|
@@ -1593,6 +1598,7 @@ declare class SkinTextures {
|
|
|
1593
1598
|
private static createMaterial;
|
|
1594
1599
|
private static isSlim;
|
|
1595
1600
|
private static normalizeLegacy;
|
|
1601
|
+
private static makeBaseOpaque;
|
|
1596
1602
|
}
|
|
1597
1603
|
|
|
1598
1604
|
declare class Skins {
|
|
@@ -1744,4 +1750,4 @@ declare class NodeCache extends PersistentCache<LocalStorage> {
|
|
|
1744
1750
|
forEach<T>(callback: (v: T, k: string) => void): Promise<void>;
|
|
1745
1751
|
}
|
|
1746
1752
|
|
|
1747
|
-
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, 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, NodeCache, NodeEnv, 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, registerNodeEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
|
|
1753
|
+
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, 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, NodeCache, NodeEnv, 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, registerNodeEnv, serializeBoxGeometryKey, serializeImageKey, serializeMaterialKey, serializeMeshKey, serializeTextureKey, sha1, sha256, sha512, shutdown, sleep, slimSkinGeometries, slimSkinTextureCoordinates, timingEnd, timingStart, toDegrees, toRadians, toTrianglesDrawMode };
|
package/dist/node/index.js
CHANGED
|
@@ -193,6 +193,7 @@ __export(index_node_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,
|
|
@@ -5625,17 +5626,17 @@ var baseSkinCoordinates = {
|
|
|
5625
5626
|
},
|
|
5626
5627
|
up: {
|
|
5627
5628
|
uv: [
|
|
5628
|
-
4,
|
|
5629
|
-
36,
|
|
5630
5629
|
8,
|
|
5630
|
+
36,
|
|
5631
|
+
4,
|
|
5631
5632
|
32
|
|
5632
5633
|
]
|
|
5633
5634
|
},
|
|
5634
5635
|
down: {
|
|
5635
5636
|
uv: [
|
|
5636
|
-
8,
|
|
5637
|
-
32,
|
|
5638
5637
|
12,
|
|
5638
|
+
32,
|
|
5639
|
+
8,
|
|
5639
5640
|
36
|
|
5640
5641
|
],
|
|
5641
5642
|
rotation: 180
|
|
@@ -5691,13 +5692,13 @@ var slimSkinTextureCoordinates = {
|
|
|
5691
5692
|
|
|
5692
5693
|
// src/skin/SkinGeometries.ts
|
|
5693
5694
|
var box8inner = [8, 8, 8];
|
|
5694
|
-
var box8outer = [
|
|
5695
|
+
var box8outer = [9, 9, 9];
|
|
5695
5696
|
var box8_12_4inner = [8, 12, 4];
|
|
5696
|
-
var box8_12_4outer = [8.
|
|
5697
|
+
var box8_12_4outer = [8.5, 12.5, 4.5];
|
|
5697
5698
|
var box4_12_4inner = [4, 12, 4];
|
|
5698
|
-
var box4_12_4outer = [4.
|
|
5699
|
+
var box4_12_4outer = [4.5, 12.5, 4.5];
|
|
5699
5700
|
var box3_12_4inner = [3, 12, 4];
|
|
5700
|
-
var box3_12_4outer = [3.
|
|
5701
|
+
var box3_12_4outer = [3.5, 12.5, 4.5];
|
|
5701
5702
|
var box10_16_1 = [10, 16, 1];
|
|
5702
5703
|
var baseSkinGeometries = {
|
|
5703
5704
|
head: box8inner,
|
|
@@ -5731,9 +5732,54 @@ var import_ts_deepmerge7 = __toESM(require_dist());
|
|
|
5731
5732
|
|
|
5732
5733
|
// src/skin/SkinTextures.ts
|
|
5733
5734
|
var import_three18 = require("three");
|
|
5735
|
+
|
|
5736
|
+
// src/skin/SkinImage.ts
|
|
5737
|
+
var SkinImage = class {
|
|
5738
|
+
static async getData(src) {
|
|
5739
|
+
const key = serializeImageKey({ src });
|
|
5740
|
+
return await Caching.imageDataCache.get(`skin:${key}`, async () => {
|
|
5741
|
+
const info = await ImageLoader.getInfo(src);
|
|
5742
|
+
if (info.type !== "png") return ImageLoader.getData(src);
|
|
5743
|
+
try {
|
|
5744
|
+
return await this.decodePng(info.data);
|
|
5745
|
+
} catch (error) {
|
|
5746
|
+
Caching.rawImageCache.invalidate(key);
|
|
5747
|
+
throw error;
|
|
5748
|
+
}
|
|
5749
|
+
});
|
|
5750
|
+
}
|
|
5751
|
+
static async decodePng(bytes) {
|
|
5752
|
+
const { decode, convertIndexedToRgb } = await import("fast-png");
|
|
5753
|
+
const png = decode(bytes);
|
|
5754
|
+
let { data, channels, depth } = png;
|
|
5755
|
+
if (channels === 1 && (png.palette || depth < 8)) {
|
|
5756
|
+
const max = (1 << depth) - 1;
|
|
5757
|
+
const palette = png.palette ?? Array.from({ length: max + 1 }, (_, value) => {
|
|
5758
|
+
const gray = value * 255 / max;
|
|
5759
|
+
return [gray, gray, gray, png.transparency?.[0] === value ? 0 : 255];
|
|
5760
|
+
});
|
|
5761
|
+
data = convertIndexedToRgb({ ...png, palette });
|
|
5762
|
+
channels = palette[0].length;
|
|
5763
|
+
depth = 8;
|
|
5764
|
+
}
|
|
5765
|
+
const pixels = new Uint8ClampedArray(png.width * png.height * 4);
|
|
5766
|
+
for (let pixel = 0; pixel < png.width * png.height; pixel++) {
|
|
5767
|
+
const source = pixel * channels;
|
|
5768
|
+
const target = pixel * 4;
|
|
5769
|
+
const sample = (channel) => depth === 16 ? data[source + channel] >>> 8 : data[source + channel];
|
|
5770
|
+
pixels[target] = sample(0);
|
|
5771
|
+
pixels[target + 1] = sample(channels < 3 ? 0 : 1);
|
|
5772
|
+
pixels[target + 2] = sample(channels < 3 ? 0 : 2);
|
|
5773
|
+
pixels[target + 3] = channels % 2 === 0 ? sample(channels - 1) : png.transparency?.every((value, channel) => data[source + channel] === value) ? 0 : 255;
|
|
5774
|
+
}
|
|
5775
|
+
return { width: png.width, height: png.height, data: pixels, colorSpace: "srgb" };
|
|
5776
|
+
}
|
|
5777
|
+
};
|
|
5778
|
+
|
|
5779
|
+
// src/skin/SkinTextures.ts
|
|
5734
5780
|
var SkinTextures = class {
|
|
5735
5781
|
static async get(src, legacy) {
|
|
5736
|
-
const image = await
|
|
5782
|
+
const image = await SkinImage.getData(src);
|
|
5737
5783
|
const scale = image.width / 64;
|
|
5738
5784
|
if (!Number.isInteger(scale) || scale < 1 || image.height !== image.width && image.height !== image.width / 2) {
|
|
5739
5785
|
throw new MineRenderError(`Invalid skin dimensions ${image.width}x${image.height}; expected 64x64 or 64x32, or an integer-scaled equivalent`);
|
|
@@ -5746,12 +5792,13 @@ var SkinTextures = class {
|
|
|
5746
5792
|
const key = `skin:${serializeImageKey({ src })}:${isLegacy}`;
|
|
5747
5793
|
const material = Caching.materialCache.get(key, () => {
|
|
5748
5794
|
const pixels = isLegacy ? this.normalizeLegacy(image, scale) : new Uint8Array(image.data);
|
|
5795
|
+
this.makeBaseOpaque(pixels, image.width, scale);
|
|
5749
5796
|
return this.createMaterial(pixels, image.width, image.width);
|
|
5750
5797
|
});
|
|
5751
5798
|
return { material, slim, legacy: isLegacy };
|
|
5752
5799
|
}
|
|
5753
5800
|
static async getCape(src, layout = "minecraft") {
|
|
5754
|
-
const image = await
|
|
5801
|
+
const image = await SkinImage.getData(src);
|
|
5755
5802
|
const scale = image.width / 64;
|
|
5756
5803
|
if (layout === "minecraft" && (!Number.isInteger(scale) || scale < 1 || image.height !== image.width / 2)) {
|
|
5757
5804
|
throw new MineRenderError(`Invalid cape dimensions ${image.width}x${image.height}; expected 64x32 or an integer-scaled equivalent`);
|
|
@@ -5765,7 +5812,7 @@ var SkinTextures = class {
|
|
|
5765
5812
|
texture.colorSpace = import_three18.SRGBColorSpace;
|
|
5766
5813
|
texture.flipY = true;
|
|
5767
5814
|
texture.needsUpdate = true;
|
|
5768
|
-
return new import_three18.MeshBasicMaterial({ map: texture, transparent, side: transparent ? import_three18.DoubleSide : import_three18.FrontSide, alphaTest: transparent ? 0.
|
|
5815
|
+
return new import_three18.MeshBasicMaterial({ map: texture, transparent, side: transparent ? import_three18.DoubleSide : import_three18.FrontSide, alphaTest: transparent ? 0.1 : 0 });
|
|
5769
5816
|
}
|
|
5770
5817
|
static isSlim(image, scale) {
|
|
5771
5818
|
for (const [x, y] of [[46, 52], [54, 20]]) {
|
|
@@ -5808,18 +5855,22 @@ var SkinTextures = class {
|
|
|
5808
5855
|
if (pixels[(y * image.width + x) * 4 + 3] < 128) clearHat = false;
|
|
5809
5856
|
}
|
|
5810
5857
|
}
|
|
5811
|
-
|
|
5812
|
-
for (let
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
pixels[alpha] = 255;
|
|
5816
|
-
} else if (clearHat && x >= 32 * scale && y < 32 * scale) {
|
|
5817
|
-
pixels[alpha] = 0;
|
|
5858
|
+
if (clearHat) {
|
|
5859
|
+
for (let y = 0; y < 32 * scale; y++) {
|
|
5860
|
+
for (let x = 32 * scale; x < image.width; x++) {
|
|
5861
|
+
pixels[(y * image.width + x) * 4 + 3] = 0;
|
|
5818
5862
|
}
|
|
5819
5863
|
}
|
|
5820
5864
|
}
|
|
5821
5865
|
return pixels;
|
|
5822
5866
|
}
|
|
5867
|
+
static makeBaseOpaque(pixels, width, scale) {
|
|
5868
|
+
for (const [x0, y0, x1, y1] of [[0, 0, 32, 16], [0, 16, 64, 32], [16, 48, 48, 64]]) {
|
|
5869
|
+
for (let y = y0 * scale; y < y1 * scale; y++) {
|
|
5870
|
+
for (let x = x0 * scale; x < x1 * scale; x++) pixels[(y * width + x) * 4 + 3] = 255;
|
|
5871
|
+
}
|
|
5872
|
+
}
|
|
5873
|
+
}
|
|
5823
5874
|
};
|
|
5824
5875
|
|
|
5825
5876
|
// src/skin/CapeLayout.ts
|
|
@@ -5841,12 +5892,13 @@ var SkinObject = class extends SceneObject {
|
|
|
5841
5892
|
this.slim = this.options.slim ?? false;
|
|
5842
5893
|
}
|
|
5843
5894
|
async init() {
|
|
5895
|
+
const cape = this.getGroupByName("cape" /* CAPE */);
|
|
5844
5896
|
this.createMeshes();
|
|
5897
|
+
if (cape) this.getGroupByName("body" /* BODY */).attach(cape);
|
|
5845
5898
|
}
|
|
5846
5899
|
removeMeshes() {
|
|
5847
5900
|
}
|
|
5848
5901
|
createMeshes() {
|
|
5849
|
-
console.log("#createMeshes");
|
|
5850
5902
|
const mat = this.skinMaterial ?? Materials.MISSING_TEXTURE;
|
|
5851
5903
|
{
|
|
5852
5904
|
const headGroup = this.createAndAddGroup("head", 0, 28, 0, "y" /* Y */, -4);
|
|
@@ -5856,45 +5908,48 @@ var SkinObject = class extends SceneObject {
|
|
|
5856
5908
|
const hat = this.createAndAddMesh("hat", headGroup, hatGeo, mat, "y" /* Y */, 4);
|
|
5857
5909
|
}
|
|
5858
5910
|
{
|
|
5859
|
-
const bodyGroup = this.createAndAddGroup("body", 0,
|
|
5911
|
+
const bodyGroup = this.createAndAddGroup("body", 0, 24, 0);
|
|
5860
5912
|
const bodyGeo = this.getBoxGeometry("body" /* BODY */);
|
|
5861
|
-
const body = this.createAndAddMesh("body", bodyGroup, bodyGeo, mat);
|
|
5913
|
+
const body = this.createAndAddMesh("body", bodyGroup, bodyGeo, mat, "y" /* Y */, -6);
|
|
5862
5914
|
const jacketGeo = this.getBoxGeometry("jacket" /* JACKET */);
|
|
5863
|
-
const jacket = this.createAndAddMesh("jacket", bodyGroup, jacketGeo, mat);
|
|
5915
|
+
const jacket = this.createAndAddMesh("jacket", bodyGroup, jacketGeo, mat, "y" /* Y */, -6);
|
|
5864
5916
|
}
|
|
5865
5917
|
{
|
|
5866
5918
|
{
|
|
5867
|
-
const leftArmGroup = this.createAndAddGroup("leftArm",
|
|
5919
|
+
const leftArmGroup = this.createAndAddGroup("leftArm", -5, 22, 0);
|
|
5868
5920
|
const leftArmGeo = this.getBoxGeometry("leftArm" /* LEFT_ARM */);
|
|
5869
5921
|
const leftArm = this.createAndAddMesh("leftArm", leftArmGroup, leftArmGeo, mat, "y" /* Y */, -4);
|
|
5922
|
+
leftArm.position.x = this.slim ? -0.5 : -1;
|
|
5870
5923
|
const leftSleeveGeo = this.getBoxGeometry("leftSleeve" /* LEFT_SLEEVE */);
|
|
5871
5924
|
const leftSleeve = this.createAndAddMesh("leftSleeve", leftArmGroup, leftSleeveGeo, mat, "y" /* Y */, -4);
|
|
5925
|
+
leftSleeve.position.x = this.slim ? -0.5 : -1;
|
|
5872
5926
|
}
|
|
5873
5927
|
{
|
|
5874
|
-
const rightArmGroup = this.createAndAddGroup("rightArm",
|
|
5928
|
+
const rightArmGroup = this.createAndAddGroup("rightArm", 5, 22, 0);
|
|
5875
5929
|
const rightArmGeo = this.getBoxGeometry("rightArm" /* RIGHT_ARM */);
|
|
5876
5930
|
const rightArm = this.createAndAddMesh("rightArm", rightArmGroup, rightArmGeo, mat, "y" /* Y */, -4);
|
|
5931
|
+
rightArm.position.x = this.slim ? 0.5 : 1;
|
|
5877
5932
|
const rightSleeveGeo = this.getBoxGeometry("rightSleeve" /* RIGHT_SLEEVE */);
|
|
5878
5933
|
const rightSleeve = this.createAndAddMesh("rightSleeve", rightArmGroup, rightSleeveGeo, mat, "y" /* Y */, -4);
|
|
5934
|
+
rightSleeve.position.x = this.slim ? 0.5 : 1;
|
|
5879
5935
|
}
|
|
5880
5936
|
}
|
|
5881
5937
|
{
|
|
5882
5938
|
{
|
|
5883
|
-
const leftLegGroup = this.createAndAddGroup("leftLeg", -
|
|
5939
|
+
const leftLegGroup = this.createAndAddGroup("leftLeg", -1.9, 12, 0);
|
|
5884
5940
|
const leftLegGeo = this.getBoxGeometry("leftLeg" /* LEFT_LEG */);
|
|
5885
|
-
const leftLeg = this.createAndAddMesh("leftLeg", leftLegGroup, leftLegGeo, mat, "y" /* Y */, -
|
|
5941
|
+
const leftLeg = this.createAndAddMesh("leftLeg", leftLegGroup, leftLegGeo, mat, "y" /* Y */, -6);
|
|
5886
5942
|
const leftTrousersGeo = this.getBoxGeometry("leftTrousers" /* LEFT_TROUSERS */);
|
|
5887
|
-
const leftTrousers = this.createAndAddMesh("leftTrousers", leftLegGroup, leftTrousersGeo, mat, "y" /* Y */, -
|
|
5943
|
+
const leftTrousers = this.createAndAddMesh("leftTrousers", leftLegGroup, leftTrousersGeo, mat, "y" /* Y */, -6);
|
|
5888
5944
|
}
|
|
5889
5945
|
{
|
|
5890
|
-
const rightLegGroup = this.createAndAddGroup("rightLeg",
|
|
5946
|
+
const rightLegGroup = this.createAndAddGroup("rightLeg", 1.9, 12, 0);
|
|
5891
5947
|
const rightLegGeo = this.getBoxGeometry("rightLeg" /* RIGHT_LEG */);
|
|
5892
|
-
const rightLeg = this.createAndAddMesh("rightLeg", rightLegGroup, rightLegGeo, mat, "y" /* Y */, -
|
|
5948
|
+
const rightLeg = this.createAndAddMesh("rightLeg", rightLegGroup, rightLegGeo, mat, "y" /* Y */, -6);
|
|
5893
5949
|
const rightTrousersGeo = this.getBoxGeometry("rightTrousers" /* RIGHT_TROUSERS */);
|
|
5894
|
-
const rightTrousers = this.createAndAddMesh("rightTrousers", rightLegGroup, rightTrousersGeo, mat, "y" /* Y */, -
|
|
5950
|
+
const rightTrousers = this.createAndAddMesh("rightTrousers", rightLegGroup, rightTrousersGeo, mat, "y" /* Y */, -6);
|
|
5895
5951
|
}
|
|
5896
5952
|
}
|
|
5897
|
-
console.log("#createMeshes done");
|
|
5898
5953
|
}
|
|
5899
5954
|
async setSkinTexture(src) {
|
|
5900
5955
|
if (typeof src === "undefined") return;
|
|
@@ -5919,7 +5974,7 @@ var SkinObject = class extends SceneObject {
|
|
|
5919
5974
|
const load = ++this.capeLoad;
|
|
5920
5975
|
if (src === void 0) {
|
|
5921
5976
|
const group = this.getGroupByName("cape" /* CAPE */);
|
|
5922
|
-
|
|
5977
|
+
group?.removeFromParent();
|
|
5923
5978
|
this.notifyDirty();
|
|
5924
5979
|
return;
|
|
5925
5980
|
}
|
|
@@ -5937,7 +5992,9 @@ var SkinObject = class extends SceneObject {
|
|
|
5937
5992
|
mesh.material = material;
|
|
5938
5993
|
mesh.geometry = geometry;
|
|
5939
5994
|
} else {
|
|
5940
|
-
const
|
|
5995
|
+
const body = this.getGroupByName("body" /* BODY */);
|
|
5996
|
+
const group = this.createGroup("cape" /* CAPE */, 0, body ? 0 : 24, 2);
|
|
5997
|
+
(body ?? this).add(group);
|
|
5941
5998
|
group.rotation.set(toRadians(-6), Math.PI, 0);
|
|
5942
5999
|
const cape = this.createAndAddMesh("cape" /* CAPE */, group, geometry, material);
|
|
5943
6000
|
cape.position.set(0, -8, -0.5);
|
|
@@ -5952,15 +6009,14 @@ var SkinObject = class extends SceneObject {
|
|
|
5952
6009
|
updateSlim(slim) {
|
|
5953
6010
|
if (slim === this.slim) return;
|
|
5954
6011
|
this.slim = slim;
|
|
6012
|
+
const offset = slim ? 0.5 : -0.5;
|
|
5955
6013
|
for (const part of ["leftArm" /* LEFT_ARM */, "leftSleeve" /* LEFT_SLEEVE */, "rightArm" /* RIGHT_ARM */, "rightSleeve" /* RIGHT_SLEEVE */]) {
|
|
5956
6014
|
const mesh = this.getMeshByName(part);
|
|
5957
|
-
if (mesh)
|
|
6015
|
+
if (mesh) {
|
|
6016
|
+
mesh.geometry = this.getBoxGeometry(part);
|
|
6017
|
+
mesh.position.x += part === "leftArm" /* LEFT_ARM */ || part === "leftSleeve" /* LEFT_SLEEVE */ ? offset : -offset;
|
|
6018
|
+
}
|
|
5958
6019
|
}
|
|
5959
|
-
const offset = slim ? 0.5 : -0.5;
|
|
5960
|
-
const leftArm = this.getGroupByName("leftArm" /* LEFT_ARM */);
|
|
5961
|
-
const rightArm = this.getGroupByName("rightArm" /* RIGHT_ARM */);
|
|
5962
|
-
if (leftArm) leftArm.position.x += offset;
|
|
5963
|
-
if (rightArm) rightArm.position.x -= offset;
|
|
5964
6020
|
this.notifyDirty();
|
|
5965
6021
|
}
|
|
5966
6022
|
/** Select the texture layout, or pass undefined to detect it from image dimensions. */
|
|
@@ -5976,7 +6032,6 @@ var SkinObject = class extends SceneObject {
|
|
|
5976
6032
|
}
|
|
5977
6033
|
//TODO: layer toggles
|
|
5978
6034
|
getBoxGeometry(part) {
|
|
5979
|
-
console.log("slim", this.slim);
|
|
5980
6035
|
const coordinates = this.slim ? slimSkinTextureCoordinates : classicSkinTextureCoordinates;
|
|
5981
6036
|
const geometries = this.slim ? slimSkinGeometries : classicSkinGeometries;
|
|
5982
6037
|
return this._getBoxGeometryFromDimensions(geometries[part], coordinates[part], [64, 64], [64, 64]);
|
|
@@ -7554,6 +7609,7 @@ var Chunk = class _Chunk {
|
|
|
7554
7609
|
SceneStats,
|
|
7555
7610
|
SceneStatsDisplay,
|
|
7556
7611
|
SchematicParser,
|
|
7612
|
+
SkinImage,
|
|
7557
7613
|
SkinObject,
|
|
7558
7614
|
SkinPart,
|
|
7559
7615
|
SkinTextures,
|