2020-04-07 21:44:46 +02:00
|
|
|
class Visual {
|
|
|
|
constructor() {
|
|
|
|
this.data = []; //for drawing
|
|
|
|
this.dataArray = [];
|
|
|
|
}
|
2020-08-01 21:51:54 +02:00
|
|
|
|
|
|
|
updateData() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-04-07 21:44:46 +02:00
|
|
|
draw() {
|
|
|
|
}
|
|
|
|
|
|
|
|
setup() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class VisualDrawer {
|
2020-08-01 21:51:54 +02:00
|
|
|
constructor() {
|
|
|
|
this.visuals = {
|
|
|
|
"sphere": new Sphere(),
|
|
|
|
"wave": new Wave(),
|
|
|
|
"water": new Water()
|
|
|
|
}
|
|
|
|
this.c = "wave";
|
|
|
|
}
|
2020-04-07 21:44:46 +02:00
|
|
|
|
2020-08-01 21:51:54 +02:00
|
|
|
init() {
|
|
|
|
this.visuals[this.c].setup();
|
|
|
|
this.updateLoop();
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(visual) {
|
|
|
|
if (this.visuals[visual] != null) {
|
|
|
|
this.c = visual;
|
|
|
|
this.visuals[this.c].setup();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
updateLoop() {
|
|
|
|
let self = this;
|
|
|
|
let pro = shaderHandler.use(self.c);
|
|
|
|
let vis = self.visuals[self.c];
|
|
|
|
vis.updateData();
|
|
|
|
vis.draw(pro);
|
|
|
|
requestAnimationFrame(self.updateLoop.bind(self))
|
|
|
|
}
|
2020-04-07 21:44:46 +02:00
|
|
|
}
|