LCOV - code coverage report
Current view: top level - seq - viewData.h (source / functions) Hit Total Coverage
Test: lcov2.info Lines: 1 3 33.3 %
Date: 2014-06-18 Functions: 1 3 33.3 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2011-2012, Stefan Eilemann <eile@eyescale.ch>
       3             :  *                    2012, Daniel Nachbaur <danielnachbaur@gmail.com>
       4             :  *
       5             :  * This library is free software; you can redistribute it and/or modify it under
       6             :  * the terms of the GNU Lesser General Public License version 2.1 as published
       7             :  * by the Free Software Foundation.
       8             :  *
       9             :  * This library is distributed in the hope that it will be useful, but WITHOUT
      10             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      11             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      12             :  * details.
      13             :  *
      14             :  * You should have received a copy of the GNU Lesser General Public License
      15             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      16             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      17             :  */
      18             : 
      19             : #ifndef EQSEQUEL_VIEWDATA_H
      20             : #define EQSEQUEL_VIEWDATA_H
      21             : 
      22             : #include <seq/api.h>
      23             : #include <seq/types.h>
      24             : #include <co/serializable.h>               // base class
      25             : 
      26             : namespace seq
      27             : {
      28             :     /** Stores per-view data. */
      29             :     class ViewData : public co::Serializable
      30             :     {
      31             :     public:
      32             :         /** Construct a new view data. @version 1.0 */
      33             :         SEQ_API ViewData();
      34             : 
      35             :         /** Destruct this view data. @version 1.0 */
      36             :         SEQ_API virtual ~ViewData();
      37             : 
      38             :         /** @name Operations */
      39             :         //@{
      40             : #ifndef EQ_2_0_API
      41             :         /**
      42             :          * Handle the given event.
      43             :          *
      44             :          * The default implementation provides a pointer-based camera model and
      45             :          * some key event handling, all of which can be modified by overwriting
      46             :          * this method and handling the appropriate events.
      47             :          * @version 1.0
      48             :          * @deprecated
      49             :          */
      50             :         SEQ_API virtual bool handleEvent( const eq::ConfigEvent* event );
      51             : #endif
      52             : 
      53             :         /**
      54             :          * Handle the given event command.
      55             :          *
      56             :          * The default implementation provides a pointer-based camera model and
      57             :          * some key event handling, all of which can be modified by overwriting
      58             :          * this method and handling the appropriate events.
      59             :          * @version 1.5.1
      60             :          */
      61             :         SEQ_API virtual bool handleEvent( eq::EventICommand command );
      62             : 
      63             :         /** Rotate the model matrix by the given increments. @version 1.0 */
      64             :         SEQ_API void spinModel( const float x, const float y, const float z );
      65             : 
      66             :         /** Move the model matrix by the given increments. @version 1.0 */
      67             :         SEQ_API void moveModel( const float x, const float y, const float z );
      68             : 
      69             :         /**
      70             :          * Enable or disable statistics rendering.
      71             :          *
      72             :          * The statistics are rendered in the views where they are enabled. The
      73             :          * default event handler of this view toggles the statistics rendering
      74             :          * state when 's' is pressed.
      75             :          *
      76             :          * @param on the state of the statistics rendering.
      77             :          * @version 1.0
      78             :          */
      79             :         SEQ_API void showStatistics( const bool on );
      80             : 
      81             :         /**
      82             :          * Enable or disable orthographic rendering.
      83             :          *
      84             :          * The default event handler of this view toggles the orthographic
      85             :          * rendering state when 'o' is pressed.
      86             :          *
      87             :          * @param on the state of the orthographic rendering.
      88             :          * @version 1.2
      89             :          */
      90             :         SEQ_API void setOrtho( const bool on );
      91             : 
      92             :         /**
      93             :          * Update the view data.
      94             :          *
      95             :          * Called once at the end of each frame to trigger animations. The
      96             :          * default implementation updates the camera data.
      97             :          * @return true to request a redraw.
      98             :          * @version 1.0
      99             :          */
     100             :         virtual SEQ_API bool update();
     101             :         //@}
     102             : 
     103             :         /** @name Data Access. */
     104             :         //@{
     105             :         /** @return the current model matrix (global camera). @version 1.0 */
     106           0 :         const Matrix4f& getModelMatrix() const { return _modelMatrix; }
     107             : 
     108             :         /** @return true is statistics are rendered. @version 1.0 */
     109           1 :         bool getStatistics() const { return _statistics; }
     110             :         //@}
     111             : 
     112             :         /** @return true when orthographic rendering is enabled. @version 1.2 */
     113           0 :         bool useOrtho() const { return _ortho; }
     114             :         //@}
     115             : 
     116             :     protected:
     117             :         virtual SEQ_API void serialize( co::DataOStream& os,
     118             :                                         const uint64_t dirtyBits );
     119             :         virtual SEQ_API void deserialize( co::DataIStream& is,
     120             :                                           const uint64_t dirtyBits );
     121             : 
     122             :     private:
     123             :         /** The changed parts of the object since the last serialize(). */
     124             :         enum DirtyBits
     125             :         {
     126             :             DIRTY_MODELMATRIX = co::Serializable::DIRTY_CUSTOM << 0, // 1
     127             :             DIRTY_STATISTICS = co::Serializable::DIRTY_CUSTOM << 1, // 2
     128             :             DIRTY_ORTHO = co::Serializable::DIRTY_CUSTOM << 2 // 4
     129             :         };
     130             : 
     131             :         bool _handleEvent( const eq::Event& event );
     132             : 
     133             :         Matrix4f _modelMatrix;
     134             :         int32_t _spinX, _spinY;
     135             :         int32_t _advance;
     136             :         bool _statistics;
     137             :         bool _ortho;
     138             :     };
     139             : }
     140             : #endif // EQSEQUEL_VIEWDATA_H

Generated by: LCOV version 1.10