コード例 #1
0
MouseNavigationTool::MouseNavigationTool(const ToolFactory* factory,const ToolInputAssignment& inputAssignment)
    :NavigationTool(factory,inputAssignment),
     mouseAdapter(0),
     currentValue(0),
     dolly(MouseNavigationTool::factory->invertDolly),navigationMode(IDLE),
     draggedWidget(0)
{
    /* Find the mouse input device adapter controlling the input device: */
    mouseAdapter=dynamic_cast<InputDeviceAdapterMouse*>(getInputDeviceManager()->findInputDeviceAdapter(input.getDevice(0)));

    if(MouseNavigationTool::factory->showMouseCursor)
    {
        /* Load the mouse cursor image file: */
        mouseCursorImage=Images::readCursorFile(MouseNavigationTool::factory->mouseCursorImageFileName.c_str(),MouseNavigationTool::factory->mouseCursorNominalSize);

        /* Calculate the texture coordinate box: */
        Geometry::Point<float,2> tcMin,tcMax;
        for(int i=0; i<2; ++i)
        {
            unsigned int texSize;
            for(texSize=1; texSize<mouseCursorImage.getSize(i); texSize<<=1)
                ;
            tcMin[i]=0.5f/float(texSize);
            tcMax[i]=(float(mouseCursorImage.getSize(i))-0.5f)/float(texSize);
        }
        mouseCursorTexCoordBox=Geometry::Box<float,2>(tcMin,tcMax);
    }
}
コード例 #2
0
MouseDialogNavigationTool::MouseDialogNavigationTool(const ToolFactory* factory,const ToolInputAssignment& inputAssignment)
	:NavigationTool(factory,inputAssignment),
	 GUIInteractor(false,Scalar(0),getButtonDevice(0)),
	 mouseAdapter(0),
	 navigationDialogPopup(0),
	 currentPos(Point::origin),
	 navigationMode(ROTATING),
	 spinning(false),
	 showScreenCenter(false)
	{
	/* Find the mouse input device adapter controlling the input device: */
	InputDevice* rootDevice=getInputGraphManager()->getRootDevice(getButtonDevice(0));
	mouseAdapter=dynamic_cast<InputDeviceAdapterMouse*>(getInputDeviceManager()->findInputDeviceAdapter(rootDevice));
	
	/* Create the tool's GUI: */
	navigationDialogPopup=new GLMotif::PopupWindow("NavigationDialogPopup",getWidgetManager(),"Mouse Navigation Dialog");
	
	GLMotif::RowColumn* navigationDialog=new GLMotif::RowColumn("NavigationDialog",navigationDialogPopup,false);
	
	GLMotif::RadioBox* navigationModes=new GLMotif::RadioBox("NavigationModes",navigationDialog,false);
	navigationModes->setOrientation(GLMotif::RowColumn::VERTICAL);
	navigationModes->setPacking(GLMotif::RowColumn::PACK_GRID);
	navigationModes->setSelectionMode(GLMotif::RadioBox::ALWAYS_ONE);
	
	navigationModes->addToggle("Rotate");
	navigationModes->addToggle("Pan");
	navigationModes->addToggle("Dolly");
	navigationModes->addToggle("Scale");
	
	switch(navigationMode)
		{
		case ROTATING:
			navigationModes->setSelectedToggle(0);
			break;
		
		case PANNING:
			navigationModes->setSelectedToggle(1);
			break;
		
		case DOLLYING:
			navigationModes->setSelectedToggle(2);
			break;
		
		case SCALING:
			navigationModes->setSelectedToggle(3);
			break;
		}
	navigationModes->getValueChangedCallbacks().add(this,&MouseDialogNavigationTool::navigationModesValueChangedCallback);
	navigationModes->manageChild();
	
	GLMotif::ToggleButton* showScreenCenterToggle=new GLMotif::ToggleButton("ShowScreenCenterToggle",navigationDialog,"Show Screen Center");
	showScreenCenterToggle->setToggle(showScreenCenter);
	showScreenCenterToggle->getValueChangedCallbacks().add(this,&MouseDialogNavigationTool::showScreenCenterToggleValueChangedCallback);
	
	navigationDialog->manageChild();
	
	/* Pop up the navigation dialog: */
	popupPrimaryWidget(navigationDialogPopup);
	}
