vrj::SimViewport Class Reference

Simulator viewport. More...

#include <vrj/Display/SimViewport.h>

Inheritance diagram for vrj::SimViewport:

Inheritance graph
[legend]
Collaboration diagram for vrj::SimViewport:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SimViewport ()
 SimViewport (const SimViewport &sv)
virtual ~SimViewport ()
virtual bool config (jccl::ConfigElementPtr element)
 Configure the simulator.
virtual void updateProjections (const float positionScale)
 Updates the projections.
DrawSimInterfacegetDrawSimInterface ()
void setDrawSimInterface (DrawSimInterface *draw_sim_i)

Protected Attributes

DrawSimInterfacemSimulator
 The simulator that we are using here.

Detailed Description

Simulator viewport.

Definition at line 52 of file SimViewport.h.


Constructor & Destructor Documentation

vrj::SimViewport::SimViewport (  )  [inline]

Definition at line 55 of file SimViewport.h.

00056       : Viewport()
00057    {
00058       ;
00059    }

vrj::SimViewport::SimViewport ( const SimViewport sv  )  [inline]

Definition at line 61 of file SimViewport.h.

00062       : Viewport(sv)
00063       , mSimulator(sv.mSimulator)
00064    {
00065       ;
00066    }

vrj::SimViewport::~SimViewport (  )  [virtual]

Definition at line 50 of file SimViewport.cpp.

References vrj::Viewport::mLeftProj, and vrj::Viewport::mRightProj.

00051 {
00052    if ( NULL != mLeftProj )
00053    {
00054       delete mLeftProj;
00055       mLeftProj = NULL;
00056    }
00057 
00058    if ( NULL != mRightProj )
00059    {
00060       delete mRightProj;
00061       mRightProj = NULL;
00062    }
00063 }


Member Function Documentation

bool vrj::SimViewport::config ( jccl::ConfigElementPtr  element  )  [virtual]

Configure the simulator.

Reimplemented from vrj::Viewport.

Definition at line 66 of file SimViewport.cpp.

References vrj::Projection::config(), vrj::Viewport::config(), vrj::Projection::LEFT, vrj::Viewport::mLeftProj, vrj::Viewport::mRightProj, mSimulator, vrj::Viewport::mType, vrj::Projection::RIGHT, vrj::Projection::setEye(), vrj::Projection::setViewport(), and vrj::Viewport::SIM.

Referenced by vrj::Display::configViewports().

00067 {
00068    vprASSERT(element.get() != NULL);
00069    vprASSERT(element->getID() == "simulator_viewport");
00070 
00071    if ( ! Viewport::config(element) )
00072    {
00073       return false;
00074    }
00075 
00076    bool result(true);
00077 
00078    mType = SIM;
00079 
00080    const float vert_fov = element->getProperty<float>("vertical_fov");
00081 
00082    if ( NULL != mLeftProj )
00083    {
00084       delete mLeftProj;
00085    }
00086 
00087    mLeftProj = new CameraProjection;
00088    ((CameraProjection*) mLeftProj)->setVerticalFOV(vert_fov);
00089    mLeftProj->config(element);
00090    mLeftProj->setEye(Projection::LEFT);
00091    mLeftProj->setViewport(this);
00092 
00093    if ( NULL != mRightProj )
00094    {
00095       delete mRightProj;
00096    }
00097 
00098    mRightProj = new CameraProjection;
00099    ((CameraProjection*) mRightProj)->setVerticalFOV(vert_fov);
00100    mRightProj->config(element);
00101    mRightProj->setEye(Projection::RIGHT);
00102    mRightProj->setViewport(this);
00103 
00104    //bool has_simulator(false);
00105    //has_simulator = element->getProperty<bool>("has_simulator_plugin");
00106    mSimulator = NULL;
00107 
00108    // Create the simulator stuff
00109    /*if(has_simulator)
00110    {
00111       jccl::ConfigElementPtr sim_element =
00112          element->getProperty<jccl::ConfigElementPtr>("simulator_plugin");
00113 
00114       vprDEBUG(vrjDBG_DISP_MGR, vprDBG_CONFIG_LVL)
00115          << "SimViewport::config() creating simulator of type '"
00116          << sim_element->getID() << "'\n" << vprDEBUG_FLUSH;
00117       mSimulator = DrawSimInterfaceFactory::instance()->createObject(sim_element->getID());
00118 
00119       // XXX: Change this to an error once the new simulator loading code is
00120       // more robust.  -PH (4/13/2003)
00121       vprASSERT(NULL != mSimulator && "Failed to create draw simulator");
00122       mSimulator->initialize(this);
00123       mSimulator->config(sim_element);
00124    }
00125    */
00126 
00127    return result;
00128 }

void vrj::SimViewport::updateProjections ( const float  positionScale  )  [virtual]

Updates the projections.

Parameters:
positionScale Scale value for converting from Juggler units (meters) to the display units.

Implements vrj::Viewport.

Definition at line 130 of file SimViewport.cpp.

References vrj::Viewport::mLeftProj, vrj::Viewport::mRightProj, mSimulator, and vrj::DrawSimInterface::updateProjectionData().

00131 {
00132    if(mSimulator != NULL)
00133    {
00134       mSimulator->updateProjectionData(positionScale, mLeftProj, mRightProj);
00135    }
00136 }

DrawSimInterface* vrj::SimViewport::getDrawSimInterface (  )  [inline]

Definition at line 82 of file SimViewport.h.

00083    {
00084       return mSimulator;
00085    }

void vrj::SimViewport::setDrawSimInterface ( DrawSimInterface draw_sim_i  )  [inline]

Definition at line 87 of file SimViewport.h.

Referenced by vrj::PfDrawManager::addDisplay(), and vrj::GlDrawManager::addDisplay().

00088    {
00089       mSimulator = draw_sim_i;
00090    }


Member Data Documentation

DrawSimInterface* vrj::SimViewport::mSimulator [protected]

The simulator that we are using here.

Definition at line 93 of file SimViewport.h.

Referenced by config(), and updateProjections().


The documentation for this class was generated from the following files:
Generated on Thu Jan 4 10:58:06 2007 for VR Juggler by  doxygen 1.5.1