Panda3D
Public Types | Public Member Functions | Static Public Member Functions

OrthographicLens Class Reference

An orthographic lens. More...

Inheritance diagram for OrthographicLens:
Lens TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject MemoryBase MemoryBase

List of all members.

Public Types

enum  FromCorners {
  FCRoll = 1, FCCameraPlane = 2, FCOffAxis = 4, FCAspectRatio = 8,
  FCShear = 16, FCKeystone = 32
}
enum  StereoChannel { SCMono = 0, SCLeft = 1, SCRight = 2, SCStereo = 3 }

Public Member Functions

 OrthographicLens ()
 clear ()
 Resets all lens parameters to their initial default settings.
 clearKeystone ()
 Disables the lens keystone correction.
 clearViewMat ()
 Resets the lens transform to identity.
string encodeToBamStream ()
 Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a string string.
bool encodeToBamStream (basic_stringchar data, BamWriter writer)
 Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string.
bool encodeToBamStream (basic_stringchar data)
 Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string.
bool extrude (Point3 const point2d, Point3 near_point, Point3 far_point)
 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.
bool extrude (Point2 const point2d, Point3 near_point, Point3 far_point)
 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.
bool extrudeVec (Point2 const point2d, Vec3 vec3d)
 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.
bool extrudeVec (Point3 const point2d, Vec3 vec3d)
 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.
float getAspectRatio ()
 Returns the aspect ratio of the Lens.
UpdateSeq getBamModified ()
 Returns the current bam_modified counter.
string getChangeEvent ()
 Returns the name of the event that will be generated whenever any properties of this particular Lens have changed.
float getConvergenceDistance ()
 See set_convergence_distance().
CoordinateSystem getCoordinateSystem ()
 Returns the coordinate system that all 3-d computations are performed within for this Lens.
float getFar ()
 Returns the position of the far plane (or cylinder, sphere, whatever).
Mat4 const getFilmMat ()
 Returns the matrix that transforms from a point behind the lens to a point on the film.
Mat4 const getFilmMatInv ()
 Returns the matrix that transforms from a point on the film to a point behind the lens.
Vec2 const getFilmOffset ()
 Returns the horizontal and vertical offset amounts of this Lens.
VBase2 const getFilmSize ()
 Returns the horizontal and vertical film size of the virtual film.
float getFocalLength ()
 Returns the focal length of the lens.
VBase2 const getFov ()
 Returns the horizontal and vertical film size of the virtual film.
float getHfov ()
 Returns the horizontal component of fov only.
float getInterocularDistance ()
 See set_interocular_distance().
VBase2 const getKeystone ()
 Returns the keystone correction specified for the lens.
Mat4 const getLensMat ()
 Returns the matrix that transforms from a point in front of the lens to a point in space.
Mat4 const getLensMatInv ()
 Returns the matrix that transforms from a point in space to a point in front of the lens.
float getMinFov ()
 Returns the field of view of the narrowest dimension of the window.
float getNear ()
 Returns the position of the near plane (or cylinder, sphere, whatever).
Point3 getNodalPoint ()
 Returns the center point of the lens: the point from which the lens is viewing.
Mat4 const getProjectionMat ()
 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.
Mat4 const getProjectionMat (StereoChannel channel)
 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.
Mat4 const getProjectionMatInv (StereoChannel channel)
 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.
Mat4 const getProjectionMatInv ()
 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.
int getRefCount ()
 Returns the current reference count.
TypeHandle getType ()
int getTypeIndex ()
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.
Vec3 const getUpVector ()
 Returns the axis perpendicular to the camera's view vector that indicates the "up" direction.
float getVfov ()
 Returns the vertical component of fov only.
VBase3 const getViewHpr ()
 Returns the direction in which the lens is facing.
Mat4 const getViewMat ()
 Returns the direction in which the lens is facing.
Vec3 const getViewVector ()
 Returns the axis along which the lens is facing.
bool isExactType (TypeHandle handle)
 Returns true if the current object is the indicated type exactly.
