Katana Plug-in APIs 0.1

FnGLCoiManipulator.h

00001 // Copyright (c) 2018 The Foundry Visionmongers Ltd. All Rights Reserved.
00002 
00003 #ifndef GLCOIMANIPULATOR_H_
00004 #define GLCOIMANIPULATOR_H_
00005 
00006 #include <vector>
00007 
00008 #include "FnGLTransformManipulator.h"
00009 
00010 
00011 using Foundry::Katana::ViewerUtils::GLTransformManipulator;
00012 using Foundry::Katana::ViewerUtils::GLTransformManipulatorHandle;
00013 
00020 class GLCoiManipulator : public GLTransformManipulator
00021 {
00022 public:
00024     GLCoiManipulator();
00025 
00027     virtual ~GLCoiManipulator();
00028 
00030     static Manipulator* create()
00031     {
00032         return new GLCoiManipulator();
00033     }
00034 
00036     static void flush(){}
00037 
00042     static bool matches(FnAttribute::GroupAttribute attrs)
00043     {
00044         const FnAttribute::GroupAttribute interactiveAttrs =
00045             attrs.getChildByName("xform.interactive");
00046         if (!interactiveAttrs.isValid())
00047         {
00048             return false;
00049         }
00050 
00051         return attrs.getChildByName("geometry.centerOfInterest").isValid() &&
00052             (interactiveAttrs.getChildByName("translate").isValid()
00053             || interactiveAttrs.getChildByName("rotateX").isValid()
00054             || interactiveAttrs.getChildByName("rotateY").isValid()
00055             || interactiveAttrs.getChildByName("rotateZ").isValid());
00056     }
00057 
00064     static FnAttribute::GroupAttribute getTags()
00065     {
00066         FnAttribute::GroupBuilder gb;
00067         gb.set(kTagName, FnAttribute::StringAttribute("Center of Interest"));
00068         gb.set(kTagShortcut, FnAttribute::StringAttribute("T"));
00069         gb.set(kTagGroup, FnAttribute::StringAttribute(kTagGroup_TRANSFORM));
00070         gb.set(kTagTechnology, FnAttribute::StringAttribute(
00071             GLTransformManipulator::kTechnology));
00072         gb.set(kTagAlwaysAvailable, FnAttribute::IntAttribute(1));
00073         gb.set(kTagExclusiveInGroup, FnAttribute::IntAttribute(1));
00074         gb.set(kTagPriorityInGroup, FnAttribute::IntAttribute(700));
00075 
00076         return gb.build();
00077     }
00078 
00083     virtual void draw();
00084 
00089     virtual void pickerDraw(int64_t pickerID);
00090 
00092     void setup();
00093 
00094 protected:
00098     template <typename className>
00099     className* addManipulatorHandle(
00100         const char* pluginName,
00101         const char* manipName,
00102         bool placeOnCenterOfInterest,
00103         FnKat::ViewerUtils::TransformMode transformMode,
00104         std::vector<GLTransformManipulatorHandle*>& handles)
00105     {
00106         Foundry::Katana::ViewerAPI::ManipulatorHandleWrapperPtr handleWrapper =
00107             Manipulator::addManipulatorHandle(pluginName, manipName);
00108         className* const handle = handleWrapper->getPluginInstance<className>();
00109         handle->placeOnCenterOfInterest(placeOnCenterOfInterest);
00110         handle->setTransformMode(transformMode);
00111         handles.push_back(handle);
00112         return handle;
00113     }
00114 
00115     GLTransformManipulatorHandle* m_coiHandle;
00116     std::vector<GLTransformManipulatorHandle*> m_rotateAroundCoiHandles;
00117     std::vector<GLTransformManipulatorHandle*> m_translateAroundCoiHandles;
00118     std::vector<GLTransformManipulatorHandle*> m_translateCoiHandles;
00119 };
00120 
00121 #endif  // GLCOIMANIPULATOR_H_
 All Classes Functions Variables Typedefs Enumerations Enumerator