Efficiently draw actors from the light view

Introduced properties

fun coord: AttributeVec4

gamnit :: ShadowDepthProgram :: coord

Vertices coordinates
protected fun coord=(coord: AttributeVec4)

gamnit :: ShadowDepthProgram :: coord=

Vertices coordinates
protected fun diffuse_color=(diffuse_color: UniformVec4)

gamnit :: ShadowDepthProgram :: diffuse_color=

Diffuse color
protected fun fragment_shader_source=(fragment_shader_source: Text)

gamnit :: ShadowDepthProgram :: fragment_shader_source=

protected fun map_diffuse=(map_diffuse: UniformSampler2D)

gamnit :: ShadowDepthProgram :: map_diffuse=

Diffuse texture unit
fun mvp: UniformMat4

gamnit :: ShadowDepthProgram :: mvp

Model view projection matrix
protected fun mvp=(mvp: UniformMat4)

gamnit :: ShadowDepthProgram :: mvp=

Model view projection matrix
fun rotation: UniformMat4

gamnit :: ShadowDepthProgram :: rotation

Rotation matrix
protected fun rotation=(rotation: UniformMat4)

gamnit :: ShadowDepthProgram :: rotation=

Rotation matrix
fun scale: UniformFloat

gamnit :: ShadowDepthProgram :: scale

Scaling per vertex
protected fun scale=(scale: UniformFloat)

gamnit :: ShadowDepthProgram :: scale=

Scaling per vertex
fun tex_coord: AttributeVec2

gamnit :: ShadowDepthProgram :: tex_coord

Coordinates on the textures, per vertex
protected fun tex_coord=(tex_coord: AttributeVec2)

gamnit :: ShadowDepthProgram :: tex_coord=

Coordinates on the textures, per vertex
fun translation: UniformVec4

gamnit :: ShadowDepthProgram :: translation

Translation applied to each vertex
protected fun translation=(translation: UniformVec4)

gamnit :: ShadowDepthProgram :: translation=

Translation applied to each vertex
fun use_map_diffuse: UniformBool

gamnit :: ShadowDepthProgram :: use_map_diffuse

Should this program use the texture map_diffuse?
protected fun use_map_diffuse=(use_map_diffuse: UniformBool)

gamnit :: ShadowDepthProgram :: use_map_diffuse=

Should this program use the texture map_diffuse?
protected fun vertex_shader_source=(vertex_shader_source: Text)

gamnit :: ShadowDepthProgram :: vertex_shader_source=

Redefined properties

redef type SELF: ShadowDepthProgram

gamnit $ ShadowDepthProgram :: SELF

Type of this instance, automatically specialized in every class
redef fun fragment_shader_source: Text

gamnit $ ShadowDepthProgram :: fragment_shader_source

Source code of the fragment shader
redef fun vertex_shader_source: Text

gamnit $ ShadowDepthProgram :: vertex_shader_source

Source code of the vertex shader

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
fun attributes: AttributeMap

gamnit :: GamnitProgram :: attributes

Attributes of this program organized by name
protected fun attributes=(attributes: AttributeMap)

gamnit :: GamnitProgram :: attributes=

Attributes of this program organized by name
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
fun coord: AttributeVec4

gamnit :: ShadowDepthProgram :: coord

Vertices coordinates
protected fun coord=(coord: AttributeVec4)

gamnit :: ShadowDepthProgram :: coord=

Vertices coordinates
fun delete

gamnit :: GamnitProgram :: delete

Delete this program if it has not already been deleted
fun deleted: Bool

gamnit :: GamnitProgram :: deleted

Has this program been deleted?
protected fun deleted=(deleted: Bool)

gamnit :: GamnitProgram :: deleted=

Has this program been deleted?
fun diagnose

gamnit :: GamnitProgram :: diagnose

Diagnose possible problems with the shaders of the program
protected fun diffuse_color=(diffuse_color: UniformVec4)

gamnit :: ShadowDepthProgram :: diffuse_color=

