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

Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages

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

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

Generated on Tue May 30 14:35:48 2006 for Coin by Doxygen. 1.4.4