LCOV - code coverage report
Current view: top level - eq/fabric - frustum.h (source / functions) Hit Total Coverage
Test: lcov2.info Lines: 8 10 80.0 %
Date: 2014-06-18 Functions: 8 10 80.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2009-2014, Stefan Eilemann <eile@equalizergraphics.com>
       3             :  *
       4             :  * This library is free software; you can redistribute it and/or modify it under
       5             :  * the terms of the GNU Lesser General Public License version 2.1 as published
       6             :  * by the Free Software Foundation.
       7             :  *
       8             :  * This library is distributed in the hope that it will be useful, but WITHOUT
       9             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      10             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      11             :  * details.
      12             :  *
      13             :  * You should have received a copy of the GNU Lesser General Public License
      14             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      15             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      16             :  */
      17             : 
      18             : #ifndef EQFABRIC_FRUSTUM_H
      19             : #define EQFABRIC_FRUSTUM_H
      20             : 
      21             : #include <eq/fabric/projection.h> // member
      22             : #include <eq/fabric/wall.h>       // member
      23             : #include <eq/fabric/api.h>       // decl
      24             : 
      25             : namespace eq
      26             : {
      27             : namespace fabric
      28             : {
      29             : /** A distributed object for frustum data. */
      30          64 : class Frustum
      31             : {
      32             : public:
      33             :     /** Construct a new frustum. @version 1.0 */
      34             :     EQFABRIC_API Frustum();
      35             : 
      36             :     /** Destruct the frustum. @version 1.0 */
      37             :     EQFABRIC_API virtual ~Frustum();
      38             : 
      39             :     /** The type of the last specified frustum. @version 1.0 */
      40             :     enum Type
      41             :     {
      42             :         TYPE_NONE,        //!< No frustum has been specified
      43             :         TYPE_WALL,        //!< A wall description has been set last
      44             :         TYPE_PROJECTION   //!< A projection description has been set last
      45             :     };
      46             : 
      47             :     /** Set the frustum using a wall description. @version 1.0 */
      48             :     EQFABRIC_API void setWall( const Wall& wall );
      49             : 
      50             :     /** Set the frustum using a projection description. @version 1.0 */
      51             :     EQFABRIC_API void setProjection( const Projection& projection );
      52             : 
      53             :     /** @return the last specified frustum as a wall. @version 1.0 */
      54        1658 :     const Wall& getWall() const { return _data.wall; }
      55             : 
      56             :     /** @return the last specified frustum as a projection. @version 1.0 */
      57           9 :     const Projection& getProjection() const { return _data.projection; }
      58             : 
      59             :     /** @return the type of the latest specified frustum. @version 1.0 */
      60        6906 :     Type getCurrentType() const { return _data.current; }
      61             : 
      62             :     /** Set the last specified frustum to TYPE_NONE. @version 1.0 */
      63             :     EQFABRIC_API void unsetFrustum();
      64             : 
      65             :     EQFABRIC_API void serialize( co::DataOStream& os ); //!< @internal
      66             :     EQFABRIC_API void deserialize( co::DataIStream& is ); //!< @internal
      67             : 
      68             :     EQFABRIC_API virtual void backup(); //!< @internal
      69             :     EQFABRIC_API virtual void restore(); //!< @internal
      70             : 
      71             : protected:
      72         101 :     virtual void updateFrustum() {}
      73         291 :     virtual void notifyFrustumChanged() {}
      74             : 
      75             : private:
      76         217 :     struct BackupData
      77             :     {
      78        7230 :         BackupData() : current( TYPE_NONE ) {}
      79             : 
      80             :         /** The frustum description as a wall. */
      81             :         Wall wall;
      82             : 
      83             :         /** The frustum description as a projection. */
      84             :         Projection projection;
      85             : 
      86             :         /** The type of the last specified frustum description. */
      87             :         Type current;
      88             :     }
      89             :         _data, _backup;
      90             : };
      91             : EQFABRIC_API std::ostream& operator << ( std::ostream& os, const Frustum& );
      92             : }
      93             : }
      94             : 
      95             : namespace lunchbox
      96             : {
      97           0 : template<> inline void byteswap( eq::fabric::Frustum::Type& value )
      98           0 :     { byteswap( reinterpret_cast< uint32_t& >( value )); }
      99             : }
     100             : 
     101             : #endif // EQFABRIC_FRUSTUM_H

Generated by: LCOV version 1.10