Panda3D
|
A PSphereLens is a special nonlinear lens that doesn't correspond to any real physical lenses. More...
#include "pSphereLens.h"
Public Member Functions | |
PSphereLens (const PSphereLens ©) | |
virtual TypeHandle | force_init_type () |
virtual TypeHandle | get_type () const |
void | operator= (const PSphereLens ©) |
virtual | PT (Lens) make_copy() const |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
Protected Member Functions | |
virtual bool | do_extrude (const Lens::CData *lens_cdata, const LPoint3 &point2d, LPoint3 &near_point, LPoint3 &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 | do_project (const Lens::CData *lens_cdata, const LPoint3 &point3d, LPoint3 &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 PN_stdfloat | film_to_fov (PN_stdfloat film_size, PN_stdfloat focal_length, bool horiz) const |
Given a width (or height) on the film and a focal length, compute the field of view in degrees. | |
virtual PN_stdfloat | fov_to_film (PN_stdfloat fov, PN_stdfloat 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 PN_stdfloat | fov_to_focal_length (PN_stdfloat fov, PN_stdfloat 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. |
A PSphereLens is a special nonlinear lens that doesn't correspond to any real physical lenses.
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 38 of file pSphereLens.h.
bool PSphereLens::do_extrude | ( | const Lens::CData * | lens_cdata, |
const LPoint3 & | point2d, | ||
LPoint3 & | near_point, | ||
LPoint3 & | far_point | ||
) | const [protected, virtual] |
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 53 of file pSphereLens.cxx.
References LMatrix3f::rotate_mat().
bool PSphereLens::do_project | ( | const Lens::CData * | lens_cdata, |
const LPoint3 & | point3d, | ||
LPoint3 & | point2d | ||
) | const [protected, virtual] |
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 95 of file pSphereLens.cxx.
References LVecBase3f::length(), and LVecBase2f::normalize().
PN_stdfloat PSphereLens::film_to_fov | ( | PN_stdfloat | film_size, |
PN_stdfloat | focal_length, | ||
bool | horiz | ||
) | const [protected, virtual] |
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 175 of file pSphereLens.cxx.
PN_stdfloat PSphereLens::fov_to_film | ( | PN_stdfloat | fov, |
PN_stdfloat | focal_length, | ||
bool | horiz | ||
) | const [protected, virtual] |
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 147 of file pSphereLens.cxx.
PN_stdfloat PSphereLens::fov_to_focal_length | ( | PN_stdfloat | fov, |
PN_stdfloat | film_size, | ||
bool | horiz | ||
) | const [protected, virtual] |
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 161 of file pSphereLens.cxx.