Nitlanguage.org
  • Nitdoc
  • gamnit
  • depth
  • particles
  • ParticleProgram
  • vertex_shader_source=

protected fun vertex_shader_source=(vertex_shader_source: Text)

gamnit :: ParticleProgram :: vertex_shader_source=

  • Doc
  • Linearization

Summary

  • Property definitions

  • gamnit$ParticleProgram$vertex_shader_source=

Property definitions

gamnit $ ParticleProgram :: vertex_shader_source=
	redef var vertex_shader_source = """
		// Coordinates of particle effects
		attribute vec4 center;

		// Particles color tint
		attribute vec4 color;
		varying vec4 v_color;

		// Per particle scaling
		attribute float scale;

		// Model view projection matrix
		uniform mat4 mvp;

		// Time-to-live of each particle
		attribute float ttl;

		// Creation time of each particle
		attribute float ot;

		// Current time
		uniform float t;

		void main()
		{
			// Pass varyings to the fragment shader
			v_color = color;

			float dt = t - ot;
			float pt = dt/ttl;

			// Discard expired or not yet created particles
			if (dt > ttl || dt < 0.0) {
				gl_PointSize = 0.0;
				return;
			}

			{{{vertex_shader_core}}}
		}
		"""
lib/gamnit/depth/particles.nit:172,2--211,5
Nit standard library. Version .