Program to color objects from their normal vectors

May be used in place of BlinnPhongProgram for debugging or effect.

Introduced properties

Redefined properties

redef type SELF: NormalProgram

gamnit $ NormalProgram :: SELF

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

gamnit $ NormalProgram :: fragment_shader_source

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

gamnit $ NormalProgram :: fragment_shader_source=

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 alpha: AttributeFloat

gamnit :: BlinnPhongProgram :: alpha

Scaling per vertex
protected fun alpha=(alpha: AttributeFloat)

gamnit :: BlinnPhongProgram :: alpha=

Scaling per vertex
protected fun ambient_color=(ambient_color: UniformVec4)

gamnit :: BlinnPhongProgram :: ambient_color=

Ambient color
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
fun camera: UniformVec3

gamnit :: BlinnPhongProgram :: camera

Camera position
protected fun camera=(camera: UniformVec3)

gamnit :: BlinnPhongProgram :: camera=

Camera position
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 :: BlinnPhongProgram :: coord

Vertices coordinates
protected fun coord=(coord: AttributeVec4)

gamnit :: BlinnPhongProgram :: 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?
protected fun depth_texture=(depth_texture: UniformSampler2D)

gamnit :: BlinnPhongProgram :: depth_texture=

Diffuse texture unit
fun depth_texture_size: UniformFloat

gamnit :: BlinnPhongProgram :: depth_texture_size

Size, in pixels, of depth_texture
protected fun depth_texture_size=(depth_texture_size: UniformFloat)

gamnit :: BlinnPhongProgram :: depth_texture_size=

Size, in pixels, of depth_texture
fun depth_texture_taps: UniformInt

gamnit :: BlinnPhongProgram :: depth_texture_taps

Times to tap the depth_texture, square root (set to 3 for a total of 9 taps)
protected fun depth_texture_taps=(depth_texture_taps: UniformInt)

gamnit :: BlinnPhongProgram :: depth_texture_taps=

Times to tap the depth_texture, square root (set to 3 for a total of 9 taps)
fun diagnose

gamnit :: GamnitProgram :: diagnose

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

gamnit :: BlinnPhongProgram :: 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 :: BlinnPhongProgram :: 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.
fun light_center: UniformVec3

gamnit :: BlinnPhongProgram :: light_center

Center position of the light or vector to parallel light source
protected fun light_center=(light_center: UniformVec3)

gamnit :: BlinnPhongProgram :: light_center=

Center position of the light or vector to parallel light source
fun light_kind: UniformInt

gamnit :: BlinnPhongProgram :: light_kind

Kind of lights: 0 -> no light, 1 -> parallel, 2 -> point
protected fun light_kind=(light_kind: UniformInt)

gamnit :: BlinnPhongProgram :: light_kind=

Kind of lights: 0 -> no light, 1 -> parallel, 2 -> point
fun light_mvp: UniformMat4

gamnit :: BlinnPhongProgram :: light_mvp

Light model view projection matrix
protected fun light_mvp=(light_mvp: UniformMat4)

gamnit :: BlinnPhongProgram :: light_mvp=

Light model view projection matrix
protected fun map_ambient=(map_ambient: UniformSampler2D)

gamnit :: BlinnPhongProgram :: map_ambient=

Ambient texture unit
protected fun map_bump=(map_bump: UniformSampler2D)

gamnit :: BlinnPhongProgram :: map_bump=

Bump texture unit
protected fun map_diffuse=(map_diffuse: UniformSampler2D)

gamnit :: BlinnPhongProgram :: map_diffuse=

Diffuse texture unit
fun map_specular: UniformSampler2D

gamnit :: BlinnPhongProgram :: map_specular

Specularity texture unit
protected fun map_specular=(map_specular: UniformSampler2D)

gamnit :: BlinnPhongProgram :: map_specular=

Specularity texture unit
fun mvp: UniformMat4

gamnit :: BlinnPhongProgram :: mvp

Camera model view projection matrix
protected fun mvp=(mvp: UniformMat4)

gamnit :: BlinnPhongProgram :: mvp=

Camera model view projection matrix
fun normal: AttributeVec3

gamnit :: BlinnPhongProgram :: normal

Normal per vertex
protected fun normal=(normal: AttributeVec3)

gamnit :: BlinnPhongProgram :: normal=

Normal per vertex
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=(mat: Matrix)

