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

Public Types | |
| enum | Type { UNDEFINED, SURFACE, SIM } |
| Type of viewport. More... | |
| enum | View { NONE = 0, LEFT_EYE = 1, RIGHT_EYE = 2, STEREO = 3 } |
| Used for referencing which eye(s) to draw. More... | |
Public Methods | |
| Viewport () | |
| Viewport (const Viewport &v) | |
| virtual | ~Viewport () |
| virtual void | config (jccl::ConfigElementPtr element) |
| Takes a viewport element and configures the display based one it. More... | |
| virtual void | updateProjections (const float positionScale)=0 |
| Updates the projection data for this display. More... | |
| Viewport::Type | getType () |
| bool | isSimulator () |
| bool | isSurface () |
| bool | isActive () |
| void | setName (const std::string &name) |
| const std::string & | getName () |
| Gets the name of this display. More... | |
| bool | inStereo () |
| Viewport::View | getView () |
| void | setOriginAndSize (float xo, float yo, float xs, float ys) |
| void | getOriginAndSize (float &xo, float &yo, float &xs, float &ys) |
| jccl::ConfigElementPtr | getConfigElement () |
| Gets the config element that configured this viewport. More... | |
| User * | getUser () |
| Gets the user associated with this display. More... | |
| void | setDisplay (Display *disp) |
| Display * | getDisplay () |
| Projection * | getLeftProj () |
| Projection * | getRightProj () |
| virtual std::ostream & | outStream (std::ostream &out, const unsigned int indentLevel=0) |
Base class for all viewport data. Stores projection data, viewport info, and relevant user.
Definition at line 55 of file Viewport.h.
|
|
Type of viewport.
Definition at line 80 of file Viewport.h.
|
|
|
Used for referencing which eye(s) to draw.
Definition at line 88 of file Viewport.h. Referenced by vrj::GlWindow::setViewBuffer.
|
|
|
Definition at line 58 of file Viewport.h.
00059 : mUser(NULL), mDisplay(NULL),
00060 mLeftProj(NULL), mRightProj(NULL)
00061 {
00062 mXorigin = mYorigin = mXsize = mYsize = -1.0f;
00063 mType = Viewport::UNDEFINED;
00064 mActive = false;
00065 }
|
|
|
Definition at line 67 of file Viewport.h.
00068 : mName(v.mName), mUser(v.mUser), mType(v.mType), mView(v.mView),
00069 mActive(v.mActive), mDisplay(v.mDisplay),
00070 mViewportElement(v.mViewportElement), mXorigin(v.mXorigin),
00071 mYorigin(v.mYorigin), mXsize(v.mXsize), mYsize(v.mYsize),
00072 mLeftProj(v.mLeftProj), mRightProj(v.mRightProj)
00073 {
00074 }
|
|
|
Definition at line 76 of file Viewport.h.
00077 {;}
|
|
|
Takes a viewport element and configures the display based one it.
Reimplemented in vrj::SimViewport. Definition at line 45 of file Viewport.cpp. References setName, setOriginAndSize, and vrjDBG_DISP_MGR.
00046 {
00047 vprASSERT(element.get() != NULL);
00048
00049 // -- Get config info from element -- //
00050 float originX = element->getProperty<float>("origin", 0);
00051 float originY = element->getProperty<float>("origin", 1);
00052 float sizeX = element->getProperty<float>("size", 0);
00053 float sizeY = element->getProperty<float>("size", 1);
00054 std::string name = element->getName();
00055 mView = (Viewport::View) element->getProperty<int>("view");
00056 mActive = element->getProperty<bool>("active");
00057
00058 // -- Check for error in configuration -- //
00059 // NOTE: If there are errors, set them to some default value
00060 if(sizeX <= 0)
00061 {
00062 vprDEBUG(vrjDBG_DISP_MGR, vprDBG_WARNING_LVL)
00063 << "WARNING: viewport sizeX set to: " << sizeX
00064 << ". Setting to 1." << std::endl << vprDEBUG_FLUSH;
00065 sizeX = 1.0f;
00066 }
00067
00068 if(sizeY <= 0)
00069 {
00070 vprDEBUG(vrjDBG_DISP_MGR, vprDBG_WARNING_LVL)
00071 << "WARNING: viewport sizeY set to: " << sizeY
00072 << ". Setting to 1." << std::endl << vprDEBUG_FLUSH;
00073 sizeY = 1.0f;
00074 }
00075
00076 // -- Set local window attributes --- //
00077 setOriginAndSize(originX, originY, sizeX, sizeY);
00078
00079 // Get the user for this display
00080 std::string user_name = element->getProperty<std::string>("user");
00081 mUser = Kernel::instance()->getUser(user_name);
00082
00083 if(NULL == mUser)
00084 {
00085 vprDEBUG(vprDBG_ERROR, vprDBG_CRITICAL_LVL)
00086 << clrOutNORM(clrRED, "ERROR:") << " User not found named: '"
00087 << user_name << "'" << std::endl << vprDEBUG_FLUSH;
00088 vprASSERT(false && "User not found in Viewport::config");
00089 }
00090
00091 setName(name);
00092 mViewportElement = element; // Save the element for later use
00093
00094 std::string bufname = "Head Latency " + name;
00095 }
|
|
|
Updates the projection data for this display. Uses the data for the head position for this window.
Implemented in vrj::SimViewport. |
|
|
Definition at line 117 of file Viewport.h.
00118 { return mType;}
|
|
|
Definition at line 120 of file Viewport.h.
00121 { return (mType == SIM); }
|
|
|
Definition at line 123 of file Viewport.h.
00124 { return (mType == SURFACE); }
|
|
|
Definition at line 126 of file Viewport.h.
00127 { return mActive; }
|
|
|
Definition at line 129 of file Viewport.h. Referenced by config.
00130 {
00131 mName = name;
00132 }
|
|
|
Gets the name of this display.
Definition at line 135 of file Viewport.h. Referenced by outStream.
00136 {
00137 return mName;
00138 }
|
|
|
Definition at line 143 of file Viewport.h.
00144 { return (mView == STEREO); }
|
|
|
Definition at line 147 of file Viewport.h.
00148 { return mView; }
|
|
||||||||||||||||||||
|
Definition at line 150 of file Viewport.h. Referenced by config.
00151 { mXorigin = xo; mYorigin = yo; mXsize = xs; mYsize = ys;}
|
|
||||||||||||||||||||
|
Definition at line 152 of file Viewport.h.
00153 {
00154 xo = mXorigin; yo = mYorigin; xs = mXsize; ys = mYsize;
00155 }
|
|
|
Gets the config element that configured this viewport.
Definition at line 158 of file Viewport.h.
00159 {
00160 return mViewportElement;
00161 }
|
|
|
Gets the user associated with this display.
Definition at line 164 of file Viewport.h. Referenced by outStream.
00165 { return mUser;}
|
|
|
Definition at line 167 of file Viewport.h.
00168 { mDisplay = disp; }
|
|
|
Definition at line 169 of file Viewport.h.
00170 { return mDisplay; }
|
|
|
Definition at line 172 of file Viewport.h.
00173 { return mLeftProj; }
|
|
|
Definition at line 175 of file Viewport.h.
00176 { return mRightProj; }
|
|
||||||||||||
|
Reimplemented in vrj::SurfaceViewport. Definition at line 102 of file Viewport.cpp. References getName, and getUser.
00104 {
00105 const int pad_width_dot(20 - indentLevel);
00106 const std::string indent_text(indentLevel, ' ');
00107
00108 out << indent_text << std::setw(pad_width_dot)
00109 << "Name " << " " << getName() << std::endl;
00110 out << indent_text << std::setw(pad_width_dot)
00111 << "Active " << " " << (mActive ? "Yes" : "No") << std::endl;
00112 out << indent_text << std::setw(pad_width_dot)
00113 << "User " << " " << getUser()->getName() << std::endl;
00114 out << indent_text << std::setw(pad_width_dot)
00115 << "Origin " << " " << mXorigin << ", " << mYorigin << std::endl;
00116 out << indent_text << std::setw(pad_width_dot)
00117 << "Size " << " " << mXsize << "x" << mYsize << std::endl;
00118 out << indent_text << std::setw(pad_width_dot)
00119 << "View " << " "
00120 << ((mView == Viewport::LEFT_EYE) ? "Left" : ((mView==Viewport::RIGHT_EYE)?"Right" : "Stereo") );
00121
00122 out << std::flush;
00123
00124 return out;
00125 }
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002