Go to the documentation of this file.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 #ifndef FlatManipulator_INCLUDE_ONCE
00033 #define FlatManipulator_INCLUDE_ONCE
00034
00035 #include <vlCore/Vector3.hpp>
00036 #include <vlCore/Vector4.hpp>
00037 #include <vlGraphics/UIEventListener.hpp>
00038 #include <vlGraphics/Camera.hpp>
00039 #include <vlGraphics/Geometry.hpp>
00040
00041 namespace vl
00042 {
00043
00044
00045
00046
00055 class FlatManipulator: public UIEventListener
00056 {
00057 public:
00058 typedef enum { NoMode, TranslationMode, ZoomMode } EManipMode;
00059
00060 public:
00061 virtual const char* className() { return "vl::FlatManipulator"; }
00062
00064 FlatManipulator();
00065
00066
00067
00068 virtual void mouseDownEvent(EMouseButton, int x, int y);
00069
00070 virtual void mouseUpEvent(EMouseButton, int x, int y);
00071
00072 virtual void mouseMoveEvent(int x, int y);
00073
00074 virtual void enableEvent(bool enabled);
00075
00076 virtual void initEvent() {}
00077
00078 virtual void destroyEvent() {}
00079
00080 virtual void updateEvent() {}
00081
00082 virtual void addedListenerEvent(OpenGLContext*) {}
00083
00084 virtual void removedListenerEvent(OpenGLContext*) {}
00085
00086 virtual void mouseWheelEvent(int) {}
00087
00088 virtual void keyPressEvent(unsigned short, EKey) {}
00089
00090 virtual void keyReleaseEvent(unsigned short, EKey) {}
00091
00092 virtual void resizeEvent(int, int) {}
00093
00094 virtual void fileDroppedEvent(const std::vector<String>&) {}
00095
00096 virtual void visibilityEvent(bool) {}
00097
00098
00099
00101 void setCamera(Camera* camera);
00102
00104 Camera* camera() { return mCamera.get(); }
00105
00107 int zoomButton() const { return mZoomButton; }
00108
00110 void setZoomButton(int mouse_button) { mZoomButton = mouse_button; }
00111
00113 int translationButton() const { return mTranslationButton; }
00114
00116 void setTranslationButton(int mouse_button) { mTranslationButton = mouse_button; }
00117
00119 float zoomSpeed() const { return mZoomSpeed; }
00120
00122 void setZoomSpeed(float speed) { mZoomSpeed = speed; }
00123
00125 EManipMode mode() const { return mMode; }
00126
00127 protected:
00128
00129 bool mouseInViewport(int mx, int my, int& vx, int& vy);
00130
00131 protected:
00132 ref<Camera> mCamera;
00133 vec2 mMouseStart;
00134 vec2 mPixelSize;
00135 EManipMode mMode;
00136 int mTranslationButton;
00137 int mZoomButton;
00138 float mZoomSpeed;
00139 };
00140
00142
00154 vl::ref<vl::Geometry> makeScales(bool X = true,
00155 bool Y = true,
00156 bool Z = true,
00157 int numArmTicks = 50,
00158 float mmStep = 10,
00159 float mmTickSize = 4,
00160 vl::fvec4 color = vl::fvec4(1,1,1,1));
00161 }
00162
00163 #endif // FlatManipulator_INCLUDE_ONCE