lythreeframe 1.2.23 → 1.2.25
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
CHANGED
|
@@ -10,7 +10,6 @@ var FXAANode_js = require('three/examples/jsm/tsl/display/FXAANode.js');
|
|
|
10
10
|
var GTAONode_js = require('three/examples/jsm/tsl/display/GTAONode.js');
|
|
11
11
|
var OutlineNode_js = require('three/examples/jsm/tsl/display/OutlineNode.js');
|
|
12
12
|
var SMAANode_js = require('three/examples/jsm/tsl/display/SMAANode.js');
|
|
13
|
-
var SSRNode_js = require('three/examples/jsm/tsl/display/SSRNode.js');
|
|
14
13
|
var gsap = require('gsap');
|
|
15
14
|
var three = require('three');
|
|
16
15
|
var SkyMesh_js = require('three/examples/jsm/objects/SkyMesh.js');
|
|
@@ -898,16 +897,34 @@ class TAssetPointer extends TSmartPointer {
|
|
|
898
897
|
if (this.value) {
|
|
899
898
|
this.referenceCount--;
|
|
900
899
|
if (this.referenceCount === 0) {
|
|
901
|
-
|
|
902
|
-
|
|
900
|
+
try {
|
|
901
|
+
this.value.dispose();
|
|
902
|
+
this.value = null;
|
|
903
|
+
}
|
|
904
|
+
catch (e) {
|
|
905
|
+
console.error("Error disposing asset pointer:", e);
|
|
906
|
+
}
|
|
903
907
|
}
|
|
904
908
|
}
|
|
905
909
|
}
|
|
906
910
|
forceRelease() {
|
|
907
911
|
if (this.value) {
|
|
908
|
-
this.value.
|
|
909
|
-
|
|
910
|
-
|
|
912
|
+
if (this.value.userData && this.value.userData["assetPointer"]) {
|
|
913
|
+
delete this.value.userData["assetPointer"];
|
|
914
|
+
}
|
|
915
|
+
if (typeof this.value.dispose === "function") {
|
|
916
|
+
try {
|
|
917
|
+
this.value.dispose();
|
|
918
|
+
this.value = null;
|
|
919
|
+
}
|
|
920
|
+
catch (e) {
|
|
921
|
+
console.warn("Error disposing asset pointer:", e);
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
setTimeout(() => {
|
|
925
|
+
//this.value = null;
|
|
926
|
+
this.referenceCount = 0;
|
|
927
|
+
}, 0);
|
|
911
928
|
}
|
|
912
929
|
}
|
|
913
930
|
}
|
|
@@ -1342,7 +1359,10 @@ class World {
|
|
|
1342
1359
|
class WebGPUPostProcessFactory {
|
|
1343
1360
|
// scene pass
|
|
1344
1361
|
static constructScenePass(scene, camera) {
|
|
1345
|
-
const scenePass = tsl.pass(scene, camera);
|
|
1362
|
+
const scenePass = tsl.pass(scene, camera, { minFilter: webgpu.NearestFilter, magFilter: webgpu.NearestFilter });
|
|
1363
|
+
// scenePass.setMRT(mrt({
|
|
1364
|
+
// output: output,
|
|
1365
|
+
// }));
|
|
1346
1366
|
scenePass.setMRT(tsl.mrt({
|
|
1347
1367
|
output: tsl.output,
|
|
1348
1368
|
}));
|
|
@@ -1352,7 +1372,8 @@ class WebGPUPostProcessFactory {
|
|
|
1352
1372
|
let oldMRT = scenePass.getMRT();
|
|
1353
1373
|
let newMRT = tsl.mrt(outputNodes);
|
|
1354
1374
|
if (oldMRT) {
|
|
1355
|
-
|
|
1375
|
+
let merge = oldMRT.merge(newMRT);
|
|
1376
|
+
scenePass.setMRT(merge);
|
|
1356
1377
|
}
|
|
1357
1378
|
else {
|
|
1358
1379
|
scenePass.setMRT(newMRT);
|
|
@@ -1393,16 +1414,18 @@ class WebGPUPostProcessFactory {
|
|
|
1393
1414
|
// ssr
|
|
1394
1415
|
static constructSSRPass(scenePass, param) {
|
|
1395
1416
|
WebGPUPostProcessFactory.updateScenePass(scenePass, {
|
|
1417
|
+
output: tsl.output,
|
|
1396
1418
|
normal: tsl.transformedNormalView,
|
|
1397
|
-
metalness: tsl.metalness
|
|
1419
|
+
metalness: tsl.metalness
|
|
1398
1420
|
});
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
const
|
|
1404
|
-
ssrPass
|
|
1405
|
-
|
|
1421
|
+
let ssrPass = null;
|
|
1422
|
+
scenePass.getTextureNode('output');
|
|
1423
|
+
scenePass.getTextureNode('depth');
|
|
1424
|
+
scenePass.getTextureNode('normal');
|
|
1425
|
+
//const scenePassMetalness = scenePass.getTextureNode('metalness');
|
|
1426
|
+
// const ssrPass = ssr(scenePassColor, scenePassDepth, scenePassNormal, scenePassMetalness, scenePass.camera)
|
|
1427
|
+
// ssrPass.resolutionScale = 1.0;
|
|
1428
|
+
//WebGPUPostProcessFactory.updateSSRPass(ssrPass, param);
|
|
1406
1429
|
return ssrPass;
|
|
1407
1430
|
}
|
|
1408
1431
|
static updateSSRPass(ssrPass, params) {
|
|
@@ -1602,24 +1625,28 @@ class Viewport {
|
|
|
1602
1625
|
}
|
|
1603
1626
|
case exports.PostProcessStepType.ScreenSpaceReflection:
|
|
1604
1627
|
{
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1628
|
+
console.warn("[PostProcess] SSR 目前存在技术问题,暂不支持。");
|
|
1629
|
+
// const ssrPass = WebGPUPostProcessFactory.constructSSRPass(scenePass, step as SSRParam);
|
|
1630
|
+
// console.log("[PostProcess] SSRPass 构建完成");
|
|
1631
|
+
//finalNode = blendColor(finalNode, ssrPass);
|
|
1608
1632
|
break;
|
|
1609
1633
|
}
|
|
1610
1634
|
case exports.PostProcessStepType.GroundTruthAmbientOcclusion:
|
|
1611
1635
|
{
|
|
1612
|
-
|
|
1613
|
-
const
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1636
|
+
console.warn("[PostProcess] AO 目前存在技术问题,暂不支持。");
|
|
1637
|
+
// const stepParam = step as GTAOParam
|
|
1638
|
+
// const GTAOPass = WebGPUPostProcessFactory.constructGTAOPass(scenePass, stepParam);
|
|
1639
|
+
// console.log("[PostProcess] GTAOPass 构建完成");
|
|
1640
|
+
// if (stepParam.denoised)
|
|
1641
|
+
// {
|
|
1642
|
+
// const denoiseGTAOPass = WebGPUPostProcessFactory.constructGTAODenoisePass(scenePass, GTAOPass, stepParam);
|
|
1643
|
+
// console.log("[PostProcess] GTAODenoisePass 构建完成");
|
|
1644
|
+
// finalNode = denoiseGTAOPass.mul(finalNode);
|
|
1645
|
+
// }
|
|
1646
|
+
// else
|
|
1647
|
+
// {
|
|
1648
|
+
// finalNode = GTAOPass.getTextureNode().mul(finalNode);
|
|
1649
|
+
// }
|
|
1623
1650
|
break;
|
|
1624
1651
|
}
|
|
1625
1652
|
case exports.PostProcessStepType.Outline:
|
package/dist/bundle.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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';
|
|
1
|
+
import { MathUtils, Object3D, Vector3, Box3, Quaternion, Euler, Matrix4, Mesh, LoadingManager, BufferGeometry, Texture, FileLoader, Material, NearestFilter, 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
|
-
import { pass, mrt, output, uniform, metalness, transformedNormalView, time, oscSine
|
|
3
|
+
import { pass, mrt, output, uniform, metalness, transformedNormalView, time, oscSine } from 'three/tsl';
|
|
4
4
|
import { dof } from 'three/addons/tsl/display/DepthOfFieldNode.js';
|
|
5
5
|
import { bloom } from 'three/examples/jsm/tsl/display/BloomNode.js';
|
|
6
6
|
import { denoise } from 'three/examples/jsm/tsl/display/DenoiseNode.js';
|
|
@@ -8,7 +8,6 @@ import { fxaa } from 'three/examples/jsm/tsl/display/FXAANode.js';
|
|
|
8
8
|
import { ao } from 'three/examples/jsm/tsl/display/GTAONode.js';
|
|
9
9
|
import { outline } from 'three/examples/jsm/tsl/display/OutlineNode.js';
|
|
10
10
|
import { smaa } from 'three/examples/jsm/tsl/display/SMAANode.js';
|
|
11
|
-
import { ssr } from 'three/examples/jsm/tsl/display/SSRNode.js';
|
|
12
11
|
import { gsap } from 'gsap';
|
|
13
12
|
import { Scene } from 'three';
|
|
14
13
|
import { SkyMesh } from 'three/examples/jsm/objects/SkyMesh.js';
|
|
@@ -896,16 +895,34 @@ class TAssetPointer extends TSmartPointer {
|
|
|
896
895
|
if (this.value) {
|
|
897
896
|
this.referenceCount--;
|
|
898
897
|
if (this.referenceCount === 0) {
|
|
899
|
-
|
|
900
|
-
|
|
898
|
+
try {
|
|
899
|
+
this.value.dispose();
|
|
900
|
+
this.value = null;
|
|
901
|
+
}
|
|
902
|
+
catch (e) {
|
|
903
|
+
console.error("Error disposing asset pointer:", e);
|
|
904
|
+
}
|
|
901
905
|
}
|
|
902
906
|
}
|
|
903
907
|
}
|
|
904
908
|
forceRelease() {
|
|
905
909
|
if (this.value) {
|
|
906
|
-
this.value.
|
|
907
|
-
|
|
908
|
-
|
|
910
|
+
if (this.value.userData && this.value.userData["assetPointer"]) {
|
|
911
|
+
delete this.value.userData["assetPointer"];
|
|
912
|
+
}
|
|
913
|
+
if (typeof this.value.dispose === "function") {
|
|
914
|
+
try {
|
|
915
|
+
this.value.dispose();
|
|
916
|
+
this.value = null;
|
|
917
|
+
}
|
|
918
|
+
catch (e) {
|
|
919
|
+
console.warn("Error disposing asset pointer:", e);
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
setTimeout(() => {
|
|
923
|
+
//this.value = null;
|
|
924
|
+
this.referenceCount = 0;
|
|
925
|
+
}, 0);
|
|
909
926
|
}
|
|
910
927
|
}
|
|
911
928
|
}
|
|
@@ -1340,7 +1357,10 @@ class World {
|
|
|
1340
1357
|
class WebGPUPostProcessFactory {
|
|
1341
1358
|
// scene pass
|
|
1342
1359
|
static constructScenePass(scene, camera) {
|
|
1343
|
-
const scenePass = pass(scene, camera);
|
|
1360
|
+
const scenePass = pass(scene, camera, { minFilter: NearestFilter, magFilter: NearestFilter });
|
|
1361
|
+
// scenePass.setMRT(mrt({
|
|
1362
|
+
// output: output,
|
|
1363
|
+
// }));
|
|
1344
1364
|
scenePass.setMRT(mrt({
|
|
1345
1365
|
output: output,
|
|
1346
1366
|
}));
|
|
@@ -1350,7 +1370,8 @@ class WebGPUPostProcessFactory {
|
|
|
1350
1370
|
let oldMRT = scenePass.getMRT();
|
|
1351
1371
|
let newMRT = mrt(outputNodes);
|
|
1352
1372
|
if (oldMRT) {
|
|
1353
|
-
|
|
1373
|
+
let merge = oldMRT.merge(newMRT);
|
|
1374
|
+
scenePass.setMRT(merge);
|
|
1354
1375
|
}
|
|
1355
1376
|
else {
|
|
1356
1377
|
scenePass.setMRT(newMRT);
|
|
@@ -1391,16 +1412,18 @@ class WebGPUPostProcessFactory {
|
|
|
1391
1412
|
// ssr
|
|
1392
1413
|
static constructSSRPass(scenePass, param) {
|
|
1393
1414
|
WebGPUPostProcessFactory.updateScenePass(scenePass, {
|
|
1415
|
+
output: output,
|
|
1394
1416
|
normal: transformedNormalView,
|
|
1395
|
-
metalness: metalness
|
|
1417
|
+
metalness: metalness
|
|
1396
1418
|
});
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
const
|
|
1402
|
-
ssrPass
|
|
1403
|
-
|
|
1419
|
+
let ssrPass = null;
|
|
1420
|
+
scenePass.getTextureNode('output');
|
|
1421
|
+
scenePass.getTextureNode('depth');
|
|
1422
|
+
scenePass.getTextureNode('normal');
|
|
1423
|
+
//const scenePassMetalness = scenePass.getTextureNode('metalness');
|
|
1424
|
+
// const ssrPass = ssr(scenePassColor, scenePassDepth, scenePassNormal, scenePassMetalness, scenePass.camera)
|
|
1425
|
+
// ssrPass.resolutionScale = 1.0;
|
|
1426
|
+
//WebGPUPostProcessFactory.updateSSRPass(ssrPass, param);
|
|
1404
1427
|
return ssrPass;
|
|
1405
1428
|
}
|
|
1406
1429
|
static updateSSRPass(ssrPass, params) {
|
|
@@ -1600,24 +1623,28 @@ class Viewport {
|
|
|
1600
1623
|
}
|
|
1601
1624
|
case PostProcessStepType.ScreenSpaceReflection:
|
|
1602
1625
|
{
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1626
|
+
console.warn("[PostProcess] SSR 目前存在技术问题,暂不支持。");
|
|
1627
|
+
// const ssrPass = WebGPUPostProcessFactory.constructSSRPass(scenePass, step as SSRParam);
|
|
1628
|
+
// console.log("[PostProcess] SSRPass 构建完成");
|
|
1629
|
+
//finalNode = blendColor(finalNode, ssrPass);
|
|
1606
1630
|
break;
|
|
1607
1631
|
}
|
|
1608
1632
|
case PostProcessStepType.GroundTruthAmbientOcclusion:
|
|
1609
1633
|
{
|
|
1610
|
-
|
|
1611
|
-
const
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1634
|
+
console.warn("[PostProcess] AO 目前存在技术问题,暂不支持。");
|
|
1635
|
+
// const stepParam = step as GTAOParam
|
|
1636
|
+
// const GTAOPass = WebGPUPostProcessFactory.constructGTAOPass(scenePass, stepParam);
|
|
1637
|
+
// console.log("[PostProcess] GTAOPass 构建完成");
|
|
1638
|
+
// if (stepParam.denoised)
|
|
1639
|
+
// {
|
|
1640
|
+
// const denoiseGTAOPass = WebGPUPostProcessFactory.constructGTAODenoisePass(scenePass, GTAOPass, stepParam);
|
|
1641
|
+
// console.log("[PostProcess] GTAODenoisePass 构建完成");
|
|
1642
|
+
// finalNode = denoiseGTAOPass.mul(finalNode);
|
|
1643
|
+
// }
|
|
1644
|
+
// else
|
|
1645
|
+
// {
|
|
1646
|
+
// finalNode = GTAOPass.getTextureNode().mul(finalNode);
|
|
1647
|
+
// }
|
|
1621
1648
|
break;
|
|
1622
1649
|
}
|
|
1623
1650
|
case PostProcessStepType.Outline:
|
|
@@ -21,7 +21,7 @@ export declare class WebGPUPostProcessFactory {
|
|
|
21
21
|
static updateBloomPass(bloomPass: ShaderNodeObject<BloomNode>, params: BloomParam): void;
|
|
22
22
|
static constructDOFPass(scenePass: ShaderNodeObject<PassNode>, params: DOFParam): ShaderNodeObject<DepthOfFieldNode>;
|
|
23
23
|
static updateDOFPass(dofPass: ShaderNodeObject<DepthOfFieldNode>, params: DOFParam): void;
|
|
24
|
-
static constructSSRPass(scenePass: ShaderNodeObject<PassNode>, param: SSRParam): ShaderNodeObject<SSRNode
|
|
24
|
+
static constructSSRPass(scenePass: ShaderNodeObject<PassNode>, param: SSRParam): ShaderNodeObject<SSRNode> | null;
|
|
25
25
|
static updateSSRPass(ssrPass: ShaderNodeObject<SSRNode>, params: SSRParam): void;
|
|
26
26
|
static constructGTAOPass(scenePass: ShaderNodeObject<PassNode>, params: GTAOParam): ShaderNodeObject<GTAONode>;
|
|
27
27
|
static updateGTAOPass(gtaoPass: ShaderNodeObject<GTAONode>, params: GTAOParam): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lythreeframe",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.25",
|
|
4
4
|
"description": "Three.js 封装",
|
|
5
5
|
"main": "dist/bundle.cjs.js",
|
|
6
6
|
"module": "dist/bundle.esm.js",
|
|
@@ -11,19 +11,19 @@
|
|
|
11
11
|
"prepublishOnly": "npm run build"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@types/three": "^0.
|
|
14
|
+
"@types/three": "^0.178.0",
|
|
15
15
|
"gsap": "^3.12.2",
|
|
16
|
-
"three": "^0.
|
|
16
|
+
"three": "^0.178.0"
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
19
|
"dist"
|
|
20
20
|
],
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
23
|
-
"@types/three": "^0.
|
|
23
|
+
"@types/three": "^0.178.0",
|
|
24
24
|
"gsap": "^3.12.2",
|
|
25
25
|
"rollup": "^4.35.0",
|
|
26
|
-
"three": "^0.
|
|
26
|
+
"three": "^0.178.0",
|
|
27
27
|
"tslib": "^2.8.1",
|
|
28
28
|
"typescript": "^5.8.2"
|
|
29
29
|
},
|