MatrixLens

class MatrixLens

Bases: Lens

A completely generic linear lens. This is provided for the benefit of low- level code that wants to specify a perspective or orthographic frustum via an explicit projection matrix, but not mess around with fov’s or focal lengths or any of that nonsense.

Inheritance diagram

digraph inheritance47ef1a8115 { bgcolor=transparent; rankdir=BT; size="8.0, 12.0"; "DTOOL_SUPER_BASE" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style=""]; "Lens" [URL="acron.core.Lens.html#acron.core.Lens",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "TypedWritableReferenceCount" -> "Lens" [arrowsize=0.75,style=""]; "MatrixLens" [URL="acron.core.MatrixLens.html#acron.core.MatrixLens",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "Lens" -> "MatrixLens" [arrowsize=0.75,style=""]; "ReferenceCount" [URL="acron.core.ReferenceCount.html#acron.core.ReferenceCount",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "DTOOL_SUPER_BASE" -> "ReferenceCount" [arrowsize=0.75,style=""]; "TypedObject" [URL="acron.core.TypedObject.html#acron.core.TypedObject",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "DTOOL_SUPER_BASE" -> "TypedObject" [arrowsize=0.75,style=""]; "TypedWritable" [URL="acron.core.TypedWritable.html#acron.core.TypedWritable",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "TypedObject" -> "TypedWritable" [arrowsize=0.75,style=""]; "TypedWritableReferenceCount" [URL="acron.core.TypedWritableReferenceCount.html#acron.core.TypedWritableReferenceCount",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "TypedWritable" -> "TypedWritableReferenceCount" [arrowsize=0.75,style=""]; "ReferenceCount" -> "TypedWritableReferenceCount" [arrowsize=0.75,style=""]; }
MatrixLens.__init__()
MatrixLens.clear_left_eye_mat()

Removes the custom projection matrix set for the left eye, and uses the center matrix (set by set_user_mat) instead.

MatrixLens.clear_right_eye_mat()

Removes the custom projection matrix set for the right eye, and uses the center matrix (set by set_user_mat) instead.

static MatrixLens.get_class_type()
MatrixLens.get_left_eye_mat()

Returns the custom projection matrix for the left eye, if any, or the center matrix if there is no custom matrix set for the left eye.

MatrixLens.get_right_eye_mat()

Returns the custom projection matrix for the right eye, if any, or the center matrix if there is no custom matrix set for the right eye.

MatrixLens.get_user_mat()

Returns the explicit projection matrix as set by the user. This does not include transforms on the lens or film (e.g. a film offset or view hpr).

MatrixLens.has_left_eye_mat()

Returns true if the camera has a custom projection matrix set for the left eye, or false if the center matrix (set by set_user_mat) will be used for the left eye.

MatrixLens.has_right_eye_mat()

Returns true if the camera has a custom projection matrix set for the right eye, or false if the center matrix (set by set_user_mat) will be used for the right eye.

MatrixLens.set_left_eye_mat()

Sets a custom projection matrix for the left eye. This is only used if the lens is attached to a stereo camera, in which case the left eye matrix will be used to draw the scene in the left eye (but the center matrix–the user_mat–will still be used to cull the scene).

This matrix should not be too different from the center matrix (set by set_user_mat()) or culling errors may become obvious.

MatrixLens.set_right_eye_mat()

Sets a custom projection matrix for the right eye. This is only used if the lens is attached to a stereo camera, in which case the right eye matrix will be used to draw the scene in the right eye (but the center matrix–the user_mat–will still be used to cull the scene).

This matrix should not be too different from the center matrix (set by set_user_mat()) or culling errors may become obvious.

MatrixLens.set_user_mat()

Explicitly specifies the projection matrix. This matrix should convert X and Y to the range [-film_size/2, film_size/2], where (-fs/2,-fs/2) is the lower left corner of the screen and (fs/2, fs/2) is the upper right. Z should go to the range [-1, 1], where -1 is the near plane and 1 is the far plane. Note that this is a left-handed Y-up coordinate system.

The default film_size for a MatrixLens is 2, so the default range is [-1, 1] for both X and Y. This is consistent with the GL conventions for projection matrices.