Equalizer 1.0
|
00001 00002 /* Copyright (c) 2006-2010, Stefan Eilemann <eile@equalizergraphics.com> 00003 * 2010, Cedric Stalder <cedric.stalder@gmail.com> 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions are met: 00007 * 00008 * - Redistributions of source code must retain the above copyright notice, this 00009 * list of conditions and the following disclaimer. 00010 * - Redistributions in binary form must reproduce the above copyright notice, 00011 * this list of conditions and the following disclaimer in the documentation 00012 * and/or other materials provided with the distribution. 00013 * - Neither the name of Eyescale Software GmbH nor the names of its 00014 * contributors may be used to endorse or promote products derived from this 00015 * software without specific prior written permission. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00018 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00019 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00020 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 00021 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00022 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00023 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00024 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00025 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00026 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00027 * POSSIBILITY OF SUCH DAMAGE. 00028 */ 00029 00030 #ifndef EQ_PLY_CONFIG_H 00031 #define EQ_PLY_CONFIG_H 00032 00033 #include <eq/eq.h> 00034 #include <eq/admin/base.h> 00035 00036 // members 00037 #include "localInitData.h" 00038 #include "frameData.h" 00039 #include "tracker.h" 00040 #include "cameraAnimation.h" 00041 00042 namespace eqPly 00043 { 00044 typedef std::vector< Model* > Models; 00045 typedef std::vector< ModelDist* > ModelDists; 00046 00054 class Config : public eq::Config 00055 { 00056 public: 00057 Config( co::base::RefPtr< eq::Server > parent ); 00058 00060 virtual bool init(); 00062 virtual bool exit(); 00063 00065 virtual uint32_t startFrame(); 00066 00067 void setInitData( const LocalInitData& data ) { _initData = data; } 00068 const InitData& getInitData() const { return _initData; } 00069 00071 bool mapData( const eq::uint128_t& initDataID ); 00072 00074 void unmapData(); 00075 00077 const Model* getModel( const eq::uint128_t& id ); 00078 00080 virtual bool handleEvent( const eq::ConfigEvent* event ); 00081 00083 bool isIdleAA(); 00084 00086 bool needsRedraw(); 00087 00089 bool isUserEvent(); 00090 00091 protected: 00092 virtual ~Config(); 00093 00095 virtual co::uint128_t sync( 00096 const co::uint128_t& version = co::VERSION_HEAD ); 00097 00098 private: 00099 int _spinX, _spinY; 00100 int _advance; 00101 eq::Canvas* _currentCanvas; 00102 00103 LocalInitData _initData; 00104 FrameData _frameData; 00105 00106 Tracker _tracker; 00107 00108 Models _models; 00109 ModelDists _modelDist; 00110 co::base::Lock _modelLock; 00111 00112 CameraAnimation _animation; 00113 00114 uint64_t _messageTime; 00115 00116 bool _redraw; 00117 bool _freeze; 00118 bool _useIdleAA; 00119 00120 uint32_t _numFramesAA; 00121 00122 eq::admin::ServerPtr _admin; 00123 00124 void _loadModels(); 00125 void _registerModels(); 00126 void _loadPath(); 00127 void _deregisterData(); 00128 bool _handleKeyEvent( const eq::KeyEvent& event ); 00129 00130 void _switchCanvas(); 00131 void _switchView(); 00132 void _switchViewMode(); 00133 void _switchModel(); 00134 void _switchLayout( int32_t increment ); 00135 00136 void _setHeadMatrix( const eq::Matrix4f& matrix ); 00137 const eq::Matrix4f& _getHeadMatrix() const; 00138 00140 eq::admin::ServerPtr _getAdminServer(); 00141 void _closeAdminServer(); 00142 00143 void _setMessage( const std::string& message ); 00144 void _updateData(); 00145 }; 00146 } 00147 00148 #endif // EQ_PLY_CONFIG_H