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/browser/index.mjs
CHANGED
|
@@ -477,6 +477,7 @@ import { CanvasTexture, Texture as Texture2 } from "three";
|
|
|
477
477
|
|
|
478
478
|
// src/texture/TextureLoader.ts
|
|
479
479
|
import { RGBAFormat, Texture } from "three";
|
|
480
|
+
import * as THREE from "three";
|
|
480
481
|
|
|
481
482
|
// src/canvas/CanvasCompat.ts
|
|
482
483
|
function createImage(width, height) {
|
|
@@ -865,6 +866,7 @@ var TextureLoader = class {
|
|
|
865
866
|
}
|
|
866
867
|
static loadInBackground(src, format = RGBAFormat, rotation = 0) {
|
|
867
868
|
const texture = this.createTexture();
|
|
869
|
+
texture.colorSpace = THREE.SRGBColorSpace;
|
|
868
870
|
const image = ImageLoader.loadElement(src);
|
|
869
871
|
image.onload = function() {
|
|
870
872
|
texture.needsUpdate = true;
|
|
@@ -876,6 +878,7 @@ var TextureLoader = class {
|
|
|
876
878
|
}
|
|
877
879
|
static load(src, format = RGBAFormat, rotation = 0) {
|
|
878
880
|
const texture = new Texture();
|
|
881
|
+
texture.colorSpace = THREE.SRGBColorSpace;
|
|
879
882
|
ImageLoader.getData(src).then((image) => {
|
|
880
883
|
texture.needsUpdate = true;
|
|
881
884
|
texture.image = image;
|
|
@@ -887,11 +890,11 @@ var TextureLoader = class {
|
|
|
887
890
|
};
|
|
888
891
|
|
|
889
892
|
// src/texture/Textures.ts
|
|
890
|
-
import * as
|
|
893
|
+
import * as THREE2 from "three";
|
|
891
894
|
var Textures = class _Textures {
|
|
892
895
|
static initTextureProps(texture) {
|
|
893
|
-
texture.magFilter =
|
|
894
|
-
texture.minFilter =
|
|
896
|
+
texture.magFilter = THREE2.NearestFilter;
|
|
897
|
+
texture.minFilter = THREE2.NearestFilter;
|
|
895
898
|
texture.anisotropy = 0;
|
|
896
899
|
return texture;
|
|
897
900
|
}
|
|
@@ -902,7 +905,9 @@ var Textures = class _Textures {
|
|
|
902
905
|
return new Texture2();
|
|
903
906
|
}
|
|
904
907
|
static createCanvasTexture(canvas) {
|
|
905
|
-
|
|
908
|
+
const texture = new CanvasTexture(canvas);
|
|
909
|
+
texture.colorSpace = THREE2.SRGBColorSpace;
|
|
910
|
+
return this.initTextureProps(texture);
|
|
906
911
|
}
|
|
907
912
|
static getImage(key) {
|
|
908
913
|
const keyStr = serializeTextureKey(key);
|
|
@@ -1019,6 +1024,9 @@ var _Materials = class _Materials {
|
|
|
1019
1024
|
gl_FragColor = vec4(lift + color.rgb * light2, 1.0);
|
|
1020
1025
|
|
|
1021
1026
|
}
|
|
1027
|
+
|
|
1028
|
+
#include <tonemapping_fragment>
|
|
1029
|
+
#include <colorspace_fragment>
|
|
1022
1030
|
}
|
|
1023
1031
|
`;
|
|
1024
1032
|
try {
|
|
@@ -2893,7 +2901,7 @@ function isSceneObject(obj) {
|
|
|
2893
2901
|
// src/entity/scene/EntityObject.ts
|
|
2894
2902
|
var import_ts_deepmerge5 = __toESM(require_dist());
|
|
2895
2903
|
import { Object3D as Object3D3 } from "three";
|
|
2896
|
-
import * as
|
|
2904
|
+
import * as THREE3 from "three";
|
|
2897
2905
|
var EntityObject = class extends SceneObject {
|
|
2898
2906
|
constructor(entity, options) {
|
|
2899
2907
|
super();
|
|
@@ -2937,8 +2945,8 @@ var EntityObject = class extends SceneObject {
|
|
|
2937
2945
|
const l = cube.maxZ - cube.minZ;
|
|
2938
2946
|
const uv = texture.toUvArray(w, h, l);
|
|
2939
2947
|
const cubeGeo = this._getBoxGeometryForDimensionsAndUv(w, h, l, uv).clone();
|
|
2940
|
-
cubeGeo.applyMatrix4(new
|
|
2941
|
-
cubeGeo.applyMatrix4(new
|
|
2948
|
+
cubeGeo.applyMatrix4(new THREE3.Matrix4().makeTranslation(w / 2, h / 2, l / 2));
|
|
2949
|
+
cubeGeo.applyMatrix4(new THREE3.Matrix4().makeTranslation(cube.minX, cube.minY, cube.minZ));
|
|
2942
2950
|
applyModelPartRotation(part, cubeGeo);
|
|
2943
2951
|
const mesh = this.createMesh(partName, cubeGeo, mat);
|
|
2944
2952
|
partAnchor.add(mesh);
|
|
@@ -5395,7 +5403,7 @@ function isMineRenderScene(obj) {
|
|
|
5395
5403
|
}
|
|
5396
5404
|
|
|
5397
5405
|
// src/renderer/Renderer.ts
|
|
5398
|
-
import { AxesHelper as AxesHelper3, GridHelper,
|
|
5406
|
+
import { AxesHelper as AxesHelper3, GridHelper, OrthographicCamera, PCFSoftShadowMap, PerspectiveCamera, SRGBColorSpace as SRGBColorSpace3, Vector3 as Vector38, WebGLRenderer } from "three";
|
|
5399
5407
|
var import_ts_deepmerge10 = __toESM(require_dist());
|
|
5400
5408
|
import Stats from "stats.js";
|
|
5401
5409
|
import { EffectComposer, RenderPass } from "postprocessing";
|
|
@@ -6110,13 +6118,13 @@ var _Renderer = class _Renderer {
|
|
|
6110
6118
|
renderer.setClearColor(0, 0);
|
|
6111
6119
|
renderer.shadowMap.enabled = true;
|
|
6112
6120
|
renderer.shadowMap.type = PCFSoftShadowMap;
|
|
6113
|
-
renderer.
|
|
6121
|
+
renderer.outputColorSpace = SRGBColorSpace3;
|
|
6114
6122
|
renderer.setSize(this.viewWidth, this.viewHeight);
|
|
6115
6123
|
return renderer;
|
|
6116
6124
|
}
|
|
6117
6125
|
createComposer() {
|
|
6126
|
+
if (!this.options.composer.enabled) return void 0;
|
|
6118
6127
|
const composer = new EffectComposer(this.renderer);
|
|
6119
|
-
if (!this.options.composer.enabled) return composer;
|
|
6120
6128
|
composer.setSize(this.viewWidth, this.viewHeight);
|
|
6121
6129
|
composer.addPass(new RenderPass(this.scene, this.camera));
|
|
6122
6130
|
return composer;
|
|
@@ -6225,7 +6233,7 @@ var _Renderer = class _Renderer {
|
|
|
6225
6233
|
this.camera.updateProjectionMatrix();
|
|
6226
6234
|
}
|
|
6227
6235
|
this.renderer.setSize(width, height);
|
|
6228
|
-
this.composer
|
|
6236
|
+
this.composer?.setSize(width, height);
|
|
6229
6237
|
this._dirty = true;
|
|
6230
6238
|
}
|
|
6231
6239
|
//<editor-fold desc="RENDER">
|
|
@@ -6284,7 +6292,7 @@ var _Renderer = class _Renderer {
|
|
|
6284
6292
|
}
|
|
6285
6293
|
}
|
|
6286
6294
|
this._debugHelpers.length = 0;
|
|
6287
|
-
this.composer
|
|
6295
|
+
this.composer?.dispose();
|
|
6288
6296
|
this.renderer.dispose();
|
|
6289
6297
|
this.renderer.forceContextLoss();
|
|
6290
6298
|
}
|
|
@@ -6304,7 +6312,7 @@ var _Renderer = class _Renderer {
|
|
|
6304
6312
|
if (this._stats) {
|
|
6305
6313
|
this._stats.begin();
|
|
6306
6314
|
}
|
|
6307
|
-
if (this.options.composer.enabled) {
|
|
6315
|
+
if (this.options.composer.enabled && this.composer) {
|
|
6308
6316
|
this.composer.render();
|
|
6309
6317
|
} else {
|
|
6310
6318
|
this.renderer.render(this.scene, this.camera);
|