-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlackHoleShader.js
18 lines (16 loc) · 979 Bytes
/
BlackHoleShader.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import Matrix4f from "./gl/Matrix4f.js";
import ShaderProgram from "./gl/ShaderProgram.js";
import Vector3f from "./gl/Vector3f.js";
const [vertexSource,fragmentSource] = await Promise.all((await Promise.all([fetch("./blackhole.vert"),fetch("./blackhole.frag")])).map(response=>response.text()));
/**
* @extends {ShaderProgram<{viewProjection:Matrix4f,centerPosition:Vector3f,cameraPosition:Vector3f,blackHoleMass:number,innerAccretionDiskRadius:number,outerAccretionDiskRadius:number,accretionDiskHeight:number,steps:number,stepSize:number,simulationRadius:number},{ACCRETION_DISK_ENABLED:boolean,TEAPOT_ENABLED:boolean}>}
*/
export default class BlackHoleShader extends ShaderProgram {
/**
* @param {WebGL2RenderingContext} gl
* @param {{ACCRETION_DISK_ENABLED:boolean,TEAPOT_ENABLED:boolean}} flags
*/
constructor(gl,flags){
super(gl,vertexSource,fragmentSource,{attribs:["position"],textures:["imageColors","imageRayData","starMap","noiseTexture"],flags});
}
}