| 1188 | webglRef.current = webgl; |
| 1189 | |
| 1190 | const applyOptionsFromProps = () => { |
| 1191 | if (!webglRef.current) return; |
| 1192 | const sim = webglRef.current.output?.simulation; |
| 1193 | if (!sim) return; |
| 1194 | const prevRes = sim.options.resolution; |
| 1195 | Object.assign(sim.options, { |
| 1196 | mouse_force: mouseForce, |
| 1197 | cursor_size: cursorSize, |
| 1198 | isViscous, |
| 1199 | viscous, |
| 1200 | iterations_viscous: iterationsViscous, |
| 1201 | iterations_poisson: iterationsPoisson, |
| 1202 | dt, |
| 1203 | BFECC, |
| 1204 | resolution, |
| 1205 | isBounce, |
| 1206 | }); |
| 1207 | if (resolution !== prevRes) sim.resize(); |
| 1208 | }; |
| 1209 | applyOptionsFromProps(); |
| 1210 | webgl.start(); |
| 1211 | |