1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGBINARYSWAPCOMPOSER_H_
40 #define _OSGBINARYSWAPCOMPOSER_H_
45 #include "OSGBaseThread.h"
47 #include "OSGBinarySwapComposerBase.h"
49 #include "OSGClusterNetwork.h"
53 /*! \brief BinarySwapComposer class. See \ref
54 PageSystemBinarySwapComposer for a description.
56 \ingroup GrpClusterWindowComposer
57 \ingroup GrpLibOSGCluster
61 class OSG_CLUSTER_DLLMAPPING BinarySwapComposer
:
62 public BinarySwapComposerBase
66 typedef BinarySwapComposerBase Inherited
;
68 /*! \brief RGB Color value
114 /*========================== PUBLIC =================================*/
118 /*---------------------------------------------------------------------*/
122 virtual void changed(ConstFieldMaskArg whichField
,
127 /*---------------------------------------------------------------------*/
131 virtual void dump( UInt32 uiIndent
= 0,
132 const BitVector bvFlags
= 0) const;
135 /*---------------------------------------------------------------------*/
136 /*! \name features */
139 virtual bool clientRendering(void);
142 /*---------------------------------------------------------------------*/
143 /*! \name composition */
146 virtual void open ( );
147 virtual void composeViewport(Viewport
*port
);
148 virtual void close (void );
151 /*---------------------------------------------------------------------*/
152 /*! \name features */
155 virtual bool getClientRendering(void);
156 virtual UInt32
getUsableServers (void);
159 /*========================= PROTECTED ===============================*/
163 BaseThreadRefPtr _writer
;
164 BarrierRefPtr _barrier
;
167 Connection
*_swapConnection
;
170 UInt32 _tileBufferSize
;
171 std::vector
<UInt8
> _tile
;
172 std::vector
<UInt8
> _readTile
;
177 UInt32 _usableServers
;
178 Statistics _statistics
;
180 UInt32 _shortDepthMax
;
182 /*---------------------------------------------------------------------*/
183 /*! \name Constructors */
186 BinarySwapComposer(void);
187 BinarySwapComposer(const BinarySwapComposer
&source
);
190 /*---------------------------------------------------------------------*/
191 /*! \name Destructors */
194 virtual ~BinarySwapComposer(void);
197 /*---------------------------------------------------------------------*/
205 /*---------------------------------------------------------------------*/
206 /*! \name helper function */
209 template<class DepthT
,class ColorT
>
210 void sendToClient(DepthT
&depth
,ColorT
&color
,
216 template<class DepthT
,class ColorT
>
217 void recvFromServers(DepthT
&depth
,ColorT
&color
,
222 template<class DepthT
,class ColorT
>
223 void writeCombine(DepthT
&depthDummy
,ColorT
&colorDummy
);
225 template<class DepthT
,class ColorT
>
226 void readCombine(DepthT
&depth
,ColorT
&color
,
235 template<class DepthT
,class ColorT
>
236 void startReader(DepthT
&depth
,ColorT
&color
,
242 TileBuffer
*getTileBuffer(UInt32 x
,UInt32 y
);
243 TileBuffer
*getTileReadBuffer(void);
246 /*---------------------------------------------------------------------*/
250 static void initMethod(InitPhase ePhase
);
253 /*========================== PRIVATE ================================*/
257 friend class FieldContainer
;
258 friend class BinarySwapComposerBase
;
260 static void writeProc(void *arg
);
262 // prohibit default functions (move to 'public' if you need one)
263 void operator =(const BinarySwapComposer
&source
);
266 typedef BinarySwapComposer
*BinarySwapComposerP
;
270 #include "OSGBinarySwapComposerBase.inl"
271 #include "OSGBinarySwapComposer.inl"
273 #endif /* _OSGBINARYSWAPCOMPOSER_H_ */