#include <Projection.h>
Inheritance diagram for vrj::Projection:

Public Types | |
| enum | Eye { LEFT = 1, RIGHT = 2 } |
| Eye and type. More... | |
Public Methods | |
| Projection () | |
| Projection (const Projection &p) | |
| virtual | ~Projection () |
| virtual void | config (jccl::ConfigElementPtr element) |
| Configures the projection. More... | |
| void | setEye (Projection::Eye _eye) |
| int | getEye () |
| void | setViewport (Viewport *vp) |
| Viewport * | getViewport () |
| virtual void | calcViewMatrix (gmtl::Matrix44f &eyePos, const float scaleFactor)=0 |
| void | getFrustumApexAndCorners (gmtl::Vec3f &apex, gmtl::Vec3f &ur, gmtl::Vec3f &lr, gmtl::Vec3f &ul, gmtl::Vec3f &ll) |
| Helper to the frustum apex and corners in model coordinates. More... | |
| const gmtl::Matrix44f & | getViewMatrix () const |
| Returns this projection's view matrix. More... | |
| vrj::Frustum | getFrustum () const |
| Returns a copy of this projection's frustum. More... | |
| virtual std::ostream & | outStream (std::ostream &out, const unsigned int indentLevel=0) |
| Virtual output oporators. More... | |
Responsible for storing and computing projection information based upon an eye positions. This class is an abstract base class for other classes that actually compute the projections.
Definition at line 57 of file Projection.h.
|
|
Eye and type.
Definition at line 61 of file Projection.h.
|
|
|
Definition at line 68 of file Projection.h.
00068 : mEye(LEFT), mViewport(NULL), mFocusPlaneDist(1.0f) 00069 { 00070 ; 00071 } |
|
|
Definition at line 73 of file Projection.h.
00074 : mViewMat(p.mViewMat), mFrustum(p.mFrustum), mEye(p.mEye),
00075 mViewport(p.mViewport), mFocusPlaneDist(p.mFocusPlaneDist)
00076 {
00077 }
|
|
|
Definition at line 79 of file Projection.h.
00080 {
00081 ;
00082 }
|
|
|
Configures the projection. Default implementation does nothing. Reimplemented in vrj::CameraProjection. Definition at line 53 of file Projection.cpp.
00054 {
00055 boost::ignore_unused_variable_warning(element);
00056 }
|
|
|
Definition at line 89 of file Projection.h.
00090 { mEye = _eye; }
|
|
|
Definition at line 92 of file Projection.h.
00093 { return mEye;}
|
|
|
Definition at line 95 of file Projection.h.
00096 { mViewport = vp; }
|
|
|
Definition at line 97 of file Projection.h. Referenced by vrj::CameraProjection::calcViewMatrix.
00098 { return mViewport; }
|
|
||||||||||||
|
Implemented in vrj::CameraProjection. |
|
||||||||||||||||||||||||
|
Helper to the frustum apex and corners in model coordinates.
Definition at line 64 of file Projection.cpp.
00067 {
00068 gmtl::Matrix44f view_mat_inv;
00069 gmtl::invert(view_mat_inv, mViewMat);
00070
00071 // vprDEBUG(vprDBG_ALL, vprDBG_HVERB_LVL) << "GetApex:\nview mat:\n" << mViewMat << "\nviewMatInv:\n" << view_mat_inv << std::endl << vprDEBUG_FLUSH;
00072
00073
00074 //float near_dist = mFocusPlaneDist;
00075 // Use like triangles to get the params for the focus surface
00076 float mult_factor = mFocusPlaneDist/mFrustum[Frustum::VJ_NEAR];
00077 float bot = mFrustum[Frustum::VJ_BOTTOM]*mult_factor;
00078 float left = mFrustum[Frustum::VJ_LEFT]*mult_factor;
00079 float top = mFrustum[Frustum::VJ_TOP]*mult_factor;
00080 float right = mFrustum[Frustum::VJ_RIGHT]*mult_factor;
00081
00082 // Create points in clip space
00083 gmtl::Point3f apexClip(0.0f, 0.0f, 0.0f);
00084 gmtl::Point3f urClip(right, top, -mFocusPlaneDist);
00085 gmtl::Point3f lrClip(right, bot, -mFocusPlaneDist);
00086 gmtl::Point3f ulClip(left, top, -mFocusPlaneDist);
00087 gmtl::Point3f llClip(left, bot, -mFocusPlaneDist);
00088
00089 apex = view_mat_inv * apexClip;
00090 ur = view_mat_inv * urClip;
00091 lr = view_mat_inv * lrClip;
00092 ul = view_mat_inv * ulClip;
00093 ll = view_mat_inv * llClip;
00094 }
|
|
|
Returns this projection's view matrix.
Definition at line 116 of file Projection.h. Referenced by vrj::OpenSGApp::draw, and vrj::GlWindow::setProjection.
00117 {
00118 return mViewMat;
00119 }
|
|
|
Returns a copy of this projection's frustum.
Definition at line 122 of file Projection.h. Referenced by vrj::GlWindow::setProjection.
00123 {
00124 return mFrustum;
00125 }
|
|
||||||||||||
|
Virtual output oporators. Every class derived from us shoudl just define this, and the opertetor<< will "just work". Reimplemented in vrj::CameraProjection. Definition at line 96 of file Projection.cpp.
00098 {
00099 const int pad_width_dot(20 - indentLevel);
00100 out.setf(std::ios::left);
00101
00102 const std::string indent_text(indentLevel, ' ');
00103
00104 out << indent_text << "vrj::Projection:\n";
00105 out << indent_text << std::setw(pad_width_dot) << " Eye " << " ";
00106
00107 switch(mEye)
00108 {
00109 case Projection::LEFT:
00110 out << "Left";
00111 break;
00112 case Projection::RIGHT:
00113 out << "Right";
00114 break;
00115 }
00116 out << std::endl;
00117 out << indent_text << std::setw(pad_width_dot)
00118 << " Frustum " << " " << mFrustum;
00119 return out;
00120 }
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002