Skip to content

Commit

Permalink
Add seq::Renderer::requestRedraw()
Browse files Browse the repository at this point in the history
  • Loading branch information
tribal-tec committed Jun 10, 2016
1 parent a226154 commit 0710501
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 100 deletions.
2 changes: 2 additions & 0 deletions doc/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Changelog {#Changelog}

# git master

* [563](https://github.com/Eyescale/Equalizer/pull/563):
Add seq::Renderer::requestRedraw()
* [561](https://github.com/Eyescale/Equalizer/pull/561):
Change Deflect streaming activation

Expand Down
210 changes: 110 additions & 100 deletions seq/detail/masterConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,56 +144,61 @@ bool MasterConfig::handleEvent( const eq::ConfigEvent* event )
{
switch( event->data.type )
{
case eq::Event::CHANNEL_POINTER_BUTTON_PRESS:
_currentViewID = event->data.context.view.identifier;
return true;

case eq::Event::KEY_PRESS:
case eq::Event::KEY_RELEASE:
if( Config::handleEvent( event ))
{
_redraw = true;
LBVERB << "Redraw: requested by eq::Config" << std::endl;
}
// no break;
case eq::Event::CHANNEL_POINTER_BUTTON_RELEASE:
case eq::Event::CHANNEL_POINTER_MOTION:
case eq::Event::CHANNEL_POINTER_WHEEL:
case eq::Event::MAGELLAN_AXIS:
{
if( _currentViewID == 0 )
return false;

View* view = static_cast<View*>( find<eq::View>( _currentViewID ));
if( view->handleEvent( event ))
{
_redraw = true;
LBVERB << "Redraw: requested by view event handler" << std::endl;
}
return true;
}

case eq::Event::STATISTIC:
{
Config::handleEvent( event );
if( event->data.statistic.type != eq::Statistic::CONFIG_FINISH_FRAME )
return false;

ViewUpdateVisitor viewUpdate( _redraw );
accept( viewUpdate );
return _redraw;
}

case eq::Event::WINDOW_EXPOSE:
case eq::Event::WINDOW_RESIZE:
case eq::Event::WINDOW_CLOSE:
case eq::Event::VIEW_RESIZE:
_redraw = true;
LBVERB << "Redraw: window change" << std::endl;
break;
case eq::Event::CHANNEL_POINTER_BUTTON_PRESS:
_currentViewID = event->data.context.view.identifier;
return true;

default:
break;
case eq::Event::KEY_PRESS:
case eq::Event::KEY_RELEASE:
if( Config::handleEvent( event ))
{
_redraw = true;
LBVERB << "Redraw: requested by eq::Config" << std::endl;
}
// no break;
case eq::Event::CHANNEL_POINTER_BUTTON_RELEASE:
case eq::Event::CHANNEL_POINTER_MOTION:
case eq::Event::CHANNEL_POINTER_WHEEL:
case eq::Event::MAGELLAN_AXIS:
{
if( _currentViewID == 0 )
return false;

View* view = static_cast<View*>( find<eq::View>( _currentViewID ));
if( view->handleEvent( event ))
{
_redraw = true;
LBVERB << "Redraw: requested by view event handler" << std::endl;
}
return true;
}

case eq::Event::STATISTIC:
{
Config::handleEvent( event );
if( event->data.statistic.type != eq::Statistic::CONFIG_FINISH_FRAME )
return false;

ViewUpdateVisitor viewUpdate( _redraw );
accept( viewUpdate );
return _redraw;
}

case eq::Event::WINDOW_EXPOSE:
case eq::Event::WINDOW_RESIZE:
case eq::Event::WINDOW_CLOSE:
case eq::Event::VIEW_RESIZE:
_redraw = true;
LBVERB << "Redraw: window change" << std::endl;
break;

case EVENT_REDRAW:
_redraw = true;
LBINFO << "Redraw request" << std::endl;
break;

default:
break;
}

if( eq::Config::handleEvent( event ))
Expand All @@ -209,57 +214,62 @@ bool MasterConfig::handleEvent( eq::EventICommand command )
{
switch( command.getEventType( ))
{
case eq::Event::CHANNEL_POINTER_BUTTON_PRESS:
{
const eq::Event& event = command.read< eq::Event >();
_currentViewID = event.context.view.identifier;
return true;
}

case eq::Event::KEY_PRESS:
case eq::Event::KEY_RELEASE:
if( Config::handleEvent( command ))
{
_redraw = true;
LBVERB << "Redraw: requested by eq::Config" << std::endl;
}
// no break;
case eq::Event::CHANNEL_POINTER_BUTTON_RELEASE:
case eq::Event::CHANNEL_POINTER_MOTION:
case eq::Event::CHANNEL_POINTER_WHEEL:
case eq::Event::MAGELLAN_AXIS:
{
if( _currentViewID == 0 )
return false;

View* view = static_cast<View*>( find<eq::View>( _currentViewID ));
if( view->handleEvent( command ))
{
_redraw = true;
LBVERB << "Redraw: requested by view event handler" << std::endl;
}
return true;
}

case eq::Event::STATISTIC:
{
Config::handleEvent( command );
const eq::Event& event = command.read< eq::Event >();
if( event.statistic.type != eq::Statistic::CONFIG_FINISH_FRAME )
return false;

ViewUpdateVisitor viewUpdate( _redraw );
accept( viewUpdate );
return _redraw;
}

case eq::Event::WINDOW_EXPOSE:
case eq::Event::WINDOW_RESIZE:
case eq::Event::WINDOW_CLOSE:
case eq::Event::VIEW_RESIZE:
_redraw = true;
LBVERB << "Redraw: window change" << std::endl;
break;
case eq::Event::CHANNEL_POINTER_BUTTON_PRESS:
{
const eq::Event& event = command.read< eq::Event >();
_currentViewID = event.context.view.identifier;
return true;
}

case eq::Event::KEY_PRESS:
case eq::Event::KEY_RELEASE:
if( Config::handleEvent( command ))
{
_redraw = true;
LBVERB << "Redraw: requested by eq::Config" << std::endl;
}
// no break;
case eq::Event::CHANNEL_POINTER_BUTTON_RELEASE:
case eq::Event::CHANNEL_POINTER_MOTION:
case eq::Event::CHANNEL_POINTER_WHEEL:
case eq::Event::MAGELLAN_AXIS:
{
if( _currentViewID == 0 )
return false;

View* view = static_cast<View*>( find<eq::View>( _currentViewID ));
if( view->handleEvent( command ))
{
_redraw = true;
LBVERB << "Redraw: requested by view event handler" << std::endl;
}
return true;
}

case eq::Event::STATISTIC:
{
Config::handleEvent( command );
const eq::Event& event = command.read< eq::Event >();
if( event.statistic.type != eq::Statistic::CONFIG_FINISH_FRAME )
return false;

ViewUpdateVisitor viewUpdate( _redraw );
accept( viewUpdate );
return _redraw;
}

case eq::Event::WINDOW_EXPOSE:
case eq::Event::WINDOW_RESIZE:
case eq::Event::WINDOW_CLOSE:
case eq::Event::VIEW_RESIZE:
_redraw = true;
LBVERB << "Redraw: window change" << std::endl;
break;

case EVENT_REDRAW:
_redraw = true;
LBVERB << "Redraw request" << std::endl;
break;

default:
break;
Expand Down
8 changes: 8 additions & 0 deletions seq/detail/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "objectMap.h"

#include <seq/renderer.h>
#include <eq/config.h>

namespace seq
{
Expand Down Expand Up @@ -168,6 +169,13 @@ void Renderer::clear()
_channel->clear();
}

void Renderer::requestRedraw()
{
LBASSERT( _channel );
if( _channel )
_channel->getConfig()->sendEvent( EVENT_REDRAW );
}

void Renderer::applyRenderContext()
{
LBASSERT( _channel );
Expand Down
1 change: 1 addition & 0 deletions seq/detail/renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class Renderer
bool exitContext();

void clear();
void requestRedraw();

void applyRenderContext();
void applyModelMatrix();
Expand Down
5 changes: 5 additions & 0 deletions seq/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ void Renderer::clear( co::Object* /*frameData*/ )
_impl->clear();
}

void Renderer::requestRedraw()
{
_impl->requestRedraw();
}

void Renderer::updateNearFar( const Vector4f& boundingSphere )
{
const Matrix4f& view = getViewMatrix();
Expand Down
3 changes: 3 additions & 0 deletions seq/renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ class Renderer : public co::ObjectFactory
*/
virtual void draw( co::Object* frameData ) = 0;

/** Request another call to draw(). @version 1.12 */
SEQ_API void requestRedraw();

/**
* Update the near and far planes to tightly enclose the given sphere.
*
Expand Down
8 changes: 8 additions & 0 deletions seq/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
#define EQSEQUEL_TYPES_H

#include <seq/api.h>

#include <eq/types.h>
#include <eq/fabric/event.h>

namespace seq
{
Expand All @@ -44,6 +46,12 @@ class ViewData;

typedef lunchbox::RefPtr< Application > ApplicationPtr;

enum EventType
{
EVENT_REDRAW = eq::Event::USER,
EVENT_USER
};

/** @cond IGNORE */
namespace detail
{
Expand Down

0 comments on commit 0710501

Please sign in to comment.