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