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) by Kongsberg Oil & Gas Technologies.
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 Kongsberg Oil & Gas Technologies
00018  *  about acquiring a Coin Professional Edition License.
00019  *
00020  *  See http://www.coin3d.org/ for more information.
00021  *
00022  *  Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, 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 SoGLRenderActionP;
00040 
00041 class COIN_DLL_API SoGLRenderAction : public SoAction {
00042   typedef SoAction inherited;
00043 
00044   SO_ACTION_HEADER(SoGLRenderAction);
00045 
00046 public:
00047   static void initClass(void);
00048 
00049   SoGLRenderAction(const SbViewportRegion & viewportregion);
00050   virtual ~SoGLRenderAction(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 TransparentDelayedObjectRenderType {
00063     ONE_PASS,
00064     NONSOLID_SEPARATE_BACKFACE_PASS
00065   };
00066 
00067   enum AbortCode {
00068     CONTINUE, ABORT, PRUNE, DELAY
00069   };
00070 
00071   enum SortedObjectOrderStrategy {
00072     BBOX_CENTER,
00073     BBOX_CLOSEST_CORNER,
00074     BBOX_FARTHEST_CORNER,
00075     CUSTOM_CALLBACK
00076   };
00077 
00078   typedef AbortCode SoGLRenderAbortCB(void * userdata);
00079 
00080   void setViewportRegion(const SbViewportRegion & newregion);
00081   const SbViewportRegion & getViewportRegion(void) const;
00082   void setUpdateArea(const SbVec2f & origin, const SbVec2f & size);
00083   void getUpdateArea(SbVec2f & origin, SbVec2f & size) const;
00084   void setAbortCallback(SoGLRenderAbortCB * const func, void * const userdata);
00085   void getAbortCallback(SoGLRenderAbortCB * & func_out, void * & userdata_out) const;
00086   void setTransparencyType(const TransparencyType type);
00087   TransparencyType getTransparencyType(void) const;
00088   void setTransparentDelayedObjectRenderType(TransparentDelayedObjectRenderType type);
00089   TransparentDelayedObjectRenderType getTransparentDelayedObjectRenderType(void) const;
00090   void setSmoothing(const SbBool smooth);
00091   SbBool isSmoothing(void) const;
00092   void setNumPasses(const int num);
00093   int getNumPasses(void) const;
00094   void setPassUpdate(const SbBool flag);
00095   SbBool isPassUpdate(void) const;
00096   void setPassCallback(SoGLRenderPassCB * const func, void * const userdata);
00097   void setCacheContext(const uint32_t context);
00098   uint32_t getCacheContext(void) const;
00099 
00100   void addDelayedPath(SoPath * path);
00101   SbBool isRenderingDelayedPaths(void) const;
00102 
00103   SbBool handleTransparency(SbBool istransparent = FALSE);
00104   void setCurPass(const int passnum, const int numpasses);
00105   int getCurPass(void) const;
00106   SbBool abortNow(void);
00107 
00108   void setRenderingIsRemote(SbBool isremote);
00109   SbBool getRenderingIsRemote(void) const;
00110 
00111   virtual void invalidateState(void);
00112 
00113   void addPreRenderCallback(SoGLPreRenderCB * func, void * userdata);
00114   void removePreRenderCallback(SoGLPreRenderCB * func, void * userdata);
00115  
00116   void setSortedLayersNumPasses(int num);
00117   int getSortedLayersNumPasses(void) const;
00118 
00119   void setSortedObjectOrderStrategy(const SortedObjectOrderStrategy strategy,
00120                                     SoGLSortedObjectOrderCB * cb = NULL,
00121                                     void * closure = NULL);
00122 
00123   void setDelayedObjDepthWrite(SbBool write);
00124   SbBool getDelayedObjDepthWrite(void) const;
00125 
00126   SbBool isRenderingTranspPaths(void) const;
00127   SbBool isRenderingTranspBackfaces(void) const;
00128 
00129 protected:
00130   friend class SoGLRenderActionP; // calls beginTraversal
00131   virtual void beginTraversal(SoNode * node);
00132   virtual void endTraversal(SoNode * node);
00133 
00134 private:
00135   SbPimplPtr<SoGLRenderActionP> pimpl;
00136 
00137   SoGLRenderAction(const SoGLRenderAction & rhs);
00138   SoGLRenderAction & operator = (const SoGLRenderAction & rhs);
00139 
00140 }; // SoGLRenderAction
00141 
00142 #endif // !COIN_SOGLRENDERACTION_H

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated for Coin by Doxygen 1.7.3.