Diffuse color
fun error: nullable Error

gamnit :: GamnitProgram :: error

Last error raised by compile_and_link
protected fun error=(error: nullable Error)

gamnit :: GamnitProgram :: error=

Last error raised by compile_and_link
abstract fun fragment_shader: FragmentShader

gamnit :: GamnitProgram :: fragment_shader

Fragment shader to attach to this program
abstract fun fragment_shader_source: Text

gamnit :: GamnitProgramFromSource :: fragment_shader_source

Source code of the fragment shader
protected fun fragment_shader_source=(fragment_shader_source: Text)

gamnit :: ShadowDepthProgram :: fragment_shader_source=

fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
protected fun map_diffuse=(map_diffuse: UniformSampler2D)

gamnit :: ShadowDepthProgram :: map_diffuse=

Diffuse texture unit
fun mvp: UniformMat4

gamnit :: ShadowDepthProgram :: mvp

Model view projection matrix
protected fun mvp=(mvp: UniformMat4)

gamnit :: ShadowDepthProgram :: mvp=

Model view projection matrix
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun rotation: UniformMat4

gamnit :: ShadowDepthProgram :: rotation

Rotation matrix
protected fun rotation=(rotation: UniformMat4)

gamnit :: ShadowDepthProgram :: rotation=

Rotation matrix
fun scale: UniformFloat

gamnit :: ShadowDepthProgram :: scale

Scaling per vertex
protected fun scale=(scale: UniformFloat)

gamnit :: ShadowDepthProgram :: scale=

Scaling per vertex
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
fun tex_coord: AttributeVec2

gamnit :: ShadowDepthProgram :: tex_coord

Coordinates on the textures, per vertex
protected fun tex_coord=(tex_coord: AttributeVec2)

gamnit :: ShadowDepthProgram :: tex_coord=

Coordinates on the textures, per vertex
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
fun translation: UniformVec4

gamnit :: ShadowDepthProgram :: translation

Translation applied to each vertex
protected fun translation=(translation: UniformVec4)

gamnit :: ShadowDepthProgram :: translation=

Translation applied to each vertex
fun uniforms: UniformMap

gamnit :: GamnitProgram :: uniforms

Uniforms of this program organized by name
protected fun uniforms=(uniforms: UniformMap)

gamnit :: GamnitProgram :: uniforms=

Uniforms of this program organized by name
fun use

gamnit :: GamnitProgram :: use

Notify the GPU to use this program
fun use_map_diffuse: UniformBool

gamnit :: ShadowDepthProgram :: use_map_diffuse

Should this program use the texture map_diffuse?
protected fun use_map_diffuse=(use_map_diffuse: UniformBool)

gamnit :: ShadowDepthProgram :: use_map_diffuse=

Should this program use the texture map_diffuse?
abstract fun vertex_shader: VertexShader

gamnit :: GamnitProgram :: vertex_shader

Vertex shader to attach to this program
abstract fun vertex_shader_source: Text

gamnit :: GamnitProgramFromSource :: vertex_shader_source

Source code of the vertex shader
protected fun vertex_shader_source=(vertex_shader_source: Text)

gamnit :: ShadowDepthProgram :: vertex_shader_source=

package_diagram gamnit::ShadowDepthProgram ShadowDepthProgram gamnit::GamnitProgramFromSource GamnitProgramFromSource gamnit::ShadowDepthProgram->gamnit::GamnitProgramFromSource gamnit::GamnitProgram GamnitProgram gamnit::GamnitProgramFromSource->gamnit::GamnitProgram ...gamnit::GamnitProgram ... ...gamnit::GamnitProgram->gamnit::GamnitProgram

Ancestors

abstract class GamnitProgram

gamnit :: GamnitProgram

Gamnit graphical program
interface Object

core :: Object

The root of the class hierarchy.

Parents

class GamnitProgramFromSource

gamnit :: GamnitProgramFromSource

Gamnit graphical program from the shaders source code

Class definitions

gamnit $ ShadowDepthProgram
# 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