00001 /*
00002 File: ScenePane.h
00003
00004 Function: 'ScenePane' provides a pane which you can attach a scene
00005 to. The pane then lets the user manipulate the view of the
00006 scene.
00007
00008 Author(s): Andrew Willmott
00009
00010 Copyright: (c) 1995-2000, Andrew Willmott
00011 */
00012
00013 #ifndef __ScenePane__
00014 #define __ScenePane__
00015
00016 #include "gcl/GLXPane.h"
00017 #include "gcl/SceneObjects.h"
00018 #include "gcl/MRModel.h"
00019
00020 class scFrame;
00021
00022 class ScenePane : public GLXPane
00023 {
00024 public:
00025 ScenePane(Bool doubleBuf = true);
00026
00027 virtual Void SetScene(scScenePtr scene);
00028
00029 virtual Void Redraw();
00030 // Force redraw of scene.
00031 Void ViewFrom(Point &position, Vector &normal);
00032 // Change viewing point
00033 Void Restore();
00034
00035 virtual Void StartDrag(Coord start, Int modifiers);
00036 virtual Void Drag(Coord current, Int modifiers);
00037 // Mouse is being dragged from start, currently at current.
00038 virtual Void EndDrag(Coord end, Int modifiers);
00039 // Mouse was dragged from start to end.
00040
00041 Void ComplexityDrag();
00042 Void SceneRotDrag();
00043 Void SceneTransDrag();
00044
00045 Void HandleKey(Char c);
00046 Void HandleExpose();
00047 Void TrackMouse(Int x, Int y, Int modifiers);
00048
00049 Void SetGrid(Bool on);
00050 Void SetAxes(Bool on);
00051
00052 Camera* ItsCamera() { return(itsCamera); };
00053 scScenePtr ItsScene() { return(itsScene); };
00054
00055 Void SetCameraParams();
00056
00057 MRModelsFinder models;
00058
00059 protected:
00060 Coord dragStart;
00061 Int modifiersStart;
00062 Coord offset;
00063 GCLReal baseErr;
00064
00065 Coord rot;
00066 Vector trans;
00067 GCLReal zoom;
00068
00069 Coord tRot;
00070 Vector tTrans;
00071 GCLReal tZoom;
00072
00073 Bool wire;
00074 scScenePtr itsScene;
00075 scFrame *frame;
00076 scCamera *itsCamera;
00077 Bool gridShown;
00078 Bool axesShown;
00079 };
00080
00081 class ScenePane2D : public ScenePane
00082 {
00083 public:
00084 Void SetScene(scScenePtr scene);
00085 Void Drag(Coord current, Int modifiers);
00086 };
00087
00088 #endif