Equalizer 1.0
|
00001 00002 /* 00003 * Copyright (c) 2009, Philippe Robert <philippe.robert@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 EQNBODY_CONFIG_H 00031 #define EQNBODY_CONFIG_H 00032 00033 #include <eq/eq.h> 00034 00035 #include "initData.h" 00036 #include "frameData.h" 00037 #include "configEvent.h" 00038 00039 namespace eqNbody 00040 { 00041 class Config : public eq::Config 00042 { 00043 public: 00044 Config( eq::ServerPtr parent ); 00045 00046 virtual bool init(); 00047 virtual bool exit(); 00048 00049 virtual uint32_t startFrame(); 00050 00051 void setInitData( const InitData& data ) { _initData = data; } 00052 const InitData& getInitData() const { return _initData; } 00053 00054 void mapData( const eq::uint128_t& initDataID ); 00055 void releaseData(); 00056 00057 virtual bool handleEvent( const eq::ConfigEvent* event ); 00058 bool needsRedraw(); 00059 00060 protected: 00061 virtual ~Config() {} 00062 00063 private: 00064 InitData _initData; 00065 FrameData _frameData; 00066 bool _redraw; 00067 00068 bool _readyToCommit(); 00069 bool _handleKeyEvent( const eq::KeyEvent& event ); 00070 00071 void _updateSimulation(); 00072 void _registerData(const ConfigEvent* event); 00073 void _updateData(const ConfigEvent* event); 00074 void _deregisterData(); 00075 }; 00076 } 00077 00078 #endif // EQ_PLY_CONFIG_H