fshake3d  0.0.1
FreeformDensity3DSurfaceEditor
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
scene_Slider.hpp
Go to the documentation of this file.
00001 #ifndef SCENE_SLIDER_HPP
00002 #define SCENE_SLIDER_HPP
00003 
00004 #include "math.hpp"
00005 #include <boost/function.hpp>
00006 // #include "ui_SceneView.hpp"
00007 #include "scene.hpp"
00008 
00009 enum Axis
00010 {
00011   AXIS_X, AXIS_Y, AXIS_Z
00012 };
00013 
00014 enum AbsMode
00015 {
00016   ABSMODE_POSITIVE, ABSMODE_MIRROR
00017 };
00018 
00019 enum KnobType
00020 {
00021   KNOB_TRANSLATE
00022 , KNOB_STRETCH
00023 };
00024 
00025 class Slider : public Control3D
00026 {
00027 public:
00028   Slider();
00029   void setBorder(double border);
00030   void setAxis(int axis) { mAxis = axis; }
00031   void setUpAxis(int axis) { mUpAxis = axis; }
00032   void setEnabled(bool e) { mEnabled = e; }
00033   void setMinValue(double min) { mMin = min; }
00034   void setMaxValue(double max) { mMax = max; }
00035   void setColor(Vec4d c) { mColor = c; }
00036   void setBGColor(Vec4d bg) { mBGColor = bg; }
00037   void setAbsMode(AbsMode absmode) { mAbsMode = absmode; }
00038   void setKnobType(KnobType kt) { mKnobType = kt; }
00039   void setSlotValueChange(boost::function1<void,double> f) { mSlotValueChange = f; }
00040 
00041   void setPosition(const Point3d& p);
00042 
00043   bool hit(const Rayd& ray, double& t);
00044 
00045   bool select(const Rayd& r, SceneView& view);
00046   bool drag(const Rayd& r, SceneView& view);
00047 
00048   void setValue(double v);
00049 
00050   void display();
00051 private:
00052   void updateSensorVolume();
00053   bool    mEnabled;
00054   bool    mDrag;
00055   int     mAxis;
00056   int     mUpAxis;
00057   AbsMode mAbsMode;
00058   double  mBorder;
00059   double  mMin;
00060   double  mMax;
00061   double  mValue;
00062   Vec4d   mColor;
00063   Vec4d   mBGColor;
00064   AABoxd  mAABoxControl;
00065   int     mKnobType;
00066   Planed  mDragPlane;
00067   Point3d mPosition;
00068   boost::function1<void,double> mSlotValueChange;
00069 };
00070 
00071 #endif // SCENE_SLIDER_HPP