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 _OSGCOMPUTEALGORITHM_H_
40 #define _OSGCOMPUTEALGORITHM_H_
47 #include "OSGComputeAlgorithmBase.h"
48 #include "OSGAction.h"
49 #include "OSGDrawTask.h"
57 //! \ingroup GrpSystemNodeCoresMisc
59 class OSG_CONTRIBCOMPUTEBASE_DLLMAPPING ComputeAlgorithm
:
60 public ComputeAlgorithmBase
62 /*========================== PUBLIC =================================*/
66 /*---------------------------------------------------------------------*/
70 virtual void changed(ConstFieldMaskArg whichField
,
74 /*---------------------------------------------------------------------*/
78 virtual Action::ResultE
renderEnter(Action
*pAction
) = 0;
79 virtual Action::ResultE
renderLeave(Action
*pAction
) = 0;
80 virtual void execute (HardwareContext
*pContext
,
84 /*---------------------------------------------------------------------*/
88 virtual void dump( UInt32 uiIndent
= 0,
89 const BitVector bvFlags
= 0) const;
92 /*========================= PROTECTED ===============================*/
96 typedef ComputeAlgorithmBase Inherited
;
98 /*---------------------------------------------------------------------*/
99 /*! \name Constructors */
102 ComputeAlgorithm(void);
103 ComputeAlgorithm(const ComputeAlgorithm
&source
);
106 /*---------------------------------------------------------------------*/
107 /*! \name Destructors */
110 virtual ~ComputeAlgorithm(void);
113 /*---------------------------------------------------------------------*/
118 /*---------------------------------------------------------------------*/
122 static void initMethod(InitPhase ePhase
);
125 /*========================== PRIVATE ================================*/
129 friend class FieldContainer
;
130 friend class ComputeAlgorithmBase
;
132 /*---------------------------------------------------------------------*/
133 /*! \name thread local */
137 /*---------------------------------------------------------------------*/
138 /*! \name load thread */
142 /*---------------------------------------------------------------------*/
144 /*!\brief prohibit default function (move to 'public' if needed) */
145 void operator =(const ComputeAlgorithm
&source
);
148 typedef ComputeAlgorithm
*ComputeAlgorithmP
;
150 class OSG_CONTRIBCOMPUTEBASE_DLLMAPPING ComputeAlgorithmDrawTask
:
153 /*========================== PUBLIC =================================*/
157 static const UInt32 Algorithm
= Inherited::LastType
+ 1;
158 static const UInt32 AlgorithmWithBarrier
= Inherited::LastType
+ 2;
159 static const UInt32 LastType
= AlgorithmWithBarrier
;
161 typedef DrawTask Inherited
;
164 /*---------------------------------------------------------------------*/
165 /*! \name Statistic */
168 ComputeAlgorithmDrawTask(UInt32 uiType
);
169 ComputeAlgorithmDrawTask(ComputeAlgorithmP pAlgorithm
, UInt32 uiType
);
172 /*---------------------------------------------------------------------*/
176 virtual void execute(HardwareContext
*pContext
, DrawEnv
*pEnv
);
179 /*---------------------------------------------------------------------*/
183 void activateBarrier(bool bVal
);
184 void setAlgorithm (ComputeAlgorithmP pAlgorithm
);
187 /*---------------------------------------------------------------------*/
191 void waitForBarrier(void);
194 /*---------------------------------------------------------------------*/
199 /*---------------------------------------------------------------------*/
203 virtual void dump(UInt32 uiIndent
);
206 /*========================= PROTECTED ===============================*/
210 /*---------------------------------------------------------------------*/
214 ComputeAlgorithmUnrecPtr _pAlgorithm
;
215 BarrierRefPtr _pBarrier
;
218 /*---------------------------------------------------------------------*/
219 /*! \name Destructor */
222 virtual ~ComputeAlgorithmDrawTask(void);
225 /*========================== PRIVATE ================================*/
229 /*! \brief prohibit default function (move to 'public' if needed) */
230 ComputeAlgorithmDrawTask(const ComputeAlgorithmDrawTask
&source
);
231 /*! \brief prohibit default function (move to 'public' if needed) */
232 void operator =(const ComputeAlgorithmDrawTask
&source
);
235 typedef RefCountPtr
<ComputeAlgorithmDrawTask
,
236 MemObjRefCountPolicy
> ComputeAlgorithmDrawTaskRefPtr
;
240 #include "OSGComputeAlgorithmBase.inl"
241 #include "OSGComputeAlgorithm.inl"
243 #endif /* _OSGCOMPUTEALGORITHM_H_ */