|
Katana Plug-in APIs 0.1
|
00001 // Copyright (c) 2017 The Foundry Visionmongers Ltd. All Rights Reserved. 00002 00003 #ifndef GLSCALEAXISHANDLE_H_ 00004 #define GLSCALEAXISHANDLE_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 00035 class GLScaleAxisHandle : public GLTransformManipulatorHandle 00036 { 00037 public: 00039 GLScaleAxisHandle(); 00040 00042 virtual ~GLScaleAxisHandle(); 00043 00045 static Foundry::Katana::ViewerAPI::ManipulatorHandle* create() 00046 { 00047 return new GLScaleAxisHandle(); 00048 } 00049 00051 static void flush(){} 00052 00056 void draw(); 00057 00063 void pickerDraw(int64_t pickerId); 00064 00066 void setup(const IMATH_NAMESPACE::V3d& axis); 00067 00069 virtual FnKat::ViewerUtils::Orientation getOrientation() { return OBJECT; } 00070 00071 protected: 00075 virtual std::string getComponentName() { return "scale"; } 00076 00082 bool getDraggingPlane(Vec3d& origin, Vec3d& normal); 00083 00087 void startDrag(const Vec3d& initialPointOnPlane, 00088 const Vec2i& initialMousePosition); 00089 00093 void endDrag(); 00094 00099 void drag(const Vec3d& initialPointOnPlane, 00100 const Vec3d& previousPointOnPlane, 00101 const Vec3d& currentPointOnPlane, 00102 const Vec2i& initialMousePosition, 00103 const Vec2i& previousMousePosition, 00104 const Vec2i& currentMousePosition, 00105 bool isFinal); 00106 00110 void applyXformToLocation(const std::string& locationPath, 00111 const IMATH_NAMESPACE::M44d& xform, 00112 bool isFinal); 00113 00114 private: 00118 void initMesh(); 00119 00121 IMATH_NAMESPACE::V3d m_axis; 00122 00124 IMATH_NAMESPACE::V3d m_axisWorldSpace; 00125 00128 Vec3d m_originWorldSpace; 00129 Vec3d m_normalWorldSpace; 00130 00132 Drawable m_cubeMesh; 00133 Drawable m_trunkMesh; 00134 00141 IMATH_NAMESPACE::M44d m_meshXform; 00142 00143 IMATH_NAMESPACE::M44d m_scaleXform; 00144 00145 Vec4f m_axisColor; 00146 }; 00147 00148 #endif // GLScaleManipulator_H_
1.7.3