Nitlanguage.org
  • Nitdoc
  • gamnit
  • dynamic_resolution
  • DynamicResolutionProgram
  • defaultinit

init defaultinit

gamnit :: DynamicResolutionProgram :: defaultinit

  • Doc
  • Linearization

Summary

  • Property definitions

  • gamnit::dynamic_resolution$DynamicResolutionProgram$defaultinit

Property definitions

gamnit $ DynamicResolutionProgram :: defaultinit
private class DynamicResolutionProgram
	super GamnitProgramFromSource

	redef var vertex_shader_source = """
		// Vertex coordinates
		attribute vec3 coord;

		// Vertex coordinates on textures
		attribute vec2 tex_coord;

		// Output to the fragment shader
		varying vec2 v_coord;

		void main()
		{
			gl_Position = vec4(coord, 1.0);
			v_coord = tex_coord;
		}
		""" @ glsl_vertex_shader

	redef var fragment_shader_source = """
		precision mediump float;

		// Virtual screen texture / color attachment
		uniform sampler2D texture0;

		// Input from the vertex shader
		varying vec2 v_coord;

		// Ratio of the virtual screen to draw
		uniform float ratio;

		void main()
		{
			gl_FragColor = texture2D(texture0, v_coord*ratio);
		}
		""" @ glsl_fragment_shader

	# Vertices coordinates
	var coord = attributes["coord"].as(AttributeVec3) is lazy

	# Coordinates on the textures, per vertex
	var tex_coord = attributes["tex_coord"].as(AttributeVec2) is lazy

	# Virtual screen texture / color attachment
	var texture = uniforms["texture0"].as(UniformSampler2D) is lazy

	# Ratio of the virtual screen to draw
	var ratio = uniforms["ratio"].as(UniformFloat) is lazy
end
lib/gamnit/dynamic_resolution.nit:305,1--354,3
Nit standard library. Version .