Katana Plug-in APIs 0.1

FnGLScalePlaneHandle.h

00001 // Copyright (c) 2017 The Foundry Visionmongers Ltd. All Rights Reserved.
00002 
00003 #ifndef GLSCALEPLANEHANDLE_H_
00004 #define GLSCALEPLANEHANDLE_H_
00005 
00006 #include "FnGLTransformManipulator.h"
00007 
00008 #include <string>
00009 
00010 #include <FnViewer/plugin/FnManipulatorHandle.h>
00011 #include <FnViewer/plugin/FnMathTypes.h>
00012 #include <FnViewer/utils/FnDrawable.h>
00013 
00021 class GLScalePlaneHandle :
00022         public Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle
00023 {
00024 public:
00028     GLScalePlaneHandle();
00029 
00033     virtual ~GLScalePlaneHandle();
00034 
00038     static Foundry::Katana::ViewerAPI::ManipulatorHandle* create()
00039     {
00040         return new GLScalePlaneHandle();
00041     }
00042 
00046     static void flush(){}
00047 
00051     void draw();
00052 
00058     void pickerDraw(int64_t pickerId);
00059 
00063     void setup(const IMATH_NAMESPACE::V3d& normal);
00064 
00068     virtual FnKat::ViewerUtils::Orientation getOrientation()
00069     {
00070         return FnKat::ViewerUtils::OBJECT;
00071     }
00072 
00073 protected:
00077     virtual std::string getComponentName() { return "scale"; }
00078 
00084     bool getDraggingPlane(
00085         Foundry::Katana::ViewerAPI::Vec3d& origin,
00086         Foundry::Katana::ViewerAPI::Vec3d& normal);
00087 
00093     void drag(const Foundry::Katana::ViewerAPI::Vec3d& initialPointOnPlane,
00094               const Foundry::Katana::ViewerAPI::Vec3d& previousPointOnPlane,
00095               const Foundry::Katana::ViewerAPI::Vec3d& currentPointOnPlane,
00096               const Foundry::Katana::ViewerAPI::Vec2i& initialMousePosition,
00097               const Foundry::Katana::ViewerAPI::Vec2i& previousMousePosition,
00098               const Foundry::Katana::ViewerAPI::Vec2i& currentMousePosition,
00099               bool isFinal);
00100 
00104     void applyXformToLocation(const std::string& locationPath,
00105                               const IMATH_NAMESPACE::M44d& xform,
00106                               bool isFinal);
00107 
00108 private:
00112     void initMesh();
00113 
00117     Foundry::Katana::ViewerUtils::Drawable m_mesh;
00118     IMATH_NAMESPACE::M44d m_meshXform;
00119 
00120     IMATH_NAMESPACE::V3d m_normal;
00121 
00122     Foundry::Katana::ViewerAPI::Vec4f m_color;
00123 
00124     Foundry::Katana::ViewerAPI::Vec3d m_originWorldSpace;
00125     Foundry::Katana::ViewerAPI::Vec3d m_normalWorldSpace;
00126 
00127     bool m_isDragInProgress;
00128 };
00129 
00130 #endif  // GLSCALEPLANEHANDLE_H_
 All Classes Functions Variables Typedefs Enumerations Enumerator