Equalizer  1.6.1
share/Equalizer/examples/eqPly/channel.h
1 
2 /* Copyright (c) 2006-2012, Stefan Eilemann <eile@equalizergraphics.com>
3  * 2010, Cedric Stalder <cedric.stalder@gmail.com>
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * - Redistributions of source code must retain the above copyright notice, this
9  * list of conditions and the following disclaimer.
10  * - Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  * - Neither the name of Eyescale Software GmbH nor the names of its
14  * contributors may be used to endorse or promote products derived from this
15  * software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef EQ_PLY_CHANNEL_H
31 #define EQ_PLY_CHANNEL_H
32 
33 #include "eqPly.h"
34 
35 #include "typedefs.h"
36 
37 #include <eq/eq.h>
38 
39 
40 namespace eqPly
41 {
42  class FrameData;
43  class InitData;
44 
48  class Channel : public eq::Channel
49  {
50  public:
51  Channel( eq::Window* parent );
52 
53  bool stopRendering() const;
54 
55  protected:
56  virtual ~Channel() {}
57 
58  virtual bool configInit( const eq::uint128_t& initID );
59  virtual bool configExit();
60  virtual void frameClear( const eq::uint128_t& frameID );
61  virtual void frameDraw( const eq::uint128_t& frameID );
62  virtual void frameAssemble( const eq::uint128_t& frameID );
63  virtual void frameReadback( const eq::uint128_t& frameID );
64  virtual void frameStart( const eq::uint128_t& frameID,
65  const uint32_t frameNumber );
66  virtual void frameFinish( const eq::uint128_t& frameID,
67  const uint32_t frameNumber );
68  virtual void frameViewStart( const eq::uint128_t& frameID );
69  virtual void frameViewFinish( const eq::uint128_t& frameID );
70 
71  virtual bool useOrtho() const;
72  virtual eq::Vector2f getJitter() const;
73 
74  virtual void notifyStopFrame( const uint32_t lastFrameNumber )
75  { _frameRestart = lastFrameNumber + 1; }
76 
77  private:
78  void _drawModel( const Model* model );
79  void _drawOverlay();
80  void _drawHelp();
81  void _updateNearFar( const mesh::BoundingSphere& boundingSphere );
82 
83  bool _isDone() const;
84 
85  void _initJitter();
86  bool _initAccum();
87 
89  eq::Vector2i _getJitterStep() const;
90 
91  const FrameData& _getFrameData() const;
92  const Model* _getModel();
93 
94  const Model* _model;
95  eq::uint128_t _modelID;
96  uint32_t _frameRestart;
97 
98  struct Accum
99  {
100  Accum() : buffer( 0 ), step( 0 ), stepsDone( 0 ), transfer( false )
101  {}
102 
103  eq::util::Accum* buffer;
104  int32_t step;
105  uint32_t stepsDone;
106  bool transfer;
107  }
108  _accum[ eq::NUM_EYES ];
109 
110  eq::PixelViewport _currentPVP;
111  };
112 }
113 
114 #endif // EQ_PLY_CHANNEL_H
115 
virtual void frameClear(const eq::uint128_t &frameID)
Clear the frame buffer.
A channel represents a two-dimensional viewport within a Window.
virtual ~Channel()
Destruct the channel.
A Window represents an on-screen or off-screen drawable.
The rendering entity, updating a part of a Window.
virtual bool configInit(const eq::uint128_t &initID)
Initialize this channel.
virtual bool useOrtho() const
Select perspective or orthographic rendering.
virtual void frameDraw(const eq::uint128_t &frameID)
Draw the scene.
virtual eq::Vector2f getJitter() const
virtual void frameReadback(const eq::uint128_t &frameID)
Read back the rendered frame buffer into the output frames.
A C++ class to abstract an accumulation buffer.
Definition: accum.h:39
virtual void frameViewStart(const eq::uint128_t &frameID)
Start updating a destination channel.
virtual void frameFinish(const eq::uint128_t &frameID, const uint32_t frameNumber)
Finish rendering a frame.
virtual void frameStart(const eq::uint128_t &frameID, const uint32_t frameNumber)
Start rendering a frame.
virtual void frameAssemble(const eq::uint128_t &frameID)
Assemble all input frames.
virtual void frameViewFinish(const eq::uint128_t &frameID)
Finish updating a destination channel.
virtual void notifyStopFrame(const uint32_t lastFrameNumber)
Notify interruption of the rendering.
virtual bool configExit()
Exit this channel.