@xviewer.js/core 1.0.0-alpha.47 → 1.0.0-alpha.48
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/main.js +39 -19
- package/dist/main.js.map +1 -1
- package/dist/module.js +39 -19
- package/dist/module.js.map +1 -1
- package/package.json +1 -1
- package/types/Viewer.d.ts +2 -0
- package/types/passes/cubeuv/MergeInfo.d.ts +1 -1
- package/types/passes/cubeuv/utils.d.ts +4 -3
- package/types/plugins/EnvironmentPlugin.d.ts +7 -4
package/dist/main.js
CHANGED
|
@@ -3604,10 +3604,11 @@ const _axisDirections = [
|
|
|
3604
3604
|
/*@__PURE__*/ new three.Vector3(PHI, INV_PHI, 0),
|
|
3605
3605
|
/*@__PURE__*/ new three.Vector3(-PHI, INV_PHI, 0)
|
|
3606
3606
|
];
|
|
3607
|
-
const
|
|
3608
|
-
|
|
3607
|
+
const _Quality = {
|
|
3608
|
+
LOW: 0,
|
|
3609
3609
|
MEDIUM: 1,
|
|
3610
|
-
|
|
3610
|
+
HIGH: 2,
|
|
3611
|
+
ULTRA: 3
|
|
3611
3612
|
};
|
|
3612
3613
|
function _setViewport(target, x, y, width, height) {
|
|
3613
3614
|
target.viewport.set(x, y, width, height);
|
|
@@ -4604,6 +4605,12 @@ class Viewer extends EventEmitter {
|
|
|
4604
4605
|
get input() {
|
|
4605
4606
|
return this._input;
|
|
4606
4607
|
}
|
|
4608
|
+
get targetFrameRate() {
|
|
4609
|
+
return this._targetFrameRate;
|
|
4610
|
+
}
|
|
4611
|
+
set targetFrameRate(v) {
|
|
4612
|
+
this._targetFrameRate = Math.max(1, v);
|
|
4613
|
+
}
|
|
4607
4614
|
destroy() {
|
|
4608
4615
|
this._renderer.dispose();
|
|
4609
4616
|
this._taskManager.destroy();
|
|
@@ -5005,7 +5012,7 @@ class MergeRefectPass {
|
|
|
5005
5012
|
}
|
|
5006
5013
|
mergeReflect(info) {
|
|
5007
5014
|
this._pmremGenerator._copyTexture(this._envMapTarget, this._sourceTarget.texture, info.envMapIntensity);
|
|
5008
|
-
this._pmremGenerator._mergeReflect(this._envMapTarget, this._reflectMap, info.
|
|
5015
|
+
this._pmremGenerator._mergeReflect(this._envMapTarget, this._reflectMap, info.quality);
|
|
5009
5016
|
info.envMapTarget = this._envMapTarget;
|
|
5010
5017
|
info.lodMax = this._pmremGenerator._lodMeshes.length - 1;
|
|
5011
5018
|
}
|
|
@@ -5039,19 +5046,19 @@ class MergeRefectPass {
|
|
|
5039
5046
|
pmremGenerator._clearTexture = function(targetOut, intensity) {
|
|
5040
5047
|
this._copyTexture(targetOut, this._sourceTarget.texture, intensity);
|
|
5041
5048
|
};
|
|
5042
|
-
pmremGenerator._mergeReflect = function(sourceTarget, reflectMap,
|
|
5049
|
+
pmremGenerator._mergeReflect = function(sourceTarget, reflectMap, quality) {
|
|
5043
5050
|
const renderer = this._renderer;
|
|
5044
5051
|
const autoClear = renderer.autoClear;
|
|
5045
5052
|
const cubeMapMaterial = this._cubeMapMaterial;
|
|
5046
5053
|
const uniforms = this._cubeMapMaterial.uniforms;
|
|
5047
5054
|
uniforms.envMap.value = reflectMap;
|
|
5048
5055
|
renderer.autoClear = false;
|
|
5049
|
-
if (
|
|
5056
|
+
if (quality === _Quality.HIGH) {
|
|
5050
5057
|
for(let i = 0; i < this._lodMeshes.length - 1; i++){
|
|
5051
5058
|
uniforms.lod.value = i < 5 ? 0 : i;
|
|
5052
5059
|
this._blit(sourceTarget, i, cubeMapMaterial);
|
|
5053
5060
|
}
|
|
5054
|
-
} else if (
|
|
5061
|
+
} else if (quality === _Quality.MEDIUM) {
|
|
5055
5062
|
for(let i = 0; i < this._lodMeshes.length; i++){
|
|
5056
5063
|
if (i < 4) {
|
|
5057
5064
|
uniforms.lod.value = 0;
|
|
@@ -5060,7 +5067,7 @@ class MergeRefectPass {
|
|
|
5060
5067
|
this._pmremblur(sourceTarget, i - 1, i);
|
|
5061
5068
|
}
|
|
5062
5069
|
}
|
|
5063
|
-
} else {
|
|
5070
|
+
} else if (quality === _Quality.ULTRA) {
|
|
5064
5071
|
uniforms.lod.value = 0;
|
|
5065
5072
|
this._blit(sourceTarget, 0, cubeMapMaterial);
|
|
5066
5073
|
for(let i = 1; i < this._lodMeshes.length; i++){
|
|
@@ -5246,11 +5253,18 @@ class EnvironmentPlugin extends Plugin {
|
|
|
5246
5253
|
}
|
|
5247
5254
|
}
|
|
5248
5255
|
onRender(dt) {
|
|
5249
|
-
if (this.
|
|
5250
|
-
this._elapsed
|
|
5256
|
+
if (!this.manual) {
|
|
5257
|
+
if (this._elapsed >= this.interval || this._elapsed === 0) {
|
|
5258
|
+
this._elapsed = 0;
|
|
5259
|
+
this._renderFrame();
|
|
5260
|
+
}
|
|
5261
|
+
this._elapsed += dt;
|
|
5262
|
+
}
|
|
5263
|
+
}
|
|
5264
|
+
manualFrame() {
|
|
5265
|
+
if (this.manual) {
|
|
5251
5266
|
this._renderFrame();
|
|
5252
5267
|
}
|
|
5253
|
-
this._elapsed += dt;
|
|
5254
5268
|
}
|
|
5255
5269
|
_renderFrame() {
|
|
5256
5270
|
const { renderer } = this.viewer;
|
|
@@ -5259,13 +5273,15 @@ class EnvironmentPlugin extends Plugin {
|
|
|
5259
5273
|
const oldActiveCubeFace = renderer.getActiveCubeFace();
|
|
5260
5274
|
const oldActiveMipmapLevel = renderer.getActiveMipmapLevel();
|
|
5261
5275
|
renderer.autoClear = true;
|
|
5262
|
-
this.
|
|
5263
|
-
this._mergeInfo.performance = this.performance;
|
|
5276
|
+
this._mergeInfo.quality = this.quality;
|
|
5264
5277
|
this._mergeInfo.exposure = this.reflectExposure;
|
|
5265
5278
|
this._mergeInfo.envMapIntensity = this.envMapIntensity;
|
|
5266
5279
|
this._mergeInfo.blurIntensity = this.reflectBlurIntensity;
|
|
5280
|
+
if (this.quality !== _Quality.LOW) {
|
|
5281
|
+
this._cubeCamera.update(renderer, this._scene);
|
|
5282
|
+
}
|
|
5267
5283
|
this._reflectPass.mergeReflect(this._mergeInfo);
|
|
5268
|
-
if (this.
|
|
5284
|
+
if (this.quality === _Quality.HIGH) {
|
|
5269
5285
|
if (this._mipBlurPass === undefined) {
|
|
5270
5286
|
this._mipBlurPass = new MergeMipBlurPass({
|
|
5271
5287
|
viewer: this.viewer,
|
|
@@ -5280,7 +5296,7 @@ class EnvironmentPlugin extends Plugin {
|
|
|
5280
5296
|
constructor({ envMap, scene, near, far, layer = 0, resolution = 256, floatType = three.HalfFloatType, position = new three.Vector3(0, 1, 0) } = {}){
|
|
5281
5297
|
super();
|
|
5282
5298
|
this._mergeInfo = {
|
|
5283
|
-
|
|
5299
|
+
quality: _Quality.HIGH,
|
|
5284
5300
|
envMapTarget: null,
|
|
5285
5301
|
envMapIntensity: 1,
|
|
5286
5302
|
blurIntensity: 1,
|
|
@@ -5290,11 +5306,12 @@ class EnvironmentPlugin extends Plugin {
|
|
|
5290
5306
|
this._debug = false;
|
|
5291
5307
|
this._debugNode = null;
|
|
5292
5308
|
this._elapsed = 0;
|
|
5293
|
-
this.
|
|
5309
|
+
this.quality = _Quality.HIGH;
|
|
5294
5310
|
this.envMapIntensity = 1;
|
|
5295
5311
|
this.reflectExposure = 1;
|
|
5296
5312
|
this.reflectBlurIntensity = 5;
|
|
5297
5313
|
this.interval = 0;
|
|
5314
|
+
this.manual = false;
|
|
5298
5315
|
this.install = ()=>{
|
|
5299
5316
|
const viewer = this.viewer;
|
|
5300
5317
|
this._scene = scene || viewer.scene;
|
|
@@ -5317,15 +5334,15 @@ class EnvironmentPlugin extends Plugin {
|
|
|
5317
5334
|
};
|
|
5318
5335
|
}
|
|
5319
5336
|
}
|
|
5320
|
-
EnvironmentPlugin.
|
|
5337
|
+
EnvironmentPlugin.Quality = _Quality;
|
|
5321
5338
|
__decorate([
|
|
5322
5339
|
property
|
|
5323
5340
|
], EnvironmentPlugin.prototype, "debug", null);
|
|
5324
5341
|
__decorate([
|
|
5325
5342
|
property({
|
|
5326
|
-
value:
|
|
5343
|
+
value: _Quality
|
|
5327
5344
|
})
|
|
5328
|
-
], EnvironmentPlugin.prototype, "
|
|
5345
|
+
], EnvironmentPlugin.prototype, "quality", void 0);
|
|
5329
5346
|
__decorate([
|
|
5330
5347
|
property({
|
|
5331
5348
|
min: 0,
|
|
@@ -5350,6 +5367,9 @@ __decorate([
|
|
|
5350
5367
|
__decorate([
|
|
5351
5368
|
property
|
|
5352
5369
|
], EnvironmentPlugin.prototype, "interval", void 0);
|
|
5370
|
+
__decorate([
|
|
5371
|
+
property
|
|
5372
|
+
], EnvironmentPlugin.prototype, "manual", void 0);
|
|
5353
5373
|
|
|
5354
5374
|
class BoxProjectionPlugin extends Plugin {
|
|
5355
5375
|
get debug() {
|