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 \*---------------------------------------------------------------------------*/
45 #include "OSGConfig.h"
47 #include "OSGAction.h"
48 #include "OSGCamera.h"
49 #include "OSGRenderAction.h"
50 #include "OSGSceneFileHandler.h"
51 #include "OSGVolumeDraw.h"
53 #include "OSGAlgorithmComputeElement.h"
54 #include "OSGAlgorithmComputeElementData.h"
56 #include "OSGComputeAlgorithm.h"
58 #include "OSGFrameBufferObject.h"
59 #include "OSGFrameBufferAttachment.h"
61 #include "OSGMatrixUtility.h"
65 // Documentation for this class is emited in the
66 // OSGAlgorithmComputeElementBase.cpp file.
67 // To modify it, please change the .fcd file (OSGAlgorithmComputeElement.fcd)
68 // and regenerate the base file.
70 /*-------------------------------------------------------------------------*/
73 void AlgorithmComputeElement::changed(ConstFieldMaskArg whichField
,
77 Inherited::changed(whichField
, origin
, details
);
80 /*-------------------------------------------------------------------------*/
84 AlgorithmComputeElement::dump( UInt32
OSG_CHECK_ARG(uiIndent
),
85 const BitVector
OSG_CHECK_ARG(bvFlags
)) const
87 SLOG
<< "Dump AlgorithmComputeElement NI" << std::endl
;
90 /*-------------------------------------------------------------------------*/
93 AlgorithmComputeElement::AlgorithmComputeElement(void) :
98 AlgorithmComputeElement::AlgorithmComputeElement(
99 const AlgorithmComputeElement
&source
) :
105 /*-------------------------------------------------------------------------*/
108 AlgorithmComputeElement::~AlgorithmComputeElement(void)
112 /*-------------------------------------------------------------------------*/
115 Action::ResultE
AlgorithmComputeElement::renderEnter(Action
*action
)
117 RenderAction
*a
= dynamic_cast<RenderAction
*>(action
);
118 ComputeAlgorithm
*pAlgo
= this->getAlgorithm();
122 AlgorithmComputeElementData
*pData
=
123 a
->getData
<AlgorithmComputeElementData
*>(_iDataSlotId
);
127 AlgorithmComputeElementDataUnrecPtr pDataNew
=
128 AlgorithmComputeElementData::create();
130 this->setData(pDataNew
.get(), _iDataSlotId
, a
);
135 ComputeAlgorithmDrawTask
*pTask
= pData
->getTask();
139 pTask
= new ComputeAlgorithmDrawTask(
141 ComputeAlgorithmDrawTask::Algorithm
);
143 pData
->setTask(pTask
);
147 a
->getWindow()->queueTaskFromDrawer(pTask
);
150 return Action::Continue
;
153 Action::ResultE
AlgorithmComputeElement::renderLeave(Action
*a
)
155 return Action::Continue
;
159 /*-------------------------------------------------------------------------*/
162 void AlgorithmComputeElement::initMethod(InitPhase ePhase
)
164 Inherited::initMethod(ePhase
);
166 if(ePhase
== TypeObject::SystemPost
)
168 RenderAction::registerEnterDefault(
169 AlgorithmComputeElement::getClassType(),
170 reinterpret_cast<Action::Callback
>(
171 &AlgorithmComputeElement::renderEnter
));
173 RenderAction::registerLeaveDefault(
174 AlgorithmComputeElement::getClassType(),
175 reinterpret_cast<Action::Callback
>(
176 &AlgorithmComputeElement::renderLeave
));