Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

SimViewport.cpp

Go to the documentation of this file.
00001 /*************** <auto-copyright.pl BEGIN do not edit this line> **************
00002  *
00003  * VR Juggler is (C) Copyright 1998-2003 by Iowa State University
00004  *
00005  * Original Authors:
00006  *   Allen Bierbaum, Christopher Just,
00007  *   Patrick Hartling, Kevin Meinert,
00008  *   Carolina Cruz-Neira, Albert Baker
00009  *
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Library General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2 of the License, or (at your option) any later version.
00014  *
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Library General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU Library General Public
00021  * License along with this library; if not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00023  * Boston, MA 02111-1307, USA.
00024  *
00025  * -----------------------------------------------------------------
00026  * File:          $RCSfile: SimViewport.cpp,v $
00027  * Date modified: $Date: 2003/07/10 23:59:14 $
00028  * Version:       $Revision: 1.14 $
00029  * -----------------------------------------------------------------
00030  *
00031  *************** <auto-copyright.pl END do not edit this line> ***************/
00032 
00033 #include <vrj/vrjConfig.h>
00034 
00035 #include <vpr/Util/Assert.h>
00036 #include <vpr/Util/Debug.h>
00037 
00038 #include <vrj/Util/Debug.h>
00039 #include <vrj/Display/CameraProjection.h>
00040 #include <vrj/Display/Projection.h>
00041 #include <gadget/Type/Position/PositionUnitConversion.h>
00042 
00043 #include <vrj/Display/SimViewport.h>
00044 
00045 
00046 namespace vrj
00047 {
00048 
00050 void SimViewport::config(jccl::ConfigElementPtr element)
00051 {
00052    vprASSERT(element.get() != NULL);
00053    vprASSERT(element->getID() == "simulator_viewport");
00054 
00055    Viewport::config(element);
00056 
00057    mType = SIM;
00058 
00059    const float vert_fov = element->getProperty<float>("vertical_fov");
00060 
00061    mLeftProj = new CameraProjection;
00062    ((CameraProjection*) mLeftProj)->setVerticalFOV(vert_fov);
00063    mLeftProj->config(element);
00064    mLeftProj->setEye(Projection::LEFT);
00065    mLeftProj->setViewport(this);
00066 
00067    mRightProj = new CameraProjection;
00068    ((CameraProjection*) mRightProj)->setVerticalFOV(vert_fov);
00069    mRightProj->config(element);
00070    mRightProj->setEye(Projection::RIGHT);
00071    mRightProj->setViewport(this);
00072 
00073    //bool has_simulator(false);
00074    //has_simulator = element->getProperty<bool>("has_simulator_plugin");
00075    mSimulator = NULL;
00076 
00077    // Create the simulator stuff
00078    /*if(has_simulator)
00079    {
00080       jccl::ConfigElementPtr sim_element =
00081          element->getProperty<jccl::ConfigElementPtr>("simulator_plugin");
00082 
00083       vprDEBUG(vrjDBG_DISP_MGR, vprDBG_CONFIG_LVL)
00084          << "SimViewport::config() creating simulator of type '"
00085          << sim_element->getID() << "'\n" << vprDEBUG_FLUSH;
00086       mSimulator = DrawSimInterfaceFactory::instance()->createObject(sim_element->getID());
00087 
00088       // XXX: Change this to an error once the new simulator loading code is
00089       // more robust.  -PH (4/13/2003)
00090       vprASSERT(NULL != mSimulator && "Failed to create draw simulator");
00091       mSimulator->initialize(this);
00092       mSimulator->config(sim_element);
00093    }
00094    */
00095 }
00096 
00097 void SimViewport::updateProjections(const float positionScale)
00098 {
00099    if(mSimulator != NULL)
00100    {
00101       mSimulator->updateProjectionData(positionScale, mLeftProj, mRightProj);
00102    }
00103 }
00104 
00105 }

Generated on Sun May 2 15:10:17 2004 for VR Juggler by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002