LCOV - code coverage report
Current view: top level - eq/server - frustumData.h (source / functions) Hit Total Coverage
Test: lcov2.info Lines: 7 7 100.0 %
Date: 2014-06-18 Functions: 7 7 100.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2006-2011, 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 EQSERVER_FRUSTUMDATA_H
      19             : #define EQSERVER_FRUSTUMDATA_H
      20             : 
      21             : #include "api.h"
      22             : #include "types.h"
      23             : 
      24             : #include <eq/fabric/eye.h>   // EYE enum
      25             : #include <eq/fabric/wall.h>  // Wall::Type enum
      26             : 
      27             : namespace eq
      28             : {
      29             : 
      30             : namespace server
      31             : {
      32             :     /** 
      33             :      * Data derived from fabric::Frustum, in a general, optimized format used
      34             :      * for frustum calculations during rendering.
      35             :      */
      36        1830 :     class FrustumData
      37             :     {
      38             :     public:
      39             :         EQSERVER_API FrustumData();
      40             : 
      41        1164 :         bool isValid() const { return (_width!=0.f && _height!=0.f); }
      42        2455 :         void invalidate()    { _width = 0.f; _height = 0.f; }
      43             : 
      44             :         /** @name Data Update. */
      45             :         //@{
      46             :         /** Update the frustum data using the given projection. */
      47             :         void applyProjection( const fabric::Projection& projection );
      48             : 
      49             :         /** Update the frustum data using the given wall. */
      50             :         EQSERVER_API void applyWall( const fabric::Wall& wall );
      51             :         //@}
      52             : 
      53             :         /** @name Data Access. */
      54             :         //@{
      55             :         /** @return the frustum plane transformation */
      56          42 :         const Matrix4f& getTransform() const { return _xfm; }
      57             : 
      58             :         /** @return the frustum plane width */
      59          29 :         float getWidth() const { return _width; }
      60             : 
      61             :         /** @return the frustum plane height */
      62          29 :         float getHeight() const { return _height; }
      63             : 
      64             :         /** @return the projection type. */
      65          52 :         fabric::Wall::Type getType() const { return _type; }
      66             :         //@}
      67             : 
      68             :     private:
      69             :         float _width;
      70             :         float _height;
      71             :         Matrix4f _xfm;
      72             :         fabric::Wall::Type _type;
      73             :     };
      74             : 
      75             :     std::ostream& operator << ( std::ostream& os, const FrustumData& ); 
      76             : }
      77             : }
      78             : #endif // EQ_FRUSTUMDATA_H

Generated by: LCOV version 1.10