Show
Ignore:
Timestamp:
11/26/07 22:53:32 (1 year ago)
Author:
vossg
Message:

changed: more flexible navigators, allow user navigator (thanks to M. Spindler for the code)

: add _d when pulling windows dlls

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Source/System/Window/Utilities/OSGTrackballEngine.h

    r785 r1021  
    3737\*---------------------------------------------------------------------------*/ 
    3838 
    39 #ifndef _OSG_TRACKBALLNAVIGATOR_H_ 
    40 #define _OSG_TRACKBALLNAVIGATOR_H_ 
     39#ifndef _OSG_TRACKBALLENGINE_H_ 
     40#define _OSG_TRACKBALLENGINE_H_ 
    4141 
    42 #include "OSGConfig.h" 
    43 #include "OSGUtilDef.h" 
    44  
    45 #include "OSGVector.h" 
    46 #include "OSGQuaternion.h" 
    47 #include "OSGViewport.h" 
     42#include "OSGNavigatorEngine.h" 
    4843 
    4944OSG_BEGIN_NAMESPACE 
    5045 
    51 /*! \brief Navigator for trackball model. See \ref  
    52     PageSystemWindowNavigatorsTrackball for a description. 
     46/*! \brief TrackballEngine provides the trackball navigator functionality. 
    5347*/ 
    54 class OSG_UTIL_DLLMAPPING TrackballNavigator 
     48class OSG_UTIL_DLLMAPPING TrackballEngine : public NavigatorEngine 
    5549{ 
     50    typedef NavigatorEngine Inherited; 
     51 
    5652    /*==========================  PUBLIC  =================================*/ 
    5753  public: 
    5854 
    59     enum State 
    60     { 
    61         IDLE=0, 
    62         ROTATING, 
    63         TRANSLATING_XY, 
    64         TRANSLATING_Z 
    65     }; 
    6655 
    6756 
     
    7059    /*! \{                                                                 */ 
    7160 
    72     TrackballNavigator(Real32 rSize=0.8); 
     61    TrackballEngine(Real32 rSize=0.8); 
    7362 
    7463    /*! \}                                                                 */ 
     
    7766    /*! \{                                                                 */ 
    7867 
    79     ~TrackballNavigator(); 
     68    ~TrackballEngine(); 
    8069 
    8170    /*! \}                                                                 */ 
     
    8473    /*! \{                                                                 */ 
    8574 
    86     const char *getClassname(void) { return "TrackballNavigator"; } 
     75    const char *getClassname(void) { return "TrackballEngine"; } 
    8776 
    8877    /*! \}                                                                 */ 
     
    9180    /*! \{                                                                 */ 
    9281 
    93     Matrix &getMatrix(); 
    94     Pnt3f  &getFrom(); 
    95     Pnt3f  &getAt(); 
    96     Vec3f  &getUp(); 
    97     Real32  getDistance(); 
     82    virtual const Pnt3f  &getFrom(void); 
     83    virtual const Pnt3f  &getAt(void); 
     84    virtual const Vec3f  &getUp(void); 
     85    virtual const Matrix &getMatrix(void); 
     86    virtual Real32 getDistance(void); 
    9887 
    9988    /*! \}                                                                 */ 
     
    10291    /*! \{                                                                 */ 
    10392 
    104     void setAt       (Pnt3f  new_at); 
    105     void setFrom     (Pnt3f  new_from); 
    106     void setDistance (Real32 new_distance); 
    107     void setUp       (Vec3f  new_up); 
    108     void set         (Pnt3f  new_from, Pnt3f new_center, Vec3f new_up); 
    109     void set         (Matrix new_matrix); 
     93    virtual void setFrom(Pnt3f new_from); 
     94    virtual void setAt(Pnt3f new_at); 
     95    virtual void setUp(Vec3f new_up); 
     96    virtual void set(Pnt3f new_from, Pnt3f new_at, Vec3f new_up); 
     97    virtual void set(const Matrix & new_matrix); 
     98    virtual void setDistance(Real32 new_distance); 
     99 
     100    /*! \}                                                                 */ 
     101    /*---------------------------------------------------------------------*/ 
     102    /*! \name             navigator engine callbacks                       */ 
     103    /*! \{                                                                 */ 
     104 
     105    virtual void buttonPress(Int16 button,   Int16 x, Int16 y, Navigator* nav); 
     106    virtual void buttonRelease(Int16 button, Int16 x, Int16 y, Navigator* nav); 
     107    virtual void keyPress(Int16 key,         Int16 x, Int16 y, Navigator* nav); 
     108    virtual void moveTo(                     Int16 x, Int16 y, Navigator* nav); 
     109    virtual void idle(Int16 buttons,         Int16 x, Int16 y, Navigator* nav); 
     110 
     111    virtual void onViewportChanged(ViewportPtr new_viewport); 
    110112 
    111113    /*! \}                                                                 */ 
     
    119121    void translateZ (Real32 distance); 
    120122 
     123 
    121124    /*! \}                                                                 */ 
    122     /*==========================  PRIVATE  ================================*/ 
    123   private
     125    /*==========================  PROTECTED  ==============================*/ 
     126  protected
    124127     
    125128    /*---------------------------------------------------------------------*/ 
     
    127130    /*! \{                                                                 */ 
    128131 
    129     Real32 _rRadius, _rDistance; 
    130     Matrix _tMatrix, _finalMatrix; 
    131     State  _currentState; 
    132     Pnt3f  _pFrom, _pAt; 
     132    Real32 _rRadius; 
     133    Real32 _rDistance; 
     134    Matrix _tMatrix; 
     135    Matrix _finalMatrix; 
     136    Pnt3f  _pFrom; 
     137    Pnt3f  _pAt; 
    133138    Vec3f  _vUp; 
     139 
     140    /* temporary values */ 
     141    Pnt3f  _ip; 
     142    Vec3f  _dir; 
    134143 
    135144    /*! \}                                                                 */ 
     
    138147 
    139148    Real32 projectToSphere(Real32 rRadius, Real32 rX, Real32 rY); 
     149    void getIntersectionPoint(Int16 x, Int16 y, Navigator* nav); 
     150    void calcDeltas(Int16 , Int16 , Int16 toX, Int16 toY, 
     151                    Real32 &distanceX, Real32 &distanceY, Navigator* nav); 
     152 
     153 
     154  private: 
     155    /* Not implemented */ 
     156    TrackballEngine(const TrackballEngine &other); 
     157    TrackballEngine &operator =(const TrackballEngine &other); 
    140158}; 
    141159