Nitlanguage.org
  • Nitdoc
  • gamnit
  • flat
  • flat_core
  • Simple2dProgram
  • fragment_shader_source=

protected fun fragment_shader_source=(fragment_shader_source: Text)

gamnit :: Simple2dProgram :: fragment_shader_source=

  • Doc
  • Linearization

Summary

  • Property definitions

  • gamnit::flat_core$Simple2dProgram$fragment_shader_source=

Property definitions

gamnit $ Simple2dProgram :: fragment_shader_source=
	redef var fragment_shader_source = """
		precision mediump float;

		// Does this object use a texture?
		uniform bool use_texture;

		// Texture to apply on this object
		uniform sampler2D texture0;

		// Texture to apply on this object
		uniform sampler2D animation;

		// Input from the vertex shader
		varying vec4 v_color;
		varying vec2 v_coord;
		varying float v_animated;

		void main()
		{
			if (v_animated > 0.5) {
				gl_FragColor = v_color * texture2D(animation, v_coord);
				if (gl_FragColor.a <= 0.01) discard;
			} else if (use_texture) {
				gl_FragColor = v_color * texture2D(texture0, v_coord);
				if (gl_FragColor.a <= 0.01) discard;
			} else {
				gl_FragColor = v_color;
			}
		}
		""" @ glsl_fragment_shader
lib/gamnit/flat/flat_core.nit:722,2--751,28
Nit tools. Version .