Sha256: 23c7951431a761ad50b06d3a5ca2ea10a785d17a7cc10bc1ebb5645f358bc28a

Contents?: true

Size: 1004 Bytes

Versions: 11

Compression:

Stored size: 1004 Bytes

Contents

#version 110

// Use a stencil texture to selectively draw. Drawing of the image will occur
// where the stencil is transparent (or only where the stencil is opaque if
// inverted).
//
// Partial transparency in the stencil will allow the image to be drawn
// partially too.

varying vec4 var_Color;
varying vec2 var_TexCoord0; // The texture/image to draw.
varying vec2 var_TexCoord1; // The stencil (multitexture).

uniform sampler2D in_Texture0; // The texture/image to draw.
uniform sampler2D in_Texture1; // The stencil (multitexture).
uniform bool in_Inverted; // true to draw in opaque areas / false to draw in transparent areas.
 
void main()
{
  vec4 texColor = texture2D(in_Texture0, var_TexCoord0);
  vec4 maskColor = texture2D(in_Texture1, var_TexCoord1);

  // Only draw the texture where the stencil is transparent (unless inverted).
  float mask_alpha = in_Inverted ? (1.0 - maskColor.a) : maskColor.a;

  gl_FragColor = vec4(texColor.r, texColor.g, texColor.b, texColor.a - mask_alpha);
}

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
danabr75-ashton-0.1.5 lib/ashton/shaders/stencil.frag
ashton-0.1.6 lib/ashton/shaders/stencil.frag
ashton-0.1.5 lib/ashton/shaders/stencil.frag
ashton-0.1.4 lib/ashton/shaders/stencil.frag
ashton-0.1.3 lib/ashton/shaders/stencil.frag
ashton-0.1.2 lib/ashton/shaders/stencil.frag
ashton-0.1.1 lib/ashton/shaders/stencil.frag
ashton-0.1.0 lib/ashton/shaders/stencil.frag
ashton-0.0.4alpha lib/ashton/shaders/stencil.frag
ashton-0.0.3alpha lib/ashton/shaders/stencil.frag
ashton-0.0.2alpha lib/ashton/shaders/stencil.frag