server/frustum.cpp

00001 
00002 /* Copyright (c) 2008-2009, Stefan Eilemann <eile@equalizergraphics.com> 
00003  *
00004  * This library is free software; you can redistribute it and/or modify it under
00005  * the terms of the GNU Lesser General Public License version 2.1 as published
00006  * by the Free Software Foundation.
00007  *  
00008  * This library is distributed in the hope that it will be useful, but WITHOUT
00009  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00010  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00011  * details.
00012  * 
00013  * You should have received a copy of the GNU Lesser General Public License
00014  * along with this library; if not, write to the Free Software Foundation, Inc.,
00015  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00016  */
00017 
00018 #include "frustum.h"
00019 
00020 #include "config.h"
00021 #include "frustumData.h"
00022 
00023 #include <eq/net/dataIStream.h>
00024 #include <eq/net/dataOStream.h>
00025 
00026 using namespace eq::base;
00027 
00028 namespace eq
00029 {
00030 namespace server
00031 {
00032 Frustum::Frustum( FrustumData& data )
00033         : _data( data )
00034 {
00035     _updateFrustum();
00036 }
00037 
00038 Frustum::Frustum( const Frustum& from, FrustumData& data )
00039         : eq::Frustum( from )
00040         , _data( data )
00041 {
00042     _updateFrustum();
00043 }
00044 
00045 void Frustum::setWall( const eq::Wall& wall )
00046 {
00047     eq::Frustum::setWall( wall );
00048     _updateFrustum();
00049 }
00050         
00051 void Frustum::setProjection( const eq::Projection& projection )
00052 {
00053     eq::Frustum::setProjection( projection );
00054     _updateFrustum();
00055 }
00056 
00057 void Frustum::_updateFrustum()
00058 {
00059     switch( getCurrentType( ))
00060     {
00061         case TYPE_WALL:
00062             _data.applyWall( getWall( ));
00063             break;
00064         case TYPE_PROJECTION:
00065             _data.applyProjection( getProjection( ));
00066             break;
00067 
00068         case TYPE_NONE:
00069             _data.invalidate();
00070             break;
00071         default:
00072             EQUNREACHABLE;
00073     }
00074 }
00075 
00076 }
00077 }
Generated on Mon Aug 10 18:58:33 2009 for Equalizer 0.9 by  doxygen 1.5.8