#include <pSphereLens.h>
Inheritance diagram for PSphereLens:
Public Types | |
enum | FromCorners { FC_roll = 0x0001, FC_camera_plane = 0x0002, FC_off_axis = 0x0004, FC_aspect_ratio = 0x0008, FC_shear = 0x0010 } |
Public Member Functions | |
PSphereLens () | |
PSphereLens (const PSphereLens ©) | |
void | operator= (const PSphereLens ©) |
virtual | PT (Lens) make_copy() const |
virtual TypeHandle | get_type () const |
virtual TypeHandle | force_init_type () |
virtual PointerTo< Lens > | make_copy () const=0 |
bool | extrude (const LPoint2f &point2d, LPoint3f &near_point, LPoint3f &far_point) const |
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 (const LPoint3f &point2d, LPoint3f &near_point, LPoint3f &far_point) const |
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 | project (const LPoint3f &point3d, LPoint3f &point2d) const |
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 (const LPoint3f &point3d, LPoint2f &point2d) const |
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. | |
void | set_change_event (const string &event) |
Sets the name of the event that will be generated whenever any properties of the Lens have changed. | |
const string & | get_change_event () const |
Returns the name of the event that will be generated whenever any properties of this particular Lens have changed. | |
void | set_coordinate_system (CoordinateSystem cs) |
Specifies the coordinate system that all 3-d computations are performed within for this Lens. | |
CoordinateSystem | get_coordinate_system () const |
Returns the coordinate system that all 3-d computations are performed within for this Lens. | |
void | clear () |
Resets all lens parameters to their initial default settings. | |
void | set_film_size (float width) |
Sets the horizontal size of the film without changing its shape. | |
void | set_film_size (float width, float height) |
Sets the size and shape of the "film" within the lens. | |
void | set_film_size (const LVecBase2f &film_size) |
Sets the size and shape of the "film" within the lens. | |
const LVecBase2f & | get_film_size () const |
Returns the horizontal and vertical film size of the virtual film. | |
void | set_film_offset (float x, float y) |
Sets the horizontal and vertical offset amounts of this Lens. | |
void | set_film_offset (const LVecBase2f &film_offset) |
Sets the horizontal and vertical offset amounts of this Lens. | |
const LVector2f & | get_film_offset () const |
Returns the horizontal and vertical offset amounts of this Lens. | |
void | set_focal_length (float focal_length) |
Sets the focal length of the lens. | |
float | get_focal_length () const |
Returns the focal length of the lens. | |
void | set_fov (float fov) |
Sets the horizontal field of view of the lens without changing the aspect ratio. | |
void | set_fov (float hfov, float vfov) |
Sets the field of view of the lens in both dimensions. | |
void | set_fov (const LVecBase2f &fov) |
Sets the field of view of the lens in both dimensions. | |
const LVecBase2f & | get_fov () const |
Returns the horizontal and vertical film size of the virtual film. | |
float | get_hfov () const |
Returns the horizontal component of fov only. | |
float | get_vfov () const |
Returns the vertical component of fov only. | |
void | set_aspect_ratio (float aspect_ratio) |
Sets the aspect ratio of the lens. | |
float | get_aspect_ratio () const |
Returns the aspect ratio of the Lens. | |
void | set_near (float near_distance) |
Defines the position of the near plane (or cylinder, sphere, whatever). | |
float | get_near () const |
Returns the position of the near plane (or cylinder, sphere, whatever). | |
void | set_far (float far_distance) |
Defines the position of the far plane (or cylinder, sphere, whatever). | |
float | get_far () const |
Returns the position of the far plane (or cylinder, sphere, whatever). | |
void | set_near_far (float near_distance, float far_distance) |
Simultaneously changes the near and far planes. | |
void | set_view_hpr (float h, float p, float r) |
Sets the direction in which the lens is facing. | |
void | set_view_hpr (const LVecBase3f &view_hpr) |
Sets the direction in which the lens is facing. | |
const LVecBase3f & | get_view_hpr () const |
Returns the direction in which the lens is facing. | |
void | set_view_vector (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. | |
void | set_view_vector (const LVector3f &view_vector, const LVector3f &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. | |
const LVector3f & | get_view_vector () const |
Returns the axis along which the lens is facing. | |
const LVector3f & | get_up_vector () const |
Returns the axis perpendicular to the camera's view vector that indicates the "up" direction. | |
LPoint3f | get_nodal_point () const |
Returns the center point of the lens: the point from which the lens is viewing. | |
void | set_iod_offset (float offset) |
Sets the amount by which the lens is shifted to the right, perpendicular to its view vector and up vector. | |
float | get_iod_offset () const |
Returns the aspect ratio of the Lens. | |
void | set_view_mat (const LMatrix4f &view_mat) |
Sets an arbitrary transformation on the lens. | |
const LMatrix4f & | get_view_mat () const |
Returns the direction in which the lens is facing. | |
void | set_frustum_from_corners (const LVecBase3f &ul, const LVecBase3f &ur, const LVecBase3f &ll, const LVecBase3f &lr, int flags) |
Sets up the lens to use the frustum defined by the four indicated points. | |
void | recompute_all () |
Forces all internal parameters of the Lens to be recomputed. | |
virtual bool | is_linear () const |
Returns true if the lens represents a linear projection (e.g. | |
virtual PointerTo< Geom > | make_geometry () |
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. | |
virtual PointerTo< BoundingVolume > | make_bounds () const |
Allocates and returns a new BoundingVolume that encloses the frustum used for this kind of lens, if possible. | |
const LMatrix4f & | get_projection_mat () const |
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. | |
const LMatrix4f & | get_projection_mat_inv () const |
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. | |
virtual void | output (ostream &out) const |
virtual void | write (ostream &out, int indent_level=0) const |
const UpdateSeq & | get_last_change () const |
Returns the UpdateSeq that is incremented whenever the lens properties are changed. | |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. | |
int | get_ref_count () const |
Returns the current reference count. | |
int | ref () const |
Explicitly increments the reference count. | |
int | unref () const |
Explicitly decrements the reference count. | |
void | test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
Static Public Member Functions | |
TypeHandle | get_class_type () |
void | init_type () |
float | get_default_near () |
Returns the default near plane distance that will be assigned to each newly-created lens. | |
float | get_default_far () |
Returns the default far plane distance that will be assigned to each newly-created lens. | |
Protected Types | |
enum | UserFlags { UF_film_width = 0x0001, UF_film_height = 0x0002, UF_focal_length = 0x0004, UF_hfov = 0x0008, UF_vfov = 0x0010, UF_aspect_ratio = 0x0020, UF_view_hpr = 0x0040, UF_view_vector = 0x0080, UF_iod_offset = 0x0100, UF_view_mat = 0x0200 } |
enum | CompFlags { CF_film_mat = 0x0001, CF_film_mat_inv = 0x0002, CF_lens_mat = 0x0004, CF_lens_mat_inv = 0x0008, CF_projection_mat = 0x0010, CF_projection_mat_inv = 0x0020, CF_mat = 0x003f, CF_focal_length = 0x0040, CF_fov = 0x0080, CF_film_size = 0x0100, CF_aspect_ratio = 0x0200, CF_view_hpr = 0x0400, CF_view_vector = 0x0800, CF_iod_offset = 0x1000 } |
Protected Member Functions | |
virtual bool | extrude_impl (const LPoint3f &point2d, LPoint3f &near_point, LPoint3f &far_point) const |
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. | |
virtual bool | project_impl (const LPoint3f &point3d, LPoint3f &point2d) const |
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. | |
virtual float | fov_to_film (float fov, float focal_length, bool horiz) const |
Given a field of view in degrees and a focal length, compute the correspdonding width (or height) on the film. | |
virtual float | fov_to_focal_length (float fov, float film_size, bool horiz) const |
Given a field of view in degrees and a width (or height) on the film, compute the focal length of the lens. | |
virtual float | film_to_fov (float film_size, float focal_length, bool horiz) const |
Given a width (or height) on the film and a focal length, compute the field of view in degrees. | |
void | adjust_user_flags (int clear_flags, int set_flags) |
Clears from _user_flags the bits in the first parameter, and sets the bits in the second parameter. | |
void | adjust_comp_flags (int clear_flags, int set_flags) |
Clears from _comp_flags the bits in the first parameter, and sets the bits in the second parameter. | |
void | throw_change_event () |
Throws the event associated with changing properties on this Lens, if any. | |
const LMatrix4f & | get_film_mat () const |
Returns the matrix that transforms from a point behind the lens to a point on the film. | |
const LMatrix4f & | get_film_mat_inv () const |
Returns the matrix that transforms from a point on the film to a point behind the lens. | |
const LMatrix4f & | get_lens_mat () const |
Returns the matrix that transforms from a point in front of the lens to a point in space. | |
const LMatrix4f & | get_lens_mat_inv () const |
Returns the matrix that transforms from a point in space to a point in front of the lens. | |
virtual void | compute_film_size () |
Computes the size and shape of the film behind the camera, based on the aspect ratio and fov. | |
virtual void | compute_focal_length () |
Computes the focal length of the lens, based on the fov and film size. | |
virtual void | compute_fov () |
Computes the field of view of the lens, based on the film size and focal length. | |
virtual void | compute_aspect_ratio () |
Computes the aspect ratio of the film rectangle, as a ratio of width to height. | |
virtual void | compute_view_hpr () |
Computes the Euler angles representing the lens' rotation. | |
virtual void | compute_view_vector () |
Computes the view vector and up vector for the lens. | |
virtual void | compute_iod_offset () |
Computes the IOD offset: the translation along the "right" axis. | |
virtual void | compute_projection_mat () |
Computes the complete transformation matrix from 3-d point to 2-d point, if the lens is linear. | |
virtual void | compute_film_mat () |
Computes the matrix that transforms from a point behind the lens to a point on the film. | |
virtual void | compute_lens_mat () |
Computes the matrix that transforms from a point in front of the lens to a point in space. | |
Protected Attributes | |
string | _change_event |
UpdateSeq | _last_change |
CoordinateSystem | _cs |
LVecBase2f | _film_size |
LVector2f | _film_offset |
float | _focal_length |
LVecBase2f | _fov |
float | _aspect_ratio |
float | _near_distance |
float | _far_distance |
LVecBase3f | _view_hpr |
LVector3f | _view_vector |
LVector3f | _up_vector |
float | _iod_offset |
LMatrix4f | _film_mat |
LMatrix4f | _film_mat_inv |
LMatrix4f | _lens_mat |
LMatrix4f | _lens_mat_inv |
LMatrix4f | _projection_mat |
LMatrix4f | _projection_mat_inv |
short | _user_flags |
short | _comp_flags |
char | _focal_length_seq |
char | _fov_seq |
char | _film_size_seq |
PTA_Vertexf | _geom_coords |
Static Protected Attributes | |
const float | _default_fov = 40.0f |
Static Private Attributes | |
TypeHandle | _type_handle |
It's primarily useful for generating 360-degree wraparound images while avoiding the distortion associated with fisheye images.
A PSphereLens is similar to a cylindrical lens, except it is also curved in the vertical direction. This allows it to extend to both poles in the vertical direction. The mapping is similar to what many modeling packages call a sphere mapping: the x coordinate is proportional to azimuth, while the y coordinate is proportional to altitude.
Definition at line 60 of file pSphereLens.h.
|
|
|
|
|
|
|
Definition at line 30 of file pSphereLens.I. References INLINE. |
|
Definition at line 41 of file pSphereLens.I. References INLINE, and Lens::operator=(). |
|
Clears from _comp_flags the bits in the first parameter, and sets the bits in the second parameter.
Definition at line 561 of file lens.I. Referenced by Lens::get_default_far(), Lens::get_view_hpr(), Lens::is_linear(), MatrixLens::operator=(), Lens::output(), Lens::set_aspect_ratio(), Lens::set_change_event(), Lens::set_film_offset(), and Lens::set_film_size(). |
|
Clears from _user_flags the bits in the first parameter, and sets the bits in the second parameter.
Definition at line 546 of file lens.I. Referenced by Lens::get_default_far(), Lens::get_view_hpr(), Lens::set_aspect_ratio(), and Lens::set_film_size(). |
|
Resets all lens parameters to their initial default settings.
|
|
Computes the aspect ratio of the film rectangle, as a ratio of width to height.
Definition at line 1586 of file lens.cxx. References length. Referenced by Lens::set_film_size(). |
|
Computes the matrix that transforms from a point behind the lens to a point on the film.
|
|
Computes the size and shape of the film behind the camera, based on the aspect ratio and fov.
|
|
Computes the focal length of the lens, based on the fov and film size. This is based on the horizontal dimension. |
|
Computes the field of view of the lens, based on the film size and focal length.
Definition at line 1550 of file lens.cxx. References Lens::_geom_coords. |
|
Computes the IOD offset: the translation along the "right" axis.
|
|
Computes the matrix that transforms from a point in front of the lens to a point in space.
|
|
Computes the complete transformation matrix from 3-d point to 2-d point, if the lens is linear.
Reimplemented in MatrixLens, OrthographicLens, and PerspectiveLens. Definition at line 1668 of file lens.cxx. References t. |
|
Computes the Euler angles representing the lens' rotation.
Definition at line 1609 of file lens.cxx. References csqrt(). |
|
Computes the view vector and up vector for the lens.
|
|
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. Definition at line 90 of file lens.I. References INLINE, and Lens::project_impl(). |
|
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. Definition at line 52 of file lens.I. References Lens::extrude_impl(), and INLINE. Referenced by ProjectionScreen::set_projector(). |
|
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. Reimplemented from Lens. Definition at line 79 of file pSphereLens.cxx. References catan2(), Lens::get_far(), Lens::get_film_mat(), Lens::get_focal_length(), Lens::get_lens_mat_inv(), Lens::get_near(), rad_2_deg(), and spherical_k. |
|
Given a width (or height) on the film and a focal length, compute the field of view in degrees. If horiz is true, this is in the horizontal direction; otherwise, it is in the vertical direction (some lenses behave differently in each direction). Reimplemented from Lens. Definition at line 235 of file pSphereLens.cxx. |
|
Reimplemented from Lens. Definition at line 84 of file pSphereLens.h. |
|
Given a field of view in degrees and a focal length, compute the correspdonding width (or height) on the film. If horiz is true, this is in the horizontal direction; otherwise, it is in the vertical direction (some lenses behave differently in each direction). Reimplemented from Lens. Definition at line 193 of file pSphereLens.cxx. |
|
Given a field of view in degrees and a width (or height) on the film, compute the focal length of the lens. If horiz is true, this is in the horizontal direction; otherwise, it is in the vertical direction (some lenses behave differently in each direction). Reimplemented from Lens. Definition at line 214 of file pSphereLens.cxx. |
|
Returns the aspect ratio of the Lens. This is determined based on the indicated film size; see set_film_size(). |
|
Returns the name of the event that will be generated whenever any properties of this particular Lens have changed.
Definition at line 207 of file lens.I. References Lens::_film_offset, and INLINE. |
|
Reimplemented from Lens. Definition at line 85 of file pSphereLens.h. |
|
Returns the coordinate system that all 3-d computations are performed within for this Lens. Normally, this is CS_default. Definition at line 224 of file lens.I. References INLINE, and Lens::set_fov(). |
|
Returns the default far plane distance that will be assigned to each newly-created lens. This is read from the Configrc file. Definition at line 515 of file lens.cxx. References Lens::_iod_offset, Lens::adjust_comp_flags(), Lens::adjust_user_flags(), Lens::CF_iod_offset, Lens::CF_mat, Lens::CF_view_hpr, Lens::CF_view_vector, Lens::throw_change_event(), Lens::UF_iod_offset, and Lens::UF_view_mat. |
|
Returns the default near plane distance that will be assigned to each newly-created lens. This is read from the Configrc file. Definition at line 498 of file lens.cxx. References Lens::get_view_mat(). |
|
Returns the position of the far plane (or cylinder, sphere, whatever).
Definition at line 453 of file lens.I. Referenced by ProjectionScreen::cull_callback(), and extrude_impl(). |
|
Returns the matrix that transforms from a point behind the lens to a point on the film.
Definition at line 1295 of file lens.cxx. Referenced by extrude_impl(), and Lens::is_linear(). |
|
Returns the matrix that transforms from a point on the film to a point behind the lens.
|
|
Returns the horizontal and vertical offset amounts of this Lens. See set_film_offset(). Definition at line 328 of file lens.I. References INLINE, and Lens::set_view_hpr(). Referenced by Lens::get_lens_mat(). |
|
Returns the horizontal and vertical film size of the virtual film. See set_film_size(). Definition at line 257 of file lens.cxx. References Lens::_comp_flags, Lens::_focal_length, and Lens::CF_focal_length. Referenced by Lens::get_lens_mat(), Lens::get_projection_mat_inv(), and Lens::write(). |
|
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. Definition at line 326 of file lens.cxx. Referenced by extrude_impl(). |
|
Returns the horizontal and vertical film size of the virtual film. See set_fov(). Definition at line 433 of file lens.cxx. References Lens::_comp_flags, Lens::_view_hpr, and Lens::CF_view_hpr. |
|
Returns the horizontal component of fov only. See get_fov(). Definition at line 370 of file lens.I. References Lens::_comp_flags, and INLINE. Referenced by GLGraphicsStateGuardian::issue_cull_face(). |
|
Returns the aspect ratio of the Lens. This is determined based on the indicated film size; see set_film_size(). Definition at line 682 of file lens.cxx. References Lens::FC_shear. |
|
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. |
|
Returns the matrix that transforms from a point in front of the lens to a point in space.
Definition at line 1334 of file lens.cxx. References Lens::get_film_offset(), and Lens::get_film_size(). |
|
Returns the matrix that transforms from a point in space to a point in front of the lens.
Definition at line 1352 of file lens.cxx. References Lens::_film_mat. Referenced by extrude_impl(), and Lens::get_nodal_point(). |
|
Returns the position of the near plane (or cylinder, sphere, whatever).
Definition at line 419 of file lens.I. Referenced by ProjectionScreen::cull_callback(), and extrude_impl(). |
|
Returns the center point of the lens: the point from which the lens is viewing.
Definition at line 635 of file lens.cxx. References Lens::FC_camera_plane, and Lens::get_lens_mat_inv(). Referenced by GLGraphicsStateGuardian::issue_cull_face(), and DXGraphicsStateGuardian8::issue_depth_write(). |
|
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.
|
|
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.
Definition at line 1216 of file lens.cxx. References Lens::_default_fov, Lens::_focal_length, Lens::_fov, Lens::_user_flags, Lens::film_to_fov(), Lens::get_film_size(), Lens::UF_focal_length, and Lens::UF_hfov. |
|
Returns the current reference count.
Definition at line 183 of file referenceCount.I. Referenced by RenderState::determine_bin_index(), RenderEffects::determine_show_bounds(), FontPool::ns_garbage_collect(), TexturePool::ns_garbage_collect(), MaterialPool::ns_get_material(), and TexturePool::ns_release_texture(). |
|
Reimplemented from Lens. Definition at line 81 of file pSphereLens.h. |
|
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(). Definition at line 71 of file typedObject.I. References TypeHandle::get_name(), TypedObject::get_type(), and INLINE. |
|
Returns the axis perpendicular to the camera's view vector that indicates the "up" direction.
|
|
Returns the vertical component of fov only. See get_fov(). |
|
Returns the direction in which the lens is facing.
Definition at line 556 of file lens.cxx. References Lens::_lens_mat, Lens::adjust_comp_flags(), Lens::adjust_user_flags(), Lens::CF_iod_offset, Lens::CF_lens_mat, Lens::CF_lens_mat_inv, Lens::CF_view_hpr, Lens::CF_view_vector, Lens::throw_change_event(), Lens::UF_iod_offset, Lens::UF_view_hpr, Lens::UF_view_mat, and Lens::UF_view_vector. |
|
Returns the direction in which the lens is facing.
Definition at line 736 of file lens.cxx. Referenced by Lens::get_default_near(). |
|
Returns the axis along which the lens is facing.
Definition at line 599 of file lens.cxx. Referenced by GLGraphicsStateGuardian::issue_cull_face(). |
|
Reimplemented from Lens. Definition at line 88 of file pSphereLens.h. |
|
Returns true if the current object is the indicated type exactly.
Definition at line 101 of file typedObject.I. Referenced by PT(), and CollisionNode::xform(). |
|
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. Reimplemented in MatrixLens, OrthographicLens, and PerspectiveLens. Definition at line 1034 of file lens.cxx. References Lens::_comp_flags, Lens::_film_mat_inv, Lens::adjust_comp_flags(), Lens::CF_film_mat_inv, and Lens::get_film_mat(). |
|
|
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. |
|
Implemented in MatrixLens, OrthographicLens, and PerspectiveLens. |
|
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. Definition at line 1055 of file lens.cxx. References Lens::_comp_flags, Lens::_lens_mat, and Lens::CF_lens_mat. |
|
Definition at line 52 of file pSphereLens.I. |
|
Definition at line 1235 of file lens.cxx. References Lens::_comp_flags, Lens::_focal_length, Lens::_fov, Lens::_user_flags, Lens::adjust_comp_flags(), Lens::CF_focal_length, Lens::film_to_fov(), Lens::fov_to_focal_length(), Lens::UF_focal_length, and Lens::UF_vfov. |
|
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). Definition at line 121 of file lens.I. References Lens::_change_event. |
|
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). Definition at line 163 of file lens.I. References height, INLINE, Lens::set_film_size(), and width. |
|
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. Some lens types also set the z coordinate of the 2-d point 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. Reimplemented from Lens. Definition at line 134 of file pSphereLens.cxx. |
|
|
|
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. |
|
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. The return value is the new reference count. Definition at line 225 of file referenceCount.I. Referenced by ClientDevice::ClientDevice(), EggGroupNode::find_textures(), EggGroupNode::r_apply_texmats(), EggGroupNode::r_flatten_transforms(), and EggGroupNode::reverse_vertex_ordering(). |
|
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. Definition at line 456 of file lens.cxx. References Lens::_up_vector, Lens::_view_vector, Lens::adjust_comp_flags(), Lens::adjust_user_flags(), Lens::CF_iod_offset, Lens::CF_mat, Lens::CF_view_hpr, Lens::CF_view_vector, Lens::throw_change_event(), Lens::UF_view_hpr, Lens::UF_view_mat, and Lens::UF_view_vector. |
|
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. Definition at line 190 of file lens.I. References Lens::_film_offset, Lens::adjust_comp_flags(), Lens::CF_mat, INLINE, and Lens::throw_change_event(). |
|
Specifies the coordinate system that all 3-d computations are performed within for this Lens. Normally, this is CS_default. Definition at line 101 of file lens.cxx. References Lens::_aspect_ratio, Lens::_comp_flags, Lens::_far_distance, Lens::_film_size_seq, Lens::_focal_length, Lens::_focal_length_seq, Lens::_fov, Lens::_fov_seq, Lens::_iod_offset, Lens::_near_distance, Lens::_up_vector, Lens::_user_flags, Lens::_view_hpr, Lens::_view_vector, Lens::CF_fov, default_far, and default_near. |
|
Defines the position of the far plane (or cylinder, sphere, whatever). Points farther from the lens than this may not be rendered. |
|
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. Definition at line 311 of file lens.I. References Lens::_far_distance, Lens::_near_distance, Lens::adjust_comp_flags(), Lens::CF_projection_mat, Lens::CF_projection_mat_inv, and Lens::throw_change_event(). |
|
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. |
|
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. Definition at line 218 of file lens.cxx. References Lens::_film_size_seq, Lens::_focal_length, Lens::_focal_length_seq, Lens::_fov_seq, Lens::adjust_comp_flags(), Lens::adjust_user_flags(), Lens::CF_film_size, Lens::CF_focal_length, Lens::CF_fov, Lens::CF_mat, nassertv, Lens::resequence_fov_triad(), Lens::throw_change_event(), Lens::UF_film_height, Lens::UF_film_width, Lens::UF_focal_length, Lens::UF_hfov, and Lens::UF_vfov. |
|
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. Definition at line 269 of file lens.I. References Lens::_near_distance, and INLINE. |
|
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. Definition at line 155 of file lens.cxx. References Lens::_film_size, Lens::_film_size_seq, Lens::_focal_length_seq, Lens::_fov_seq, Lens::adjust_comp_flags(), Lens::adjust_user_flags(), Lens::CF_aspect_ratio, Lens::CF_film_size, Lens::CF_focal_length, Lens::CF_fov, Lens::CF_mat, Lens::compute_aspect_ratio(), nassertv, Lens::resequence_fov_triad(), Lens::throw_change_event(), Lens::UF_aspect_ratio, Lens::UF_film_height, Lens::UF_film_width, Lens::UF_focal_length, Lens::UF_hfov, and Lens::UF_vfov. Referenced by Lens::project(), and WindowFramework::set_one_sided_reverse(). |
|
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. |
|
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. Definition at line 394 of file lens.cxx. References default_near. |
|
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. Definition at line 355 of file lens.I. References Lens::_last_change. |
|
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. Definition at line 346 of file lens.cxx. References Lens::_comp_flags, Lens::_fov, and Lens::CF_fov. Referenced by Lens::get_coordinate_system(). |
|
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 offset by iod_offset, 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. |
|
Sets the amount by which the lens is shifted to the right, perpendicular to its view vector and up vector. This is normally used to shift one or both lens of a stereo camera to generate parallax. You can also simply set a complete transformation matrix (via set_view_mat()) that includes an arbitrary translation. |
|
Defines the position of the near plane (or cylinder, sphere, whatever). Points closer to the lens than this may not be rendered. |
|
Simultaneously changes the near and far planes.
|
|
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. Definition at line 538 of file lens.cxx. References Lens::_iod_offset. |
|
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. Definition at line 492 of file lens.I. Referenced by Lens::get_film_offset(). |
|
Sets an arbitrary transformation on the lens. This replaces the individual transformation components like set_view_hpr() or set_iod_offset(). 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. Definition at line 718 of file lens.cxx. References Lens::FC_off_axis. |
|
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(). |
|
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(). |
|
Does some easy checks to make sure that the reference count isn't completely bogus.
Definition at line 328 of file referenceCount.I. References INLINE. Referenced by EggNode::determine_bin(), and ReferenceCount::~ReferenceCount(). |
|
Throws the event associated with changing properties on this Lens, if any.
Definition at line 1263 of file lens.cxx. Referenced by Lens::get_default_far(), Lens::get_view_hpr(), Lens::set_aspect_ratio(), Lens::set_change_event(), Lens::set_film_offset(), and Lens::set_film_size(). |
|
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; plus, we don't have a virtual destructor anyway.) 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 the new reference count. Definition at line 293 of file referenceCount.I. References INLINE. Referenced by RenderState::determine_bin_index(), and RenderEffects::determine_show_bounds(). |
|
Reimplemented in MatrixLens, and OrthographicLens. Definition at line 1248 of file lens.cxx. References Lens::_aspect_ratio, Lens::_user_flags, Lens::get_film_size(), and Lens::UF_aspect_ratio. |
|
Definition at line 205 of file lens.h. Referenced by Lens::Lens(), Lens::set_coordinate_system(), and Lens::write(). |
|
Definition at line 197 of file lens.h. Referenced by Lens::Lens(), and Lens::project(). |
|
Definition at line 249 of file lens.h. Referenced by Lens::get_film_size(), Lens::get_fov(), Lens::get_hfov(), Lens::is_linear(), Lens::Lens(), Lens::make_geometry(), Lens::output(), Lens::set_coordinate_system(), and Lens::set_fov(). |
|
Definition at line 199 of file lens.h. Referenced by PerspectiveLens::is_linear(), and Lens::Lens(). |
|
Definition at line 34 of file lens.cxx. Referenced by Lens::get_projection_mat_inv(). |
|
Definition at line 206 of file lens.h. Referenced by Lens::Lens(), Lens::set_coordinate_system(), and Lens::set_film_offset(). |
|
Definition at line 212 of file lens.h. Referenced by Lens::get_lens_mat_inv(). |
|
Definition at line 212 of file lens.h. Referenced by Lens::is_linear(). |
|
Definition at line 202 of file lens.h. Referenced by Lens::get_change_event(), Lens::Lens(), and Lens::set_change_event(). |
|
Definition at line 201 of file lens.h. Referenced by Lens::Lens(), and Lens::set_film_size(). |
|
Definition at line 255 of file lens.h. Referenced by Lens::set_coordinate_system(), and Lens::set_film_size(). |
|
Definition at line 203 of file lens.h. Referenced by Lens::get_film_size(), Lens::get_projection_mat_inv(), Lens::Lens(), Lens::output(), Lens::set_coordinate_system(), and Lens::set_film_size(). |
|
Definition at line 255 of file lens.h. Referenced by Lens::set_coordinate_system(), and Lens::set_film_size(). |
|
Definition at line 204 of file lens.h. Referenced by Lens::get_projection_mat_inv(), Lens::Lens(), Lens::output(), Lens::set_coordinate_system(), and Lens::set_fov(). |
|
Definition at line 255 of file lens.h. Referenced by Lens::set_coordinate_system(), and Lens::set_film_size(). |
|
Definition at line 257 of file lens.h. Referenced by Lens::compute_fov(). |
|
Definition at line 210 of file lens.h. Referenced by Lens::get_default_far(), Lens::set_coordinate_system(), and Lens::set_view_hpr(). |
|
Definition at line 198 of file lens.h. Referenced by Lens::set_fov(). |
|
Definition at line 213 of file lens.h. Referenced by Lens::get_view_hpr(), and Lens::make_geometry(). |
|
|
|
Definition at line 206 of file lens.h. Referenced by Lens::Lens(), Lens::set_coordinate_system(), Lens::set_film_offset(), and Lens::set_film_size(). |
|
Definition at line 214 of file lens.h. Referenced by MatrixLens::is_linear(). |
|
|
|
Reimplemented from Lens. Definition at line 25 of file pSphereLens.cxx. |
|
Definition at line 209 of file lens.h. Referenced by Lens::set_aspect_ratio(), and Lens::set_coordinate_system(). |
|
Definition at line 248 of file lens.h. Referenced by Lens::get_projection_mat_inv(), Lens::Lens(), Lens::output(), Lens::set_coordinate_system(), and Lens::write(). |
|
Definition at line 208 of file lens.h. Referenced by Lens::get_fov(), and Lens::set_coordinate_system(). |
|
Definition at line 209 of file lens.h. Referenced by Lens::set_aspect_ratio(), and Lens::set_coordinate_system(). |