Panda3D
|
A perspective-type lens: a normal camera. More...
#include "perspectiveLens.h"
Public Member Functions | |
PerspectiveLens (PN_stdfloat hfov, PN_stdfloat vfov) | |
PerspectiveLens (const PerspectiveLens ©) | |
virtual TypeHandle | force_init_type () |
virtual TypeHandle | get_type () const |
virtual bool | is_linear () const |
Returns true if the lens represents a linear projection (e.g. | |
virtual bool | is_perspective () const |
Returns true if the lens represents a perspective projection (i.e. | |
void | operator= (const PerspectiveLens ©) |
virtual | PT (Lens) make_copy() const |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
static void | register_with_read_factory () |
Tells the BamReader how to create objects of type Lens. | |
Protected Member Functions | |
virtual void | do_compute_projection_mat (Lens::CData *lens_cdata) |
Computes the complete transformation matrix from 3-d point to 2-d point, if the lens is linear. | |
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. | |
Static Protected Member Functions | |
static TypedWritable * | make_from_bam (const FactoryParams ¶ms) |
This function is called by the BamReader's factory when a new object of type Lens is encountered in the Bam file. |
A perspective-type lens: a normal camera.
Definition at line 27 of file perspectiveLens.h.
void PerspectiveLens::do_compute_projection_mat | ( | Lens::CData * | lens_cdata | ) | [protected, virtual] |
Computes the complete transformation matrix from 3-d point to 2-d point, if the lens is linear.
Reimplemented from Lens.
Definition at line 63 of file perspectiveLens.cxx.
References Lens::do_adjust_comp_flags(), LMatrix4f::ident_mat(), LVector3f::left(), and LMatrix4f::translate_mat().
PN_stdfloat PerspectiveLens::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 179 of file perspectiveLens.cxx.
PN_stdfloat PerspectiveLens::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 151 of file perspectiveLens.cxx.
PN_stdfloat PerspectiveLens::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 165 of file perspectiveLens.cxx.
bool PerspectiveLens::is_linear | ( | ) | const [virtual] |
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 from Lens.
Definition at line 40 of file perspectiveLens.cxx.
bool PerspectiveLens::is_perspective | ( | ) | const [virtual] |
Returns true if the lens represents a perspective projection (i.e.
it is a PerspectiveLens), false otherwise.
Reimplemented from Lens.
Definition at line 52 of file perspectiveLens.cxx.
TypedWritable * PerspectiveLens::make_from_bam | ( | const FactoryParams & | params | ) | [static, protected] |
This function is called by the BamReader's factory when a new object of type Lens is encountered in the Bam file.
It should create the Lens and extract its information from the file.
Definition at line 203 of file perspectiveLens.cxx.
References Lens::fillin().
Referenced by register_with_read_factory().
void PerspectiveLens::register_with_read_factory | ( | ) | [static] |
Tells the BamReader how to create objects of type Lens.
Definition at line 190 of file perspectiveLens.cxx.
References BamReader::get_factory(), make_from_bam(), and Factory< Type >::register_factory().