LCOV - code coverage report
Current view: top level - seq/detail - renderer.cpp (source / functions) Hit Total Coverage
Test: lcov2.info Lines: 28 60 46.7 %
Date: 2014-06-18 Functions: 10 18 55.6 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2011-2013, Stefan Eilemann <eile@eyescale.ch>
       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             : #include "renderer.h"
      19             : 
      20             : #include "channel.h"
      21             : #include "pipe.h"
      22             : #include "window.h"
      23             : 
      24             : #include <seq/renderer.h>
      25             : 
      26             : namespace seq
      27             : {
      28             : namespace detail
      29             : {
      30           1 : static const RenderContext dummyContext;
      31             : 
      32           2 : Renderer::Renderer()
      33             :         : _glewContext( 0 )
      34             :         , _pipe( 0 )
      35             :         , _window( 0 )
      36           2 :         , _channel( 0 )
      37           2 : {}
      38             : 
      39           2 : Renderer::~Renderer()
      40             : {
      41           2 :     LBASSERT( !_pipe );
      42           2 :     LBASSERT( !_channel );
      43           2 : }
      44             : 
      45           4 : co::Object* Renderer::getFrameData()
      46             : {
      47           4 :     return _pipe->getFrameData();
      48             : }
      49             : 
      50           0 : const Frustumf& Renderer::getFrustum() const
      51             : {
      52           0 :     LBASSERT( _channel );
      53           0 :     return _channel ? _channel->getFrustum() : Frustumf::DEFAULT;
      54             : }
      55             : 
      56           0 : const Matrix4f& Renderer::getViewMatrix() const
      57             : {
      58           0 :     LBASSERT( _channel );
      59           0 :     return _channel ? _channel->getViewMatrix() : Matrix4f::IDENTITY;
      60             : }
      61             : 
      62           0 : const Matrix4f& Renderer::getModelMatrix() const
      63             : {
      64           0 :     LBASSERT( _channel );
      65           0 :     return _channel ? _channel->getModelMatrix() : Matrix4f::IDENTITY;
      66             : }
      67             : 
      68           0 : bool Renderer::useOrtho() const
      69             : {
      70           0 :     LBASSERT( _channel );
      71           0 :     return _channel ? _channel->useOrtho() : false;
      72             : }
      73             : 
      74           0 : void Renderer::setNearFar( const float nearPlane, const float farPlane )
      75             : {
      76           0 :     LBASSERT( _channel );
      77           0 :     if( _channel )
      78           0 :         _channel->setNearFar( nearPlane, farPlane );
      79           0 : }
      80             : 
      81          12 : void Renderer::setWindow( Window* window )
      82             : {
      83          12 :     _window = window;
      84          12 :     _glewContext = window ? window->glewGetContext() : 0;
      85          12 : }
      86             : 
      87           4 : void Renderer::setChannel( Channel* channel )
      88             : {
      89           4 :     _channel = channel;
      90           4 :     _glewContext = channel ? channel->glewGetContext() : 0;
      91           4 : }
      92             : 
      93           2 : bool Renderer::initContext()
      94             : {
      95           2 :     return _window ? _window->initContext() : false;
      96             : }
      97             : 
      98           2 : bool Renderer::exitContext()
      99             : {
     100           2 :     return _window ? _window->exitContext() : false;
     101             : }
     102             : 
     103           3 : void Renderer::clear()
     104             : {
     105           3 :     LBASSERT( _channel );
     106           3 :     if( _channel )
     107           3 :         _channel->clear();
     108           3 : }
     109             : 
     110           0 : void Renderer::applyRenderContext()
     111             : {
     112           0 :     LBASSERT( _channel );
     113           0 :     if( _channel )
     114           0 :         _channel->applyRenderContext();
     115           0 : }
     116             : 
     117           0 : const RenderContext& Renderer::getRenderContext() const
     118             : {
     119           0 :     LBASSERT( _channel );
     120           0 :     if( _channel )
     121           0 :         return _channel->getRenderContext();
     122           0 :     return dummyContext;
     123             : }
     124             : 
     125           0 : void Renderer::applyModelMatrix()
     126             : {
     127           0 :     LBASSERT( _channel );
     128           0 :     if( _channel )
     129           0 :         _channel->applyModelMatrix();
     130           0 : }
     131             : 
     132             : }
     133           3 : }

Generated by: LCOV version 1.10