bool isLinear ()
 Returns true if the lens represents a linear projection (e.g.
bool isOfType (TypeHandle handle)
 Returns true if the current object is or derives from the indicated type.
bool isOrthographic ()
 Returns true if the lens represents a orthographic projection (i.e.
bool isPerspective ()
 Returns true if the lens represents a perspective projection (i.e.
BoundingVolume makeBounds ()
 Allocates and returns a new BoundingVolume that encloses the frustum used for this kind of lens, if possible.
Lens makeCopy ()
Geom makeGeometry ()
 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.
 markBamModified ()
 Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams.
 output (ostream out)
bool project (Point3 const point3d, Point3 point2d)
 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.
bool project (Point3 const point3d, Point2 point2d)
 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.
 recomputeAll ()
 Forces all internal parameters of the Lens to be recomputed.
PyObject reduce (PyObject self)
 This special Python method is implement to provide support for the pickle module.
PyObject reducePersist (PyObject self, PyObject pickler)
 This special Python method is implement to provide support for the pickle module.
 ref ()
 Explicitly increments the reference count.
 setAspectRatio (float aspect_ratio)
 Sets the aspect ratio of the lens.
 setChangeEvent (string event)
 Sets the name of the event that will be generated whenever any properties of the Lens have changed.
 setConvergenceDistance (float convergence_distance)
 Sets the distance between between the camera plane and the point in the distance that the left and right eyes are both looking at.
 setCoordinateSystem (CoordinateSystem cs)
 Specifies the coordinate system that all 3-d computations are performed within for this Lens.
 setFar (float far_distance)
 Defines the position of the far plane (or cylinder, sphere, whatever).
 setFilmOffset (VBase2 const film_offset)
 Sets the horizontal and vertical offset amounts of this Lens.
 setFilmOffset (float x, float y)
 Sets the horizontal and vertical offset amounts of this Lens.
 setFilmSize (float width)
 Sets the horizontal size of the film without changing its shape.
 setFilmSize (float width, float height)
 Sets the size and shape of the "film" within the lens.
 setFilmSize (VBase2 const film_size)
 Sets the size and shape of the "film" within the lens.
 setFocalLength (float focal_length)
 Sets the focal length of the lens.
 setFov (VBase2 const fov)
 Sets the field of view of the lens in both dimensions.
 setFov (float fov)
 Sets the horizontal field of view of the lens without changing the aspect ratio.
 setFov (float hfov, float vfov)
 Sets the field of view of the lens in both dimensions.
 setFrustumFromCorners (VBase3 const ul, VBase3 const ur, VBase3 const ll, VBase3 const lr, int flags)
 Sets up the lens to use the frustum defined by the four indicated points.
 setInterocularDistance (float interocular_distance)
 Sets the distance between the left and right eyes of a stereo camera.
 setKeystone (VBase2 const keystone)
 Indicates the ratio of keystone correction to perform on the lens, in each of three axes.
 setMinFov (float min_fov)
 Sets the field of view of the smallest dimension of the window.
 setNear (float near_distance)
 Defines the position of the near plane (or cylinder, sphere, whatever).
 setNearFar (float near_distance, float far_distance)
 Simultaneously changes the near and far planes.
 setViewHpr (VBase3 const view_hpr)
 Sets the direction in which the lens is facing.
 setViewHpr (float h, float p, float r)
 Sets the direction in which the lens is facing.
 setViewMat (Mat4 const view_mat)
 Sets an arbitrary transformation on the lens.
 setViewVector (float x, float y, float z, float i, float j, float k)
 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.
 setViewVector (Vec3 const view_vector, Vec3 const up_vector)
 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.
bool testRefCountIntegrity ()
 Does some easy checks to make sure that the reference count isn't completely bogus.
bool testRefCountNonzero ()
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
bool unref ()
 Explicitly decrements the reference count.
 write (ostream out)
 write (ostream out, int indent_level)

Static Public Member Functions

static TypedWritableReferenceCount decodeFromBamStream (string data, BamReader reader)
 Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on that string.
static TypedWritableReferenceCount decodeFromBamStream (string data)
 Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on that string.
static TypeHandle getClassType ()
static float getDefaultFar ()
 Returns the default far plane distance that will be assigned to each newly-created lens.
static float getDefaultNear ()
 Returns the default near plane distance that will be assigned to each newly-created lens.

Detailed Description

An orthographic lens.

Although this kind of lens is linear, like a PerspectiveLens, it doesn't respect field-of-view or focal length parameters, and adjusting these will have no effect. Instead, its field of view is controlled by adjusting the film_size; the orthographic lens represents a planar projection onto its imaginary film of the specified size, hanging in space.


Member Enumeration Documentation

enum FromCorners [inherited]
Enumerator:
FCRoll 
FCCameraPlane 
FCOffAxis 
FCAspectRatio 
FCShear 
FCKeystone 
enum StereoChannel [inherited]
Enumerator:
SCMono 
SCLeft 
SCRight 
SCStereo 

Constructor & Destructor Documentation


Member Function Documentation

clear ( ) [inherited]

Resets all lens parameters to their initial default settings.

clearKeystone ( ) [inherited]

Disables the lens keystone correction.

clearViewMat ( ) [inherited]

Resets the lens transform to identity.

static TypedWritableReferenceCount decodeFromBamStream ( string  data,
BamReader  reader 
) [static, inherited]

Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on that string.

Returns NULL on error.

This method is intended to replace decode_raw_from_bam_stream() when you know the stream in question returns an object of type TypedWritableReferenceCount, allowing for easier reference count management. Note that the caller is still responsible for maintaining the reference count on the return value.

static TypedWritableReferenceCount decodeFromBamStream ( string  data) [static, inherited]

Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on that string.

Returns NULL on error.

This method is intended to replace decode_raw_from_bam_stream() when you know the stream in question returns an object of type TypedWritableReferenceCount, allowing for easier reference count management. Note that the caller is still responsible for maintaining the reference count on the return value.

string encodeToBamStream ( ) [inherited]

Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a string string.

Returns empty string on failure.

This is a convenience method particularly useful for cases when you are only serializing a single object. If you have many objects to process, it is more efficient to use the same BamWriter to serialize all of them together.

bool encodeToBamStream ( basic_stringchar  data,
BamWriter  writer 
) [inherited]

Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string.

Returns true on success, false on failure.

This is a convenience method particularly useful for cases when you are only serializing a single object. If you have many objects to process, it is more efficient to use the same BamWriter to serialize all of them together.

bool encodeToBamStream ( basic_stringchar  data) [inherited]

Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string.

Returns true on success, false on failure.

This is a convenience method particularly useful for cases when you are only serializing a single object. If you have many objects to process, it is more efficient to use the same BamWriter to serialize all of them together.

bool extrude ( Point3 const  point2d,
Point3  near_point,
Point3  far_point 
) [inherited]

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.

bool extrude ( Point2 const  point2d,
Point3  near_point,
Point3  far_point 
) [inherited]

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.

bool extrudeVec ( Point2 const  point2d,
Vec3  vec3d 
) [inherited]

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.

bool extrudeVec ( Point3 const  point2d,
Vec3  vec3d 
) [inherited]

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.

float getAspectRatio ( ) [inherited]

Returns the aspect ratio of the Lens.

This is determined based on the indicated film size; see set_film_size().

UpdateSeq getBamModified ( ) [inherited]

Returns the current bam_modified counter.

This counter is normally incremented automatically whenever the object is modified.

string getChangeEvent ( ) [inherited]

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

static TypeHandle getClassType ( ) [static]

Reimplemented from Lens.

float getConvergenceDistance ( ) [inherited]

See set_convergence_distance().

CoordinateSystem getCoordinateSystem ( ) [inherited]

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

Normally, this is CS_default.

static float getDefaultFar ( ) [static, inherited]

Returns the default far plane distance that will be assigned to each newly-created lens.

This is read from the Configrc file.

static float getDefaultNear ( ) [static, inherited]

Returns the default near plane distance that will be assigned to each newly-created lens.

This is read from the Configrc file.

float getFar ( ) [inherited]

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

Mat4 const getFilmMat ( ) [inherited]

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

Mat4 const getFilmMatInv ( ) [inherited]

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

Vec2 const getFilmOffset ( ) [inherited]

Returns the horizontal and vertical offset amounts of this Lens.

See set_film_offset().

VBase2 const getFilmSize ( ) [inherited]

Returns the horizontal and vertical film size of the virtual film.

See set_film_size().

float getFocalLength ( ) [inherited]

Returns the focal length of the lens.

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

VBase2 const getFov ( ) [inherited]

Returns the horizontal and vertical film size of the virtual film.

See set_fov().

float getHfov ( ) [inherited]

Returns the horizontal component of fov only.

See get_fov().

float getInterocularDistance ( ) [inherited]

See set_interocular_distance().

VBase2 const getKeystone ( ) [inherited]

Returns the keystone correction specified for the lens.

Mat4 const getLensMat ( ) [inherited]

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

Mat4 const getLensMatInv ( ) [inherited]

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

float getMinFov ( ) [inherited]

Returns the field of view of the narrowest dimension of the window.

See set_min_fov().

float getNear ( ) [inherited]

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

Point3 getNodalPoint ( ) [inherited]

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

Mat4 const getProjectionMat ( StereoChannel  channel) [inherited]

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.

Mat4 const getProjectionMat ( ) [inherited]

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.

Mat4 const getProjectionMatInv ( ) [inherited]

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.

Mat4 const getProjectionMatInv ( StereoChannel  channel) [inherited]

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.

int getRefCount ( ) [inherited]

Returns the current reference count.

TypeHandle getType ( ) [inherited]

Reimplemented in AnimChannelBase.

int getTypeIndex ( ) [inherited]

Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.

This is equivalent to get_type().get_index().

Vec3 const getUpVector ( ) [inherited]

Returns the axis perpendicular to the camera's view vector that indicates the "up" direction.

float getVfov ( ) [inherited]

Returns the vertical component of fov only.

See get_fov().

VBase3 const getViewHpr ( ) [inherited]

Returns the direction in which the lens is facing.

Mat4 const getViewMat ( ) [inherited]

Returns the direction in which the lens is facing.

Vec3 const getViewVector ( ) [inherited]

Returns the axis along which the lens is facing.

bool isExactType ( TypeHandle  handle) [inherited]

Returns true if the current object is the indicated type exactly.

bool isLinear ( ) [inherited]

Returns true if the lens represents a linear projection (e.g.

PerspectiveLens, OrthographicLens), and therefore there is a valid matrix returned by get_projection_mat(), or false otherwise.

bool isOfType ( TypeHandle  handle) [inherited]

Returns true if the current object is or derives from the indicated type.

bool isOrthographic ( ) [inherited]

Returns true if the lens represents a orthographic projection (i.e.

it is a OrthographicLens), false otherwise.

bool isPerspective ( ) [inherited]

Returns true if the lens represents a perspective projection (i.e.

it is a PerspectiveLens), false otherwise.

BoundingVolume makeBounds ( ) [inherited]

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.

Lens makeCopy ( ) [inherited]
Geom makeGeometry ( ) [inherited]

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.

markBamModified ( ) [inherited]

Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams.

This should normally not need to be called by user code; it should be called internally when the object has been changed in a way that legitimately requires its retransmission to any connected clients.

output ( ostream  out) [inherited]
bool project ( Point3 const  point3d,
Point3  point2d 
) [inherited]

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).

bool project ( Point3 const  point3d,
Point2  point2d 
) [inherited]

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).

recomputeAll ( ) [inherited]

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.

PyObject reduce ( PyObject  self) [inherited]

This special Python method is implement to provide support for the pickle module.

This hooks into the native pickle and cPickle modules, but it cannot properly handle self-referential BAM objects.

PyObject reducePersist ( PyObject  self,
PyObject  pickler 
) [inherited]

This special Python method is implement to provide support for the pickle module.

This is similar to __reduce__, but it provides additional support for the missing persistent-state object needed to properly support self-referential BAM objects written to the pickle stream. This hooks into the pickle and cPickle modules implemented in direct/src/stdpy.

ref ( ) [inherited]

Explicitly increments the reference count.

User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.

This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

setAspectRatio ( float  aspect_ratio) [inherited]

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.

setChangeEvent ( string  event) [inherited]

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.

setConvergenceDistance ( float  convergence_distance) [inherited]

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 amount to which the two eyes are directed inwards towards each other, which is a normal property of stereo vision. It is a distance, not an angle; normally this should be set to the distance from the camera to the area of interest in your scene. If you want to simulate parallel stereo, set this value to a very large number.

Also see set_interocular_distance(), which relates.

setCoordinateSystem ( CoordinateSystem  cs) [inherited]

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

Normally, this is CS_default.

setFar ( float  far_distance) [inherited]

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

Points farther from the lens than this may not be rendered.

setFilmOffset ( float  x,
float  y 
) [inherited]

Sets the horizontal and vertical offset amounts of this Lens.

These are both in the same units specified in set_film_size().

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

setFilmOffset ( VBase2 const  film_offset) [inherited]

Sets the horizontal and vertical offset amounts of this Lens.

These are both in the same units specified in set_film_size().

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

setFilmSize ( float  width,
float  height 
) [inherited]

Sets the size and shape of the "film" within the lens.

This both establishes the units used by calls like set_focal_length(), 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 ( float  width) [inherited]

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 ( VBase2 const  film_size) [inherited]

Sets the size and shape of the "film" within the lens.

This both establishes the units used by calls like set_focal_length(), 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.

setFocalLength ( float  focal_length) [inherited]

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.

setFov ( float  fov) [inherited]

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 ( VBase2 const  fov) [inherited]

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; set_focal_length() is another way.

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

setFov ( float  hfov,
float  vfov 
) [inherited]

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; set_focal_length() is another way.

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

setFrustumFromCorners ( VBase3 const  ul,
VBase3 const  ur,
VBase3 const  ll,
VBase3 const  lr,
int  flags 
) [inherited]

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.

setInterocularDistance ( float  interocular_distance) [inherited]

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 set_convergence_distance(), which relates.

setKeystone ( VBase2 const  keystone) [inherited]

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.

setMinFov ( float  min_fov) [inherited]

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.

setNear ( float  near_distance) [inherited]

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

Points closer to the lens than this may not be rendered.

setNearFar ( float  near_distance,
float  far_distance 
) [inherited]

Simultaneously changes the near and far planes.

setViewHpr ( VBase3 const  view_hpr) [inherited]

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 ( float  h,
float  p,
float  r 
) [inherited]

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.

setViewMat ( Mat4 const  view_mat) [inherited]

Sets an arbitrary transformation on the lens.

This replaces the individual transformation components like set_view_hpr().

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.

setViewVector ( float  x,
float  y,
float  z,
float  i,
float  j,
float  k 
) [inherited]

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 set_view_hpr().

setViewVector ( Vec3 const  view_vector,
Vec3 const  up_vector 
) [inherited]

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 set_view_hpr().

bool testRefCountIntegrity ( ) [inherited]

Does some easy checks to make sure that the reference count isn't completely bogus.

Returns true if ok, false otherwise.

Reimplemented in NodeReferenceCount, CachedTypedWritableReferenceCount, and NodeCachedReferenceCount.

bool testRefCountNonzero ( ) [inherited]

Does some easy checks to make sure that the reference count isn't zero, or completely bogus.

Returns true if ok, false otherwise.

bool unref ( ) [inherited]

Explicitly decrements the reference count.

Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic.) However, see the helper function unref_delete().

User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.

This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

The return value is true if the new reference count is nonzero, false if it is zero.

Reimplemented in GeomVertexArrayFormat, and GeomVertexFormat.

write ( ostream  out,
int  indent_level 
) [inherited]
write ( ostream  out) [inherited]
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties