Do a double frequency spectrum instead of a single one

Just looks nicer in its current iteration
This commit is contained in:
Tristan Daniël Maat 2022-08-14 00:01:48 +01:00
parent 4336c718fc
commit c962a9f8b2
Signed by: tlater
GPG key ID: 49670FD774E43268
2 changed files with 4 additions and 6 deletions

View file

@ -5,7 +5,7 @@ import { Cube } from "./cube";
import vertexSource from "./shaders/vertices.glsl"; import vertexSource from "./shaders/vertices.glsl";
import fragmentSource from "./shaders/fragments.glsl"; import fragmentSource from "./shaders/fragments.glsl";
const ROTATION_SPEED = 0.25; const ROTATION_SPEED = 0.0;
const BACKGROUND_COLOR = [0.0588235294118, 0.0588235294118, 0.0588235294118]; const BACKGROUND_COLOR = [0.0588235294118, 0.0588235294118, 0.0588235294118];
class RendererError extends Error {} class RendererError extends Error {}

View file

@ -26,11 +26,9 @@ void main() {
// they should align to the X axis. // they should align to the X axis.
float instanceX = float instanceX =
float(gl_InstanceID * 2) * abs(aVertexPosition.x) + aVertexPosition.x; float(gl_InstanceID * 2) * abs(aVertexPosition.x) + aVertexPosition.x;
// Since we want to scale the boxes by their frequencies, make the Y // To scale the boxes by their frequencies, scale vertex Y by the
// positions of any vertices that are > 0 (1, because this is a // frequency.
// cube) = the height of the frequency. float vertexY = aVertexPosition.y * aHeight;
float vertexY =
aVertexPosition.y > 0.0 ? aVertexPosition.y * aHeight : aVertexPosition.y;
gl_Position = uProjectionMatrix * uModelViewMatrix * gl_Position = uProjectionMatrix * uModelViewMatrix *
vec4(instanceX, vertexY, aVertexPosition.zw); vec4(instanceX, vertexY, aVertexPosition.zw);