TuttleOFX  1
ColorCubeViewerOverlay.hpp
Go to the documentation of this file.
00001 #ifndef _TUTTLE_PLUGIN_COLOR_CUBE_VIEWER_OVERLAY_HPP
00002 #define _TUTTLE_PLUGIN_COLOR_CUBE_VIEWER_OVERLAY_HPP
00003 
00004 #include "ColorCubeViewerPlugin.hpp"
00005 #include "SelectionAverage.hpp"
00006 #include "GeodesicForm.hpp"
00007 #include "MatrixManipulation.hpp"
00008 
00009 #include <tuttle/plugin/global.hpp>
00010 #include <tuttle/plugin/interact/interact.hpp>
00011 #include <tuttle/plugin/interact/InteractInfos.hpp>
00012 
00013 #include <ofxsImageEffect.h>
00014 #include <ofxsInteract.h>
00015 
00016 namespace tuttle {
00017 namespace plugin {
00018 namespace colorCubeViewer {
00019         
00020 class ColorCubeViewerOverlay:public OFX::OverlayInteract
00021 {
00022 public:
00023         /*Class arguments*/
00024         ColorCubeViewerPlugin* _plugin;                         //plugin reference
00025         interact::InteractInfos _infos;                         
00026         
00027         OfxPointI _origin;                                                      //origin (point of pen down)
00028         OfxPointI _end;                                                         //end (point of pen up)
00029         
00030         bool _isPenDown;                                                        //mouse management (is mouse clicked)
00031         bool _isCtrlKeyDown;                                            //keyboard management (s Ctrl key pressed)
00032         
00033         double _rotateX;                                                        //rotation on X axis (mouse)
00034         double _rotateY;                                                        //rotation on Y axis (mouse)
00035         double _rotateXForm;                                            //rotation on X (center is geodesic form)
00036         double _rotateYForm;                                            //rotation on Y (center is geodesic form)
00037         
00038         Matrix4 _modelViewMatrix;                                       //Model matrix used to do transformations
00039         
00040 public:
00041         /*Constructor/Destructor*/
00042         ColorCubeViewerOverlay(OfxInteractHandle handle,OFX::ImageEffect* effect);
00043         virtual ~ColorCubeViewerOverlay();
00044         
00045         
00046         bool draw( const OFX::DrawArgs& args ); //draw all of the component (main display)
00047                 
00048         /*Mouse management*/
00049         bool penDown( const OFX::PenArgs& args );       //mouse/pen is clicking down
00050         bool penUp( const OFX::PenArgs& args );         //mouse/pen is releasing
00051         bool penMotion( const OFX::PenArgs& args );     //mouse/pen is under motion
00052         
00053         /*Keyboard management*/
00054         bool keyDown( const OFX::KeyArgs& args );       //Ctrl key is pressing down
00055         bool keyUp( const OFX::KeyArgs& args );         //Ctrl key is releasing 
00056 
00057 private:        
00058         /*OpenGL scene*/
00059         void prepareOpenGLScene(const OFX::DrawArgs& args);                                                     //prepare the frustrum and projection settings and initialize first VBO
00060         void drawAxes();                                                                                                                        //draw X, Y and Z axes on screen
00061         void updateModelView(const Ofx3DPointD& rotationCenter);                                        //update modelView with (by adding a new transformation)
00062         void drawWarning(const Ofx3DPointD& centerPoint, const double ratio);           //draw a warning sign on the openGL scene
00063         
00064         /*Get overlay data*/
00065         CloudPointData& getData();
00066 };
00067 
00068 class ColorCubeViewerOverlayDescriptor : public OFX::EffectOverlayDescriptor
00069 {
00070 public:
00071         OFX::Interact* createInstance( OfxInteractHandle handle, OFX::ImageEffect* effect )
00072         {
00073                 return new ColorCubeViewerOverlay( handle, effect );
00074         }
00075 };
00076 
00077 }
00078 }
00079 }
00080 
00081 #endif
00082