00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef COIN_SOGLRENDERACTION_H
00021 #define COIN_SOGLRENDERACTION_H
00022
00023 #include <Inventor/actions/SoAction.h>
00024 #include <Inventor/actions/SoSubAction.h>
00025 #include <Inventor/SbBasic.h>
00026 #include <Inventor/SbViewportRegion.h>
00027 #include <Inventor/system/inttypes.h>
00028 #include <Inventor/lists/SoPathList.h>
00029 #include <Inventor/lists/SbList.h>
00030
00031 typedef void SoGLRenderPassCB(void * userdata);
00032 typedef void SoGLPreRenderCB(void * userdata, class SoGLRenderAction * action);
00033
00034 class COIN_DLL_API SoGLRenderAction : public SoAction {
00035 typedef SoAction inherited;
00036
00037 SO_ACTION_HEADER(SoGLRenderAction);
00038
00039 public:
00040 SoGLRenderAction(const SbViewportRegion & viewportregion);
00041 virtual ~SoGLRenderAction();
00042
00043 static void initClass(void);
00044
00045 enum TransparencyType {
00046 SCREEN_DOOR,
00047 ADD, DELAYED_ADD, SORTED_OBJECT_ADD,
00048 BLEND, DELAYED_BLEND, SORTED_OBJECT_BLEND,
00049
00050 SORTED_OBJECT_SORTED_TRIANGLE_ADD,
00051 SORTED_OBJECT_SORTED_TRIANGLE_BLEND
00052 };
00053
00054 enum AbortCode {
00055 CONTINUE, ABORT, PRUNE, DELAY
00056 };
00057
00058 typedef AbortCode SoGLRenderAbortCB(void * userdata);
00059
00060 void setViewportRegion(const SbViewportRegion & newregion);
00061 const SbViewportRegion & getViewportRegion(void) const;
00062 void setUpdateArea(const SbVec2f & origin, const SbVec2f & size);
00063 void getUpdateArea(SbVec2f & origin, SbVec2f & size) const;
00064 void setAbortCallback(SoGLRenderAbortCB * const func, void * const userdata);
00065 void setTransparencyType(const TransparencyType type);
00066 TransparencyType getTransparencyType(void) const;
00067 void setSmoothing(const SbBool smooth);
00068 SbBool isSmoothing(void) const;
00069 void setNumPasses(const int num);
00070 int getNumPasses(void) const;
00071 void setPassUpdate(const SbBool flag);
00072 SbBool isPassUpdate(void) const;
00073 void setPassCallback(SoGLRenderPassCB * const func, void * const userdata);
00074 void setCacheContext(const uint32_t context);
00075 uint32_t getCacheContext(void) const;
00076
00077 void addDelayedPath(SoPath * path);
00078 SbBool isRenderingDelayedPaths(void) const;
00079
00080 SbBool handleTransparency(SbBool istransparent = FALSE);
00081 int getCurPass(void) const;
00082 SbBool abortNow(void);
00083
00084 void setRenderingIsRemote(SbBool isremote);
00085 SbBool getRenderingIsRemote(void) const;
00086
00087 virtual void invalidateState(void);
00088
00089 void addPreRenderCallback(SoGLPreRenderCB * func, void * userdata);
00090 void removePreRenderCallback(SoGLPreRenderCB * func, void * userdata);
00091
00092 protected:
00093 virtual void beginTraversal(SoNode * node);
00094 virtual void endTraversal(SoNode * node);
00095
00096 private:
00097 void addTransPath(SoPath * path);
00098 void doPathSort(void);
00099
00100 class SoGLRenderActionP * pimpl;
00101 friend class SoGLRenderActionP;
00102 };
00103
00104 #endif // !COIN_SOGLRENDERACTION_H