| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- package shader
- const shaderLineDashedVertex = `
- #version {{.Version}}
- {{?attributes}}
- // Model uniforms
- uniform mat4 MVP;
- // Material uniforms
- uniform float Scale;
- // Outputs for fragment shader
- out vec3 Color;
- out float vLineDistance;
- void main() {
- vLineDistance = Scale * VertexDistance;
- Color = VertexColor;
- gl_Position = MVP * vec4(VertexPosition, 1.0);
- }
- `
- //
- // Fragment Shader template
- //
- const shaderLineDashedFrag = `
- #version {{.Version}}
- // Inputs from vertex shader
- in vec3 Color;
- in float vLineDistance;
- // Material uniforms
- uniform float DashSize;
- uniform float TotalSize;
- // Output
- out vec4 FragColor;
- void main() {
- if (mod(vLineDistance, TotalSize) > DashSize) {
- discard;
- }
- FragColor = vec4(Color, 1.0);
- }
- `
|