#ifndef COIN_SORENDERMANAGER_H#define COIN_SORENDERMANAGER_H/**************************************************************************\ * Copyright (c) Kongsberg Oil & Gas Technologies AS * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\**************************************************************************/#include <Inventor/SbColor4f.h>#include <Inventor/SbVec2s.h>#include <Inventor/actions/SoGLRenderAction.h>classSbViewportRegion;classSoEvent;classSoGLRenderAction;classSoAudioRenderAction;classSoNode;classSoCamera;classSoNodeSensor;classSoOneShotSensor;classSoSensor;classSoRenderManagerP;typedefvoidSoRenderManagerRenderCB(void*userdata,classSoRenderManager*mgr);classCOIN_DLL_APISoRenderManager{public:classCOIN_DLL_APISuperimposition{public:enumStateFlags{ZBUFFERON=0x0001,CLEARZBUFFER=0x0002,AUTOREDRAW=0x0004,BACKGROUND=0x0008};Superimposition(SoNode*scene,SbBoolenabled,SoRenderManager*manager,uint32_tflags);~Superimposition();voidrender(SoGLRenderAction*action,SbBoolclearcolorbuffer=FALSE);voidsetEnabled(SbBoolyes);intgetStateFlags(void)const;voidsetTransparencyType(SoGLRenderAction::TransparencyTypetransparencytype);private:staticvoidchangeCB(void*data,SoSensor*sensor);classSuperimpositionP*pimpl;};enumRenderMode{AS_IS,WIREFRAME,POINTS,WIREFRAME_OVERLAY,HIDDEN_LINE,BOUNDING_BOX};enumStereoMode{MONO,ANAGLYPH,SEPARATE_OUTPUT,QUAD_BUFFER=SEPARATE_OUTPUT,INTERLEAVED_ROWS,INTERLEAVED_COLUMNS};enumBufferType{BUFFER_SINGLE,BUFFER_DOUBLE};enumAutoClippingStrategy{NO_AUTO_CLIPPING,FIXED_NEAR_PLANE,VARIABLE_NEAR_PLANE};SoRenderManager(void);virtual~SoRenderManager();virtualvoidrender(constSbBoolclearwindow=TRUE,constSbBoolclearzbuffer=TRUE);virtualvoidrender(SoGLRenderAction*action,constSbBoolinitmatrices=TRUE,constSbBoolclearwindow=TRUE,constSbBoolclearzbuffer=TRUE);Superimposition*addSuperimposition(SoNode*scene,uint32_tflags=Superimposition::AUTOREDRAW|Superimposition::ZBUFFERON|Superimposition::CLEARZBUFFER);voidremoveSuperimposition(Superimposition*s);virtualvoidsetSceneGraph(SoNode*constsceneroot);virtualSoNode*getSceneGraph(void)const;voidsetCamera(SoCamera*camera);SoCamera*getCamera(void)const;voidsetAutoClipping(AutoClippingStrategyautoclipping);AutoClippingStrategygetAutoClipping(void)const;voidsetNearPlaneValue(floatvalue);floatgetNearPlaneValue(void)const;voidsetTexturesEnabled(constSbBoolonoff);SbBoolisTexturesEnabled(void)const;voidsetDoubleBuffer(constSbBoolenable);SbBoolisDoubleBuffer(void)const;voidsetRenderMode(constRenderModemode);RenderModegetRenderMode(void)const;voidsetStereoMode(constStereoModemode);StereoModegetStereoMode(void)const;voidsetStereoOffset(constfloatoffset);floatgetStereoOffset(void)const;voidsetRenderCallback(SoRenderManagerRenderCB*f,void*constuserData=NULL);SbBoolisAutoRedraw(void)const;voidsetRedrawPriority(constuint32_tpriority);uint32_tgetRedrawPriority(void)const;voidscheduleRedraw(void);voidsetWindowSize(constSbVec2s&newsize);constSbVec2s&getWindowSize(void)const;voidsetSize(constSbVec2s&newsize);constSbVec2s&getSize(void)const;voidsetOrigin(constSbVec2s&newOrigin);constSbVec2s&getOrigin(void)const;voidsetViewportRegion(constSbViewportRegion&newRegion);constSbViewportRegion&getViewportRegion(void)const;voidsetBackgroundColor(constSbColor4f&color);constSbColor4f&getBackgroundColor(void)const;voidsetOverlayColor(constSbColor4f&color);SbColor4fgetOverlayColor(void)const;voidsetBackgroundIndex(constintindex);intgetBackgroundIndex(void)const;voidsetRGBMode(constSbBoolonOrOff);SbBoolisRGBMode(void)const;virtualvoidactivate(void);virtualvoiddeactivate(void);voidsetAntialiasing(constSbBoolsmoothing,constintnumPasses);voidgetAntialiasing(SbBool&smoothing,int&numPasses)const;voidsetGLRenderAction(SoGLRenderAction*constaction);SoGLRenderAction*getGLRenderAction(void)const;voidsetAudioRenderAction(SoAudioRenderAction*constaction);SoAudioRenderAction*getAudioRenderAction(void)const;staticvoidenableRealTimeUpdate(constSbBoolflag);staticSbBoolisRealTimeUpdateEnabled(void);staticuint32_tgetDefaultRedrawPriority(void);voidaddPreRenderCallback(SoRenderManagerRenderCB*cb,void*data);voidremovePreRenderCallback(SoRenderManagerRenderCB*cb,void*data);voidaddPostRenderCallback(SoRenderManagerRenderCB*cb,void*data);voidremovePostRenderCallback(SoRenderManagerRenderCB*cb,void*data);voidreinitialize(void);protected:intisActive(void)const;voidredraw(void);voidrenderScene(SoGLRenderAction*action,SoNode*scene,uint32_tclearmask);voidactuallyRender(SoGLRenderAction*action,constSbBoolinitmatrices=TRUE,constSbBoolclearwindow=TRUE,constSbBoolclearzbuffer=TRUE);voidrenderSingle(SoGLRenderAction*action,SbBoolinitmatrices,SbBoolclearwindow,SbBoolclearzbuffer);voidrenderStereo(SoGLRenderAction*action,SbBoolinitmatrices,SbBoolclearwindow,SbBoolclearzbuffer);voidinitStencilBufferForInterleavedStereo(void);voidclearBuffers(SbBoolcolor,SbBooldepth);private:voidattachRootSensor(SoNode*constsceneroot);voidattachClipSensor(SoNode*constsceneroot);voiddetachRootSensor(void);voiddetachClipSensor(void);staticvoidnodesensorCB(void*data,SoSensor*);staticvoidprerendercb(void*userdata,SoGLRenderAction*action);SoRenderManagerP*pimpl;friendclassSoRenderManagerP;friendclassSoSceneManager;friendclassSuperimposition;};// SoRenderManager#endif // !COIN_SORENDERMANAGER_H