VruiCustomToolDemo::MyToolFactory::MyToolFactory(Vrui::ToolManager& toolManager,VruiCustomToolDemo* sApplication) :Vrui::ToolFactory("MyTool",toolManager), application(sApplication) { /* Initialize the input device layout of the custom tool class: */ layout.setNumDevices(1); // Custom tools require one input device layout.setNumButtons(0,2); // Custom tools require two buttons on the input device #if 0 // Tool classes directly derived from Vrui::Tool must not do this /* Insert the custom tool class into the tool hierarchy: */ Vrui::ToolFactory* toolFactory=toolManager.loadClass("Tool"); toolFactory->addChildClass(this); addParentClass(toolFactory); #endif /* Set the custom tool class' factory pointer: */ MyTool::factory=this; }
EarthquakeToolFactory::EarthquakeToolFactory(Vrui::ToolManager& toolManager,const std::vector<EarthquakeSet*>& sEarthquakeSets) :Vrui::ToolFactory("EarthquakeTool",toolManager), earthquakeSets(sEarthquakeSets) { /* Insert class into class hierarchy: */ Vrui::TransformToolFactory* transformToolFactory=dynamic_cast<Vrui::TransformToolFactory*>(toolManager.loadClass("TransformTool")); transformToolFactory->addChildClass(this); addParentClass(transformToolFactory); /* Initialize tool layout: */ layout.setNumButtons(0,true); layout.setNumValuators(0,true); /* Set the custom tool class' factory pointer: */ EarthquakeTool::factory=this; }