OSGAlgorithmComputeElement.cpp

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035  *                                                                           *
00036  *                                                                           *
00037 \*---------------------------------------------------------------------------*/
00038
00039 #include <cstdlib>
00040 #include <cstdio>
00041
00042 #include <sstream>
00043 #include <fstream>
00044
00045 #include "OSGConfig.h"
00046
00047 #include "OSGAction.h"
00048 #include "OSGCamera.h"
00049 #include "OSGRenderAction.h"
00050 #include "OSGSceneFileHandler.h"
00051 #include "OSGVolumeDraw.h"
00052
00053 #include "OSGAlgorithmComputeElement.h"
00054
00055 #include "OSGFrameBufferObject.h"
00056 #include "OSGFrameBufferAttachment.h"
00057
00058 #include "OSGMatrixUtility.h"
00059
00060 OSG_BEGIN_NAMESPACE
00061
00062 // Documentation for this class is emited in the
00063 // OSGAlgorithmComputeElementBase.cpp file.
00064 // To modify it, please change the .fcd file (OSGAlgorithmComputeElement.fcd)
00065 // and regenerate the base file.
00066
00067 /*-------------------------------------------------------------------------*/
00068 /*                               Sync                                      */
00069
00070 void AlgorithmComputeElement::changed(ConstFieldMaskArg whichField,
00071                                       UInt32            origin,
00072                                       BitVector         details)
00073 {
00074     Inherited::changed(whichField, origin, details);
00075 }
00076
00077 /*-------------------------------------------------------------------------*/
00078 /*                               Dump                                      */
00079
00080 void
00081     AlgorithmComputeElement::dump(      UInt32    OSG_CHECK_ARG(uiIndent),
00082                                   const BitVector OSG_CHECK_ARG(bvFlags )) const
00083 {
00084     SLOG << "Dump AlgorithmComputeElement NI" << std::endl;
00085 }
00086
00087 /*-------------------------------------------------------------------------*/
00088 /*                            Constructors                                 */
00089
00090 AlgorithmComputeElement::AlgorithmComputeElement(void) :
00091     Inherited()
00092 {
00093 }
00094
00095 AlgorithmComputeElement::AlgorithmComputeElement(
00096     const AlgorithmComputeElement &source) :
00097
00098     Inherited(source)
00099 {
00100 }
00101
00102 /*-------------------------------------------------------------------------*/
00103 /*                             Destructor                                  */
00104
00105 AlgorithmComputeElement::~AlgorithmComputeElement(void)
00106 {
00107 }
00108
00109 /*-------------------------------------------------------------------------*/
00110 /*                               loading                                   */
00111
00112 ActionBase::ResultE AlgorithmComputeElement::renderEnter(Action *action)
00113 {
00114     RenderAction     *a     = dynamic_cast<RenderAction *>(action);
00115     ComputeAlgorithm *pAlgo = this->getAlgorithm();
00116
00117     if(pAlgo != NULL)
00118     {
00119 #if 0
00120         pAlgo->renderEnter(a);
00121 #endif
00122 
00123         ComputeAlgorithmDrawTask *pTask =
00124             new ComputeAlgorithmDrawTask(pAlgo,
00125                                          ComputeAlgorithmDrawTask::Algorithm);
00126
00127         a->getWindow()->queueTaskFromDrawer(pTask);
00128     }
00129
00130     return Action::Continue;
00131 }
00132
00133 ActionBase::ResultE AlgorithmComputeElement::renderLeave(Action *a)
00134 {
00135 #if 0
00136     ComputeAlgorithm *pAlgo = this->getAlgorithm();
00137
00138     if(pAlgorithm != NULL)
00139     {
00140         pAlgorithm->renderLeave(a);
00141     }
00142 #endif
00143 
00144     return Action::Continue;
00145 }
00146
00147
00148 /*-------------------------------------------------------------------------*/
00149 /*                               Init                                      */
00150
00151 void AlgorithmComputeElement::initMethod(InitPhase ePhase)
00152 {
00153     Inherited::initMethod(ePhase);
00154
00155     if(ePhase == TypeObject::SystemPost)
00156     {
00157         RenderAction::registerEnterDefault(
00158             AlgorithmComputeElement::getClassType(),
00159             reinterpret_cast<Action::Callback>(
00160                 &AlgorithmComputeElement::renderEnter));
00161
00162         RenderAction::registerLeaveDefault(
00163             AlgorithmComputeElement::getClassType(),
00164             reinterpret_cast<Action::Callback>(
00165                 &AlgorithmComputeElement::renderLeave));
00166     }
00167 }
00168
00169 OSG_END_NAMESPACE