Panda3D
|
A completely generic linear lens. More...
#include "matrixLens.h"
Public Member Functions | |
MatrixLens (const MatrixLens ©) | |
void | clear_left_eye_mat () |
Removes the custom projection matrix set for the left eye, and uses the center matrix (set by set_user_mat) instead. | |
void | clear_right_eye_mat () |
Removes the custom projection matrix set for the right eye, and uses the center matrix (set by set_user_mat) instead. | |
virtual TypeHandle | force_init_type () |
const LMatrix4 & | get_left_eye_mat () const |
Returns the custom projection matrix for the left eye, if any, or the center matrix if there is no custom matrix set for the left eye. | |
const LMatrix4 & | get_right_eye_mat () const |
Returns the custom projection matrix for the right eye, if any, or the center matrix if there is no custom matrix set for the right eye. | |
virtual TypeHandle | get_type () const |
const LMatrix4 & | get_user_mat () const |
Returns the explicit projection matrix as set by the user. | |
bool | has_left_eye_mat () const |
Returns true if the camera has a custom projection matrix set for the left eye, or false if the center matrix (set by set_user_mat) will be used for the left eye. | |
bool | has_right_eye_mat () const |
Returns true if the camera has a custom projection matrix set for the right eye, or false if the center matrix (set by set_user_mat) will be used for the right eye. | |
virtual bool | is_linear () const |
Returns true if the lens represents a linear projection (e.g. | |
void | operator= (const MatrixLens ©) |
virtual | PT (Lens) make_copy() const |
void | set_left_eye_mat (const LMatrix4 &user_mat) |
Sets a custom projection matrix for the left eye. | |
void | set_right_eye_mat (const LMatrix4 &user_mat) |
Sets a custom projection matrix for the right eye. | |
void | set_user_mat (const LMatrix4 &user_mat) |
Explicitly specifies the projection matrix. | |
virtual void | write (ostream &out, int indent_level=0) 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. | |
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 completely generic linear lens.
This is provided for the benefit of low-level code that wants to specify a perspective or orthographic frustum via an explicit projection matrix, but not mess around with fov's or focal lengths or any of that nonsense.
Definition at line 31 of file matrixLens.h.
void MatrixLens::clear_left_eye_mat | ( | ) | [inline] |
Removes the custom projection matrix set for the left eye, and uses the center matrix (set by set_user_mat) instead.
Definition at line 126 of file matrixLens.I.
References Lens::do_adjust_comp_flags().
void MatrixLens::clear_right_eye_mat | ( | ) | [inline] |
Removes the custom projection matrix set for the right eye, and uses the center matrix (set by set_user_mat) instead.
Definition at line 190 of file matrixLens.I.
References Lens::do_adjust_comp_flags().
void MatrixLens::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 matrixLens.cxx.
References Lens::do_adjust_comp_flags().
const LMatrix4 & MatrixLens::get_left_eye_mat | ( | ) | const [inline] |
Returns the custom projection matrix for the left eye, if any, or the center matrix if there is no custom matrix set for the left eye.
Definition at line 153 of file matrixLens.I.
const LMatrix4 & MatrixLens::get_right_eye_mat | ( | ) | const [inline] |
Returns the custom projection matrix for the right eye, if any, or the center matrix if there is no custom matrix set for the right eye.
Definition at line 217 of file matrixLens.I.
const LMatrix4 & MatrixLens::get_user_mat | ( | ) | const [inline] |
Returns the explicit projection matrix as set by the user.
This does not include transforms on the lens or film (e.g. a film offset or view hpr).
Definition at line 92 of file matrixLens.I.
bool MatrixLens::has_left_eye_mat | ( | ) | const [inline] |
Returns true if the camera has a custom projection matrix set for the left eye, or false if the center matrix (set by set_user_mat) will be used for the left eye.
Definition at line 141 of file matrixLens.I.
bool MatrixLens::has_right_eye_mat | ( | ) | const [inline] |
Returns true if the camera has a custom projection matrix set for the right eye, or false if the center matrix (set by set_user_mat) will be used for the right eye.
Definition at line 205 of file matrixLens.I.
bool MatrixLens::is_linear | ( | ) | const [virtual] |
Returns true if the lens represents a linear projection (e.g.
PerspectiveLens, MatrixLens), and therefore there is a valid matrix returned by get_projection_mat(), or false otherwise.
Reimplemented from Lens.
Definition at line 41 of file matrixLens.cxx.
TypedWritable * MatrixLens::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 102 of file matrixLens.cxx.
References Lens::fillin().
Referenced by register_with_read_factory().
void MatrixLens::register_with_read_factory | ( | ) | [static] |
Tells the BamReader how to create objects of type Lens.
Definition at line 89 of file matrixLens.cxx.
References BamReader::get_factory(), make_from_bam(), and Factory< Type >::register_factory().
void MatrixLens::set_left_eye_mat | ( | const LMatrix4 & | left_eye_mat | ) | [inline] |
Sets a custom projection matrix for the left eye.
This is only used if the lens is attached to a stereo camera, in which case the left eye matrix will be used to draw the scene in the left eye (but the center matrix--the user_mat--will still be used to cull the scene).
This matrix should not be too different from the center matrix (set by set_user_mat()) or culling errors may become obvious.
Definition at line 111 of file matrixLens.I.
References Lens::do_adjust_comp_flags().
void MatrixLens::set_right_eye_mat | ( | const LMatrix4 & | right_eye_mat | ) | [inline] |
Sets a custom projection matrix for the right eye.
This is only used if the lens is attached to a stereo camera, in which case the right eye matrix will be used to draw the scene in the right eye (but the center matrix--the user_mat--will still be used to cull the scene).
This matrix should not be too different from the center matrix (set by set_user_mat()) or culling errors may become obvious.
Definition at line 175 of file matrixLens.I.
References Lens::do_adjust_comp_flags().
void MatrixLens::set_user_mat | ( | const LMatrix4 & | user_mat | ) | [inline] |
Explicitly specifies the projection matrix.
This matrix should convert X and Y to the range [-film_size/2, film_size/2], where (-fs/2,-fs/2) is the lower left corner of the screen and (fs/2, fs/2) is the upper right. Z should go to the range [-1, 1], where -1 is the far plane and 1 is the near plane. Note that this is a left-handed Y-up coordinate system.
The default film_size for a MatrixLens is 2, so the default range is [-1, 1] for both X and Y. This is consistent with the GL conventions for projection matrices.
Definition at line 78 of file matrixLens.I.
References Lens::do_adjust_comp_flags().