コード例 #3
0
void DesktopDeviceNavigationTool::deinitialize(void)
	{
	/* Release the virtual input device: */
	getInputGraphManager()->releaseInputDevice(virtualDevice,this);
	
	/* Destroy the virtual input device: */
	getInputDeviceManager()->destroyInputDevice(virtualDevice);
	}
コード例 #4
0
void TransformTool::deinitialize(void)
{
    /* Release the virtual input device: */
    getInputGraphManager()->releaseInputDevice(transformedDevice,this);

    /* Destroy the virtual input device: */
    getInputDeviceManager()->destroyInputDevice(transformedDevice);
    transformedDevice=0;
}
コード例 #5
0
void FPSNavigationTool::initialize(void)
	{
	/* Get a pointer to the input device's controlling adapter: */
	mouseAdapter=dynamic_cast<InputDeviceAdapterMouse*>(getInputDeviceManager()->findInputDeviceAdapter(input.getDevice(0)));
	
	/* Initialize the navigation frame and current position/orientation: */
	ONTransform st=getMainScreen()->getScreenTransformation();
	navFrame=st.getRotation();
	}
コード例 #6
0
void WandNavigationTool::deinitialize(void)
	{
	/* Release the virtual input device: */
	getInputGraphManager()->releaseInputDevice(buttonDevice,this);
	
	/* Destroy the virtual input device: */
	getInputDeviceManager()->destroyInputDevice(buttonDevice);
	buttonDevice=0;
	}
コード例 #7
0
void ScrollTool::deinitialize(void)
	{
	/* Release the virtual input device: */
	getInputGraphManager()->releaseInputDevice(valuatorDevice,this);
	
	/* Destroy the virtual input device: */
	getInputDeviceManager()->destroyInputDevice(valuatorDevice);
	valuatorDevice=0;
	}
コード例 #8
0
MouseNavigationTool::MouseNavigationTool(const ToolFactory* factory,const ToolInputAssignment& inputAssignment)
	:NavigationTool(factory,inputAssignment),
	 GUIInteractor(false,Scalar(0),getButtonDevice(0)),
	 mouseAdapter(0),
	 currentPos(Point::origin),currentValue(0),
	 dolly(MouseNavigationTool::factory->invertDolly),navigationMode(IDLE)
	{
	/* Find the mouse input device adapter controlling the input device: */
	InputDevice* rootDevice=getInputGraphManager()->getRootDevice(getButtonDevice(0));
	mouseAdapter=dynamic_cast<InputDeviceAdapterMouse*>(getInputDeviceManager()->findInputDeviceAdapter(rootDevice));
	}
コード例 #9
0
ファイル: ToolKillZone.cpp プロジェクト: VisualIdeation/Vrui
ToolKillZone::ToolKillZone(const Misc::ConfigurationFileSection& configFileSection)
	:baseDevice(0),
	 render(true),
	 material(getWidgetMaterial()),
	 modelVersion(1)
	{
	/* Retrieve the name of the base device (if any) from the configuration file: */
	std::string baseDeviceName=configFileSection.retrieveString("./killZoneBaseDevice","");
	if(baseDeviceName!="")
		{
		/* Attach the kill zone to the base device: */
		baseDevice=getInputDeviceManager()->findInputDevice(baseDeviceName.c_str());
		if(baseDevice==0)
			Misc::throwStdErr("ToolKillZone: Unknown base input device \"%s\"",baseDeviceName.c_str());
		}
	
	/* Retrieve the render flag: */
	render=configFileSection.retrieveValue<bool>("./killZoneRender",render);
	
	/* Retrieve the model material: */
	material=configFileSection.retrieveValue<GLMaterial>("./killZoneMaterial",material);
	}