gamnit :: ShadowDepthProgram :: coord=
Vertices coordinatesgamnit :: ShadowDepthProgram :: diffuse_color=
Diffuse colorgamnit :: ShadowDepthProgram :: map_diffuse=
Diffuse texture unitgamnit :: ShadowDepthProgram :: mvp=
Model view projection matrixgamnit :: ShadowDepthProgram :: rotation=
Rotation matrixgamnit :: ShadowDepthProgram :: tex_coord
Coordinates on the textures, per vertexgamnit :: ShadowDepthProgram :: tex_coord=
Coordinates on the textures, per vertexgamnit :: ShadowDepthProgram :: translation
Translation applied to each vertexgamnit :: ShadowDepthProgram :: translation=
Translation applied to each vertexgamnit :: ShadowDepthProgram :: use_map_diffuse
Should this program use the texturemap_diffuse
?
gamnit :: ShadowDepthProgram :: use_map_diffuse=
Should this program use the texturemap_diffuse
?
gamnit $ ShadowDepthProgram :: SELF
Type of this instance, automatically specialized in every classgamnit $ ShadowDepthProgram :: fragment_shader_source
Source code of the fragment shadergamnit $ ShadowDepthProgram :: 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 :: GamnitProgram :: compile_and_link
Compile the shaders, and this program, then link and report any errorsgamnit :: ShadowDepthProgram :: 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 :: ShadowDepthProgram :: diffuse_color=
Diffuse colorgamnit :: 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 :: ShadowDepthProgram :: map_diffuse=
Diffuse texture unitgamnit :: ShadowDepthProgram :: mvp=
Model view projection matrixcore :: Object :: output_class_name
Display class name on stdout (debug only).gamnit :: ShadowDepthProgram :: rotation=
Rotation matrixgamnit :: ShadowDepthProgram :: tex_coord
Coordinates on the textures, per vertexgamnit :: ShadowDepthProgram :: tex_coord=
Coordinates on the textures, per vertexgamnit :: ShadowDepthProgram :: translation
Translation applied to each vertexgamnit :: ShadowDepthProgram :: translation=
Translation applied to each vertexgamnit :: GamnitProgram :: uniforms
Uniforms of this program organized by namegamnit :: GamnitProgram :: uniforms=
Uniforms of this program organized by namegamnit :: ShadowDepthProgram :: use_map_diffuse
Should this program use the texturemap_diffuse
?
gamnit :: ShadowDepthProgram :: 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
# Efficiently draw actors from the light view
class ShadowDepthProgram
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;
// Vertex normal
attribute vec3 normal;
// Model view projection matrix
uniform mat4 mvp;
// Rotation matrix
uniform mat4 rotation;
// Output for the fragment shader
varying vec2 v_tex_coord;
void main()
{
vec4 pos = (vec4(coord.xyz * scale, 1.0) * rotation + translation);
gl_Position = pos * mvp;
// Pass varyings to the fragment shader
v_tex_coord = vec2(tex_coord.x, 1.0 - tex_coord.y);
}
""" @ glsl_vertex_shader
redef var fragment_shader_source = """
precision mediump float;
// Diffuse map
uniform bool use_map_diffuse;
uniform sampler2D map_diffuse;
varying vec2 v_tex_coord;
void main()
{
if (use_map_diffuse && texture2D(map_diffuse, v_tex_coord).a <= 0.01) {
discard;
}
}
""" @ 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
# Diffuse color
var diffuse_color = uniforms["diffuse_color"].as(UniformVec4) 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
end
lib/gamnit/depth/shadow.nit:344,1--426,3