rabbit-ear
Version:
origami design library
76 lines (73 loc) • 1.96 kB
JavaScript
/* Rabbit Ear 0.9.4 alpha 2024-04-20 (c) Kraft, GNU GPLv3 License */
const cp_300_frag = `
precision highp float;
precision mediump float;
in vec3 blend_color;
out vec4 outColor;
void main() {
outColor = vec4(blend_color.rgb, 1);
}
`;
const cp_100_frag = `
precision mediump float;
varying vec3 blend_color;
void main () {
gl_FragColor = vec4(blend_color.rgb, 1);
}
`;
const thick_edges_300_vert = `
uniform mat4 u_matrix;
uniform float u_strokeWidth;
in vec2 v_position;
in vec3 v_color;
in vec2 edge_vector;
in vec2 vertex_vector;
out vec3 blend_color;
void main () {
float sign = vertex_vector[0];
float halfWidth = u_strokeWidth * 0.5;
vec2 side = normalize(vec2(edge_vector.y * sign, -edge_vector.x * sign)) * halfWidth;
gl_Position = u_matrix * vec4(side + v_position, 0, 1);
blend_color = v_color;
}
`;
const thick_edges_100_vert = `
uniform mat4 u_matrix;
uniform float u_strokeWidth;
attribute vec2 v_position;
attribute vec3 v_color;
attribute vec2 edge_vector;
attribute vec2 vertex_vector;
varying vec3 blend_color;
void main () {
float sign = vertex_vector[0];
float halfWidth = u_strokeWidth * 0.5;
vec2 side = normalize(vec2(edge_vector.y * sign, -edge_vector.x * sign)) * halfWidth;
gl_Position = u_matrix * vec4(side + v_position, 0, 1);
blend_color = v_color;
}
`;
const cp_100_vert = `
uniform mat4 u_matrix;
uniform vec3 u_cpColor;
attribute vec2 v_position;
varying vec3 blend_color;
void main () {
gl_Position = u_matrix * vec4(v_position, 0, 1);
blend_color = u_cpColor;
}
`;
const cp_300_vert = `
uniform mat4 u_matrix;
uniform vec3 u_cpColor;
in vec2 v_position;
out vec3 blend_color;
void main () {
gl_Position = u_matrix * vec4(v_position, 0, 1);
blend_color = u_cpColor;
}
`;
export { cp_100_frag, cp_100_vert, cp_300_frag, cp_300_vert, thick_edges_100_vert, thick_edges_300_vert };