lythreeframe 1.2.17 → 1.2.18
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/bundle.cjs.js +79 -89
- package/dist/bundle.esm.js +81 -89
- package/dist/index.d.ts +2 -2
- package/dist/lythreeframe/Frame/Viewport.d.ts +12 -14
- package/dist/lythreeframe/PostProcess/Param/AAParam.d.ts +5 -0
- package/dist/lythreeframe/PostProcess/Param/Bloom.d.ts +1 -0
- package/dist/lythreeframe/PostProcess/Param/DOF.d.ts +1 -0
- package/dist/lythreeframe/PostProcess/Param/GTAO.d.ts +1 -0
- package/dist/lythreeframe/PostProcess/Param/Outline.d.ts +2 -8
- package/dist/lythreeframe/PostProcess/Param/SSR.d.ts +1 -0
- package/dist/lythreeframe/PostProcess/PostProcessParam.d.ts +7 -8
- package/package.json +1 -1
- package/dist/lythreeframe/PostProcess/Param/ToneMapping.d.ts +0 -9
package/dist/bundle.cjs.js
CHANGED
|
@@ -1263,11 +1263,67 @@ class Delegate {
|
|
|
1263
1263
|
}
|
|
1264
1264
|
}
|
|
1265
1265
|
|
|
1266
|
+
const DefaultSSRParam = {
|
|
1267
|
+
isEnabled: false,
|
|
1268
|
+
maxDistance: 0.5,
|
|
1269
|
+
opacity: 1,
|
|
1270
|
+
thickness: 0.015,
|
|
1271
|
+
};
|
|
1272
|
+
|
|
1273
|
+
const DefaultDenoiseParam = {
|
|
1274
|
+
denoiseRadius: 5,
|
|
1275
|
+
lumaPhi: 5,
|
|
1276
|
+
depthPhi: 5,
|
|
1277
|
+
normalPhi: 5
|
|
1278
|
+
};
|
|
1279
|
+
|
|
1280
|
+
const DefaultGTAOParam = {
|
|
1281
|
+
isEnabled: false,
|
|
1282
|
+
distanceExponent: 1,
|
|
1283
|
+
distanceFallOff: 1,
|
|
1284
|
+
radius: 0.25,
|
|
1285
|
+
scale: 1,
|
|
1286
|
+
thickness: 1,
|
|
1287
|
+
denoised: true,
|
|
1288
|
+
denoiseParam: DefaultDenoiseParam,
|
|
1289
|
+
};
|
|
1290
|
+
|
|
1291
|
+
const DefaultBloomParam = {
|
|
1292
|
+
isEnabled: false,
|
|
1293
|
+
threshold: 0,
|
|
1294
|
+
strength: 1,
|
|
1295
|
+
radius: 0,
|
|
1296
|
+
};
|
|
1297
|
+
|
|
1298
|
+
const DefaultDOFParam = {
|
|
1299
|
+
isEnabled: false,
|
|
1300
|
+
focus: 500.0,
|
|
1301
|
+
aperture: 5,
|
|
1302
|
+
maxblur: 0.01
|
|
1303
|
+
};
|
|
1304
|
+
|
|
1305
|
+
const DefaultOutlineParams = {
|
|
1306
|
+
isEnabled: false,
|
|
1307
|
+
edgeStrength: 3.0,
|
|
1308
|
+
edgeGlow: 1.0,
|
|
1309
|
+
edgeThickness: 1.0,
|
|
1310
|
+
pulsePeriod: 0.0,
|
|
1311
|
+
visibleEdgeColor: 0xffffff,
|
|
1312
|
+
hiddenEdgeColor: 0xffffff,
|
|
1313
|
+
};
|
|
1314
|
+
|
|
1315
|
+
const DefaultAAParams = {
|
|
1316
|
+
isEnabled: false,
|
|
1317
|
+
type: "fxaa",
|
|
1318
|
+
};
|
|
1319
|
+
|
|
1266
1320
|
const DefaultPostProcessParam = {
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1321
|
+
bloom: DefaultBloomParam,
|
|
1322
|
+
dof: DefaultDOFParam,
|
|
1323
|
+
ssr: DefaultSSRParam,
|
|
1324
|
+
gtao: DefaultGTAOParam,
|
|
1325
|
+
outline: DefaultOutlineParams,
|
|
1326
|
+
aa: DefaultAAParams
|
|
1271
1327
|
};
|
|
1272
1328
|
|
|
1273
1329
|
class World {
|
|
@@ -1335,20 +1391,6 @@ class World {
|
|
|
1335
1391
|
}
|
|
1336
1392
|
}
|
|
1337
1393
|
|
|
1338
|
-
const DefaultToneMappingParams = {
|
|
1339
|
-
exposure: 1.0,
|
|
1340
|
-
toneMapping: 'AgX',
|
|
1341
|
-
};
|
|
1342
|
-
const ToneMappingOptions = new Map([
|
|
1343
|
-
["None", webgpu.NoToneMapping],
|
|
1344
|
-
["Linear", webgpu.LinearToneMapping],
|
|
1345
|
-
["Reinhard", webgpu.ReinhardToneMapping],
|
|
1346
|
-
["Cineon", webgpu.CineonToneMapping],
|
|
1347
|
-
["ACESFilmic", webgpu.ACESFilmicToneMapping],
|
|
1348
|
-
["AgX", webgpu.AgXToneMapping],
|
|
1349
|
-
["Neutral", webgpu.NeutralToneMapping]
|
|
1350
|
-
]);
|
|
1351
|
-
|
|
1352
1394
|
class WebGPUPostProcessFactory {
|
|
1353
1395
|
// scene pass
|
|
1354
1396
|
static constructScenePass(scene, camera) {
|
|
@@ -1497,15 +1539,6 @@ class WebGPUPostProcessFactory {
|
|
|
1497
1539
|
}
|
|
1498
1540
|
}
|
|
1499
1541
|
|
|
1500
|
-
const DefaultOutlineParams = {
|
|
1501
|
-
edgeStrength: 3.0,
|
|
1502
|
-
edgeGlow: 1.0,
|
|
1503
|
-
edgeThickness: 1.0,
|
|
1504
|
-
pulsePeriod: 0.0,
|
|
1505
|
-
visibleEdgeColor: 0xffffff,
|
|
1506
|
-
hiddenEdgeColor: 0xffffff,
|
|
1507
|
-
};
|
|
1508
|
-
|
|
1509
1542
|
class Viewport {
|
|
1510
1543
|
get canvas() {
|
|
1511
1544
|
return this._canvas;
|
|
@@ -1522,26 +1555,25 @@ class Viewport {
|
|
|
1522
1555
|
}
|
|
1523
1556
|
return this._app;
|
|
1524
1557
|
}
|
|
1525
|
-
constructor(app, viewportParam, rendererParam, postProcessParam
|
|
1558
|
+
constructor(app, viewportParam, rendererParam, postProcessParam) {
|
|
1526
1559
|
this._renderer = null;
|
|
1527
1560
|
this.labelRenderer = null;
|
|
1528
1561
|
this._app = null;
|
|
1529
1562
|
this.resizeObserver = null;
|
|
1530
1563
|
this._canvas = null;
|
|
1531
1564
|
this.isRenderStateDirty = true;
|
|
1532
|
-
this.postProcessParam = {};
|
|
1533
1565
|
this.postProcessing = null;
|
|
1534
1566
|
this.scenePass = null;
|
|
1535
1567
|
this.bloomPass = null;
|
|
1536
1568
|
this.dofPass = null;
|
|
1537
1569
|
this.GTAOPass = null;
|
|
1538
1570
|
this.denoiseGTAOPass = null;
|
|
1539
|
-
// private denoiseOutlinePass: ShaderNodeObject<DenoiseNode> | null = null;
|
|
1540
1571
|
this.ssrPass = null;
|
|
1541
1572
|
this.outlinePass = null;
|
|
1542
|
-
// private motionBlurPass: ShaderNodeObject<Node> | null = null;
|
|
1543
1573
|
this.fxaaPass = null;
|
|
1544
1574
|
this.smaaPass = null;
|
|
1575
|
+
// private motionBlurPass: ShaderNodeObject<Node> | null = null;
|
|
1576
|
+
// private denoiseOutlinePass: ShaderNodeObject<DenoiseNode> | null = null;
|
|
1545
1577
|
this.outlineObjects = [];
|
|
1546
1578
|
this.postProcessParam = postProcessParam;
|
|
1547
1579
|
this._app = app;
|
|
@@ -1603,14 +1635,14 @@ class Viewport {
|
|
|
1603
1635
|
this.setupPostProcess();
|
|
1604
1636
|
}
|
|
1605
1637
|
setupPostProcess() {
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
if (!(
|
|
1638
|
+
// 检查各个效果是否启用
|
|
1639
|
+
const isBloomEnabled = this.postProcessParam.bloom.isEnabled;
|
|
1640
|
+
const isDOFEnabled = this.postProcessParam.dof.isEnabled;
|
|
1641
|
+
const isSSREnabled = this.postProcessParam.ssr.isEnabled;
|
|
1642
|
+
const isGTAOEnabled = this.postProcessParam.gtao.isEnabled;
|
|
1643
|
+
const isOutlineEnabled = this.postProcessParam.outline.isEnabled;
|
|
1644
|
+
const isAAEnabled = this.postProcessParam.aa.isEnabled;
|
|
1645
|
+
if (!(isBloomEnabled) && !(isDOFEnabled) && !(isSSREnabled) && !(isGTAOEnabled) && !(isOutlineEnabled) && !(isAAEnabled)) {
|
|
1614
1646
|
this.destroyPostProcess();
|
|
1615
1647
|
return;
|
|
1616
1648
|
}
|
|
@@ -1622,7 +1654,7 @@ class Viewport {
|
|
|
1622
1654
|
}
|
|
1623
1655
|
let finalNode = this.scenePass.getTextureNode('output');
|
|
1624
1656
|
// bloom
|
|
1625
|
-
if (
|
|
1657
|
+
if (isBloomEnabled) {
|
|
1626
1658
|
if (!this.bloomPass) {
|
|
1627
1659
|
this.bloomPass = WebGPUPostProcessFactory.constructBloomPass(this.scenePass, this.postProcessParam.bloom);
|
|
1628
1660
|
}
|
|
@@ -1638,7 +1670,7 @@ class Viewport {
|
|
|
1638
1670
|
}
|
|
1639
1671
|
}
|
|
1640
1672
|
// DOF
|
|
1641
|
-
if (
|
|
1673
|
+
if (isDOFEnabled) {
|
|
1642
1674
|
if (!this.dofPass) {
|
|
1643
1675
|
this.dofPass = WebGPUPostProcessFactory.constructDOFPass(this.scenePass, this.postProcessParam.dof);
|
|
1644
1676
|
}
|
|
@@ -1672,7 +1704,7 @@ class Viewport {
|
|
|
1672
1704
|
// }
|
|
1673
1705
|
// }
|
|
1674
1706
|
// ssr
|
|
1675
|
-
if (
|
|
1707
|
+
if (isSSREnabled) {
|
|
1676
1708
|
if (!this.ssrPass) {
|
|
1677
1709
|
this.ssrPass = WebGPUPostProcessFactory.constructSSRPass(this.scenePass, this.postProcessParam.ssr);
|
|
1678
1710
|
}
|
|
@@ -1682,7 +1714,7 @@ class Viewport {
|
|
|
1682
1714
|
finalNode = tsl.blendColor(finalNode, this.ssrPass);
|
|
1683
1715
|
}
|
|
1684
1716
|
// GTAO
|
|
1685
|
-
if (
|
|
1717
|
+
if (isGTAOEnabled) {
|
|
1686
1718
|
if (!this.GTAOPass) {
|
|
1687
1719
|
this.GTAOPass = WebGPUPostProcessFactory.constructGTAOPass(this.scenePass, this.postProcessParam.gtao);
|
|
1688
1720
|
}
|
|
@@ -1717,7 +1749,7 @@ class Viewport {
|
|
|
1717
1749
|
}
|
|
1718
1750
|
}
|
|
1719
1751
|
// outline
|
|
1720
|
-
if (
|
|
1752
|
+
if (isOutlineEnabled) {
|
|
1721
1753
|
if (!this.outlinePass) {
|
|
1722
1754
|
this.outlinePass = WebGPUPostProcessFactory.constructOutlinePass(this.app.world.scene, this.scenePass.camera, this.outlineObjects, this.postProcessParam.outline);
|
|
1723
1755
|
}
|
|
@@ -1745,12 +1777,12 @@ class Viewport {
|
|
|
1745
1777
|
this.outlinePass = null;
|
|
1746
1778
|
}
|
|
1747
1779
|
}
|
|
1748
|
-
if (
|
|
1749
|
-
if (this.postProcessParam.aa === "fxaa") {
|
|
1780
|
+
if (isAAEnabled) {
|
|
1781
|
+
if (this.postProcessParam.aa.type === "fxaa") {
|
|
1750
1782
|
this.fxaaPass = WebGPUPostProcessFactory.constructFXAAPass(finalNode);
|
|
1751
1783
|
finalNode = this.fxaaPass;
|
|
1752
1784
|
}
|
|
1753
|
-
if (this.postProcessParam.aa === "smaa") {
|
|
1785
|
+
if (this.postProcessParam.aa.type === "smaa") {
|
|
1754
1786
|
this.smaaPass = WebGPUPostProcessFactory.constructSMAAPass(finalNode);
|
|
1755
1787
|
finalNode = this.smaaPass;
|
|
1756
1788
|
}
|
|
@@ -1768,11 +1800,6 @@ class Viewport {
|
|
|
1768
1800
|
this.postProcessing.outputNode = finalNode;
|
|
1769
1801
|
this.markRenderStateDirty();
|
|
1770
1802
|
}
|
|
1771
|
-
updateToneMappingParam(params) {
|
|
1772
|
-
this.postProcessParam.toneMapping = params;
|
|
1773
|
-
this.setupPostProcess();
|
|
1774
|
-
this.markRenderStateDirty();
|
|
1775
|
-
}
|
|
1776
1803
|
updateBloomPass(params) {
|
|
1777
1804
|
this.postProcessParam.bloom = params;
|
|
1778
1805
|
this.setupPostProcess();
|
|
@@ -3197,41 +3224,6 @@ class LabelComponent extends SceneComponent {
|
|
|
3197
3224
|
// labelStyle.style.fontSize = "10px";
|
|
3198
3225
|
// labelStyle.style.pointerEvents = 'auto';
|
|
3199
3226
|
|
|
3200
|
-
const DefaultBloomParam = {
|
|
3201
|
-
threshold: 0,
|
|
3202
|
-
strength: 1,
|
|
3203
|
-
radius: 0,
|
|
3204
|
-
};
|
|
3205
|
-
|
|
3206
|
-
const DefaultDenoiseParam = {
|
|
3207
|
-
denoiseRadius: 5,
|
|
3208
|
-
lumaPhi: 5,
|
|
3209
|
-
depthPhi: 5,
|
|
3210
|
-
normalPhi: 5
|
|
3211
|
-
};
|
|
3212
|
-
|
|
3213
|
-
const DefaultDOFParam = {
|
|
3214
|
-
focus: 500.0,
|
|
3215
|
-
aperture: 5,
|
|
3216
|
-
maxblur: 0.01
|
|
3217
|
-
};
|
|
3218
|
-
|
|
3219
|
-
const DefaultGTAOParam = {
|
|
3220
|
-
distanceExponent: 1,
|
|
3221
|
-
distanceFallOff: 1,
|
|
3222
|
-
radius: 0.25,
|
|
3223
|
-
scale: 1,
|
|
3224
|
-
thickness: 1,
|
|
3225
|
-
denoised: true,
|
|
3226
|
-
denoiseParam: DefaultDenoiseParam,
|
|
3227
|
-
};
|
|
3228
|
-
|
|
3229
|
-
const DefaultSSRParam = {
|
|
3230
|
-
maxDistance: 0.5,
|
|
3231
|
-
opacity: 1,
|
|
3232
|
-
thickness: 0.015,
|
|
3233
|
-
};
|
|
3234
|
-
|
|
3235
3227
|
class FirstPerson extends Pawn {
|
|
3236
3228
|
constructor(controller) {
|
|
3237
3229
|
super(controller);
|
|
@@ -3453,7 +3445,6 @@ exports.DefaultPostProcessParam = DefaultPostProcessParam;
|
|
|
3453
3445
|
exports.DefaultRendererParameters = DefaultRendererParameters;
|
|
3454
3446
|
exports.DefaultSSRParam = DefaultSSRParam;
|
|
3455
3447
|
exports.DefaultSkyParam = DefaultSkyParam;
|
|
3456
|
-
exports.DefaultToneMappingParams = DefaultToneMappingParams;
|
|
3457
3448
|
exports.DefaultViewportParam = DefaultViewportParam;
|
|
3458
3449
|
exports.DefaultWorldParam = DefaultWorldParam;
|
|
3459
3450
|
exports.Delegate = Delegate;
|
|
@@ -3478,7 +3469,6 @@ exports.TSmartPointer = TSmartPointer;
|
|
|
3478
3469
|
exports.TextureAssetPointer = TextureAssetPointer;
|
|
3479
3470
|
exports.ThreeJsApp = ThreeJsApp;
|
|
3480
3471
|
exports.ThreeObjectLibrary = ThreeObjectLibrary;
|
|
3481
|
-
exports.ToneMappingOptions = ToneMappingOptions;
|
|
3482
3472
|
exports.TransformGizmo = TransformGizmo;
|
|
3483
3473
|
exports.Viewport = Viewport;
|
|
3484
3474
|
exports.WebGPUPostProcessFactory = WebGPUPostProcessFactory;
|
package/dist/bundle.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MathUtils, Object3D, Vector3, Box3, Quaternion, Euler, Matrix4, Mesh, LoadingManager, BufferGeometry, Texture, FileLoader, Material,
|
|
1
|
+
import { MathUtils, Object3D, Vector3, Box3, Quaternion, Euler, Matrix4, Mesh, LoadingManager, BufferGeometry, Texture, FileLoader, Material, WebGPURenderer, PostProcessing, Color, Vector2, Raycaster, PerspectiveCamera, OrthographicCamera, Clock, DirectionalLight, MeshStandardMaterial, BoxGeometry, MeshBasicMaterial, PlaneGeometry, SphereGeometry } from 'three/webgpu';
|
|
2
2
|
import { GLTFLoader, DRACOLoader, CSS2DRenderer, OrbitControls } from 'three/examples/jsm/Addons.js';
|
|
3
3
|
import { pass, mrt, output, uniform, velocity, metalness, transformedNormalView, blendColor, time, oscSine } from 'three/tsl';
|
|
4
4
|
import { bloom } from 'three/examples/jsm/tsl/display/BloomNode.js';
|
|
@@ -1261,11 +1261,67 @@ class Delegate {
|
|
|
1261
1261
|
}
|
|
1262
1262
|
}
|
|
1263
1263
|
|
|
1264
|
+
const DefaultSSRParam = {
|
|
1265
|
+
isEnabled: false,
|
|
1266
|
+
maxDistance: 0.5,
|
|
1267
|
+
opacity: 1,
|
|
1268
|
+
thickness: 0.015,
|
|
1269
|
+
};
|
|
1270
|
+
|
|
1271
|
+
const DefaultDenoiseParam = {
|
|
1272
|
+
denoiseRadius: 5,
|
|
1273
|
+
lumaPhi: 5,
|
|
1274
|
+
depthPhi: 5,
|
|
1275
|
+
normalPhi: 5
|
|
1276
|
+
};
|
|
1277
|
+
|
|
1278
|
+
const DefaultGTAOParam = {
|
|
1279
|
+
isEnabled: false,
|
|
1280
|
+
distanceExponent: 1,
|
|
1281
|
+
distanceFallOff: 1,
|
|
1282
|
+
radius: 0.25,
|
|
1283
|
+
scale: 1,
|
|
1284
|
+
thickness: 1,
|
|
1285
|
+
denoised: true,
|
|
1286
|
+
denoiseParam: DefaultDenoiseParam,
|
|
1287
|
+
};
|
|
1288
|
+
|
|
1289
|
+
const DefaultBloomParam = {
|
|
1290
|
+
isEnabled: false,
|
|
1291
|
+
threshold: 0,
|
|
1292
|
+
strength: 1,
|
|
1293
|
+
radius: 0,
|
|
1294
|
+
};
|
|
1295
|
+
|
|
1296
|
+
const DefaultDOFParam = {
|
|
1297
|
+
isEnabled: false,
|
|
1298
|
+
focus: 500.0,
|
|
1299
|
+
aperture: 5,
|
|
1300
|
+
maxblur: 0.01
|
|
1301
|
+
};
|
|
1302
|
+
|
|
1303
|
+
const DefaultOutlineParams = {
|
|
1304
|
+
isEnabled: false,
|
|
1305
|
+
edgeStrength: 3.0,
|
|
1306
|
+
edgeGlow: 1.0,
|
|
1307
|
+
edgeThickness: 1.0,
|
|
1308
|
+
pulsePeriod: 0.0,
|
|
1309
|
+
visibleEdgeColor: 0xffffff,
|
|
1310
|
+
hiddenEdgeColor: 0xffffff,
|
|
1311
|
+
};
|
|
1312
|
+
|
|
1313
|
+
const DefaultAAParams = {
|
|
1314
|
+
isEnabled: false,
|
|
1315
|
+
type: "fxaa",
|
|
1316
|
+
};
|
|
1317
|
+
|
|
1264
1318
|
const DefaultPostProcessParam = {
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1319
|
+
bloom: DefaultBloomParam,
|
|
1320
|
+
dof: DefaultDOFParam,
|
|
1321
|
+
ssr: DefaultSSRParam,
|
|
1322
|
+
gtao: DefaultGTAOParam,
|
|
1323
|
+
outline: DefaultOutlineParams,
|
|
1324
|
+
aa: DefaultAAParams
|
|
1269
1325
|
};
|
|
1270
1326
|
|
|
1271
1327
|
class World {
|
|
@@ -1333,20 +1389,6 @@ class World {
|
|
|
1333
1389
|
}
|
|
1334
1390
|
}
|
|
1335
1391
|
|
|
1336
|
-
const DefaultToneMappingParams = {
|
|
1337
|
-
exposure: 1.0,
|
|
1338
|
-
toneMapping: 'AgX',
|
|
1339
|
-
};
|
|
1340
|
-
const ToneMappingOptions = new Map([
|
|
1341
|
-
["None", NoToneMapping],
|
|
1342
|
-
["Linear", LinearToneMapping],
|
|
1343
|
-
["Reinhard", ReinhardToneMapping],
|
|
1344
|
-
["Cineon", CineonToneMapping],
|
|
1345
|
-
["ACESFilmic", ACESFilmicToneMapping],
|
|
1346
|
-
["AgX", AgXToneMapping],
|
|
1347
|
-
["Neutral", NeutralToneMapping]
|
|
1348
|
-
]);
|
|
1349
|
-
|
|
1350
1392
|
class WebGPUPostProcessFactory {
|
|
1351
1393
|
// scene pass
|
|
1352
1394
|
static constructScenePass(scene, camera) {
|
|
@@ -1495,15 +1537,6 @@ class WebGPUPostProcessFactory {
|
|
|
1495
1537
|
}
|
|
1496
1538
|
}
|
|
1497
1539
|
|
|
1498
|
-
const DefaultOutlineParams = {
|
|
1499
|
-
edgeStrength: 3.0,
|
|
1500
|
-
edgeGlow: 1.0,
|
|
1501
|
-
edgeThickness: 1.0,
|
|
1502
|
-
pulsePeriod: 0.0,
|
|
1503
|
-
visibleEdgeColor: 0xffffff,
|
|
1504
|
-
hiddenEdgeColor: 0xffffff,
|
|
1505
|
-
};
|
|
1506
|
-
|
|
1507
1540
|
class Viewport {
|
|
1508
1541
|
get canvas() {
|
|
1509
1542
|
return this._canvas;
|
|
@@ -1520,26 +1553,25 @@ class Viewport {
|
|
|
1520
1553
|
}
|
|
1521
1554
|
return this._app;
|
|
1522
1555
|
}
|
|
1523
|
-
constructor(app, viewportParam, rendererParam, postProcessParam
|
|
1556
|
+
constructor(app, viewportParam, rendererParam, postProcessParam) {
|
|
1524
1557
|
this._renderer = null;
|
|
1525
1558
|
this.labelRenderer = null;
|
|
1526
1559
|
this._app = null;
|
|
1527
1560
|
this.resizeObserver = null;
|
|
1528
1561
|
this._canvas = null;
|
|
1529
1562
|
this.isRenderStateDirty = true;
|
|
1530
|
-
this.postProcessParam = {};
|
|
1531
1563
|
this.postProcessing = null;
|
|
1532
1564
|
this.scenePass = null;
|
|
1533
1565
|
this.bloomPass = null;
|
|
1534
1566
|
this.dofPass = null;
|
|
1535
1567
|
this.GTAOPass = null;
|
|
1536
1568
|
this.denoiseGTAOPass = null;
|
|
1537
|
-
// private denoiseOutlinePass: ShaderNodeObject<DenoiseNode> | null = null;
|
|
1538
1569
|
this.ssrPass = null;
|
|
1539
1570
|
this.outlinePass = null;
|
|
1540
|
-
// private motionBlurPass: ShaderNodeObject<Node> | null = null;
|
|
1541
1571
|
this.fxaaPass = null;
|
|
1542
1572
|
this.smaaPass = null;
|
|
1573
|
+
// private motionBlurPass: ShaderNodeObject<Node> | null = null;
|
|
1574
|
+
// private denoiseOutlinePass: ShaderNodeObject<DenoiseNode> | null = null;
|
|
1543
1575
|
this.outlineObjects = [];
|
|
1544
1576
|
this.postProcessParam = postProcessParam;
|
|
1545
1577
|
this._app = app;
|
|
@@ -1601,14 +1633,14 @@ class Viewport {
|
|
|
1601
1633
|
this.setupPostProcess();
|
|
1602
1634
|
}
|
|
1603
1635
|
setupPostProcess() {
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
if (!(
|
|
1636
|
+
// 检查各个效果是否启用
|
|
1637
|
+
const isBloomEnabled = this.postProcessParam.bloom.isEnabled;
|
|
1638
|
+
const isDOFEnabled = this.postProcessParam.dof.isEnabled;
|
|
1639
|
+
const isSSREnabled = this.postProcessParam.ssr.isEnabled;
|
|
1640
|
+
const isGTAOEnabled = this.postProcessParam.gtao.isEnabled;
|
|
1641
|
+
const isOutlineEnabled = this.postProcessParam.outline.isEnabled;
|
|
1642
|
+
const isAAEnabled = this.postProcessParam.aa.isEnabled;
|
|
1643
|
+
if (!(isBloomEnabled) && !(isDOFEnabled) && !(isSSREnabled) && !(isGTAOEnabled) && !(isOutlineEnabled) && !(isAAEnabled)) {
|
|
1612
1644
|
this.destroyPostProcess();
|
|
1613
1645
|
return;
|
|
1614
1646
|
}
|
|
@@ -1620,7 +1652,7 @@ class Viewport {
|
|
|
1620
1652
|
}
|
|
1621
1653
|
let finalNode = this.scenePass.getTextureNode('output');
|
|
1622
1654
|
// bloom
|
|
1623
|
-
if (
|
|
1655
|
+
if (isBloomEnabled) {
|
|
1624
1656
|
if (!this.bloomPass) {
|
|
1625
1657
|
this.bloomPass = WebGPUPostProcessFactory.constructBloomPass(this.scenePass, this.postProcessParam.bloom);
|
|
1626
1658
|
}
|
|
@@ -1636,7 +1668,7 @@ class Viewport {
|
|
|
1636
1668
|
}
|
|
1637
1669
|
}
|
|
1638
1670
|
// DOF
|
|
1639
|
-
if (
|
|
1671
|
+
if (isDOFEnabled) {
|
|
1640
1672
|
if (!this.dofPass) {
|
|
1641
1673
|
this.dofPass = WebGPUPostProcessFactory.constructDOFPass(this.scenePass, this.postProcessParam.dof);
|
|
1642
1674
|
}
|
|
@@ -1670,7 +1702,7 @@ class Viewport {
|
|
|
1670
1702
|
// }
|
|
1671
1703
|
// }
|
|
1672
1704
|
// ssr
|
|
1673
|
-
if (
|
|
1705
|
+
if (isSSREnabled) {
|
|
1674
1706
|
if (!this.ssrPass) {
|
|
1675
1707
|
this.ssrPass = WebGPUPostProcessFactory.constructSSRPass(this.scenePass, this.postProcessParam.ssr);
|
|
1676
1708
|
}
|
|
@@ -1680,7 +1712,7 @@ class Viewport {
|
|
|
1680
1712
|
finalNode = blendColor(finalNode, this.ssrPass);
|
|
1681
1713
|
}
|
|
1682
1714
|
// GTAO
|
|
1683
|
-
if (
|
|
1715
|
+
if (isGTAOEnabled) {
|
|
1684
1716
|
if (!this.GTAOPass) {
|
|
1685
1717
|
this.GTAOPass = WebGPUPostProcessFactory.constructGTAOPass(this.scenePass, this.postProcessParam.gtao);
|
|
1686
1718
|
}
|
|
@@ -1715,7 +1747,7 @@ class Viewport {
|
|
|
1715
1747
|
}
|
|
1716
1748
|
}
|
|
1717
1749
|
// outline
|
|
1718
|
-
if (
|
|
1750
|
+
if (isOutlineEnabled) {
|
|
1719
1751
|
if (!this.outlinePass) {
|
|
1720
1752
|
this.outlinePass = WebGPUPostProcessFactory.constructOutlinePass(this.app.world.scene, this.scenePass.camera, this.outlineObjects, this.postProcessParam.outline);
|
|
1721
1753
|
}
|
|
@@ -1743,12 +1775,12 @@ class Viewport {
|
|
|
1743
1775
|
this.outlinePass = null;
|
|
1744
1776
|
}
|
|
1745
1777
|
}
|
|
1746
|
-
if (
|
|
1747
|
-
if (this.postProcessParam.aa === "fxaa") {
|
|
1778
|
+
if (isAAEnabled) {
|
|
1779
|
+
if (this.postProcessParam.aa.type === "fxaa") {
|
|
1748
1780
|
this.fxaaPass = WebGPUPostProcessFactory.constructFXAAPass(finalNode);
|
|
1749
1781
|
finalNode = this.fxaaPass;
|
|
1750
1782
|
}
|
|
1751
|
-
if (this.postProcessParam.aa === "smaa") {
|
|
1783
|
+
if (this.postProcessParam.aa.type === "smaa") {
|
|
1752
1784
|
this.smaaPass = WebGPUPostProcessFactory.constructSMAAPass(finalNode);
|
|
1753
1785
|
finalNode = this.smaaPass;
|
|
1754
1786
|
}
|
|
@@ -1766,11 +1798,6 @@ class Viewport {
|
|
|
1766
1798
|
this.postProcessing.outputNode = finalNode;
|
|
1767
1799
|
this.markRenderStateDirty();
|
|
1768
1800
|
}
|
|
1769
|
-
updateToneMappingParam(params) {
|
|
1770
|
-
this.postProcessParam.toneMapping = params;
|
|
1771
|
-
this.setupPostProcess();
|
|
1772
|
-
this.markRenderStateDirty();
|
|
1773
|
-
}
|
|
1774
1801
|
updateBloomPass(params) {
|
|
1775
1802
|
this.postProcessParam.bloom = params;
|
|
1776
1803
|
this.setupPostProcess();
|
|
@@ -3195,41 +3222,6 @@ class LabelComponent extends SceneComponent {
|
|
|
3195
3222
|
// labelStyle.style.fontSize = "10px";
|
|
3196
3223
|
// labelStyle.style.pointerEvents = 'auto';
|
|
3197
3224
|
|
|
3198
|
-
const DefaultBloomParam = {
|
|
3199
|
-
threshold: 0,
|
|
3200
|
-
strength: 1,
|
|
3201
|
-
radius: 0,
|
|
3202
|
-
};
|
|
3203
|
-
|
|
3204
|
-
const DefaultDenoiseParam = {
|
|
3205
|
-
denoiseRadius: 5,
|
|
3206
|
-
lumaPhi: 5,
|
|
3207
|
-
depthPhi: 5,
|
|
3208
|
-
normalPhi: 5
|
|
3209
|
-
};
|
|
3210
|
-
|
|
3211
|
-
const DefaultDOFParam = {
|
|
3212
|
-
focus: 500.0,
|
|
3213
|
-
aperture: 5,
|
|
3214
|
-
maxblur: 0.01
|
|
3215
|
-
};
|
|
3216
|
-
|
|
3217
|
-
const DefaultGTAOParam = {
|
|
3218
|
-
distanceExponent: 1,
|
|
3219
|
-
distanceFallOff: 1,
|
|
3220
|
-
radius: 0.25,
|
|
3221
|
-
scale: 1,
|
|
3222
|
-
thickness: 1,
|
|
3223
|
-
denoised: true,
|
|
3224
|
-
denoiseParam: DefaultDenoiseParam,
|
|
3225
|
-
};
|
|
3226
|
-
|
|
3227
|
-
const DefaultSSRParam = {
|
|
3228
|
-
maxDistance: 0.5,
|
|
3229
|
-
opacity: 1,
|
|
3230
|
-
thickness: 0.015,
|
|
3231
|
-
};
|
|
3232
|
-
|
|
3233
3225
|
class FirstPerson extends Pawn {
|
|
3234
3226
|
constructor(controller) {
|
|
3235
3227
|
super(controller);
|
|
@@ -3435,4 +3427,4 @@ class TransformGizmo extends Pawn {
|
|
|
3435
3427
|
}
|
|
3436
3428
|
}
|
|
3437
3429
|
|
|
3438
|
-
export { Actor, AssetManager, AttachmentRules, BoxActor, BoxComponent, Controller, DefaultAppParam, DefaultBloomParam, DefaultCameraParam, DefaultDOFParam, DefaultDenoiseParam, DefaultGTAOParam, DefaultOutlineParams, DefaultPostProcessParam, DefaultRendererParameters, DefaultSSRParam, DefaultSkyParam,
|
|
3430
|
+
export { Actor, AssetManager, AttachmentRules, BoxActor, BoxComponent, Controller, DefaultAppParam, DefaultBloomParam, DefaultCameraParam, DefaultDOFParam, DefaultDenoiseParam, DefaultGTAOParam, DefaultOutlineParams, DefaultPostProcessParam, DefaultRendererParameters, DefaultSSRParam, DefaultSkyParam, DefaultViewportParam, DefaultWorldParam, Delegate, DirectionalLightActor, DirectionalLightComponent, FirstPerson, GeometryAssetPointer, LabelComponent, LevelActor, LevelComponent, MaterialAssetPointer, MeshComponent, Orbital, PlaneActor, PlaneComponent, SceneComponent, SkyActor, SkyComponent, SphereComponent, TAssetPointer, TSmartPointer, TextureAssetPointer, ThreeJsApp, ThreeObjectLibrary, TransformGizmo, Viewport, WebGPUPostProcessFactory, World };
|
package/dist/index.d.ts
CHANGED
|
@@ -52,8 +52,8 @@ export { DefaultOutlineParams } from "./lythreeframe/PostProcess/Param/Outline";
|
|
|
52
52
|
export type { OutlineParams } from "./lythreeframe/PostProcess/Param/Outline";
|
|
53
53
|
export { DefaultSSRParam } from "./lythreeframe/PostProcess/Param/SSR";
|
|
54
54
|
export type { SSRParam } from "./lythreeframe/PostProcess/Param/SSR";
|
|
55
|
-
export {
|
|
56
|
-
export type {
|
|
55
|
+
export { AAParams } from "./lythreeframe/PostProcess/Param/AAParam";
|
|
56
|
+
export type { DefaultAAParams } from "./lythreeframe/PostProcess/Param/AAParam";
|
|
57
57
|
export { Orbital } from "./lythreeframe/Object/PawnV2/Oribital";
|
|
58
58
|
export { FirstPerson } from "./lythreeframe/Object/PawnV2/FirstPerson";
|
|
59
59
|
export type { ITransforming } from "./lythreeframe/Object/PawnV2/TransformControl";
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Object3D } from 'three/src/Three.WebGPU.Nodes.js';
|
|
2
|
+
import { ShadowMapType, ToneMapping, WebGPURenderer } from "three/webgpu";
|
|
3
3
|
import { BloomParam } from "../PostProcess/Param/Bloom";
|
|
4
|
+
import { DOFParam } from '../PostProcess/Param/DOF';
|
|
4
5
|
import { GTAOParam } from "../PostProcess/Param/GTAO";
|
|
5
|
-
import { ToneMappingParams } from "../PostProcess/Param/ToneMapping";
|
|
6
|
-
import { ThreeJsApp } from "../ThreeJsApp";
|
|
7
|
-
import { SSRParam } from "../PostProcess/Param/SSR";
|
|
8
6
|
import { OutlineParams } from '../PostProcess/Param/Outline';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import { SSRParam } from "../PostProcess/Param/SSR";
|
|
8
|
+
import { ThreeJsApp } from "../ThreeJsApp";
|
|
9
|
+
import { PostProcessParam } from './../PostProcess/PostProcessParam';
|
|
12
10
|
import { RendererParameters } from './Parameters/RendererParameters';
|
|
11
|
+
import { ViewportParam } from './Parameters/ViewportParameters';
|
|
13
12
|
export declare class Viewport {
|
|
14
13
|
get canvas(): HTMLElement | null;
|
|
15
14
|
get renderer(): WebGPURenderer;
|
|
@@ -32,15 +31,14 @@ export declare class Viewport {
|
|
|
32
31
|
private fxaaPass;
|
|
33
32
|
private smaaPass;
|
|
34
33
|
private outlineObjects;
|
|
35
|
-
constructor(app: ThreeJsApp, viewportParam: ViewportParam, rendererParam: RendererParameters, postProcessParam
|
|
34
|
+
constructor(app: ThreeJsApp, viewportParam: ViewportParam, rendererParam: RendererParameters, postProcessParam: PostProcessParam);
|
|
36
35
|
init(): void;
|
|
37
36
|
setupPostProcess(): void;
|
|
38
|
-
updateToneMappingParam(params: ToneMappingParams): void;
|
|
39
37
|
updateBloomPass(params: BloomParam): void;
|
|
40
|
-
updateGTAOParam(params: GTAOParam
|
|
41
|
-
updateDOFParam(params: DOFParam
|
|
42
|
-
updateSSRParam(params: SSRParam
|
|
43
|
-
updateOutlineParam(params: OutlineParams
|
|
38
|
+
updateGTAOParam(params: GTAOParam): void;
|
|
39
|
+
updateDOFParam(params: DOFParam): void;
|
|
40
|
+
updateSSRParam(params: SSRParam): void;
|
|
41
|
+
updateOutlineParam(params: OutlineParams): void;
|
|
44
42
|
addOutlineObject(obj: Object3D): void;
|
|
45
43
|
setOutlineObjects(objects: Object3D[]): void;
|
|
46
44
|
removeOutlineObject(obj: Object3D): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ColorRepresentation } from "three/webgpu";
|
|
2
2
|
export interface OutlineParams {
|
|
3
|
+
isEnabled: boolean;
|
|
3
4
|
edgeStrength: number;
|
|
4
5
|
edgeGlow: number;
|
|
5
6
|
edgeThickness: number;
|
|
@@ -7,11 +8,4 @@ export interface OutlineParams {
|
|
|
7
8
|
visibleEdgeColor: ColorRepresentation;
|
|
8
9
|
hiddenEdgeColor: ColorRepresentation;
|
|
9
10
|
}
|
|
10
|
-
export declare const DefaultOutlineParams:
|
|
11
|
-
edgeStrength: number;
|
|
12
|
-
edgeGlow: number;
|
|
13
|
-
edgeThickness: number;
|
|
14
|
-
pulsePeriod: number;
|
|
15
|
-
visibleEdgeColor: number;
|
|
16
|
-
hiddenEdgeColor: number;
|
|
17
|
-
};
|
|
11
|
+
export declare const DefaultOutlineParams: OutlineParams;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { SSRParam } from './Param/SSR';
|
|
2
2
|
import { GTAOParam } from "./Param/GTAO";
|
|
3
3
|
import { BloomParam } from "./Param/Bloom";
|
|
4
|
-
import { ToneMappingParams } from "./Param/ToneMapping";
|
|
5
4
|
import { DOFParam } from "./Param/DOF";
|
|
6
5
|
import { OutlineParams } from './Param/Outline';
|
|
6
|
+
import { AAParams } from './Param/AAParam';
|
|
7
7
|
export interface PostProcessParam {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
aa?: "fxaa" | "smaa" | null;
|
|
8
|
+
bloom: BloomParam;
|
|
9
|
+
dof: DOFParam;
|
|
10
|
+
ssr: SSRParam;
|
|
11
|
+
gtao: GTAOParam;
|
|
12
|
+
outline: OutlineParams;
|
|
13
|
+
aa: AAParams;
|
|
15
14
|
}
|
|
16
15
|
export declare const DefaultPostProcessParam: PostProcessParam;
|
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export interface ToneMappingParams {
|
|
2
|
-
exposure: number;
|
|
3
|
-
toneMapping: string;
|
|
4
|
-
}
|
|
5
|
-
export declare const DefaultToneMappingParams: {
|
|
6
|
-
exposure: number;
|
|
7
|
-
toneMapping: string;
|
|
8
|
-
};
|
|
9
|
-
export declare const ToneMappingOptions: Map<string, 0 | 1 | 2 | 3 | 4 | 6 | 7>;
|