# SoGLRenderAction.h

    00001 #ifndef COIN_SOGLRENDERACTION_H
    00002 #define COIN_SOGLRENDERACTION_H
    00003
    00004 /**************************************************************************\
    00005  *
    00006  *  This file is part of the Coin 3D visualization library.
    00007  *  Copyright (C) 1998-2003 by Systems in Motion.  All rights reserved.
    00008  *
    00009  *  This library is free software; you can redistribute it and/or
    00010  *  modify it under the terms of the GNU General Public License
    00011  *  ("GPL") version 2 as published by the Free Software Foundation.
    00012  *  See the file LICENSE.GPL at the root directory of this source
    00013  *  distribution for additional information about the GNU GPL.
    00014  *
    00015  *  For using Coin with software that can not be combined with the GNU
    00016  *  GPL, and for taking advantage of the additional benefits of our
    00017  *  support services, please contact Systems in Motion about acquiring
    00018  *  a Coin Professional Edition License.
    00019  *
    00020  *  See <URL:http://www.coin3d.org> for  more information.
    00021  *
    00022  *  Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY.
    00023  *  <URL:http://www.sim.no>.
    00024  *
    00025 \**************************************************************************/
    00026
    00027 #include <Inventor/actions/SoAction.h>
    00028 #include <Inventor/actions/SoSubAction.h>
    00029 #include <Inventor/SbBasic.h>
    00030 #include <Inventor/SbViewportRegion.h>
    00031 #include <Inventor/system/inttypes.h>
    00032 #include <Inventor/lists/SoPathList.h>
    00033 #include <Inventor/lists/SbList.h>
    00034
    00035 typedef void SoGLRenderPassCB(void * userdata);
    00036 typedef void SoGLPreRenderCB(void * userdata, class SoGLRenderAction * action);
    00037
    00038 class COIN_DLL_API SoGLRenderAction : public SoAction {
    00039   typedef SoAction inherited;
    00040
    00041   SO_ACTION_HEADER(SoGLRenderAction);
    00042
    00043 public:
    00044   SoGLRenderAction(const SbViewportRegion & viewportregion);
    00045   virtual ~SoGLRenderAction();
    00046
    00047   static void initClass(void);
    00048
    00049   enum TransparencyType {
    00050     SCREEN_DOOR,
    00051     ADD, DELAYED_ADD, SORTED_OBJECT_ADD,
    00052     BLEND, DELAYED_BLEND, SORTED_OBJECT_BLEND,
    00053     // The remaining are Coin extensions to the common Inventor API
    00054     SORTED_OBJECT_SORTED_TRIANGLE_ADD,
    00055     SORTED_OBJECT_SORTED_TRIANGLE_BLEND,
    00056     NONE
    00057   };
    00058
    00059   enum AbortCode {
    00060     CONTINUE, ABORT, PRUNE, DELAY
    00061   };
    00062
    00063   typedef AbortCode SoGLRenderAbortCB(void * userdata);
    00064
    00065   void setViewportRegion(const SbViewportRegion & newregion);
    00066   const SbViewportRegion & getViewportRegion(void) const;
    00067   void setUpdateArea(const SbVec2f & origin, const SbVec2f & size);
    00068   void getUpdateArea(SbVec2f & origin, SbVec2f & size) const;
    00069   void setAbortCallback(SoGLRenderAbortCB * const func, void * const userdata);
    00070   void setTransparencyType(const TransparencyType type);
    00071   TransparencyType getTransparencyType(void) const;
    00072   void setSmoothing(const SbBool smooth);
    00073   SbBool isSmoothing(void) const;
    00074   void setNumPasses(const int num);
    00075   int getNumPasses(void) const;
    00076   void setPassUpdate(const SbBool flag);
    00077   SbBool isPassUpdate(void) const;
    00078   void setPassCallback(SoGLRenderPassCB * const func, void * const userdata);
    00079   void setCacheContext(const uint32_t context);
    00080   uint32_t getCacheContext(void) const;
    00081
    00082   void addDelayedPath(SoPath * path);
    00083   SbBool isRenderingDelayedPaths(void) const;
    00084
    00085   SbBool handleTransparency(SbBool istransparent = FALSE);
    00086   int getCurPass(void) const;
    00087   SbBool abortNow(void);
    00088
    00089   void setRenderingIsRemote(SbBool isremote);
    00090   SbBool getRenderingIsRemote(void) const;
    00091
    00092   virtual void invalidateState(void);
    00093
    00094   void addPreRenderCallback(SoGLPreRenderCB * func, void * userdata);
    00095   void removePreRenderCallback(SoGLPreRenderCB * func, void * userdata);
    00096
    00097 protected:
    00098   virtual void beginTraversal(SoNode * node);
    00099   virtual void endTraversal(SoNode * node);
    00100
    00101 private:
    00102   void addTransPath(SoPath * path);
    00103   void doPathSort(void);
    00104
    00105   class SoGLRenderActionP * pimpl;
    00106   friend class SoGLRenderActionP;
    00107 };
    00108
    00109 #endif // !COIN_SOGLRENDERACTION_H