Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | /* * Creates a checkerboard pattern but could be used for * horizontal or vertical strips. * * Returns 1.0 where board test hits. * ``` * vec3 white = vec3(1.0,1.0,1.0); * vec3 black = vec3(1.0,1.0,1.0); * vec2 p = vec2(v_position.x, v_position.y); * * float checkerboard = deguShape2dCheckerboard(p, 10.0, 10.0); * float verticalStrips = deguShape2dCheckerboard(p, 0.0, 10.0); * float horizontalStrips = deguShape2dCheckerboard(p, 10.0, 0.0); * * vec3 color = mix(white, black, checkerboard); * gl_FragColor = vec4(color, 1.0); * ``` * * @see http://pixelshaders.com/examples/sampling-displacement.html */ const deguShape2dCheckerboard = ` float deguShape2dCheckerBoard(vec2 p, float xCount, float yCount) { float x = floor(p.x * xCount); float y = floor(p.y * yCount); return mod(x + y, 2.0); } `; // eslint-disable-next-line @typescript-eslint/no-explicit-any export const deguShape2d = (three: any) => { three.ShaderChunk.deguShape2d = ` ${deguShape2dCheckerboard} `; }; |