Equalizer  1.8.0
Parallel Rendering Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
share/Equalizer/examples/eqPly/channel.h
1 
2 /* Copyright (c) 2006-2014, 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 <eq/eq.h>
36 
37 
38 namespace eqPly
39 {
40  class FrameData;
41  class InitData;
42 
46  class Channel : public eq::Channel
47  {
48  public:
49  Channel( eq::Window* parent );
50 
51  bool stopRendering() const;
52 
53  protected:
54  virtual ~Channel() {}
55 
56  bool configInit( const eq::uint128_t& initID ) override;
57  bool configExit() override;
58  void frameClear( const eq::uint128_t& frameID ) override;
59  void frameDraw( const eq::uint128_t& frameID ) override;
60  void frameAssemble( const eq::uint128_t&, const eq::Frames& ) override;
61  void frameReadback( const eq::uint128_t&, const eq::Frames& ) override;
62  void frameStart( const eq::uint128_t&, const uint32_t ) override;
63  void frameFinish( const eq::uint128_t&, const uint32_t ) override;
64  void frameViewStart( const eq::uint128_t& frameID ) override;
65  void frameViewFinish( const eq::uint128_t& frameID ) override;
66 
67  bool useOrtho() const override;
68  eq::Vector2f getJitter() const override;
69 
70  void notifyStopFrame( const uint32_t lastFrameNumber ) override
71  { _frameRestart = lastFrameNumber + 1; }
72 
73  private:
74  void _drawModel( const Model* model );
75  void _drawOverlay();
76  void _drawHelp();
77  void _updateNearFar( const triply::BoundingSphere& boundingSphere );
78 
79  bool _isDone() const;
80 
81  void _initJitter();
82  bool _initAccum();
83 
85  eq::Vector2i _getJitterStep() const;
86 
87  const FrameData& _getFrameData() const;
88  const Model* _getModel();
89 
90  const Model* _model;
91  eq::uint128_t _modelID;
92  uint32_t _frameRestart;
93 
94  struct Accum
95  {
96  Accum() : buffer( 0 ), step( 0 ), stepsDone( 0 ), transfer( false )
97  {}
98 
99  eq::util::Accum* buffer;
100  int32_t step;
101  uint32_t stepsDone;
102  bool transfer;
103  }
104  _accum[ eq::NUM_EYES ];
105 
106  eq::PixelViewport _currentPVP;
107  };
108 }
109 
110 #endif // EQ_PLY_CHANNEL_H
A channel represents a two-dimensional viewport within a Window.
A C++ class to abstract an accumulation buffer.
Definition: accum.h:39
virtual ~Channel()
Destruct the channel.
bool useOrtho() const override
Select perspective or orthographic rendering.
void frameReadback(const eq::uint128_t &, const eq::Frames &) override
Read back the rendered frame buffer into the output frames.
void frameAssemble(const eq::uint128_t &, const eq::Frames &) override
Assemble all input frames.
void notifyStopFrame(const uint32_t lastFrameNumber) override
Notify interruption of the rendering.
The rendering entity, updating a part of a Window.
void frameClear(const eq::uint128_t &frameID) override
Clear the frame buffer.
A Window represents an on-screen or off-screen drawable.
void frameViewFinish(const eq::uint128_t &frameID) override
Finish updating a destination channel.
std::vector< Frame * > Frames
A vector of pointers to eq::Frame.
bool configInit(const eq::uint128_t &initID) override
Initialize this channel.
eq::Vector2f getJitter() const override
bool configExit() override
Exit this channel.
void frameViewStart(const eq::uint128_t &frameID) override
Start updating a destination channel.
void frameFinish(const eq::uint128_t &, const uint32_t) override
Finish rendering a frame.
void frameStart(const eq::uint128_t &, const uint32_t) override
Start rendering a frame.
void frameDraw(const eq::uint128_t &frameID) override
Draw the scene.