| 1041 | } |
| 1042 | |
| 1043 | class Output { |
| 1044 | simulation: Simulation; |
| 1045 | scene: THREE.Scene; |
| 1046 | camera: THREE.Camera; |
| 1047 | output: THREE.Mesh; |
| 1048 | constructor() { |
| 1049 | this.simulation = new Simulation(); |
| 1050 | this.scene = new THREE.Scene(); |
| 1051 | this.camera = new THREE.Camera(); |
| 1052 | this.output = new THREE.Mesh( |
| 1053 | new THREE.PlaneGeometry(2, 2), |
| 1054 | new THREE.RawShaderMaterial({ |
| 1055 | vertexShader: face_vert, |
| 1056 | fragmentShader: color_frag, |
| 1057 | transparent: true, |
| 1058 | depthWrite: false, |
| 1059 | uniforms: { |
| 1060 | velocity: { value: this.simulation.fbos.vel_0!.texture }, |
| 1061 | boundarySpace: { value: new THREE.Vector2() }, |
| 1062 | palette: { value: paletteTex }, |
| 1063 | bgColor: { value: bgVec4 }, |
| 1064 | }, |
| 1065 | }) |
| 1066 | ); |
| 1067 | this.scene.add(this.output); |
| 1068 | } |
| 1069 | resize() { |
| 1070 | this.simulation.resize(); |
| 1071 | } |
| 1072 | render() { |
| 1073 | if (!Common.renderer) return; |
| 1074 | Common.renderer.setRenderTarget(null); |
| 1075 | // Clear the canvas with transparent black before rendering |
| 1076 | Common.renderer.clear(); |
| 1077 | Common.renderer.render(this.scene, this.camera); |
| 1078 | } |
| 1079 | update() { |
| 1080 | this.simulation.update(); |
| 1081 | this.render(); |
| 1082 | } |
| 1083 | } |
| 1084 | |
| 1085 | class WebGLManager implements LiquidEtherWebGL { |
| 1086 | props: any; |
nothing calls this directly
no outgoing calls
no test coverage detected