gamnit :: BlinnPhongProgram :: rotation=

Set mat at the uniform rotation matrix
protected fun rotation_row0=(rotation_row0: AttributeVec4)

gamnit :: BlinnPhongProgram :: rotation_row0=

Rotation matrix, row0
protected fun rotation_row1=(rotation_row1: AttributeVec4)

gamnit :: BlinnPhongProgram :: rotation_row1=

Rotation matrix, row 1
protected fun rotation_row2=(rotation_row2: AttributeVec4)

gamnit :: BlinnPhongProgram :: rotation_row2=

Rotation matrix, row 2
protected fun rotation_row3=(rotation_row3: AttributeVec4)

gamnit :: BlinnPhongProgram :: rotation_row3=

Rotation matrix, row 3
fun scale: AttributeFloat

gamnit :: BlinnPhongProgram :: scale

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

gamnit :: BlinnPhongProgram :: scale=

Scaling per vertex
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
protected fun specular_color=(specular_color: UniformVec4)

gamnit :: BlinnPhongProgram :: specular_color=

Specular color
intern fun sys: Sys

core :: Object :: sys

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

gamnit :: BlinnPhongProgram :: tex_coord

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

gamnit :: BlinnPhongProgram :: 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: AttributeVec4

gamnit :: BlinnPhongProgram :: translation

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

gamnit :: BlinnPhongProgram :: 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_ambient: UniformBool

gamnit :: BlinnPhongProgram :: use_map_ambient

Should this program use the texture map_ambient?
protected fun use_map_ambient=(use_map_ambient: UniformBool)

gamnit :: BlinnPhongProgram :: use_map_ambient=

Should this program use the texture map_ambient?
fun use_map_bump: UniformBool

gamnit :: BlinnPhongProgram :: use_map_bump

Should this program use the texture map_bump?
protected fun use_map_bump=(use_map_bump: UniformBool)

gamnit :: BlinnPhongProgram :: use_map_bump=

Should this program use the texture map_bump?
fun use_map_diffuse: UniformBool

gamnit :: BlinnPhongProgram :: use_map_diffuse

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

gamnit :: BlinnPhongProgram :: use_map_diffuse=

Should this program use the texture map_diffuse?
fun use_map_specular: UniformBool

gamnit :: BlinnPhongProgram :: use_map_specular

Should this program use the texture map_specular?
protected fun use_map_specular=(use_map_specular: UniformBool)

gamnit :: BlinnPhongProgram :: use_map_specular=

Should this program use the texture map_specular?
fun use_shadows: UniformBool

gamnit :: BlinnPhongProgram :: use_shadows

Should shadow be drawn? Would use depth_texture and light_mvp.
protected fun use_shadows=(use_shadows: UniformBool)

gamnit :: BlinnPhongProgram :: use_shadows=

Should shadow be drawn? Would use depth_texture and light_mvp.
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 :: BlinnPhongProgram :: vertex_shader_source=

package_diagram gamnit::NormalProgram NormalProgram gamnit::BlinnPhongProgram BlinnPhongProgram gamnit::NormalProgram->gamnit::BlinnPhongProgram gamnit::GamnitProgramFromSource GamnitProgramFromSource gamnit::BlinnPhongProgram->gamnit::GamnitProgramFromSource ...gamnit::GamnitProgramFromSource ... ...gamnit::GamnitProgramFromSource->gamnit::GamnitProgramFromSource

Ancestors

abstract class GamnitProgram

gamnit :: GamnitProgram

Gamnit graphical program
class GamnitProgramFromSource

gamnit :: GamnitProgramFromSource

Gamnit graphical program from the shaders source code
interface Object

core :: Object

The root of the class hierarchy.

Parents

class BlinnPhongProgram

gamnit :: BlinnPhongProgram

Graphic program to display 3D models with Blinn-Phong specular lighting

Class definitions

gamnit $ NormalProgram
# Program to color objects from their normal vectors
#
# May be used in place of `BlinnPhongProgram` for debugging or effect.
class NormalProgram
	super BlinnPhongProgram

	redef var fragment_shader_source = """
		precision mediump float;

		// Input from the vertex shader
		varying vec3 v_normal;

		void main()
		{
			gl_FragColor = vec4(v_normal*0.5 + 0.5, 1.0);
		}
		""" @ glsl_fragment_shader
end
lib/gamnit/depth/more_materials.nit:642,1--659,3