Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const drawParticles = this.regl({
- frag: `
- precision mediump float;
- uniform vec4 color;
- void main() {
- if (length(gl_PointCoord.xy - 0.5) > 0.5) {
- discard;
- }
- gl_FragColor = color;
- }`,
- vert: `
- precision lowp float;
- attribute vec2 position;
- uniform float pointSize;
- void main() {
- gl_PointSize = pointSize;
- gl_Position = vec4(position, 0, 1);
- }`,
- attributes: {
- position: this.positionBuffer,
- },
- uniforms: {
- // the batchId parameter gives the index of the command
- pointSize: 20,
- color: ({tick}, props, batchId) => [
- batchId > 15 ? 1 : 0,
- 1,
- 1,
- 1,
- ],
- },
- primitive: 'points',
- count: 30,
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement