panda3d.core.Lens

class Lens

Bases: TypedWritableReferenceCount

A base class for any number of different kinds of lenses, linear and otherwise. Presently, this includes perspective and orthographic lenses.

A Lens object is the main part of a Camera node, which defines the fundamental interface to point-of-view for rendering. Lenses are also used in other contexts, however; for instance, a Spotlight is also defined using a lens.

Inheritance diagram

Inheritance diagram of Lens

makeCopy() → Lens
Return type

Lens

extrude(point2d: LPoint2, near_point: LPoint3, far_point: LPoint3) → bool

Given a 2-d point in the range (-1,1) in both dimensions, where (0,0) is the center of the lens and (-1,-1) is the lower-left corner, compute the corresponding vector in space that maps to this point, if such a vector can be determined. The vector is returned by indicating the points on the near plane and far plane that both map to the indicated 2-d point.

Returns true if the vector is defined, or false otherwise.

extrude(point2d: LPoint3, near_point: LPoint3, far_point: LPoint3) → bool

Given a 2-d point in the range (-1,1) in both dimensions, where (0,0) is the center of the lens and (-1,-1) is the lower-left corner, compute the corresponding vector in space that maps to this point, if such a vector can be determined. The vector is returned by indicating the points on the near plane and far plane that both map to the indicated 2-d point.

The z coordinate of the 2-d point is ignored.

Returns true if the vector is defined, or false otherwise.

extrudeDepth(point2d: LPoint3, point3d: LPoint3) → bool

Uses the depth component of the 3-d result from project() to compute the original point in 3-d space corresponding to a particular point on the lens. This exactly reverses project(), assuming the point does fall legitimately within the lens.

extrudeVec(point2d: LPoint2, vec3d: LVector3) → bool

Given a 2-d point in the range (-1,1) in both dimensions, where (0,0) is the center of the lens and (-1,-1) is the lower-left corner, compute the vector that corresponds to the view direction. This will be parallel to the normal on the surface (the far plane) corresponding to the lens shape at this point.

See the comment block on Lens::extrude_vec_impl() for a more in-depth comment on the meaning of this vector.

Returns true if the vector is defined, or false otherwise.

extrudeVec(point2d: LPoint3, vec3d: LVector3) → bool

Given a 2-d point in the range (-1,1) in both dimensions, where (0,0) is the center of the lens and (-1,-1) is the lower-left corner, compute the vector that corresponds to the view direction. This will be parallel to the normal on the surface (the far plane) corresponding to the lens shape at this point.

See the comment block on Lens::extrude_vec_impl() for a more in-depth comment on the meaning of this vector.

The z coordinate of the 2-d point is ignored.

Returns true if the vector is defined, or false otherwise.

project(point3d: LPoint3, point2d: LPoint2) → bool

Given a 3-d point in space, determine the 2-d point this maps to, in the range (-1,1) in both dimensions, where (0,0) is the center of the lens and (-1,-1) is the lower-left corner.

Returns true if the 3-d point is in front of the lens and within the viewing frustum (in which case point2d is filled in), or false otherwise (in which case point2d will be filled in with something, which may or may not be meaningful).

project(point3d: LPoint3, point2d: LPoint3) → bool

Given a 3-d point in space, determine the 2-d point this maps to, in the range (-1,1) in both dimensions, where (0,0) is the center of the lens and (-1,-1) is the lower-left corner.

The z coordinate will also be set to a value in the range (-1, 1), where 1 represents a point on the near plane, and -1 represents a point on the far plane.

Returns true if the 3-d point is in front of the lens and within the viewing frustum (in which case point2d is filled in), or false otherwise (in which case point2d will be filled in with something, which may or may not be meaningful).

setChangeEvent(event: str) → None

Sets the name of the event that will be generated whenever any properties of the Lens have changed. If this is not set for a particular lens, no event will be generated.

The event is thrown with one parameter, the lens itself. This can be used to automatically track changes to camera fov, etc. in the application.

getChangeEvent() → str

Returns the name of the event that will be generated whenever any properties of this particular Lens have changed.

setCoordinateSystem(cs: CoordinateSystem) → None

Specifies the coordinate system that all 3-d computations are performed within for this Lens. Normally, this is CS_default.

getCoordinateSystem() → CoordinateSystem

Returns the coordinate system that all 3-d computations are performed within for this Lens. Normally, this is CS_default.

Return type

CoordinateSystem

clear() → None

Resets all lens parameters to their initial default settings.

setFilmSize(film_size: LVecBase2) → None

Sets the size and shape of the “film” within the lens. This both establishes the units used by calls like setFocalLength(), and establishes the aspect ratio of the frame.

In a physical camera, the field of view of a lens is determined by the lens’ focal length and by the size of the film area exposed by the lens. For instance, a 35mm camera exposes a rectangle on the film about 24mm x 36mm, which means a 50mm lens gives about a 40-degree horizontal field of view.

In the virtual camera, you may set the film size to any units here, and specify a focal length in the same units to simulate the same effect. Or, you may ignore this parameter, and specify the field of view and aspect ratio of the lens directly.

setFilmSize(width: float) → None

Sets the horizontal size of the film without changing its shape. The aspect ratio remains unchanged; this computes the vertical size of the film to automatically maintain the aspect ratio.

setFilmSize(width: float, height: float) → None

Sets the size and shape of the “film” within the lens. This both establishes the units used by calls like setFocalLength(), and establishes the aspect ratio of the frame.

In a physical camera, the field of view of a lens is determined by the lens’ focal length and by the size of the film area exposed by the lens. For instance, a 35mm camera exposes a rectangle on the film about 24mm x 36mm, which means a 50mm lens gives about a 40-degree horizontal field of view.

In the virtual camera, you may set the film size to any units here, and specify a focal length in the same units to simulate the same effect. Or, you may ignore this parameter, and specify the field of view and aspect ratio of the lens directly.

getFilmSize() → LVecBase2

Returns the horizontal and vertical film size of the virtual film. See setFilmSize().

Return type

LVecBase2

setFilmOffset(film_offset: LVecBase2) → None

Sets the horizontal and vertical offset amounts of this Lens. These are both in the same units specified in setFilmSize().

This can be used to establish an off-axis lens.

setFilmOffset(x: float, y: float) → None

Sets the horizontal and vertical offset amounts of this Lens. These are both in the same units specified in setFilmSize().

This can be used to establish an off-axis lens.

getFilmOffset() → LVector2

Returns the horizontal and vertical offset amounts of this Lens. See setFilmOffset().

Return type

LVector2

setFocalLength(focal_length: float) → None

Sets the focal length of the lens. This may adjust the field-of-view correspondingly, and is an alternate way to specify field of view.

For certain kinds of lenses (e.g. OrthographicLens), the focal length has no meaning.

getFocalLength() → float

Returns the focal length of the lens. This may have been set explicitly by a previous call to setFocalLength(), or it may be computed based on the lens’ fov and film_size. For certain kinds of lenses, the focal length has no meaning.

setMinFov(min_fov: float) → None

Sets the field of view of the smallest dimension of the window. If the window is wider than it is tall, this specifies the vertical field of view; if it is taller than it is wide, this specifies the horizontal field of view.

In many cases, this is preferable to setting either the horizontal or vertical field of view explicitly. Setting this parameter means that pulling the window wider will widen the field of view, which is usually what you expect to happen.

setFov(fov: LVecBase2) → None

Sets the field of view of the lens in both dimensions. This establishes both the field of view and the aspect ratio of the lens. This is one way to specify the field of view of a lens; setFocalLength() is another way.

For certain kinds of lenses (like OrthographicLens), the field of view has no meaning.

setFov(fov: float) → None

Sets the horizontal field of view of the lens without changing the aspect ratio. The vertical field of view is adjusted to maintain the same aspect ratio.

setFov(hfov: float, vfov: float) → None

Sets the field of view of the lens in both dimensions. This establishes both the field of view and the aspect ratio of the lens. This is one way to specify the field of view of a lens; setFocalLength() is another way.

For certain kinds of lenses (like OrthoLens), the field of view has no meaning.

getFov() → LVecBase2

Returns the horizontal and vertical film size of the virtual film. See setFov().

Return type

LVecBase2

getHfov() → float

Returns the horizontal component of fov only. See getFov().

getVfov() → float

Returns the vertical component of fov only. See getFov().

getMinFov() → float

Returns the field of view of the narrowest dimension of the window. See setMinFov().

setAspectRatio(aspect_ratio: float) → None

Sets the aspect ratio of the lens. This is the ratio of the height to the width of the generated image. Setting this overrides the two-parameter fov or film size setting.

getAspectRatio() → float

Returns the aspect ratio of the Lens. This is determined based on the indicated film size; see setFilmSize().

setNear(near_distance: float) → None

Defines the position of the near plane (or cylinder, sphere, whatever). Points closer to the lens than this may not be rendered.

getNear() → float

Returns the position of the near plane (or cylinder, sphere, whatever).

setFar(far_distance: float) → None

Defines the position of the far plane (or cylinder, sphere, whatever). Points farther from the lens than this may not be rendered.

getFar() → float

Returns the position of the far plane (or cylinder, sphere, whatever).

setNearFar(near_distance: float, far_distance: float) → None

Simultaneously changes the near and far planes.

static getDefaultNear() → float

Returns the default near plane distance that will be assigned to each newly-created lens. This is read from the Config.prc file.

static getDefaultFar() → float

Returns the default far plane distance that will be assigned to each newly- created lens. This is read from the Config.prc file.

setViewHpr(view_hpr: LVecBase3) → None

Sets the direction in which the lens is facing. Normally, this is down the forward axis (usually the Y axis), but it may be rotated. This is only one way of specifying the rotation; you may also specify an explicit vector in which to look, or you may give a complete transformation matrix.

setViewHpr(h: float, p: float, r: float) → None

Sets the direction in which the lens is facing. Normally, this is down the forward axis (usually the Y axis), but it may be rotated. This is only one way of specifying the rotation; you may also specify an explicit vector in which to look, or you may give a complete transformation matrix.

getViewHpr() → LVecBase3

Returns the direction in which the lens is facing.

Return type

LVecBase3

setViewVector(view_vector: LVector3, up_vector: LVector3) → None

Specifies the direction in which the lens is facing by giving an axis to look along, and a perpendicular (or at least non-parallel) up axis.

See also setViewHpr().

setViewVector(x: float, y: float, z: float, i: float, j: float, k: float) → None

Specifies the direction in which the lens is facing by giving an axis to look along, and a perpendicular (or at least non-parallel) up axis.

See also setViewHpr().

getViewVector() → LVector3

Returns the axis along which the lens is facing.

Return type

LVector3

getUpVector() → LVector3

Returns the axis perpendicular to the camera’s view vector that indicates the “up” direction.

Return type

LVector3

getNodalPoint() → LPoint3

Returns the center point of the lens: the point from which the lens is viewing.

Return type

LPoint3

setInterocularDistance(interocular_distance: float) → None

Sets the distance between the left and right eyes of a stereo camera. This distance is used to apply a stereo effect when the lens is rendered on a stereo display region. It only has an effect on a PerspectiveLens.

The left eye and the right eye are each offset along the X axis by half of this distance, so that this parameter specifies the total distance between them.

Also see setConvergenceDistance(), which relates.

getInterocularDistance() → float

See setInterocularDistance().

setConvergenceDistance(convergence_distance: float) → None

Sets the distance between between the camera plane and the point in the distance that the left and right eyes are both looking at. This distance is used to apply a stereo effect when the lens is rendered on a stereo display region. It only has an effect on a PerspectiveLens.

This parameter must be greater than 0, but may be as large as you like. It controls the distance at which the two stereo images will appear to converge, which is a normal property of stereo vision. Normally this should be set to the distance from the camera to the area of interest in your scene. Anything beyond this distance will appear to go into the screen, and anything closer will appear to come out of the screen. If you want to simulate parallel stereo, set this to infinity.

Note that this creates an off-axis frustum, which means that the lenses are still pointing in the same direction, which is usually more desirable than the more naive toe-in approach, where the two lenses are simply tilted toward each other.

Prior to Panda3D 1.9.0, the convergence was being calculated incorrectly. It has since been corrected. To restore the legacy behavior you can set the stereo-lens-old-convergence variable to true.

Also see setInterocularDistance(), which relates.

getConvergenceDistance() → float

See setConvergenceDistance().

setViewMat(view_mat: LMatrix4) → None

Sets an arbitrary transformation on the lens. This replaces the individual transformation components like setViewHpr().

Setting a transformation here will have a slightly different effect than putting one on the LensNode that contains this lens. In particular, lighting and other effects computations will still be performed on the lens in its untransformed (facing forward) position, but the actual projection matrix will be transformed by this matrix.

getViewMat() → LMatrix4

Returns the direction in which the lens is facing.

Return type

LMatrix4

clearViewMat() → None

Resets the lens transform to identity.

setKeystone(keystone: LVecBase2) → None

Indicates the ratio of keystone correction to perform on the lens, in each of three axes. This will build a special non-affine scale factor into the projection matrix that will compensate for keystoning of a projected image; this can be used to compensate for a projector that for physical reasons cannot be aimed directly at its screen.

The default value is taken from the default-keystone Config variable. 0, 0 indicates no keystone correction; specify a small value (usually in the range -1 .. 1) in either the x or y position to generate a keystone correction in that axis.

getKeystone() → LVecBase2

Returns the keystone correction specified for the lens.

Return type

LVecBase2

clearKeystone() → None

Disables the lens keystone correction.

setCustomFilmMat(custom_film_mat: LMatrix4) → None

Specifies a custom matrix to transform the points on the film after they have been converted into nominal film space (-1 .. 1 in U and V). This can be used to introduce arbitrary scales, rotations, or other linear transforms to the media plane. This is normally a 2-d matrix, but a full 4x4 matrix may be specified. This is applied on top of any film size, lens shift, and/or keystone correction.

getCustomFilmMat() → LMatrix4

Returns the custom_film_mat specified for the lens.

Return type

LMatrix4

clearCustomFilmMat() → None

Disables the lens custom_film_mat correction.

setFrustumFromCorners(ul: LVecBase3, ur: LVecBase3, ll: LVecBase3, lr: LVecBase3, flags: int) → None

Sets up the lens to use the frustum defined by the four indicated points. This is most useful for a PerspectiveLens, but it may be called for other kinds of lenses as well.

The frustum will be rooted at the origin (or by whatever translation might have been specified in a previous call to set_view_mat).

It is legal for the four points not to be arranged in a rectangle; if this is the case, the frustum will be fitted as tightly as possible to cover all four points.

The flags parameter contains the union of one or more of the following bits to control the behavior of this function:

FC_roll - If this is included, the camera may be rotated so that its up vector is perpendicular to the top line. Otherwise, the standard up vector is used.

FC_camera_plane - This allows the camera plane to be adjusted to be as nearly perpendicular to the center of the frustum as possible. Without this bit, the orientation camera plane is defined by position of the four points (which should all be coplanar). With this bit, the camera plane is arbitarary, and may be chosen so that the four points do not themselves lie in the camera plane (but the points will still be within the frustum).

FC_off_axis - This allows the resulting frustum to be off-axis to get the tightest possible fit. Without this bit, the viewing axis will be centered within the frustum, but there may be more wasted space along the edges.

FC_aspect_ratio - This allows the frustum to be scaled non-proportionately in the vertical and horizontal dimensions, if necessary, to get a tighter fit. Without this bit, the current aspect ratio will be preserved.

FC_shear - This allows the frustum to be sheared, if necessary, to get the tightest possible fit. This may result in a parallelogram-based frustum, which will give a slanted appearance to the rendered image. Without this bit, the frustum will be rectangle-based.

In general, if 0 is passed in as the value for flags, the generated frustum will be a loose fit but sane; if -1 is passed in, it will be a tighter fit and possibly screwy.

recomputeAll() → None

Forces all internal parameters of the Lens to be recomputed. Normally, this should never need to be called; it is provided only to assist in debugging.

isLinear() → bool

Returns true if the lens represents a linear projection (e.g. PerspectiveLens, OrthographicLens), and therefore there is a valid matrix returned by getProjectionMat(), or false otherwise.

isPerspective() → bool

Returns true if the lens represents a perspective projection (i.e. it is a PerspectiveLens), false otherwise.

isOrthographic() → bool

Returns true if the lens represents a orthographic projection (i.e. it is a OrthographicLens), false otherwise.

makeGeometry() → Geom

Allocates and returns a new Geom that can be rendered to show a visible representation of the frustum used for this kind of lens, if it makes sense to do so. If a visible representation cannot be created, returns NULL.

Return type

Geom

makeBounds() → BoundingVolume

Allocates and returns a new BoundingVolume that encloses the frustum used for this kind of lens, if possible. If a suitable bounding volume cannot be created, returns NULL.

Return type

BoundingVolume

getProjectionMat(channel: StereoChannel) → LMatrix4

Returns the complete transformation matrix from a 3-d point in space to a point on the film, if such a matrix exists, or the identity matrix if the lens is nonlinear.

Return type

LMatrix4

getProjectionMatInv(channel: StereoChannel) → LMatrix4

Returns the matrix that transforms from a 2-d point on the film to a 3-d vector in space, if such a matrix exists.

Return type

LMatrix4

getFilmMat() → LMatrix4

Returns the matrix that transforms from a point behind the lens to a point on the film.

Return type

LMatrix4

getFilmMatInv() → LMatrix4

Returns the matrix that transforms from a point on the film to a point behind the lens.

Return type

LMatrix4

getLensMat() → LMatrix4

Returns the matrix that transforms from a point in front of the lens to a point in space.

Return type

LMatrix4

getLensMatInv() → LMatrix4

Returns the matrix that transforms from a point in space to a point in front of the lens.

Return type

LMatrix4

output(out: ostream) → None
write(out: ostream, indent_level: int) → None
getLastChange() → UpdateSeq

Returns the UpdateSeq that is incremented whenever the lens properties are changed. As long as this number remains the same, you may assume the lens properties are unchanged.

Return type

UpdateSeq

static getClassType() → TypeHandle
Return type

TypeHandle

property change_event
Getter

Returns the name of the event that will be generated whenever any properties of this particular Lens have changed.

Setter

Sets the name of the event that will be generated whenever any properties of the Lens have changed. If this is not set for a particular lens, no event will be generated.

The event is thrown with one parameter, the lens itself. This can be used to automatically track changes to camera fov, etc. in the application.

Return type

string

property coordinate_system
Getter

Returns the coordinate system that all 3-d computations are performed within for this Lens. Normally, this is CS_default.

Setter

Specifies the coordinate system that all 3-d computations are performed within for this Lens. Normally, this is CS_default.

Return type

CoordinateSystem

property film_size
Getter

Returns the horizontal and vertical film size of the virtual film. See setFilmSize().

Setter

Sets the horizontal size of the film without changing its shape. The aspect ratio remains unchanged; this computes the vertical size of the film to automatically maintain the aspect ratio.

Sets the size and shape of the “film” within the lens. This both establishes the units used by calls like setFocalLength(), and establishes the aspect ratio of the frame.

In a physical camera, the field of view of a lens is determined by the lens’ focal length and by the size of the film area exposed by the lens. For instance, a 35mm camera exposes a rectangle on the film about 24mm x 36mm, which means a 50mm lens gives about a 40-degree horizontal field of view.

In the virtual camera, you may set the film size to any units here, and specify a focal length in the same units to simulate the same effect. Or, you may ignore this parameter, and specify the field of view and aspect ratio of the lens directly.

Sets the size and shape of the “film” within the lens. This both establishes the units used by calls like setFocalLength(), and establishes the aspect ratio of the frame.

In a physical camera, the field of view of a lens is determined by the lens’ focal length and by the size of the film area exposed by the lens. For instance, a 35mm camera exposes a rectangle on the film about 24mm x 36mm, which means a 50mm lens gives about a 40-degree horizontal field of view.

In the virtual camera, you may set the film size to any units here, and specify a focal length in the same units to simulate the same effect. Or, you may ignore this parameter, and specify the field of view and aspect ratio of the lens directly.

Return type

LVecBase2

property film_offset
Getter

Returns the horizontal and vertical offset amounts of this Lens. See setFilmOffset().

Setter

Sets the horizontal and vertical offset amounts of this Lens. These are both in the same units specified in setFilmSize().

This can be used to establish an off-axis lens.

Sets the horizontal and vertical offset amounts of this Lens. These are both in the same units specified in setFilmSize().

This can be used to establish an off-axis lens.

Return type

LVector2

property focal_length
Getter

Returns the focal length of the lens. This may have been set explicitly by a previous call to setFocalLength(), or it may be computed based on the lens’ fov and film_size. For certain kinds of lenses, the focal length has no meaning.

Setter

Sets the focal length of the lens. This may adjust the field-of-view correspondingly, and is an alternate way to specify field of view.

For certain kinds of lenses (e.g. OrthographicLens), the focal length has no meaning.

Return type

float

property fov
Getter

Returns the horizontal and vertical film size of the virtual film. See setFov().

Setter

Sets the horizontal field of view of the lens without changing the aspect ratio. The vertical field of view is adjusted to maintain the same aspect ratio.

Sets the field of view of the lens in both dimensions. This establishes both the field of view and the aspect ratio of the lens. This is one way to specify the field of view of a lens; setFocalLength() is another way.

For certain kinds of lenses (like OrthoLens), the field of view has no meaning.

Sets the field of view of the lens in both dimensions. This establishes both the field of view and the aspect ratio of the lens. This is one way to specify the field of view of a lens; setFocalLength() is another way.

For certain kinds of lenses (like OrthographicLens), the field of view has no meaning.

Return type

LVecBase2

property min_fov
Getter

Returns the field of view of the narrowest dimension of the window. See setMinFov().

Setter

Sets the field of view of the smallest dimension of the window. If the window is wider than it is tall, this specifies the vertical field of view; if it is taller than it is wide, this specifies the horizontal field of view.

In many cases, this is preferable to setting either the horizontal or vertical field of view explicitly. Setting this parameter means that pulling the window wider will widen the field of view, which is usually what you expect to happen.

Return type

float

property aspect_ratio
Getter

Returns the aspect ratio of the Lens. This is determined based on the indicated film size; see setFilmSize().

Setter

Sets the aspect ratio of the lens. This is the ratio of the height to the width of the generated image. Setting this overrides the two-parameter fov or film size setting.

Return type

float

property near
Getter

Returns the position of the near plane (or cylinder, sphere, whatever).

Setter

Defines the position of the near plane (or cylinder, sphere, whatever). Points closer to the lens than this may not be rendered.

