Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. const drawParticles = this.regl({
  2. frag: `
  3. precision mediump float;
  4. uniform vec4 color;
  5. void main() {
  6. if (length(gl_PointCoord.xy - 0.5) > 0.5) {
  7. discard;
  8. }
  9. gl_FragColor = color;
  10. }`,
  11.  
  12. vert: `
  13. precision lowp float;
  14. attribute vec2 position;
  15. uniform float pointSize;
  16.  
  17. void main() {
  18. gl_PointSize = pointSize;
  19. gl_Position = vec4(position, 0, 1);
  20. }`,
  21.  
  22. attributes: {
  23. position: this.positionBuffer,
  24. },
  25.  
  26. uniforms: {
  27. // the batchId parameter gives the index of the command
  28. pointSize: 20,
  29. color: ({tick}, props, batchId) => [
  30. batchId > 15 ? 1 : 0,
  31. 1,
  32. 1,
  33. 1,
  34. ],
  35. },
  36.  
  37. primitive: 'points',
  38.  
  39. count: 30,
  40. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement