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 PerspectiveCameraPtr getCamera ( void );
00111
00113
00117 virtual void setAction ( RenderAction *action );
00118 virtual void setRoot ( NodePtr root );
00119 virtual void setWindow ( WindowPtr win );
00120 virtual void setHighlight ( NodePtr obj );
00121 virtual void setHeadlight ( bool on );
00122 virtual void turnHeadlightOn ( void );
00123 virtual void turnHeadlightOff ( void );
00124
00125 virtual void showAll ( void );
00126
00127 virtual void useOpenSGLogo ( void );
00128
00129 void setNavigationMode( Navigator::Mode new_mode );
00130 inline bool setClickCenter ( bool mode );
00131
00132 virtual void setStatistics ( bool on );
00133
00135
00139 virtual void resize(UInt16 width, UInt16 height);
00140 virtual void mouseMove(Int16 x, Int16 y);
00141 virtual void mouseButtonPress(UInt16 button, Int16 x, Int16 y);
00142 virtual void mouseButtonRelease(UInt16 button, Int16 x, Int16 y);
00143 virtual void key(UChar8 key, Int16 x, Int16 y);
00144
00145 Line calcViewRay(Int16 x, Int16 y);
00146
00148
00152 virtual void redraw( void );
00153 virtual void idle( void );
00154
00156
00160 bool operator < (const SimpleSceneManager &other) const;
00161
00162
00163
00164
00166
00167 protected:
00168
00169
00173 void initialize (void);
00174 virtual void highlightChanged(void);
00175 virtual void updateHighlight (void);
00176
00178
00182 WindowPtr _win;
00183 NodePtr _root;
00184
00185 ImageForegroundPtr _foreground;
00186 StatisticsForegroundPtr _statforeground;
00187 bool _statstate;
00188
00189 NodePtr _highlight;
00190 NodePtr _highlightNode;
00191 GeoPositions3fPtr _highlightPoints;
00192
00193 NodePtr _internalRoot;
00194 DirectionalLightPtr _headlight;
00195 RenderAction * _action;
00196 RenderAction * _ownAction;
00197 TransformPtr _cart;
00198 PerspectiveCameraPtr _camera;
00199
00200 Navigator _navigator;
00201
00202 Int16 _lastx;
00203 Int16 _lasty;
00204 UInt16 _mousebuttons;
00205
00206 static SimpleMaterialPtr _highlightMaterial;
00207
00209
00210 private:
00211
00212
00213
00214 SimpleSceneManager(const SimpleSceneManager &source);
00215 void operator =(const SimpleSceneManager &source);
00216 };
00217
00218
00219
00220
00221
00222
00223
00224 typedef SimpleSceneManager *SimpleSceneManagerP;
00225
00226 OSG_END_NAMESPACE
00227
00228 #include "OSGSimpleSceneManager.inl"
00229
00230 #define OSGSIMPLESCENEMANAGER_HEADER_CVSID "@(#)$Id: OSGSimpleSceneManager.h,v 1.11 2001/11/19 18:40:50 dirk Exp $"
00231
00232 #endif