Return type

float

property far
Getter

Returns the position of the far plane (or cylinder, sphere, whatever).

Setter

Defines the position of the far plane (or cylinder, sphere, whatever). Points farther from the lens than this may not be rendered.

Return type

float

property view_hpr
Getter

Returns the direction in which the lens is facing.

Setter

Sets the direction in which the lens is facing. Normally, this is down the forward axis (usually the Y axis), but it may be rotated. This is only one way of specifying the rotation; you may also specify an explicit vector in which to look, or you may give a complete transformation matrix.

Sets the direction in which the lens is facing. Normally, this is down the forward axis (usually the Y axis), but it may be rotated. This is only one way of specifying the rotation; you may also specify an explicit vector in which to look, or you may give a complete transformation matrix.

Return type

LVecBase3

property nodal_point

Returns the center point of the lens: the point from which the lens is viewing.

Return type

LPoint3

property interocular_distance
Getter

See setInterocularDistance().

Setter

Sets the distance between the left and right eyes of a stereo camera. This distance is used to apply a stereo effect when the lens is rendered on a stereo display region. It only has an effect on a PerspectiveLens.

The left eye and the right eye are each offset along the X axis by half of this distance, so that this parameter specifies the total distance between them.

Also see setConvergenceDistance(), which relates.

Return type

float

property convergence_distance
Getter

See setConvergenceDistance().

Setter

Sets the distance between between the camera plane and the point in the distance that the left and right eyes are both looking at. This distance is used to apply a stereo effect when the lens is rendered on a stereo display region. It only has an effect on a PerspectiveLens.

This parameter must be greater than 0, but may be as large as you like. It controls the distance at which the two stereo images will appear to converge, which is a normal property of stereo vision. Normally this should be set to the distance from the camera to the area of interest in your scene. Anything beyond this distance will appear to go into the screen, and anything closer will appear to come out of the screen. If you want to simulate parallel stereo, set this to infinity.

Note that this creates an off-axis frustum, which means that the lenses are still pointing in the same direction, which is usually more desirable than the more naive toe-in approach, where the two lenses are simply tilted toward each other.

Prior to Panda3D 1.9.0, the convergence was being calculated incorrectly. It has since been corrected. To restore the legacy behavior you can set the stereo-lens-old-convergence variable to true.

Also see setInterocularDistance(), which relates.

Return type

float

property view_mat
Getter

Returns the direction in which the lens is facing.

Setter

Sets an arbitrary transformation on the lens. This replaces the individual transformation components like setViewHpr().

Setting a transformation here will have a slightly different effect than putting one on the LensNode that contains this lens. In particular, lighting and other effects computations will still be performed on the lens in its untransformed (facing forward) position, but the actual projection matrix will be transformed by this matrix.

Return type

LMatrix4

property keystone
Getter

Returns the keystone correction specified for the lens.

Setter

Indicates the ratio of keystone correction to perform on the lens, in each of three axes. This will build a special non-affine scale factor into the projection matrix that will compensate for keystoning of a projected image; this can be used to compensate for a projector that for physical reasons cannot be aimed directly at its screen.

The default value is taken from the default-keystone Config variable. 0, 0 indicates no keystone correction; specify a small value (usually in the range -1 .. 1) in either the x or y position to generate a keystone correction in that axis.

Return type

LVecBase2

enum StereoChannel
enumerator SC_mono = 0
enumerator SC_left = 1
enumerator SC_right = 2
enumerator SC_stereo = 3

== SC_left | SC_right

enum FromCorners

These flags are passed in as the last parameter to control the behavior of setFrustumFromCorners(). See the documentation for that method for an explanation of each flag.

enumerator FC_roll = 1
enumerator FC_camera_plane = 2
enumerator FC_off_axis = 4
enumerator FC_aspect_ratio = 8
enumerator FC_shear = 16
enumerator FC_keystone = 32