Coin Logo http://www.sim.no
http://www.coin3d.org

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-2007 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 http://www.coin3d.org/ for more information.
00021  *
00022  *  Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
00023  *  http://www.sim.no/  sales@sim.no  coin-support@coin3d.org
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 typedef float SoGLSortedObjectOrderCB(void * userdata, SoGLRenderAction * action);
00038 
00039 class COIN_DLL_API SoGLRenderAction : public SoAction {
00040   typedef SoAction inherited;
00041 
00042   SO_ACTION_HEADER(SoGLRenderAction);
00043 
00044 public:
00045   SoGLRenderAction(const SbViewportRegion & viewportregion);
00046   virtual ~SoGLRenderAction(void);
00047 
00048   static void initClass(void);
00049 
00050   enum TransparencyType {
00051     SCREEN_DOOR,
00052     ADD, DELAYED_ADD, SORTED_OBJECT_ADD,
00053     BLEND, DELAYED_BLEND, SORTED_OBJECT_BLEND,
00054     // The remaining are Coin extensions to the common Inventor API
00055     SORTED_OBJECT_SORTED_TRIANGLE_ADD,
00056     SORTED_OBJECT_SORTED_TRIANGLE_BLEND,
00057     NONE, SORTED_LAYERS_BLEND
00058   };
00059 
00060   enum AbortCode {
00061     CONTINUE, ABORT, PRUNE, DELAY
00062   };
00063   enum SortedObjectOrderStrategy {
00064     BBOX_CENTER,
00065     BBOX_CLOSEST_CORNER,
00066     BBOX_FARTHEST_CORNER,
00067     CUSTOM_CALLBACK
00068   };
00069 
00070   typedef AbortCode SoGLRenderAbortCB(void * userdata);
00071 
00072   void setViewportRegion(const SbViewportRegion & newregion);
00073   const SbViewportRegion & getViewportRegion(void) const;
00074   void setUpdateArea(const SbVec2f & origin, const SbVec2f & size);
00075   void getUpdateArea(SbVec2f & origin, SbVec2f & size) const;
00076   void setAbortCallback(SoGLRenderAbortCB * const func, void * const userdata);
00077   void setTransparencyType(const TransparencyType type);
00078   TransparencyType getTransparencyType(void) const;
00079   void setSmoothing(const SbBool smooth);
00080   SbBool isSmoothing(void) const;
00081   void setNumPasses(const int num);
00082   int getNumPasses(void) const;
00083   void setPassUpdate(const SbBool flag);
00084   SbBool isPassUpdate(void) const;
00085   void setPassCallback(SoGLRenderPassCB * const func, void * const userdata);
00086   void setCacheContext(const uint32_t context);
00087   uint32_t getCacheContext(void) const;
00088 
00089   void addDelayedPath(SoPath * path);
00090   SbBool isRenderingDelayedPaths(void) const;
00091 
00092   SbBool handleTransparency(SbBool istransparent = FALSE);
00093   int getCurPass(void) const;
00094   SbBool abortNow(void);
00095 
00096   void setRenderingIsRemote(SbBool isremote);
00097   SbBool getRenderingIsRemote(void) const;
00098 
00099   virtual void invalidateState(void);
00100 
00101   void addPreRenderCallback(SoGLPreRenderCB * func, void * userdata);
00102   void removePreRenderCallback(SoGLPreRenderCB * func, void * userdata);
00103  
00104   void setSortedLayersNumPasses(int num);
00105   int getSortedLayersNumPasses(void) const;
00106 
00107   void setSortedObjectOrderStrategy(const SortedObjectOrderStrategy strategy,
00108                                     SoGLSortedObjectOrderCB * cb = NULL,
00109                                     void * closure = NULL);
00110 
00111 protected:
00112   virtual void beginTraversal(SoNode * node);
00113   virtual void endTraversal(SoNode * node);
00114 
00115 private:
00116   void addTransPath(SoPath * path);
00117   void doPathSort(void);
00118 
00119   class SoGLRenderActionP * pimpl;
00120   friend class SoGLRenderActionP;
00121 };
00122 
00123 #endif // !COIN_SOGLRENDERACTION_H
00124 

Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.

Generated on Mon Feb 23 16:33:19 2009 for Coin by Doxygen. 1.5.8