fshake3d  0.0.1
FreeformDensity3DSurfaceEditor
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
ui_SceneView.hpp
Go to the documentation of this file.
00001 #ifndef UI_SCENE_VIEW_HPP
00002 #define UI_SCENE_VIEW_HPP
00003 
00004 #include "ui_View.hpp"
00005 
00006 #include "ui_SceneRuler.hpp"
00007 #include "transform_Projection.hpp"
00008 #include "transform_LookAt.hpp"
00009 // #include "Scene.hpp"
00010 class Scene; // TODO: instead, include "Scene.hpp"
00011 
00012 class SceneView : public View
00013 {
00014 public:
00015   SceneView(ProjectionType pt);
00016 
00017   // properties:
00018 
00019   void          setScene(Scene* pScene) { mpScene = pScene; }
00020   void          setDirection(const Vec3d& direction);
00021   void          setUp(const Vec3d& up);
00022   void          setCenter(const Vec3d& center);
00023   const LookAt& getLookAt() const { return mLookAt; }
00024   LookAt&       getLookAt()       { return mLookAt; }
00025   
00026   Projection&   getProjection()   { return mProjection; }
00027 
00028   virtual void  setProjectionViewSize(const Vec2d& size);
00029 
00030 
00031   // View overloads:
00032 
00033   virtual void setViewport(const Vec4i& vp);
00034 
00035   // Display:
00036 
00037   virtual void display();
00038 
00039   // Transformation services:
00040 
00041   Point3d unprojectPoint(const Point3d& p);
00042   Rayd    makeRay(int x, int y);
00043   Rayd    makeRay(Point2i sp);
00044 
00045   void setProjectionViewWidth(double w); 
00046   void setProjectionViewHeight(double h); 
00047 
00048   // --- user-input ----------------------------------------------------------
00049 
00050   virtual void mouse(int button, int state, int x, int y);
00051   virtual void motion(int x, int y);
00052   virtual void dragBegin() = 0;
00053   virtual void dragUpdate(const Vec2i& d) = 0;
00054   virtual void dragEnd() { }
00055 
00056   void setFocusPointVar(Point3d* focusPoint) { mpFocusPoint = focusPoint; }
00057   void setZoomVar(double* pscalar) { mpZoom = pscalar; }
00058   void setCameraOffset(const Vec3d& offset) { mCameraOffset = offset; }
00059 protected:
00060   double getZoom() { return *mpZoom; }
00061   void   updateEye();
00062   void   setupLights();
00063 
00064   Scene* mpScene;
00065   int mDragButton;
00066   Projection mProjection;
00067   LookAt mLookAt;
00068   Vec2i mDragBase;
00069   Vec3d mCenterBase;
00070   Vec3d mDirection;
00071   Point3d* mpFocusPoint;
00072   double* mpZoom;
00073   Vec3d  mCameraOffset;
00074 
00075 // --- future ----------------------------------------------------------------
00076 public:
00077   virtual void onEvent(Event& e);
00078   void captureRayMotion(EventTarget* pTarget);
00079   void releaseRayMotion();
00080 protected:
00081   EventTarget* mpCaptureRayMotionTarget;
00082 
00083 
00084 };
00085 
00086 #endif // UI_SCENE_VIEW_HPP