three-base 2.0.172 → 2.0.175
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/FPScontrol.d.ts +15 -24
- package/FPScontrol.js +63 -87
- package/FPScontrol.ts +64 -88
- package/Ground1/Ground1.d.ts +4 -2
- package/Ground1/Ground1.js +77 -57
- package/Ground1/Ground1.ts +77 -57
- package/Mirror.js +0 -4
- package/Mirror.ts +0 -4
- package/MktMesh/MktMesh.d.ts +3 -2
- package/MktMesh/MktMesh.js +27 -8
- package/MktMesh/MktMesh.ts +24 -8
- package/MktMesh/mktMappingShader.d.ts +6 -5
- package/MktMesh/mktMappingShader.js +26 -19
- package/MktMesh/mktMappingShader.ts +28 -19
- package/MktMesh/mktShader.d.ts +127 -58
- package/MktMesh/mktShader.js +192 -117
- package/MktMesh/mktShader.ts +251 -127
- package/MktMesh/panoSlotRoster.d.ts +2 -2
- package/MktMesh/panoSlotRoster.js +9 -7
- package/MktMesh/panoSlotRoster.ts +9 -7
- package/MktMesh/panoTileStitcher.d.ts +20 -13
- package/MktMesh/panoTileStitcher.js +97 -76
- package/MktMesh/panoTileStitcher.ts +119 -90
- package/PipeMesh/PipeJoint.d.ts +22 -0
- package/PipeMesh/PipeJoint.js +33 -0
- package/PipeMesh/PipeJoint.ts +38 -0
- package/PipeMesh/PipeMesh.d.ts +94 -22
- package/PipeMesh/PipeMesh.js +192 -53
- package/PipeMesh/PipeMesh.ts +223 -76
- package/PipeMesh/PipeStraight.d.ts +19 -0
- package/PipeMesh/PipeStraight.js +34 -0
- package/PipeMesh/PipeStraight.ts +45 -0
- package/PipeMesh/axisSnap.d.ts +52 -0
- package/PipeMesh/axisSnap.js +52 -0
- package/PipeMesh/axisSnap.ts +93 -0
- package/PipeMesh/directRoute.d.ts +85 -0
- package/PipeMesh/directRoute.js +126 -0
- package/PipeMesh/directRoute.ts +190 -0
- package/PipeMesh/index.d.ts +6 -0
- package/PipeMesh/index.js +6 -0
- package/PipeMesh/index.ts +7 -1
- package/PipeMesh/pipeMaterial.d.ts +16 -0
- package/PipeMesh/pipeMaterial.js +23 -0
- package/PipeMesh/pipeMaterial.ts +26 -0
- package/ThreeBase.d.ts +1 -39
- package/ThreeBase.js +38 -147
- package/ThreeBase.ts +1176 -1302
- package/instanced/InstancedBatch.d.ts +14 -1
- package/instanced/InstancedBatch.js +53 -3
- package/instanced/InstancedBatch.ts +62 -3
- package/instanced/InstancedChild.d.ts +24 -0
- package/instanced/InstancedChild.js +40 -0
- package/instanced/InstancedChild.ts +41 -0
- package/instanced/InstancedGroup.d.ts +48 -0
- package/instanced/InstancedGroup.js +45 -1
- package/instanced/InstancedGroup.ts +85 -0
- package/package.json +2 -7
- package/pass/debugDepthState.d.ts +16 -8
- package/pass/debugDepthState.js +4 -0
- package/pass/debugDepthState.ts +27 -9
- package/pass/glow_pass.js +11 -94
- package/pass/glow_pass.ts +11 -97
- package/pass/ssao_pass.d.ts +9 -23
- package/pass/ssao_pass.js +41 -128
- package/pass/ssao_pass.ts +36 -166
- package/pass/stroke_pass.js +3 -0
- package/pass/stroke_pass.ts +4 -0
- package/shaders/debugDepthCompareShader.d.ts +1 -1
- package/shaders/debugDepthCompareShader.js +1 -1
- package/shaders/debugDepthCompareShader.ts +1 -1
- package/shaders/debugDepthJudgeShader.d.ts +1 -1
- package/shaders/debugDepthJudgeShader.js +1 -1
- package/shaders/debugDepthJudgeShader.ts +1 -1
- package/PipeMesh/PathGeometry.d.ts +0 -44
- package/PipeMesh/PathGeometry.js +0 -307
- package/PipeMesh/PathGeometry.ts +0 -343
- package/PipeMesh/PathPoint.d.ts +0 -17
- package/PipeMesh/PathPoint.js +0 -31
- package/PipeMesh/PathPoint.ts +0 -36
- package/PipeMesh/PathPointList.d.ts +0 -31
- package/PipeMesh/PathPointList.js +0 -209
- package/PipeMesh/PathPointList.ts +0 -227
- package/PipeMesh/PathTubeGeometry.d.ts +0 -25
- package/PipeMesh/PathTubeGeometry.js +0 -130
- package/PipeMesh/PathTubeGeometry.ts +0 -146
- package/WaterFlow/FloatingDuck.d.ts +0 -88
- package/WaterFlow/FloatingDuck.js +0 -307
- package/WaterFlow/FloatingDuck.ts +0 -445
- package/WaterFlow/GPUFluidSimulation.d.ts +0 -56
- package/WaterFlow/GPUFluidSimulation.js +0 -785
- package/WaterFlow/GPUFluidSimulation.ts +0 -827
- package/WaterFlow/ReservoirSystem.d.ts +0 -106
- package/WaterFlow/ReservoirSystem.js +0 -621
- package/WaterFlow/ReservoirSystem.ts +0 -754
- package/WaterFlow/SPHField.d.ts +0 -35
- package/WaterFlow/SPHField.js +0 -204
- package/WaterFlow/SPHField.ts +0 -228
- package/WaterFlow/ScreenSpaceFluidPass.d.ts +0 -69
- package/WaterFlow/ScreenSpaceFluidPass.js +0 -736
- package/WaterFlow/ScreenSpaceFluidPass.ts +0 -789
- package/WaterFlow/ShallowWaterSurface.d.ts +0 -45
- package/WaterFlow/ShallowWaterSurface.js +0 -441
- package/WaterFlow/ShallowWaterSurface.ts +0 -510
- package/WaterFlow/WaterFlow.d.ts +0 -87
- package/WaterFlow/WaterFlow.js +0 -171
- package/WaterFlow/WaterFlow.ts +0 -219
- package/WaterFlow/types.d.ts +0 -161
- package/WaterFlow/types.js +0 -1
- package/WaterFlow/types.ts +0 -189
- package/WaterFlow/waterFlowPass.d.ts +0 -3
- package/WaterFlow/waterFlowPass.js +0 -20
- package/WaterFlow/waterFlowPass.ts +0 -40
- package/shaders/debugExcludedShader.d.ts +0 -15
- package/shaders/debugExcludedShader.js +0 -48
- package/shaders/debugExcludedShader.ts +0 -50
|
@@ -1,510 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import type {
|
|
3
|
-
ShallowWaterSurfaceBounds,
|
|
4
|
-
ShallowWaterSurfaceOptions,
|
|
5
|
-
WaterSurfaceSample,
|
|
6
|
-
} from './types';
|
|
7
|
-
|
|
8
|
-
const quadVertex = /* glsl */`
|
|
9
|
-
out vec2 vUv;
|
|
10
|
-
void main() {
|
|
11
|
-
vUv = uv;
|
|
12
|
-
gl_Position = vec4(position, 1.0);
|
|
13
|
-
}
|
|
14
|
-
`;
|
|
15
|
-
|
|
16
|
-
function createWaveTarget(width: number, height: number): THREE.WebGLRenderTarget {
|
|
17
|
-
return new THREE.WebGLRenderTarget(width, height, {
|
|
18
|
-
format: THREE.RGBAFormat,
|
|
19
|
-
type: THREE.HalfFloatType,
|
|
20
|
-
minFilter: THREE.LinearFilter,
|
|
21
|
-
magFilter: THREE.LinearFilter,
|
|
22
|
-
wrapS: THREE.ClampToEdgeWrapping,
|
|
23
|
-
wrapT: THREE.ClampToEdgeWrapping,
|
|
24
|
-
depthBuffer: false,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function ambientSurfaceHeight(u: number, v: number, time: number): number {
|
|
29
|
-
const sourceX = 0.56 + Math.sin(time * 0.17) * 0.13;
|
|
30
|
-
const sourceZ = 0.48 + Math.cos(time * 0.14) * 0.11;
|
|
31
|
-
const radialX = (u - sourceX) * 1.65;
|
|
32
|
-
const radialZ = v - sourceZ;
|
|
33
|
-
const radialDistance = Math.hypot(radialX, radialZ);
|
|
34
|
-
const swellA = Math.sin(u * 11.0 + v * 7.0 + time * 1.15) * 0.008;
|
|
35
|
-
const swellB = Math.sin(-u * 8.0 + v * 13.0 - time * 0.88 + 0.9) * 0.0055;
|
|
36
|
-
const radial = Math.sin(radialDistance * 29.0 - time * 2.05)
|
|
37
|
-
* Math.exp(-radialDistance * 2.0) * 0.0065;
|
|
38
|
-
return swellA + swellB + radial;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function sloshSurfaceHeight(u: number, v: number, slosh: THREE.Vector2): number {
|
|
42
|
-
return (u - 0.5) * 2 * slosh.x + (v - 0.5) * 2 * slosh.y;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export class ShallowWaterSurface {
|
|
46
|
-
private readonly renderer: THREE.WebGLRenderer;
|
|
47
|
-
private readonly width: number;
|
|
48
|
-
private readonly height: number;
|
|
49
|
-
private basinMinX: number;
|
|
50
|
-
private basinMaxX: number;
|
|
51
|
-
private basinHalfZ: number;
|
|
52
|
-
private basinCenterZ: number;
|
|
53
|
-
private waterY: number;
|
|
54
|
-
private readonly cpuSampling: boolean;
|
|
55
|
-
private readonly cpuWidth: number;
|
|
56
|
-
private readonly cpuHeight: number;
|
|
57
|
-
private cpuCurrent: Float32Array | null;
|
|
58
|
-
private cpuPrevious: Float32Array | null;
|
|
59
|
-
private cpuNext: Float32Array | null;
|
|
60
|
-
private cpuLastDelta: number;
|
|
61
|
-
private cpuImpactX: number;
|
|
62
|
-
private cpuImpactZ: number;
|
|
63
|
-
private cpuImpactEnergy: number;
|
|
64
|
-
private cpuEmitting: boolean;
|
|
65
|
-
private elapsed: number;
|
|
66
|
-
private readonly slosh: THREE.Vector2;
|
|
67
|
-
private readonly previousSlosh: THREE.Vector2;
|
|
68
|
-
private readonly motionImpulse: THREE.Vector2;
|
|
69
|
-
/** 高度场乒乓 RT:每帧交换,故非 readonly。 */
|
|
70
|
-
private read: THREE.WebGLRenderTarget;
|
|
71
|
-
private write: THREE.WebGLRenderTarget;
|
|
72
|
-
|
|
73
|
-
private readonly computeScene: THREE.Scene;
|
|
74
|
-
private readonly computeCamera: THREE.OrthographicCamera;
|
|
75
|
-
private readonly computeMaterial: THREE.ShaderMaterial;
|
|
76
|
-
private readonly computeQuad: THREE.Mesh;
|
|
77
|
-
private readonly material: THREE.ShaderMaterial;
|
|
78
|
-
/** 对外可见的水面网格(ReservoirSystem 会改 renderOrder / visible)。 */
|
|
79
|
-
readonly mesh: THREE.Mesh;
|
|
80
|
-
|
|
81
|
-
constructor(renderer: THREE.WebGLRenderer, {
|
|
82
|
-
width = 256,
|
|
83
|
-
height = 128,
|
|
84
|
-
basinMinX = 0.25,
|
|
85
|
-
basinMaxX = 3.85,
|
|
86
|
-
basinHalfZ = 0.82,
|
|
87
|
-
basinCenterZ = 0,
|
|
88
|
-
waterY = 0.2,
|
|
89
|
-
cpuSampling = false,
|
|
90
|
-
}: ShallowWaterSurfaceOptions = {}) {
|
|
91
|
-
this.renderer = renderer;
|
|
92
|
-
this.width = width;
|
|
93
|
-
this.height = height;
|
|
94
|
-
this.basinMinX = basinMinX;
|
|
95
|
-
this.basinMaxX = basinMaxX;
|
|
96
|
-
this.basinHalfZ = basinHalfZ;
|
|
97
|
-
this.basinCenterZ = basinCenterZ;
|
|
98
|
-
this.waterY = waterY;
|
|
99
|
-
this.cpuSampling = cpuSampling;
|
|
100
|
-
this.cpuWidth = cpuSampling ? 48 : 0;
|
|
101
|
-
this.cpuHeight = cpuSampling ? 24 : 0;
|
|
102
|
-
this.cpuCurrent = cpuSampling ? new Float32Array(this.cpuWidth * this.cpuHeight) : null;
|
|
103
|
-
this.cpuPrevious = cpuSampling ? new Float32Array(this.cpuWidth * this.cpuHeight) : null;
|
|
104
|
-
this.cpuNext = cpuSampling ? new Float32Array(this.cpuWidth * this.cpuHeight) : null;
|
|
105
|
-
this.cpuLastDelta = 1 / 60;
|
|
106
|
-
this.cpuImpactX = (basinMinX + basinMaxX) * 0.5;
|
|
107
|
-
this.cpuImpactZ = basinCenterZ;
|
|
108
|
-
this.cpuImpactEnergy = 0;
|
|
109
|
-
this.cpuEmitting = false;
|
|
110
|
-
this.elapsed = 0;
|
|
111
|
-
this.slosh = new THREE.Vector2();
|
|
112
|
-
this.previousSlosh = new THREE.Vector2();
|
|
113
|
-
this.motionImpulse = new THREE.Vector2();
|
|
114
|
-
this.read = createWaveTarget(width, height);
|
|
115
|
-
this.write = createWaveTarget(width, height);
|
|
116
|
-
|
|
117
|
-
this.computeScene = new THREE.Scene();
|
|
118
|
-
this.computeCamera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1);
|
|
119
|
-
this.computeMaterial = new THREE.ShaderMaterial({
|
|
120
|
-
glslVersion: THREE.GLSL3,
|
|
121
|
-
uniforms: {
|
|
122
|
-
uState: { value: this.read.texture },
|
|
123
|
-
uTexel: { value: new THREE.Vector2(1 / width, 1 / height) },
|
|
124
|
-
uImpactUv: { value: new THREE.Vector2(0.35, 0.5) },
|
|
125
|
-
uImpulse: { value: 0 },
|
|
126
|
-
uTime: { value: 0 },
|
|
127
|
-
uMotionImpulse: { value: new THREE.Vector2() },
|
|
128
|
-
},
|
|
129
|
-
vertexShader: quadVertex,
|
|
130
|
-
fragmentShader: /* glsl */`
|
|
131
|
-
precision highp float;
|
|
132
|
-
uniform sampler2D uState;
|
|
133
|
-
uniform vec2 uTexel;
|
|
134
|
-
uniform vec2 uImpactUv;
|
|
135
|
-
uniform float uImpulse;
|
|
136
|
-
uniform float uTime;
|
|
137
|
-
uniform vec2 uMotionImpulse;
|
|
138
|
-
in vec2 vUv;
|
|
139
|
-
out vec4 outColor;
|
|
140
|
-
|
|
141
|
-
void main() {
|
|
142
|
-
vec2 state = texture(uState, vUv).rg;
|
|
143
|
-
float current = state.r;
|
|
144
|
-
float previous = state.g;
|
|
145
|
-
float left = texture(uState, vUv - vec2(uTexel.x, 0.0)).r;
|
|
146
|
-
float right = texture(uState, vUv + vec2(uTexel.x, 0.0)).r;
|
|
147
|
-
float down = texture(uState, vUv - vec2(0.0, uTexel.y)).r;
|
|
148
|
-
float up = texture(uState, vUv + vec2(0.0, uTexel.y)).r;
|
|
149
|
-
float laplacian = left + right + down + up - 4.0 * current;
|
|
150
|
-
float nextHeight = (2.0 * current - previous) + laplacian * 0.235;
|
|
151
|
-
nextHeight *= 0.9925;
|
|
152
|
-
|
|
153
|
-
vec2 aspectUv = (vUv - uImpactUv) * vec2(2.2, 1.0);
|
|
154
|
-
float impact = exp(-dot(aspectUv, aspectUv) * 420.0);
|
|
155
|
-
float microPulse = 0.72 + 0.28 * sin(uTime * 19.0);
|
|
156
|
-
nextHeight += impact * uImpulse * microPulse;
|
|
157
|
-
|
|
158
|
-
vec2 sourceA = vec2(0.22 + sin(uTime * 0.19) * 0.08, 0.31 + cos(uTime * 0.16) * 0.09);
|
|
159
|
-
vec2 sourceB = vec2(0.72 + cos(uTime * 0.13) * 0.09, 0.68 + sin(uTime * 0.17) * 0.08);
|
|
160
|
-
vec2 deltaA = (vUv - sourceA) * vec2(1.75, 1.0);
|
|
161
|
-
vec2 deltaB = (vUv - sourceB) * vec2(1.55, 1.0);
|
|
162
|
-
float distanceA = length(deltaA);
|
|
163
|
-
float distanceB = length(deltaB);
|
|
164
|
-
float ambientWaves = sin(distanceA * 47.0 - uTime * 2.15) * exp(-distanceA * 3.8)
|
|
165
|
-
+ sin(distanceB * 39.0 - uTime * 1.72 + 1.4) * exp(-distanceB * 3.5);
|
|
166
|
-
nextHeight += ambientWaves * 0.000028;
|
|
167
|
-
|
|
168
|
-
vec2 centered = vUv - 0.5;
|
|
169
|
-
float wallResponse = 0.34
|
|
170
|
-
+ 0.66 * pow(max(abs(centered.x), abs(centered.y)) * 2.0, 2.0);
|
|
171
|
-
nextHeight += dot(centered, uMotionImpulse) * wallResponse;
|
|
172
|
-
|
|
173
|
-
float edge = smoothstep(0.0, 0.025, vUv.x) * smoothstep(1.0, 0.975, vUv.x)
|
|
174
|
-
* smoothstep(0.0, 0.045, vUv.y) * smoothstep(1.0, 0.955, vUv.y);
|
|
175
|
-
nextHeight *= mix(0.86, 1.0, edge);
|
|
176
|
-
outColor = vec4(nextHeight, current, 0.0, 1.0);
|
|
177
|
-
}
|
|
178
|
-
`,
|
|
179
|
-
depthTest: false,
|
|
180
|
-
depthWrite: false,
|
|
181
|
-
toneMapped: false,
|
|
182
|
-
});
|
|
183
|
-
this.computeQuad = new THREE.Mesh(new THREE.PlaneGeometry(2, 2), this.computeMaterial);
|
|
184
|
-
this.computeQuad.frustumCulled = false;
|
|
185
|
-
this.computeScene.add(this.computeQuad);
|
|
186
|
-
|
|
187
|
-
this.material = new THREE.ShaderMaterial({
|
|
188
|
-
glslVersion: THREE.GLSL3,
|
|
189
|
-
uniforms: {
|
|
190
|
-
uHeightMap: { value: this.read.texture },
|
|
191
|
-
uTexel: { value: new THREE.Vector2(1 / width, 1 / height) },
|
|
192
|
-
uTime: { value: 0 },
|
|
193
|
-
uSlosh: { value: this.slosh },
|
|
194
|
-
uLightPosition: { value: new THREE.Vector3(-1, 5, 4) },
|
|
195
|
-
},
|
|
196
|
-
vertexShader: /* glsl */`
|
|
197
|
-
precision highp float;
|
|
198
|
-
uniform sampler2D uHeightMap;
|
|
199
|
-
uniform vec2 uTexel;
|
|
200
|
-
uniform float uTime;
|
|
201
|
-
uniform vec2 uSlosh;
|
|
202
|
-
out vec2 vUv;
|
|
203
|
-
out vec3 vWorldPosition;
|
|
204
|
-
out vec3 vWorldNormal;
|
|
205
|
-
|
|
206
|
-
float ambientHeight(vec2 sampleUv) {
|
|
207
|
-
vec2 source = vec2(
|
|
208
|
-
0.56 + sin(uTime * 0.17) * 0.13,
|
|
209
|
-
0.48 + cos(uTime * 0.14) * 0.11
|
|
210
|
-
);
|
|
211
|
-
vec2 radialDelta = (sampleUv - source) * vec2(1.65, 1.0);
|
|
212
|
-
float radialDistance = length(radialDelta);
|
|
213
|
-
float swellA = sin(sampleUv.x * 11.0 + sampleUv.y * 7.0 + uTime * 1.15) * 0.008;
|
|
214
|
-
float swellB = sin(-sampleUv.x * 8.0 + sampleUv.y * 13.0 - uTime * 0.88 + 0.9) * 0.0055;
|
|
215
|
-
float radial = sin(radialDistance * 29.0 - uTime * 2.05)
|
|
216
|
-
* exp(-radialDistance * 2.0) * 0.0065;
|
|
217
|
-
return swellA + swellB + radial;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
float surfaceHeight(vec2 sampleUv) {
|
|
221
|
-
float sloshHeight = dot((sampleUv - 0.5) * 2.0, uSlosh);
|
|
222
|
-
return texture(uHeightMap, sampleUv).r * 0.52 + ambientHeight(sampleUv) + sloshHeight;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
void main() {
|
|
226
|
-
vUv = uv;
|
|
227
|
-
float h = surfaceHeight(uv);
|
|
228
|
-
float hL = surfaceHeight(uv - vec2(uTexel.x, 0.0));
|
|
229
|
-
float hR = surfaceHeight(uv + vec2(uTexel.x, 0.0));
|
|
230
|
-
float hD = surfaceHeight(uv - vec2(0.0, uTexel.y));
|
|
231
|
-
float hU = surfaceHeight(uv + vec2(0.0, uTexel.y));
|
|
232
|
-
vec3 displaced = position;
|
|
233
|
-
displaced.z += h;
|
|
234
|
-
vec3 localNormal = normalize(vec3((hL - hR) * 46.0, (hD - hU) * 46.0, 1.0));
|
|
235
|
-
vec4 world = modelMatrix * vec4(displaced, 1.0);
|
|
236
|
-
vWorldPosition = world.xyz;
|
|
237
|
-
vWorldNormal = normalize(mat3(modelMatrix) * localNormal);
|
|
238
|
-
gl_Position = projectionMatrix * viewMatrix * world;
|
|
239
|
-
}
|
|
240
|
-
`,
|
|
241
|
-
fragmentShader: /* glsl */`
|
|
242
|
-
precision highp float;
|
|
243
|
-
uniform sampler2D uHeightMap;
|
|
244
|
-
uniform vec2 uTexel;
|
|
245
|
-
uniform float uTime;
|
|
246
|
-
uniform vec3 uLightPosition;
|
|
247
|
-
in vec2 vUv;
|
|
248
|
-
in vec3 vWorldPosition;
|
|
249
|
-
in vec3 vWorldNormal;
|
|
250
|
-
out vec4 outColor;
|
|
251
|
-
|
|
252
|
-
void main() {
|
|
253
|
-
vec2 microRipple = vec2(
|
|
254
|
-
sin(vUv.x * 54.0 + vUv.y * 19.0 + uTime * 1.35)
|
|
255
|
-
+ sin(vUv.y * 37.0 - uTime * 0.94),
|
|
256
|
-
cos(vUv.y * 49.0 - vUv.x * 17.0 + uTime * 1.12)
|
|
257
|
-
+ cos(vUv.x * 31.0 + uTime * 0.78)
|
|
258
|
-
) * 0.014;
|
|
259
|
-
vec3 normal = normalize(vWorldNormal + vec3(microRipple.x, 0.0, microRipple.y));
|
|
260
|
-
vec3 viewDir = normalize(cameraPosition - vWorldPosition);
|
|
261
|
-
vec3 lightDir = normalize(uLightPosition - vWorldPosition);
|
|
262
|
-
vec3 halfDir = normalize(viewDir + lightDir);
|
|
263
|
-
float fresnel = 0.02 + 0.98 * pow(1.0 - max(dot(viewDir, normal), 0.0), 5.0);
|
|
264
|
-
float specular = pow(max(dot(normal, halfDir), 0.0), 118.0);
|
|
265
|
-
float height = texture(uHeightMap, vUv).r;
|
|
266
|
-
float slope = abs(texture(uHeightMap, vUv + vec2(uTexel.x, 0.0)).r - texture(uHeightMap, vUv - vec2(uTexel.x, 0.0)).r)
|
|
267
|
-
+ abs(texture(uHeightMap, vUv + vec2(0.0, uTexel.y)).r - texture(uHeightMap, vUv - vec2(0.0, uTexel.y)).r);
|
|
268
|
-
float foam = smoothstep(0.018, 0.07, slope + abs(height) * 0.16);
|
|
269
|
-
vec3 deep = vec3(0.018, 0.16, 0.2);
|
|
270
|
-
vec3 reflection = mix(vec3(0.06, 0.2, 0.24), vec3(0.5, 0.86, 0.9), fresnel);
|
|
271
|
-
vec3 color = mix(deep, reflection, 0.32 + fresnel * 0.68);
|
|
272
|
-
color += vec3(0.75, 0.98, 1.0) * specular * 1.4;
|
|
273
|
-
color = mix(color, vec3(0.72, 0.94, 0.96), foam * 0.36);
|
|
274
|
-
outColor = vec4(color, 0.66 + fresnel * 0.22);
|
|
275
|
-
}
|
|
276
|
-
`,
|
|
277
|
-
transparent: true,
|
|
278
|
-
depthWrite: false,
|
|
279
|
-
side: THREE.DoubleSide,
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
const segmentsX = width >= 200 ? 128 : 64;
|
|
283
|
-
const segmentsY = width >= 200 ? 64 : 32;
|
|
284
|
-
this.mesh = new THREE.Mesh(
|
|
285
|
-
new THREE.PlaneGeometry(basinMaxX - basinMinX - 0.12, basinHalfZ * 2 - 0.12, segmentsX, segmentsY),
|
|
286
|
-
this.material,
|
|
287
|
-
);
|
|
288
|
-
this.mesh.rotation.x = -Math.PI / 2;
|
|
289
|
-
this.mesh.position.set((basinMinX + basinMaxX) * 0.5, waterY, basinCenterZ);
|
|
290
|
-
this.mesh.renderOrder = 2;
|
|
291
|
-
|
|
292
|
-
this.clear();
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
clear(): void {
|
|
296
|
-
this.cpuCurrent?.fill(0);
|
|
297
|
-
this.cpuPrevious?.fill(0);
|
|
298
|
-
this.cpuNext?.fill(0);
|
|
299
|
-
const previousTarget = this.renderer.getRenderTarget();
|
|
300
|
-
const previousColor = this.renderer.getClearColor(new THREE.Color());
|
|
301
|
-
const previousAlpha = this.renderer.getClearAlpha();
|
|
302
|
-
this.renderer.setClearColor(0x000000, 0);
|
|
303
|
-
this.renderer.setRenderTarget(this.read);
|
|
304
|
-
this.renderer.clear();
|
|
305
|
-
this.renderer.setRenderTarget(this.write);
|
|
306
|
-
this.renderer.clear();
|
|
307
|
-
this.renderer.setRenderTarget(previousTarget);
|
|
308
|
-
this.renderer.setClearColor(previousColor, previousAlpha);
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
setBounds({ basinMinX, basinMaxX, basinHalfZ, basinCenterZ = 0, waterY }: ShallowWaterSurfaceBounds): void {
|
|
312
|
-
this.basinMinX = basinMinX;
|
|
313
|
-
this.basinMaxX = basinMaxX;
|
|
314
|
-
this.basinHalfZ = basinHalfZ;
|
|
315
|
-
this.basinCenterZ = basinCenterZ;
|
|
316
|
-
this.waterY = waterY;
|
|
317
|
-
this.mesh.position.set((basinMinX + basinMaxX) * 0.5, waterY, basinCenterZ);
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
setContainerMotion(sloshX = 0, sloshZ = 0, impulseX = 0, impulseZ = 0): void {
|
|
321
|
-
this.previousSlosh.copy(this.slosh);
|
|
322
|
-
this.slosh.set(sloshX, sloshZ);
|
|
323
|
-
this.motionImpulse.set(impulseX, impulseZ);
|
|
324
|
-
this.computeMaterial.uniforms.uMotionImpulse.value.copy(this.motionImpulse);
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
update(
|
|
328
|
-
delta: number,
|
|
329
|
-
elapsed: number,
|
|
330
|
-
impactWorldX: number,
|
|
331
|
-
energy: number,
|
|
332
|
-
emitting: boolean,
|
|
333
|
-
impactWorldZ = 0,
|
|
334
|
-
): void {
|
|
335
|
-
this.elapsed = elapsed;
|
|
336
|
-
const impactUvX = THREE.MathUtils.clamp(
|
|
337
|
-
(impactWorldX - this.basinMinX) / (this.basinMaxX - this.basinMinX),
|
|
338
|
-
0.03,
|
|
339
|
-
0.97,
|
|
340
|
-
);
|
|
341
|
-
const impactUvZ = THREE.MathUtils.clamp(
|
|
342
|
-
(impactWorldZ - (this.basinCenterZ - this.basinHalfZ)) / (this.basinHalfZ * 2),
|
|
343
|
-
0.03,
|
|
344
|
-
0.97,
|
|
345
|
-
);
|
|
346
|
-
const impulse = emitting ? Math.min(energy * delta * 0.00135, 0.0035) : 0;
|
|
347
|
-
this.computeMaterial.uniforms.uState.value = this.read.texture;
|
|
348
|
-
this.computeMaterial.uniforms.uImpactUv.value.set(impactUvX, impactUvZ);
|
|
349
|
-
this.computeMaterial.uniforms.uImpulse.value = impulse;
|
|
350
|
-
this.computeMaterial.uniforms.uTime.value = elapsed;
|
|
351
|
-
|
|
352
|
-
if (this.cpuSampling) {
|
|
353
|
-
this.stepCpuSampler(delta, elapsed, impactUvX, impactUvZ, impactWorldX, impactWorldZ, energy, emitting, impulse);
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
const previousTarget = this.renderer.getRenderTarget();
|
|
357
|
-
this.renderer.setRenderTarget(this.write);
|
|
358
|
-
this.renderer.render(this.computeScene, this.computeCamera);
|
|
359
|
-
this.renderer.setRenderTarget(previousTarget);
|
|
360
|
-
[this.read, this.write] = [this.write, this.read];
|
|
361
|
-
this.material.uniforms.uHeightMap.value = this.read.texture;
|
|
362
|
-
this.material.uniforms.uTime.value = elapsed;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
stepCpuSampler(
|
|
366
|
-
delta: number,
|
|
367
|
-
elapsed: number,
|
|
368
|
-
impactUvX: number,
|
|
369
|
-
impactUvZ: number,
|
|
370
|
-
impactWorldX: number,
|
|
371
|
-
impactWorldZ: number,
|
|
372
|
-
energy: number,
|
|
373
|
-
emitting: boolean,
|
|
374
|
-
impulse: number,
|
|
375
|
-
): void {
|
|
376
|
-
const width = this.cpuWidth;
|
|
377
|
-
const height = this.cpuHeight;
|
|
378
|
-
const current = this.cpuCurrent;
|
|
379
|
-
const previous = this.cpuPrevious;
|
|
380
|
-
const next = this.cpuNext;
|
|
381
|
-
const microPulse = 0.72 + 0.28 * Math.sin(elapsed * 19);
|
|
382
|
-
const sourceAX = 0.22 + Math.sin(elapsed * 0.19) * 0.08;
|
|
383
|
-
const sourceAZ = 0.31 + Math.cos(elapsed * 0.16) * 0.09;
|
|
384
|
-
const sourceBX = 0.72 + Math.cos(elapsed * 0.13) * 0.09;
|
|
385
|
-
const sourceBZ = 0.68 + Math.sin(elapsed * 0.17) * 0.08;
|
|
386
|
-
|
|
387
|
-
for (let z = 0; z < height; z++) {
|
|
388
|
-
const uvZ = (z + 0.5) / height;
|
|
389
|
-
const zEdge = Math.min(1, uvZ / 0.055, (1 - uvZ) / 0.055);
|
|
390
|
-
for (let x = 0; x < width; x++) {
|
|
391
|
-
const index = z * width + x;
|
|
392
|
-
const uvX = (x + 0.5) / width;
|
|
393
|
-
const left = current[z * width + Math.max(0, x - 1)];
|
|
394
|
-
const right = current[z * width + Math.min(width - 1, x + 1)];
|
|
395
|
-
const down = current[Math.max(0, z - 1) * width + x];
|
|
396
|
-
const up = current[Math.min(height - 1, z + 1) * width + x];
|
|
397
|
-
const laplacian = left + right + down + up - 4 * current[index];
|
|
398
|
-
let nextHeight = (2 * current[index] - previous[index]) + laplacian * 0.235;
|
|
399
|
-
nextHeight *= 0.9925;
|
|
400
|
-
|
|
401
|
-
const dx = (uvX - impactUvX) * 2.2;
|
|
402
|
-
const dz = uvZ - impactUvZ;
|
|
403
|
-
nextHeight += Math.exp(-(dx * dx + dz * dz) * 420) * impulse * microPulse;
|
|
404
|
-
|
|
405
|
-
const ambientAX = (uvX - sourceAX) * 1.75;
|
|
406
|
-
const ambientAZ = uvZ - sourceAZ;
|
|
407
|
-
const ambientBX = (uvX - sourceBX) * 1.55;
|
|
408
|
-
const ambientBZ = uvZ - sourceBZ;
|
|
409
|
-
const distanceA = Math.hypot(ambientAX, ambientAZ);
|
|
410
|
-
const distanceB = Math.hypot(ambientBX, ambientBZ);
|
|
411
|
-
const ambientWaves = Math.sin(distanceA * 47 - elapsed * 2.15) * Math.exp(-distanceA * 3.8)
|
|
412
|
-
+ Math.sin(distanceB * 39 - elapsed * 1.72 + 1.4) * Math.exp(-distanceB * 3.5);
|
|
413
|
-
nextHeight += ambientWaves * 0.000028;
|
|
414
|
-
const centeredX = uvX - 0.5;
|
|
415
|
-
const centeredZ = uvZ - 0.5;
|
|
416
|
-
const wallResponse = 0.34 + 0.66 * Math.pow(Math.max(Math.abs(centeredX), Math.abs(centeredZ)) * 2, 2);
|
|
417
|
-
nextHeight += (centeredX * this.motionImpulse.x + centeredZ * this.motionImpulse.y) * wallResponse;
|
|
418
|
-
const xEdge = Math.min(1, uvX / 0.035, (1 - uvX) / 0.035);
|
|
419
|
-
nextHeight *= THREE.MathUtils.lerp(0.86, 1, Math.max(0, Math.min(xEdge, zEdge)));
|
|
420
|
-
next[index] = nextHeight;
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
this.cpuPrevious = current;
|
|
425
|
-
this.cpuCurrent = next;
|
|
426
|
-
this.cpuNext = previous;
|
|
427
|
-
this.cpuLastDelta = Math.max(delta, 1 / 120);
|
|
428
|
-
this.cpuImpactX = impactWorldX;
|
|
429
|
-
this.cpuImpactZ = impactWorldZ;
|
|
430
|
-
this.cpuImpactEnergy = energy;
|
|
431
|
-
this.cpuEmitting = emitting;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
sampleSurface(worldX: number, worldZ: number, target: WaterSurfaceSample = {}): WaterSurfaceSample {
|
|
435
|
-
target.height = 0;
|
|
436
|
-
target.velocityY = 0;
|
|
437
|
-
target.slopeX = 0;
|
|
438
|
-
target.slopeZ = 0;
|
|
439
|
-
target.flowX = 0;
|
|
440
|
-
target.flowZ = 0;
|
|
441
|
-
target.impact = 0;
|
|
442
|
-
if (!this.cpuSampling || !this.cpuCurrent) return target;
|
|
443
|
-
|
|
444
|
-
const sample = (field: Float32Array, u: number, v: number): number => {
|
|
445
|
-
const x = THREE.MathUtils.clamp(u, 0, 1) * (this.cpuWidth - 1);
|
|
446
|
-
const z = THREE.MathUtils.clamp(v, 0, 1) * (this.cpuHeight - 1);
|
|
447
|
-
const x0 = Math.floor(x);
|
|
448
|
-
const z0 = Math.floor(z);
|
|
449
|
-
const x1 = Math.min(this.cpuWidth - 1, x0 + 1);
|
|
450
|
-
const z1 = Math.min(this.cpuHeight - 1, z0 + 1);
|
|
451
|
-
const tx = x - x0;
|
|
452
|
-
const tz = z - z0;
|
|
453
|
-
const a = THREE.MathUtils.lerp(field[z0 * this.cpuWidth + x0], field[z0 * this.cpuWidth + x1], tx);
|
|
454
|
-
const b = THREE.MathUtils.lerp(field[z1 * this.cpuWidth + x0], field[z1 * this.cpuWidth + x1], tx);
|
|
455
|
-
return THREE.MathUtils.lerp(a, b, tz);
|
|
456
|
-
};
|
|
457
|
-
|
|
458
|
-
const u = (worldX - this.basinMinX) / Math.max(this.basinMaxX - this.basinMinX, 0.001);
|
|
459
|
-
const v = (worldZ - (this.basinCenterZ - this.basinHalfZ)) / Math.max(this.basinHalfZ * 2, 0.001);
|
|
460
|
-
const du = 1 / Math.max(this.cpuWidth - 1, 1);
|
|
461
|
-
const dv = 1 / Math.max(this.cpuHeight - 1, 1);
|
|
462
|
-
const center = sample(this.cpuCurrent, u, v);
|
|
463
|
-
const previous = sample(this.cpuPrevious, u, v);
|
|
464
|
-
const left = sample(this.cpuCurrent, u - du, v);
|
|
465
|
-
const right = sample(this.cpuCurrent, u + du, v);
|
|
466
|
-
const down = sample(this.cpuCurrent, u, v - dv);
|
|
467
|
-
const up = sample(this.cpuCurrent, u, v + dv);
|
|
468
|
-
const cellX = (this.basinMaxX - this.basinMinX) * du;
|
|
469
|
-
const cellZ = this.basinHalfZ * 2 * dv;
|
|
470
|
-
const displacementScale = 0.52;
|
|
471
|
-
const ambientCenter = ambientSurfaceHeight(u, v, this.elapsed) + sloshSurfaceHeight(u, v, this.slosh);
|
|
472
|
-
const ambientPrevious = ambientSurfaceHeight(u, v, this.elapsed - this.cpuLastDelta)
|
|
473
|
-
+ sloshSurfaceHeight(u, v, this.previousSlosh);
|
|
474
|
-
const ambientLeft = ambientSurfaceHeight(u - du, v, this.elapsed) + sloshSurfaceHeight(u - du, v, this.slosh);
|
|
475
|
-
const ambientRight = ambientSurfaceHeight(u + du, v, this.elapsed) + sloshSurfaceHeight(u + du, v, this.slosh);
|
|
476
|
-
const ambientDown = ambientSurfaceHeight(u, v - dv, this.elapsed) + sloshSurfaceHeight(u, v - dv, this.slosh);
|
|
477
|
-
const ambientUp = ambientSurfaceHeight(u, v + dv, this.elapsed) + sloshSurfaceHeight(u, v + dv, this.slosh);
|
|
478
|
-
|
|
479
|
-
target.height = center * displacementScale + ambientCenter;
|
|
480
|
-
target.velocityY = ((center - previous) * displacementScale + ambientCenter - ambientPrevious)
|
|
481
|
-
/ this.cpuLastDelta;
|
|
482
|
-
target.slopeX = ((right - left) * displacementScale + ambientRight - ambientLeft)
|
|
483
|
-
/ Math.max(cellX * 2, 0.001);
|
|
484
|
-
target.slopeZ = ((up - down) * displacementScale + ambientUp - ambientDown)
|
|
485
|
-
/ Math.max(cellZ * 2, 0.001);
|
|
486
|
-
target.flowX = -target.slopeX * 1.35;
|
|
487
|
-
target.flowZ = -target.slopeZ * 1.35;
|
|
488
|
-
|
|
489
|
-
if (this.cpuEmitting) {
|
|
490
|
-
const dx = worldX - this.cpuImpactX;
|
|
491
|
-
const dz = worldZ - this.cpuImpactZ;
|
|
492
|
-
const distanceSq = dx * dx + dz * dz;
|
|
493
|
-
const inverseDistance = 1 / Math.max(Math.sqrt(distanceSq), 0.06);
|
|
494
|
-
const sourceStrength = Math.min(this.cpuImpactEnergy * 0.075, 1.15) * Math.exp(-distanceSq / 0.48);
|
|
495
|
-
target.flowX += sourceStrength * (0.42 + dx * inverseDistance * 0.68);
|
|
496
|
-
target.flowZ += sourceStrength * dz * inverseDistance * 0.92;
|
|
497
|
-
target.impact = sourceStrength * Math.exp(-distanceSq / 0.095);
|
|
498
|
-
}
|
|
499
|
-
return target;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
dispose(): void {
|
|
503
|
-
this.read.dispose();
|
|
504
|
-
this.write.dispose();
|
|
505
|
-
this.computeMaterial.dispose();
|
|
506
|
-
this.computeQuad.geometry.dispose();
|
|
507
|
-
this.material.dispose();
|
|
508
|
-
this.mesh.geometry.dispose();
|
|
509
|
-
}
|
|
510
|
-
}
|
package/WaterFlow/WaterFlow.d.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import { ScreenSpaceFluidPass } from './ScreenSpaceFluidPass';
|
|
3
|
-
import type { BasinConfig, FluidParameters, FluidQuality, ReservoirState, WaterFlowBaseTextures, WaterFlowOptions, WaterFlowRenderOptions } from './types';
|
|
4
|
-
/**
|
|
5
|
-
* WaterFlow —— 可独立使用的水流对象封装。
|
|
6
|
-
*
|
|
7
|
-
* 把「GPGPU 粒子流体模拟」与「屏幕空间流体后处理」打包成一个对象:
|
|
8
|
-
* 对外只暴露 update / 参数 setter / createPass,调用方无需关心 GPU ping-pong、
|
|
9
|
-
* SPH 场、深度重建等内部细节。
|
|
10
|
-
*
|
|
11
|
-
* 两种渲染模式:
|
|
12
|
-
* A. 自渲染模式(默认):createPass(scene, camera) 不传 base 纹理。pass 内部
|
|
13
|
-
* 自己把主场景渲到带深度的缓冲,再与粒子深度合成。需要作为后处理链一环。
|
|
14
|
-
* B. 注入基础纹理模式:createPass(scene, camera, baseTextures),其中
|
|
15
|
-
* baseTextures = { colorTexture, depthTexture, depthMode }。pass 直接消费
|
|
16
|
-
* 调用方已有的基础颜色/深度纹理,不再自渲染主场景 —— 与 three-base「共用
|
|
17
|
-
* base 纹理 / base 深度图」的后处理方案完全契合,省掉一遍主场景渲染。
|
|
18
|
-
* depthMode: 'standard'(默认,普通透视深度)| 'logarithmic'
|
|
19
|
-
* (three-base 开 logarithmicDepthBuffer 时,与 frosted_glass_pass 解码对齐)。
|
|
20
|
-
*
|
|
21
|
-
* 集成到 three-base(手写 fsQuad 后处理):
|
|
22
|
-
* const water = new WaterFlow(renderer, { size: 200 });
|
|
23
|
-
* const pass = water.createPass(scene, camera, {
|
|
24
|
-
* colorTexture: this.baseRenderTarget.texture,
|
|
25
|
-
* depthTexture: this.baseDepthTexture,
|
|
26
|
-
* depthMode: 'logarithmic',
|
|
27
|
-
* });
|
|
28
|
-
* // 每帧:先 renderer.setRenderTarget(baseRenderTarget); renderer.render(scene, camera);
|
|
29
|
-
* // 再 renderVisibleDepthPass(renderer, camera, scene, depthRenderTarget); // 写 baseDepthTexture
|
|
30
|
-
* // 然后 water.update(dt, elapsed);
|
|
31
|
-
* // 最后 setRenderTarget(screenRT); fsQuad.render(renderer, pass.material);
|
|
32
|
-
* // 注意:WaterFlow 的 composite 是纯消费 base 纹理的 fsQuad,可直接放进你的链。
|
|
33
|
-
*/
|
|
34
|
-
export declare class WaterFlow {
|
|
35
|
-
private readonly renderer;
|
|
36
|
-
private width;
|
|
37
|
-
private height;
|
|
38
|
-
private readonly scale;
|
|
39
|
-
private readonly simulation;
|
|
40
|
-
/** createPass 之前为 null;各渲染参数 setter 走 `this.pass?.xxx` 可选链。 */
|
|
41
|
-
private pass;
|
|
42
|
-
constructor(renderer: THREE.WebGLRenderer, options?: WaterFlowOptions);
|
|
43
|
-
get supported(): boolean;
|
|
44
|
-
get count(): number;
|
|
45
|
-
get positionTexture(): THREE.Texture | null;
|
|
46
|
-
get velocityTexture(): THREE.Texture | null;
|
|
47
|
-
/**
|
|
48
|
-
* 生成屏幕空间流体 pass 并接入渲染链。
|
|
49
|
-
* @param scene 主场景(注入 base 纹理模式下不会被 pass 自渲染)
|
|
50
|
-
* @param camera 主相机(粒子投影 / spray 渲染需要)
|
|
51
|
-
* @param baseTextures 传入即启用「注入基础纹理」模式:pass 直接消费调用方颜色+深度,不再自渲染主场景。
|
|
52
|
-
* @returns 不支持浮点纹理时返回 null
|
|
53
|
-
*
|
|
54
|
-
* ⚠️ ScreenSpaceFluidPass 按**透视相机**建模(setSize 无条件读 `camera.fov` 算 pointScale、
|
|
55
|
-
* depthMaterial 走 projectionMatrix 重建深度),故此处收 PerspectiveCamera。
|
|
56
|
-
* ThreeBase.getCamera() 的返回类型是 `PerspectiveCamera | OrthographicCamera`,
|
|
57
|
-
* 调用处已显式窄化(见 ThreeBase 内 waterFlow.createPass 那行)。
|
|
58
|
-
* ⚠️ 若真用正交相机,fov 为 undefined → pointScale 变 NaN(**原 JS 既有行为,本次未改运行时**)。
|
|
59
|
-
*/
|
|
60
|
-
createPass(scene: THREE.Scene, camera: THREE.PerspectiveCamera, baseTextures?: WaterFlowBaseTextures | null): ScreenSpaceFluidPass | null;
|
|
61
|
-
/** 推进一帧模拟。 */
|
|
62
|
-
update(delta: number, elapsed: number): void;
|
|
63
|
-
setParameters(p: FluidParameters): void;
|
|
64
|
-
setReservoirState(state: ReservoirState): void;
|
|
65
|
-
setContainerMotion(accelerationX?: number, accelerationZ?: number): void;
|
|
66
|
-
setBasin(basin: BasinConfig): void;
|
|
67
|
-
/** 运行时改喷流起点(喷嘴)坐标 */
|
|
68
|
-
setNozzle(x: number, y: number, z: number): void;
|
|
69
|
-
/** 运行时改喷流方向(轴向,会被归一化) */
|
|
70
|
-
setJetDirection(dx: number, dy: number, dz: number): void;
|
|
71
|
-
/** 运行时开关粒子与 basin/地面碰撞回弹 */
|
|
72
|
-
setCollision(enabled: boolean): void;
|
|
73
|
-
reset(): void;
|
|
74
|
-
setAirFraction(value: number): void;
|
|
75
|
-
setParticleRadius(value: number): void;
|
|
76
|
-
setRetainedFluidVisible(value: boolean): void;
|
|
77
|
-
setQuality(quality: FluidQuality): void;
|
|
78
|
-
/** 运行时刷新注入的基础纹理(three-base resize / 切换 baseRT 时调用)。 */
|
|
79
|
-
setBaseTextures(baseTextures: WaterFlowBaseTextures): void;
|
|
80
|
-
resize(width: number, height: number): void;
|
|
81
|
-
/**
|
|
82
|
-
* 函数式渲染入口(three-base 手写 fsQuad 后处理链):直接消费基础颜色/深度纹理,
|
|
83
|
-
* 把水面合成回当前渲染目标(与 frosted_glass_pass 同构,省去自渲染主场景)。
|
|
84
|
-
*/
|
|
85
|
-
renderInto(renderer: THREE.WebGLRenderer, opts: WaterFlowRenderOptions): void;
|
|
86
|
-
dispose(): void;
|
|
87
|
-
}
|