#ifndef SOGUIVIEWERP_H #define SOGUIVIEWERP_H // @configure_input@ /**************************************************************************\ * * This file is part of the Coin 3D visualization library. * Copyright (C) by Kongsberg Oil & Gas Technologies. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * ("GPL") version 2 as published by the Free Software Foundation. * See the file LICENSE.GPL at the root directory of this source * distribution for additional information about the GNU GPL. * * For using Coin with software that can not be combined with the GNU * GPL, and for taking advantage of the additional benefits of our * support services, please contact Kongsberg Oil & Gas Technologies * about acquiring a Coin Professional Edition License. * * See http://www.coin3d.org/ for more information. * * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY. * http://www.sim.no/ sales@sim.no coin-support@coin3d.org * \**************************************************************************/ #ifndef SO@GUI@_INTERNAL #error this is a private header file #endif /* !SO@GUI@_INTERNAL */ #include #include #ifdef HAVE_CONFIG_H #include #endif // HAVE_CONFIG_H #include #include #include class SoSeparator; class SoCamera; class SoOrthographicCamera; class SoPerspectiveCamera; class SoGetBoundingBoxAction; class SoNode; class SoTimerSensor; class SoDirectionalLight; class SoSwitch; class SoBaseColor; class SoDrawStyle; class SoLightModel; class SoMaterialBinding; class SoPolygonOffset; class SoComplexity; class SoSearchAction; class SoGetMatrixAction; class SoAlarmSensor; class So@Gui@ViewerP { public: So@Gui@ViewerP(So@Gui@Viewer * publ); ~So@Gui@ViewerP(void); SoSeparator * createSuperScene(void); static void convertOrtho2Perspective(const SoOrthographicCamera * in, SoPerspectiveCamera * out); static void convertPerspective2Ortho(const SoPerspectiveCamera * in, SoOrthographicCamera * out); SoCamera * camera; So@Gui@Viewer::Type type; SbBool viewingflag; SbBool altdown; SoGetBoundingBoxAction * autoclipbboxaction; SoSeparator * sceneroot; SoNode * scenegraph; // Seek functionality SoTimerSensor * seeksensor; float seekperiod; SbBool inseekmode; SbBool seektopoint; SbVec3f camerastartposition, cameraendposition; SbRotation camerastartorient, cameraendorient; float seekdistance; SbBool seekdistanceabs; // Home position storage. SoNode * storedcamera; SoDirectionalLight * headlight; // Drawstyles So@Gui@Viewer::DrawStyle drawstyles[2]; SoSwitch * drawstyleroot, * hiddenlineroot, * polygonoffsetparent; SoBaseColor * sobasecolor; SoComplexity * socomplexity; SoDrawStyle * sodrawstyle; SoLightModel * solightmodel; SoMaterialBinding * somaterialbinding; SoSeparator * usersceneroot; SoSwitch * superimpositionroot; #ifdef HAVE_SOPOLYGONOFFSET SoPolygonOffset * sopolygonoffset; #endif // HAVE_SOPOLYGONOFFSET // Automatic setting of clipping planes SbBool adjustclipplanes; // Keep track of the frames-per-second counter. // Const value trick for old compilers. enum Constants { FRAMESARRAY_SIZE = 100 }; SbVec2f frames[FRAMESARRAY_SIZE]; float totalcoin, totaldraw; double lastgettimeofday; int framecount; // Stereo-related SbBool stereoviewing, stereotypesetexplicit; float stereooffset; So@Gui@Viewer::StereoType stereotype; SbBool stereoanaglyphmask[2][3]; SbViewportRegion stereostencilmaskvp; GLubyte * stereostencilmask; enum StencilType { ROWS, COLUMNS, NONE }; So@Gui@Viewer::StereoType stereostenciltype; enum Eye { LEFT, RIGHT, RESTORE }; struct StereoData { SbVec3f camerapos, cameradir, offsetvec, focalpoint; SbRotation camerarot; float offset; SbBool nodenotify, positionnotify, orientationnotify; }; void setStereoEye(SoCamera * camera, const So@Gui@ViewerP::Eye eye, So@Gui@ViewerP::StereoData & storage) const; void initStencilBufferForInterleavedStereo(void); // Misc SoType cameratype; SbBool cursoron, localsetbuffertype; SoCallbackList * interactionstartCallbacks, * interactionendCallbacks; int interactionnesting; So@Gui@Viewer::BufferType buffertype; SbColor wireframeoverlaycolor; void reallyRedraw(const SbBool clearcol, const SbBool clearz = TRUE); // Seek functionality static void seeksensorCB(void * data, SoSensor *); // Drawstyles void changeDrawStyle(So@Gui@Viewer::DrawStyle style); SbBool drawInteractiveAsStill(void) const; SbBool drawAsHiddenLine(void) const; SbBool drawAsWireframeOverlay(void) const; So@Gui@Viewer::DrawStyle currentDrawStyle(void) const; // Automatic setting of clipping planes void setClippingPlanes(void); // Methods to keep track of frames-per-second value. void resetFrameCounter(void); SbVec2f addFrametime(const double ft); void recordFPS(const double rendertime); // Misc static void interactivestartCB(void *, So@Gui@Viewer * thisp); static void interactiveendCB(void *, So@Gui@Viewer * thisp); void moveCameraScreen(const SbVec2f & screenpos); void getCameraCoordinateSystem(SoCamera * camera, SoNode * root, SbMatrix & matrix, SbMatrix & inverse); SoGroup * getParentOfNode(SoNode * root, SoNode * node) const; SoSearchAction * searchaction; SoGetMatrixAction * matrixaction; SbPList * superimpositions; SbGuiList superimpositionsenabled; So@Gui@Viewer * pub; // auto clipping parameters So@Gui@Viewer::AutoClippingStrategy autoclipstrategy; float autoclipvalue; So@Gui@AutoClippingCB * autoclipcb; void * autoclipuserdata; SoAlarmSensor * redrawalarm; }; #endif // SOGUIVIEWERP_H