| 949 | } |
| 950 | } |
| 951 | createShaderPass() { |
| 952 | this.advection = new Advection({ |
| 953 | cellScale: this.cellScale, |
| 954 | fboSize: this.fboSize, |
| 955 | dt: this.options.dt, |
| 956 | src: this.fbos.vel_0, |
| 957 | dst: this.fbos.vel_1, |
| 958 | }); |
| 959 | this.externalForce = new ExternalForce({ |
| 960 | cellScale: this.cellScale, |
| 961 | cursor_size: this.options.cursor_size, |
| 962 | dst: this.fbos.vel_1, |
| 963 | }); |
| 964 | this.viscous = new Viscous({ |
| 965 | cellScale: this.cellScale, |
| 966 | boundarySpace: this.boundarySpace, |
| 967 | viscous: this.options.viscous, |
| 968 | src: this.fbos.vel_1, |
| 969 | dst: this.fbos.vel_viscous1, |
| 970 | dst_: this.fbos.vel_viscous0, |
| 971 | dt: this.options.dt, |
| 972 | }); |
| 973 | this.divergence = new Divergence({ |
| 974 | cellScale: this.cellScale, |
| 975 | boundarySpace: this.boundarySpace, |
| 976 | src: this.fbos.vel_viscous0, |
| 977 | dst: this.fbos.div, |
| 978 | dt: this.options.dt, |
| 979 | }); |
| 980 | this.poisson = new Poisson({ |
| 981 | cellScale: this.cellScale, |
| 982 | boundarySpace: this.boundarySpace, |
| 983 | src: this.fbos.div, |
| 984 | dst: this.fbos.pressure_1, |
| 985 | dst_: this.fbos.pressure_0, |
| 986 | }); |
| 987 | this.pressure = new Pressure({ |
| 988 | cellScale: this.cellScale, |
| 989 | boundarySpace: this.boundarySpace, |
| 990 | src_p: this.fbos.pressure_0, |
| 991 | src_v: this.fbos.vel_viscous0, |
| 992 | dst: this.fbos.vel_0, |
| 993 | dt: this.options.dt, |
| 994 | }); |
| 995 | } |
| 996 | calcSize() { |
| 997 | const width = Math.max( |
| 998 | 1, |