Simulate thousands of n-Pendula (up to 32) with Position Based Dynamics
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

27 lines
644 B

#version 330 core
layout (location = 0) in vec3 vPos;
layout (location = 1) in vec3 vColor;
layout (location = 2) in float vMassRadius;
uniform mat3 VP;
uniform bool drawPoints;
uniform int simulationSizePixels;
uniform float simulationSizeMeters;
uniform float depthOffset;
out vec3 color;
void main() {
gl_Position = vec4(VP * vPos, 1.0);
if (drawPoints){
// Points always on top of neighbouring lines
gl_Position.z -= depthOffset * 0.5;
// PointSize is diameter in Pixels
gl_PointSize = vMassRadius / simulationSizeMeters * simulationSizePixels * 2;
} else {
color = vColor;
}
}