00001 /*************** <auto-copyright.pl BEGIN do not edit this line> ************** 00002 * 00003 * VR Juggler is (C) Copyright 1998-2005 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$ 00027 * Date modified: $Date: 2006-12-09 14:07:35 -0600 (Sat, 09 Dec 2006) $ 00028 * Version: $Revision: 19601 $ 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 <jccl/Config/ConfigElement.h> 00039 #include <vrj/Util/Debug.h> 00040 #include <vrj/Display/CameraProjection.h> 00041 #include <vrj/Display/Projection.h> 00042 #include <gadget/Type/Position/PositionUnitConversion.h> 00043 00044 #include <vrj/Display/SimViewport.h> 00045 00046 00047 namespace vrj 00048 { 00049 00050 SimViewport::~SimViewport() 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 } 00064 00066 bool SimViewport::config(jccl::ConfigElementPtr element) 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 } 00129 00130 void SimViewport::updateProjections(const float positionScale) 00131 { 00132 if(mSimulator != NULL) 00133 { 00134 mSimulator->updateProjectionData(positionScale, mLeftProj, mRightProj); 00135 } 00136 } 00137 00138 }
1.5.1