minerender 2.1.0-alpha.69 → 2.1.0-alpha.70
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 +3 -2
- package/dist/browser/index.d.ts +3 -2
- package/dist/browser/index.js +51 -14
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +54 -17
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +51 -14
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +3 -2
- package/dist/node/index.d.ts +3 -2
- package/dist/node/index.js +49 -13
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +52 -16
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -42238,6 +42238,25 @@ void main() {
|
|
|
42238
42238
|
};
|
|
42239
42239
|
}
|
|
42240
42240
|
static async loadInfo(src) {
|
|
42241
|
+
if (/^data:/i.test(src.trimStart())) {
|
|
42242
|
+
const url = new URL(src);
|
|
42243
|
+
url.hash = "";
|
|
42244
|
+
const comma = url.href.indexOf(",");
|
|
42245
|
+
if (comma < 0) {
|
|
42246
|
+
throw new Error("Invalid image data URL");
|
|
42247
|
+
}
|
|
42248
|
+
let bytes = url.href.slice(comma + 1).replace(
|
|
42249
|
+
/%([\da-f]{2})/gi,
|
|
42250
|
+
(_4, hex) => String.fromCharCode(parseInt(hex, 16))
|
|
42251
|
+
);
|
|
42252
|
+
if (/; *base64 *$/i.test(url.href.slice(5, comma))) {
|
|
42253
|
+
bytes = atob(bytes);
|
|
42254
|
+
}
|
|
42255
|
+
return this.processResponse({
|
|
42256
|
+
url: src,
|
|
42257
|
+
data: Uint8Array.from(bytes, (char) => char.charCodeAt(0)).buffer
|
|
42258
|
+
});
|
|
42259
|
+
}
|
|
42241
42260
|
return Requests.genericRequest({
|
|
42242
42261
|
url: src,
|
|
42243
42262
|
responseType: "arraybuffer"
|
|
@@ -42328,6 +42347,26 @@ void main() {
|
|
|
42328
42347
|
init_CacheKey();
|
|
42329
42348
|
init_three_module();
|
|
42330
42349
|
Textures = class _Textures {
|
|
42350
|
+
/** Creates the shared checkerboard from pixels without fetching or decoding an image. */
|
|
42351
|
+
static getMissing() {
|
|
42352
|
+
return Caching.textureCache.get("builtin:missing-texture", () => {
|
|
42353
|
+
const size = 64;
|
|
42354
|
+
const data = new Uint8Array(size * size * 4);
|
|
42355
|
+
for (let y5 = 0; y5 < size; y5++) {
|
|
42356
|
+
for (let x4 = 0; x4 < size; x4++) {
|
|
42357
|
+
const offset = (y5 * size + x4) * 4;
|
|
42358
|
+
const color2 = (x4 + y5) % 2 === 0 ? 255 : 0;
|
|
42359
|
+
data[offset] = data[offset + 2] = color2;
|
|
42360
|
+
data[offset + 3] = 255;
|
|
42361
|
+
}
|
|
42362
|
+
}
|
|
42363
|
+
const texture = new DataTexture(data, size, size);
|
|
42364
|
+
texture.colorSpace = SRGBColorSpace;
|
|
42365
|
+
texture.flipY = true;
|
|
42366
|
+
texture.needsUpdate = true;
|
|
42367
|
+
return this.initTextureProps(texture);
|
|
42368
|
+
});
|
|
42369
|
+
}
|
|
42331
42370
|
static initTextureProps(texture) {
|
|
42332
42371
|
texture.magFilter = NearestFilter;
|
|
42333
42372
|
texture.minFilter = NearestFilter;
|
|
@@ -42360,7 +42399,7 @@ void main() {
|
|
|
42360
42399
|
});
|
|
42361
42400
|
|
|
42362
42401
|
// src/Materials.ts
|
|
42363
|
-
var
|
|
42402
|
+
var Materials;
|
|
42364
42403
|
var init_Materials = __esm({
|
|
42365
42404
|
"src/Materials.ts"() {
|
|
42366
42405
|
init_dirname();
|
|
@@ -42371,11 +42410,12 @@ void main() {
|
|
|
42371
42410
|
init_Textures();
|
|
42372
42411
|
init_TextureLoader();
|
|
42373
42412
|
init_Caching();
|
|
42374
|
-
|
|
42375
|
-
// resolved lazily: as a static field this decoded an image the moment the library was
|
|
42376
|
-
// imported, which needs both a DOM and an EnvProvider to already be in place
|
|
42413
|
+
Materials = class _Materials {
|
|
42377
42414
|
static get MISSING_TEXTURE() {
|
|
42378
|
-
return
|
|
42415
|
+
return Caching.materialCache.get("builtin:missing-texture", () => new MeshBasicMaterial({
|
|
42416
|
+
map: Textures.getMissing(),
|
|
42417
|
+
alphaTest: 0.5
|
|
42418
|
+
}));
|
|
42379
42419
|
}
|
|
42380
42420
|
static createImage(key) {
|
|
42381
42421
|
const transparent = key.transparent || false;
|
|
@@ -42646,8 +42686,6 @@ void main() {
|
|
|
42646
42686
|
}
|
|
42647
42687
|
}
|
|
42648
42688
|
};
|
|
42649
|
-
_Materials.MISSING_TEXTURE_SRC = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABAAQMAAACQp+OdAAAABlBMVEX/AP8AAACfphTyAAAAFUlEQVQoz2MIhQKGVVAwKjIqQrwIAHRz/wFI17TEAAAAAElFTkSuQmCC";
|
|
42650
|
-
Materials = _Materials;
|
|
42651
42689
|
}
|
|
42652
42690
|
});
|
|
42653
42691
|
|
|
@@ -87536,7 +87574,7 @@ ${key}` : key;
|
|
|
87536
87574
|
init_CanvasImage();
|
|
87537
87575
|
init_TextureAtlas();
|
|
87538
87576
|
init_Caching();
|
|
87539
|
-
|
|
87577
|
+
init_Textures();
|
|
87540
87578
|
init_AssetKey();
|
|
87541
87579
|
init_ModelGenerator();
|
|
87542
87580
|
init_log();
|
|
@@ -87823,11 +87861,12 @@ ${key}` : key;
|
|
|
87823
87861
|
const size = Math.ceil(s4 * maxWidth);
|
|
87824
87862
|
console.debug(p8, "Atlas size:", size);
|
|
87825
87863
|
const squaredSize = size * size;
|
|
87826
|
-
const missing = await ImageLoader2.getData("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABAAQMAAACQp+OdAAAABlBMVEX/AP8AAACfphTyAAAAFUlEQVQoz2MIhQKGVVAwKjIqQrwIAHRz/wFI17TEAAAAAElFTkSuQmCC");
|
|
87827
|
-
const empty2 = await ImageLoader2.getData("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABAAQMAAACQp+OdAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAA5JREFUKM9jGAWjgAIAAAJAAAFSSwuTAAAAAElFTkSuQmCC");
|
|
87828
87864
|
const image = new CanvasImage(size, size);
|
|
87829
|
-
|
|
87830
|
-
image.
|
|
87865
|
+
const missing = Textures.getMissing().image;
|
|
87866
|
+
const missingPixels = image.context.createImageData(missing.width, missing.height);
|
|
87867
|
+
missingPixels.data.set(missing.data);
|
|
87868
|
+
image.putData(missingPixels, 0, 0);
|
|
87869
|
+
image.context.clearRect(0, 0, maxWidth, maxWidth);
|
|
87831
87870
|
const positions = {};
|
|
87832
87871
|
let hasTransparency = false;
|
|
87833
87872
|
let hasAnimation = false;
|
|
@@ -87893,8 +87932,6 @@ ${key}` : key;
|
|
|
87893
87932
|
ty++;
|
|
87894
87933
|
}
|
|
87895
87934
|
}
|
|
87896
|
-
const atlasImageData = image.toDataURL();
|
|
87897
|
-
console.log(p8, "Atlas Image for", model.key, atlasImageData);
|
|
87898
87935
|
this.fillMissingTextureKeys(model.textures, positions);
|
|
87899
87936
|
if (isItemModel) {
|
|
87900
87937
|
console.debug(p8, "Generating item model for", model);
|