* draw pen skin lines and stamps to a framebuffer * skip reading pixels and draw stamp to framebuffer * update silhouette with readPixels * draw pen canvas to buffer when its dirty Composite lines and stamps on browser preferred side (cpu/gpu) until the export texture is needed. Then blend the canvas with the current buffer contents. Updating this way invalidates useProgram optimization and the renderer currently does not have a way to know this. * draw lines on framebuffer through fragment shader * optimize draw regions and pen skin matrix creation * control draw regions * mobile gpus need high precision floats for line drawing * optimize cpu pen line math * sampled pen line caps * sampleless pen skin lines, lint, document pen skin buffer ops * add PenSkin._canvasDirty to constructor * remove DRAW_MODE_line * comment PenSkin reused memory, use memory in drawRectangle * turn draw region id's into optional method handlers A region ID object may have an enter and exit method on it that are used by default when entering and exiting that region. * remove old DRAW_MODE_line precision setting * standardize vert lines on 4 spaces * fixup! turn draw region id's into optional method handlers * do not draw when updating pen skin silhouette * do not premultiply stamp colors by alpha * fixup! do not draw when updating pen skin silhouette * do not premultiply line color * add a small rim around the line for aliasing * variable pen line alias amount * reverse offset pen line on y axis by relative alias amount Reverse the offset to keep small line overlap to a minimum. * fixup! reverse offset pen line on y axis by relative alias amount * medium precision gpu floats
23 lines
563 B
GLSL
23 lines
563 B
GLSL
uniform mat4 u_projectionMatrix;
|
|
uniform mat4 u_modelMatrix;
|
|
|
|
attribute vec2 a_position;
|
|
attribute vec2 a_texCoord;
|
|
|
|
varying vec2 v_texCoord;
|
|
|
|
#ifdef DRAW_MODE_lineSample
|
|
uniform float u_positionScalar;
|
|
#endif
|
|
|
|
void main() {
|
|
#ifdef DRAW_MODE_lineSample
|
|
vec2 position = a_position;
|
|
position.y = clamp(position.y * u_positionScalar, -0.5, 0.5);
|
|
gl_Position = u_projectionMatrix * u_modelMatrix * vec4(position, 0, 1);
|
|
#else
|
|
gl_Position = u_projectionMatrix * u_modelMatrix * vec4(a_position, 0, 1);
|
|
#endif
|
|
v_texCoord = a_texCoord;
|
|
}
|