gamnit :: SelectionProgram :: color_id=
ID as a colorgamnit :: SelectionProgram :: coord=
Vertices coordinatesgamnit :: SelectionProgram :: map_diffuse=
Diffuse texture unitgamnit :: SelectionProgram :: mvp=
Model view projection matrixgamnit :: SelectionProgram :: rotation=
Rotation matrixgamnit :: SelectionProgram :: tex_coord
Coordinates on the textures, per vertexgamnit :: SelectionProgram :: tex_coord=
Coordinates on the textures, per vertexgamnit :: SelectionProgram :: translation
Translation applied to each vertexgamnit :: SelectionProgram :: translation=
Translation applied to each vertexgamnit :: SelectionProgram :: use_map_diffuse
Should this program use the texturemap_diffuse
?
gamnit :: SelectionProgram :: use_map_diffuse=
Should this program use the texturemap_diffuse
?
gamnit $ SelectionProgram :: SELF
Type of this instance, automatically specialized in every classgamnit $ SelectionProgram :: vertex_shader_source
Source code of the vertex shadergamnit :: GamnitProgram :: attributes
Attributes of this program organized by namegamnit :: GamnitProgram :: attributes=
Attributes of this program organized by namecore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
gamnit :: SelectionProgram :: color_id=
ID as a colorgamnit :: GamnitProgram :: compile_and_link
Compile the shaders, and this program, then link and report any errorsgamnit :: SelectionProgram :: coord=
Vertices coordinatesgamnit :: GamnitProgram :: defaultinit
core :: Object :: defaultinit
gamnit :: GamnitProgram :: deleted=
Has this program been deleted?gamnit :: GamnitProgram :: diagnose
Diagnose possible problems with the shaders of the programgamnit :: GamnitProgram :: error=
Last error raised bycompile_and_link
gamnit :: GamnitProgram :: fragment_shader
Fragment shader to attach to this programgamnit :: GamnitProgramFromSource :: fragment_shader_source
Source code of the fragment shadercore :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
gamnit :: SelectionProgram :: map_diffuse=
Diffuse texture unitgamnit :: SelectionProgram :: mvp=
Model view projection matrixcore :: Object :: output_class_name
Display class name on stdout (debug only).gamnit :: SelectionProgram :: rotation=
Rotation matrixgamnit :: SelectionProgram :: tex_coord
Coordinates on the textures, per vertexgamnit :: SelectionProgram :: tex_coord=
Coordinates on the textures, per vertexgamnit :: SelectionProgram :: translation
Translation applied to each vertexgamnit :: SelectionProgram :: translation=
Translation applied to each vertexgamnit :: GamnitProgram :: uniforms
Uniforms of this program organized by namegamnit :: GamnitProgram :: uniforms=
Uniforms of this program organized by namegamnit :: SelectionProgram :: use_map_diffuse
Should this program use the texturemap_diffuse
?
gamnit :: SelectionProgram :: use_map_diffuse=
Should this program use the texturemap_diffuse
?
gamnit :: GamnitProgram :: vertex_shader
Vertex shader to attach to this programgamnit :: GamnitProgramFromSource :: vertex_shader_source
Source code of the vertex shadergamnit :: GamnitProgramFromSource
Gamnit graphical program from the shaders source code
# Program to draw selection values
class SelectionProgram
super GamnitProgramFromSource
redef var vertex_shader_source = """
// Vertex coordinates
attribute vec4 coord;
// Vertex translation
uniform vec4 translation;
// Vertex scaling
uniform float scale;
// Vertex coordinates on textures
attribute vec2 tex_coord;
// Model view projection matrix
uniform mat4 mvp;
// Model rotation
uniform mat4 rotation;
// Output for the fragment shader
varying vec2 v_tex_coord;
void main()
{
v_tex_coord = vec2(tex_coord.x, 1.0 - tex_coord.y);
gl_Position = (vec4(coord.xyz * scale, 1.0) * rotation + translation) * mvp;
}
""" @ glsl_vertex_shader
#
redef var fragment_shader_source = """
precision highp float;
varying vec2 v_tex_coord;
// Map used as reference for opacity
uniform sampler2D map_diffuse;
// Should `map_diffuse` be used?
uniform bool use_map_diffuse;
// Color ID
uniform vec4 color;
void main()
{
gl_FragColor = vec4(color.rgb, 1.0);
if (use_map_diffuse && texture2D(map_diffuse, v_tex_coord).a < 0.1) {
gl_FragColor.a = 0.0;
}
}
""" @ glsl_fragment_shader
# Vertices coordinates
var coord = attributes["coord"].as(AttributeVec4) is lazy
# Should this program use the texture `map_diffuse`?
var use_map_diffuse = uniforms["use_map_diffuse"].as(UniformBool) is lazy
# Diffuse texture unit
var map_diffuse = uniforms["map_diffuse"].as(UniformSampler2D) is lazy
# Coordinates on the textures, per vertex
var tex_coord = attributes["tex_coord"].as(AttributeVec2) is lazy
# Translation applied to each vertex
var translation = uniforms["translation"].as(UniformVec4) is lazy
# Rotation matrix
var rotation = uniforms["rotation"].as(UniformMat4) is lazy
# Scaling per vertex
var scale = uniforms["scale"].as(UniformFloat) is lazy
# Model view projection matrix
var mvp = uniforms["mvp"].as(UniformMat4) is lazy
# ID as a color
var color_id = uniforms["color"].as(UniformVec4) is lazy
end
lib/gamnit/depth/selection.nit:236,1--321,3