Introduced properties

private fun depth_cache=(depth_cache: Float)

gamnit :: ParallelLightCamera :: depth_cache=

private fun height_cache=(height_cache: Float)

gamnit :: ParallelLightCamera :: height_cache=

private fun light=(light: ParallelLight)

gamnit :: ParallelLightCamera :: light=

private fun pitch_cache=(pitch_cache: Float)

gamnit :: ParallelLightCamera :: pitch_cache=

private fun rotation_matrix: Matrix

gamnit :: ParallelLightCamera :: rotation_matrix

Rotation matrix produced by the current rotation of the camera
private fun width_cache=(width_cache: Float)

gamnit :: ParallelLightCamera :: width_cache=

private fun yaw_cache=(yaw_cache: Float)

gamnit :: ParallelLightCamera :: yaw_cache=

Redefined properties

redef type SELF: ParallelLightCamera

gamnit $ ParallelLightCamera :: SELF

Type of this instance, automatically specialized in every class
redef fun check_position_changed: Bool

gamnit $ ParallelLightCamera :: check_position_changed

Has position changed from position_cache? Update the cache at the same time
redef fun mvp_matrix: Matrix

gamnit $ ParallelLightCamera :: mvp_matrix

The Model-View-Projection matrix created by this camera

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
private var _display: GamnitDisplay

gamnit :: Camera :: _display

The host GamnitDisplay
private var _mvp_matrix_cache: nullable Matrix

gamnit :: Camera :: _mvp_matrix_cache

private var _position: Point3d[Float]

gamnit :: Camera :: _position

Position of this camera in world space
private fun check_position_changed: Bool

gamnit :: Camera :: check_position_changed

Has position changed from position_cache? Update the cache at the same time
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.
private fun depth_cache=(depth_cache: Float)

gamnit :: ParallelLightCamera :: depth_cache=

fun display: GamnitDisplay

gamnit :: Camera :: display

The host GamnitDisplay
protected fun display=(display: GamnitDisplay)

gamnit :: Camera :: display=

The host GamnitDisplay
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.
private fun height_cache=(height_cache: Float)

gamnit :: ParallelLightCamera :: height_cache=

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.
private fun light=(light: ParallelLight)

gamnit :: ParallelLightCamera :: light=

abstract fun mvp_matrix: Matrix

gamnit :: Camera :: mvp_matrix

The Model-View-Projection matrix created by this camera
private fun mvp_matrix_cache: nullable Matrix

gamnit :: Camera :: mvp_matrix_cache

private fun mvp_matrix_cache=(mvp_matrix_cache: nullable Matrix)

gamnit :: Camera :: mvp_matrix_cache=

private intern fun native_class_name: CString

core :: Object :: native_class_name

The class name of the object in CString format.
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).
private fun pitch_cache=(pitch_cache: Float)

gamnit :: ParallelLightCamera :: pitch_cache=

fun position: Point3d[Float]

gamnit :: Camera :: position

Position of this camera in world space
protected fun position=(position: Point3d[Float])

gamnit :: Camera :: position=

Position of this camera in world space
private fun position_cache=(position_cache: Point3d[Float])

gamnit :: Camera :: position_cache=

private fun rotation_matrix: Matrix

gamnit :: ParallelLightCamera :: rotation_matrix

Rotation matrix produced by the current rotation of the camera
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.
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
private fun width_cache=(width_cache: Float)

gamnit :: ParallelLightCamera :: width_cache=

private fun yaw_cache=(yaw_cache: Float)

gamnit :: ParallelLightCamera :: yaw_cache=

package_diagram gamnit::more_lights::ParallelLightCamera ParallelLightCamera gamnit::Camera Camera gamnit::more_lights::ParallelLightCamera->gamnit::Camera core::Object Object gamnit::Camera->core::Object ...core::Object ... ...core::Object->core::Object

Ancestors

interface Object

core :: Object

The root of the class hierarchy.

Parents

abstract class Camera

gamnit :: Camera

A camera with a point of view on the world

Class definitions

gamnit $ ParallelLightCamera
private class ParallelLightCamera
	super Camera

	var light: ParallelLight

	# Rotation matrix produced by the current rotation of the camera
	fun rotation_matrix: Matrix
	do
		var view = new Matrix.identity(4)
		view.rotate(light.yaw,   0.0, 1.0, 0.0)
		view.rotate(light.pitch, 1.0, 0.0, 0.0)
		return view
	end

	private fun create_mvp_matrix: Matrix
	do
		var near = -light.depth/2.0
		var far = light.depth/2.0

		var view = new Matrix.identity(4)
		view.translate(-position.x, -position.y, -position.z)
		view = view * rotation_matrix
		var projection = new Matrix.orthogonal(-light.width/2.0, light.width/2.0,
		                                       -light.height/2.0, light.height/2.0,
		                                       near, far)
		return view * projection
	end

	redef fun mvp_matrix
	do
		var m = mvp_matrix_cache
		if m == null or check_position_changed then
			m = create_mvp_matrix
			mvp_matrix_cache = m
		end
		return m
	end

	private var pitch_cache = 0.0
	private var yaw_cache = 0.0
	private var width_cache = 0.0
	private var height_cache = 0.0
	private var depth_cache = 0.0

	redef fun check_position_changed
	do
		if super then return true

		if light.pitch != pitch_cache or
		   light.yaw != yaw_cache or
		   light.width != width_cache or
		   light.height != height_cache or
		   light.depth != depth_cache then
			pitch_cache = light.pitch
			yaw_cache = light.yaw
			width_cache = light.width
			height_cache = light.height
			depth_cache = light.depth
			return true
		end

		return false
	end
end
lib/gamnit/depth/more_lights.nit:47,1--110,3