00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef _OSGSIMPLESCENEMANAGER_H_
00040 #define _OSGSIMPLESCENEMANAGER_H_
00041 #ifdef __sgi
00042 #pragma once
00043 #endif
00044
00045 #include <OSGBaseTypes.h>
00046 #include <OSGWindow.h>
00047
00048 #include <OSGDrawAction.h>
00049 #include <OSGRenderAction.h>
00050 #include <OSGNode.h>
00051 #include <OSGWindow.h>
00052 #include <OSGImageForeground.h>
00053 #include <OSGTransform.h>
00054 #include <OSGGeometry.h>
00055 #include <OSGGeoPropPtrs.h>
00056 #include <OSGSimpleMaterial.h>
00057 #include <OSGPerspectiveCamera.h>
00058 #include <OSGDirectionalLight.h>
00059 #include <OSGNavigator.h>
00060 #include <OSGStatisticsForeground.h>
00061
00062 OSG_BEGIN_NAMESPACE
00063
00068 class OSG_SYSTEMLIB_DLLMAPPING SimpleSceneManager
00069 {
00070
00071 public:
00072
00076 enum { MouseLeft = 0,
00077 MouseMiddle = 1,
00078 MouseRight = 2,
00079 MouseUp = 3,
00080 MouseDown = 4,
00081 NoButton = -1
00082 };
00083
00085
00089 SimpleSceneManager(void);
00090 SimpleSceneManager *create( void );
00091
00093
00097 virtual ~SimpleSceneManager(void);
00098
00100
00104 virtual NodePtr getRoot ( void );
00105 virtual WindowPtr getWindow ( void );
00106 virtual NodePtr getHighlight ( void );
00107 virtual DrawActionBase *getAction ( void );
00108 virtual Navigator *getNavigator ( void );
00109 virtual bool getHeadlightState ( void );
00110 virtual DirectionalLightPtr getHeadlight ( void );
00111 virtual PerspectiveCameraPtr getCamera ( void );
00112
00114
00118 virtual void setAction ( RenderAction *action );
00119 virtual void setRoot ( NodePtr root );
00120 virtual void setWindow ( WindowPtr win );
00121 virtual void setHighlight ( NodePtr obj );
00122 virtual void setHeadlight ( bool on );
00123 virtual void turnHeadlightOn ( void );
00124 virtual void turnHeadlightOff ( void );
00125 virtual void setCamera ( PerspectiveCameraPtr camera );
00126
00127 virtual void showAll ( void );
00128
00129 virtual void useOpenSGLogo ( void );
00130
00131 void setNavigationMode( Navigator::Mode new_mode );
00132 inline bool setClickCenter ( bool mode );
00133
00134 virtual void setStatistics ( bool on );
00135
00137
00141 virtual void resize(UInt16 width, UInt16 height);
00142 virtual void mouseMove(Int16 x, Int16 y);
00143 virtual void mouseButtonPress(UInt16 button, Int16 x, Int16 y);
00144 virtual void mouseButtonRelease(UInt16 button, Int16 x, Int16 y);
00145 virtual void key(UChar8 key, Int16 x, Int16 y);
00146
00147 Line calcViewRay(Int16 x, Int16 y);
00148
00150
00154 virtual void redraw( void );
00155 virtual void idle( void );
00156
00158
00162 bool operator < (const SimpleSceneManager &other) const;
00163
00164
00165
00166
00168
00169 protected:
00170
00171
00175 void initialize (void);
00176 virtual void highlightChanged(void);
00177 virtual void updateHighlight (void);
00178
00180
00184 WindowPtr _win;
00185 NodePtr _root;
00186
00187 ImageForegroundPtr _foreground;
00188 StatisticsForegroundPtr _statforeground;
00189 bool _statstate;
00190
00191 NodeRefPtr _highlight;
00192 NodePtr _highlightNode;
00193 GeoPositions3fPtr _highlightPoints;
00194
00195 NodePtr _internalRoot;
00196 DirectionalLightPtr _headlight;
00197 RenderAction * _action;
00198 RenderAction * _ownAction;
00199 TransformPtr _cart;
00200 PerspectiveCameraPtr _camera;
00201
00202 Navigator _navigator;
00203
00204 Int16 _lastx;
00205 Int16 _lasty;
00206 UInt16 _mousebuttons;
00207
00208 static SimpleMaterialPtr _highlightMaterial;
00209
00211
00212 private:
00213
00214
00215
00216 SimpleSceneManager(const SimpleSceneManager &source);
00217 void operator =(const SimpleSceneManager &source);
00218 };
00219
00220
00221
00222
00223
00224
00225
00226 typedef SimpleSceneManager *SimpleSceneManagerP;
00227
00228 OSG_END_NAMESPACE
00229
00230 #include "OSGSimpleSceneManager.inl"
00231
00232 #define OSGSIMPLESCENEMANAGER_HEADER_CVSID "@(#)$Id: OSGSimpleSceneManager.h,v 1.11 2001/11/19 18:40:50 dirk Exp $"
00233
00234 #endif