示例#1
0
ToolKillZoneFrustum::ToolKillZoneFrustum(const Misc::ConfigurationFileSection& configFileSection)
	:ToolKillZone(configFileSection),
	 viewer(0),screen(0)
	{
	/* Get the viewer: */
	std::string viewerName=configFileSection.retrieveString("./killZoneViewerName");
	viewer=findViewer(viewerName.c_str());
	if(viewer==0)
		Misc::throwStdErr("ToolKillZoneFrustum::ToolKillZoneFrustum: Viewer %s not found",viewerName.c_str());
	
	/* Get the screen: */
	std::string screenName=configFileSection.retrieveString("./killZoneScreenName");
	screen=findScreen(screenName.c_str());
	if(screen==0)
		Misc::throwStdErr("ToolKillZoneFrustum::ToolKillZoneFrustum: Screen %s not found",screenName.c_str());
	
	/* Read box' center and size: */
	Point boxCenter=configFileSection.retrieveValue<Point>("./killZoneCenter");
	Vector boxSize=configFileSection.retrieveValue<Vector>("./killZoneSize");
	
	/* Transform box center and size to screen coordinates: */
	ONTransform screenT=screen->getScreenTransformation();
	boxCenter=screenT.inverseTransform(boxCenter);
	boxCenter[2]=Scalar(0);
	boxSize=screenT.inverseTransform(boxSize);
	boxSize[2]=Scalar(0);
	box=Box(boxCenter-boxSize*Scalar(0.5),boxCenter+boxSize*Scalar(0.5));
	}
示例#2
0
void ViewerConfiguration::viewerMenuCallback(GLMotif::DropdownBox::ValueChangedCallbackData* cbData)
	{
	/* Select a new viewer: */
	setViewer(cbData->newSelectedItem!=0?findViewer(cbData->getItem()):0);
	}