minerender 2.1.0-alpha.4 → 2.1.0-alpha.5
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 +17 -17
- package/dist/browser/index.d.ts +17 -17
- package/dist/browser/index.js +20 -12
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +21 -13
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +15 -8
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +17 -17
- package/dist/node/index.d.ts +17 -17
- package/dist/node/index.js +22 -13
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +23 -14
- package/dist/node/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/node/index.mjs
CHANGED
|
@@ -441,6 +441,7 @@ import { CanvasTexture, Texture as Texture2 } from "three";
|
|
|
441
441
|
|
|
442
442
|
// src/texture/TextureLoader.ts
|
|
443
443
|
import { RGBAFormat, Texture } from "three";
|
|
444
|
+
import * as THREE from "three";
|
|
444
445
|
|
|
445
446
|
// src/canvas/CanvasCompat.ts
|
|
446
447
|
function createImage(width, height) {
|
|
@@ -829,6 +830,7 @@ var TextureLoader = class {
|
|
|
829
830
|
}
|
|
830
831
|
static loadInBackground(src, format = RGBAFormat, rotation = 0) {
|
|
831
832
|
const texture = this.createTexture();
|
|
833
|
+
texture.colorSpace = THREE.SRGBColorSpace;
|
|
832
834
|
const image = ImageLoader.loadElement(src);
|
|
833
835
|
image.onload = function() {
|
|
834
836
|
texture.needsUpdate = true;
|
|
@@ -840,6 +842,7 @@ var TextureLoader = class {
|
|
|
840
842
|
}
|
|
841
843
|
static load(src, format = RGBAFormat, rotation = 0) {
|
|
842
844
|
const texture = new Texture();
|
|
845
|
+
texture.colorSpace = THREE.SRGBColorSpace;
|
|
843
846
|
ImageLoader.getData(src).then((image) => {
|
|
844
847
|
texture.needsUpdate = true;
|
|
845
848
|
texture.image = image;
|
|
@@ -851,11 +854,11 @@ var TextureLoader = class {
|
|
|
851
854
|
};
|
|
852
855
|
|
|
853
856
|
// src/texture/Textures.ts
|
|
854
|
-
import * as
|
|
857
|
+
import * as THREE2 from "three";
|
|
855
858
|
var Textures = class _Textures {
|
|
856
859
|
static initTextureProps(texture) {
|
|
857
|
-
texture.magFilter =
|
|
858
|
-
texture.minFilter =
|
|
860
|
+
texture.magFilter = THREE2.NearestFilter;
|
|
861
|
+
texture.minFilter = THREE2.NearestFilter;
|
|
859
862
|
texture.anisotropy = 0;
|
|
860
863
|
return texture;
|
|
861
864
|
}
|
|
@@ -866,7 +869,9 @@ var Textures = class _Textures {
|
|
|
866
869
|
return new Texture2();
|
|
867
870
|
}
|
|
868
871
|
static createCanvasTexture(canvas) {
|
|
869
|
-
|
|
872
|
+
const texture = new CanvasTexture(canvas);
|
|
873
|
+
texture.colorSpace = THREE2.SRGBColorSpace;
|
|
874
|
+
return this.initTextureProps(texture);
|
|
870
875
|
}
|
|
871
876
|
static getImage(key) {
|
|
872
877
|
const keyStr = serializeTextureKey(key);
|
|
@@ -983,6 +988,9 @@ var _Materials = class _Materials {
|
|
|
983
988
|
gl_FragColor = vec4(lift + color.rgb * light2, 1.0);
|
|
984
989
|
|
|
985
990
|
}
|
|
991
|
+
|
|
992
|
+
#include <tonemapping_fragment>
|
|
993
|
+
#include <colorspace_fragment>
|
|
986
994
|
}
|
|
987
995
|
`;
|
|
988
996
|
try {
|
|
@@ -2860,7 +2868,7 @@ function isSceneObject(obj) {
|
|
|
2860
2868
|
// src/entity/scene/EntityObject.ts
|
|
2861
2869
|
var import_ts_deepmerge5 = __toESM(require_dist());
|
|
2862
2870
|
import { Object3D as Object3D3 } from "three";
|
|
2863
|
-
import * as
|
|
2871
|
+
import * as THREE3 from "three";
|
|
2864
2872
|
var EntityObject = class extends SceneObject {
|
|
2865
2873
|
constructor(entity, options) {
|
|
2866
2874
|
super();
|
|
@@ -2905,8 +2913,8 @@ var EntityObject = class extends SceneObject {
|
|
|
2905
2913
|
const l = cube.maxZ - cube.minZ;
|
|
2906
2914
|
const uv = texture.toUvArray(w, h, l);
|
|
2907
2915
|
const cubeGeo = this._getBoxGeometryForDimensionsAndUv(w, h, l, uv).clone();
|
|
2908
|
-
cubeGeo.applyMatrix4(new
|
|
2909
|
-
cubeGeo.applyMatrix4(new
|
|
2916
|
+
cubeGeo.applyMatrix4(new THREE3.Matrix4().makeTranslation(w / 2, h / 2, l / 2));
|
|
2917
|
+
cubeGeo.applyMatrix4(new THREE3.Matrix4().makeTranslation(cube.minX, cube.minY, cube.minZ));
|
|
2910
2918
|
applyModelPartRotation(part, cubeGeo);
|
|
2911
2919
|
const mesh = this.createMesh(partName, cubeGeo, mat);
|
|
2912
2920
|
partAnchor.add(mesh);
|
|
@@ -5370,7 +5378,7 @@ function isMineRenderScene(obj) {
|
|
|
5370
5378
|
}
|
|
5371
5379
|
|
|
5372
5380
|
// src/renderer/Renderer.ts
|
|
5373
|
-
import { AxesHelper as AxesHelper3, GridHelper,
|
|
5381
|
+
import { AxesHelper as AxesHelper3, GridHelper, OrthographicCamera, PCFSoftShadowMap, PerspectiveCamera, SRGBColorSpace as SRGBColorSpace3, Vector3 as Vector38, WebGLRenderer } from "three";
|
|
5374
5382
|
var import_ts_deepmerge10 = __toESM(require_dist());
|
|
5375
5383
|
import Stats from "stats.js";
|
|
5376
5384
|
import { EffectComposer, RenderPass } from "postprocessing";
|
|
@@ -6085,13 +6093,13 @@ var _Renderer = class _Renderer {
|
|
|
6085
6093
|
renderer.setClearColor(0, 0);
|
|
6086
6094
|
renderer.shadowMap.enabled = true;
|
|
6087
6095
|
renderer.shadowMap.type = PCFSoftShadowMap;
|
|
6088
|
-
renderer.
|
|
6096
|
+
renderer.outputColorSpace = SRGBColorSpace3;
|
|
6089
6097
|
renderer.setSize(this.viewWidth, this.viewHeight);
|
|
6090
6098
|
return renderer;
|
|
6091
6099
|
}
|
|
6092
6100
|
createComposer() {
|
|
6101
|
+
if (!this.options.composer.enabled) return void 0;
|
|
6093
6102
|
const composer = new EffectComposer(this.renderer);
|
|
6094
|
-
if (!this.options.composer.enabled) return composer;
|
|
6095
6103
|
composer.setSize(this.viewWidth, this.viewHeight);
|
|
6096
6104
|
composer.addPass(new RenderPass(this.scene, this.camera));
|
|
6097
6105
|
return composer;
|
|
@@ -6189,6 +6197,7 @@ var _Renderer = class _Renderer {
|
|
|
6189
6197
|
dispatcher.addEventListener(changeEvent2, this._changeListener);
|
|
6190
6198
|
}
|
|
6191
6199
|
resize(width, height) {
|
|
6200
|
+
var _a;
|
|
6192
6201
|
if (this._disposed) return;
|
|
6193
6202
|
if (isPerspectiveCamera(this.camera)) {
|
|
6194
6203
|
this.camera.aspect = width / height;
|
|
@@ -6201,7 +6210,7 @@ var _Renderer = class _Renderer {
|
|
|
6201
6210
|
this.camera.updateProjectionMatrix();
|
|
6202
6211
|
}
|
|
6203
6212
|
this.renderer.setSize(width, height);
|
|
6204
|
-
this.composer.setSize(width, height);
|
|
6213
|
+
(_a = this.composer) == null ? void 0 : _a.setSize(width, height);
|
|
6205
6214
|
this._dirty = true;
|
|
6206
6215
|
}
|
|
6207
6216
|
//<editor-fold desc="RENDER">
|
|
@@ -6228,7 +6237,7 @@ var _Renderer = class _Renderer {
|
|
|
6228
6237
|
* controls must be managed by their owners.
|
|
6229
6238
|
*/
|
|
6230
6239
|
dispose() {
|
|
6231
|
-
var _a;
|
|
6240
|
+
var _a, _b;
|
|
6232
6241
|
if (this._disposed) return;
|
|
6233
6242
|
this.stop();
|
|
6234
6243
|
this._disposed = true;
|
|
@@ -6261,7 +6270,7 @@ var _Renderer = class _Renderer {
|
|
|
6261
6270
|
}
|
|
6262
6271
|
}
|
|
6263
6272
|
this._debugHelpers.length = 0;
|
|
6264
|
-
this.composer.dispose();
|
|
6273
|
+
(_b = this.composer) == null ? void 0 : _b.dispose();
|
|
6265
6274
|
this.renderer.dispose();
|
|
6266
6275
|
this.renderer.forceContextLoss();
|
|
6267
6276
|
}
|
|
@@ -6282,7 +6291,7 @@ var _Renderer = class _Renderer {
|
|
|
6282
6291
|
if (this._stats) {
|
|
6283
6292
|
this._stats.begin();
|
|
6284
6293
|
}
|
|
6285
|
-
if (this.options.composer.enabled) {
|
|
6294
|
+
if (this.options.composer.enabled && this.composer) {
|
|
6286
6295
|
this.composer.render();
|
|
6287
6296
|
} else {
|
|
6288
6297
|
this.renderer.render(this.scene, this.camera);
|