|
Katana Plug-in APIs 0.1
|
00001 // Copyright (c) 2017 The Foundry Visionmongers Ltd. All Rights Reserved. 00002 00003 #ifndef GLROTATEBALLHANDLE_H_ 00004 #define GLROTATEBALLHANDLE_H_ 00005 00006 #include <stdint.h> 00007 00008 #include "FnGLTransformManipulator.h" 00009 00010 #include <FnViewer/plugin/FnManipulatorHandle.h> 00011 #include <FnViewer/plugin/FnMathTypes.h> 00012 #include <FnViewer/utils/FnDrawable.h> 00013 00014 using namespace Foundry::Katana::ViewerAPI; 00015 using namespace Foundry::Katana::ViewerUtils; 00016 00037 class GLRotateBallHandle : public GLTransformManipulatorHandle 00038 { 00039 public: 00041 GLRotateBallHandle(); 00042 00044 virtual ~GLRotateBallHandle(); 00045 00047 static Foundry::Katana::ViewerAPI::ManipulatorHandle* create() 00048 { 00049 return new GLRotateBallHandle(); 00050 } 00051 00053 static void flush(){} 00054 00058 void draw(); 00059 00066 void pickerDraw(int64_t pickerId); 00067 00069 void setup(); 00070 00072 Orientation getOrientation(); 00073 00079 FnAttribute::Attribute getOption( 00080 Foundry::Katana::ViewerAPI::OptionIdGenerator::value_type optionId); 00081 00082 protected: 00086 virtual std::string getComponentName() { return "rotate?"; } 00087 00093 bool getDraggingPlane(Vec3d& origin, Vec3d& normal); 00094 00098 void startDrag(const Vec3d& initialPointOnPlane, 00099 const Vec2i& initialMousePosition); 00100 00106 void drag(const Vec3d& initialPointOnPlane, 00107 const Vec3d& previousPointOnPlane, 00108 const Vec3d& currentPointOnPlane, 00109 const Vec2i& initialMousePosition, 00110 const Vec2i& previousMousePosition, 00111 const Vec2i& currentMousePosition, 00112 bool isFinal); 00113 00118 void applyXformToLocation(const std::string& locationPath, 00119 const IMATH_NAMESPACE::M44d& xform, 00120 bool isFinal); 00121 00122 private: 00129 IMATH_NAMESPACE::V3d getDirectionOnHemisphere( 00130 const IMATH_NAMESPACE::V3d& pointOnPlane); 00131 00133 Drawable m_mesh; 00134 00136 IMATH_NAMESPACE::V3d m_normal; 00137 00142 IMATH_NAMESPACE::V3d m_initialDir; 00143 }; 00144 00145 #endif // GLROTATEBALLHANDLE_H_
1.7.3