vertex.glsl 474 B

12345678910111213141516
  1. attribute float aScale;
  2. uniform float uPixelRatio;
  3. uniform float uTime;
  4. void main()
  5. {
  6. vec4 modelPosition = modelMatrix * vec4(position, 1.0);
  7. modelPosition.y += sin(uTime + modelPosition.x * 100.0) * aScale * 0.1;
  8. vec4 viewPosition = viewMatrix * modelPosition;
  9. vec4 projectionPosition = projectionMatrix * viewPosition;
  10. gl_Position = projectionPosition;
  11. gl_PointSize = 100.0 * aScale * uPixelRatio;
  12. gl_PointSize *= (1.0 / -viewPosition.z);
  13. }