osg鼠标缩放
osg鼠标缩放
bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us) { // 得到x的初始屏幕坐标 float mouseX = ea.getX(); // 得到y的初始屏幕坐标 float mouseY = ea.getY(); // 判断事件类型 switch (ea.getEventType()) { case (osgGA::GUIEventAdapter::EventType::SCROLL): //osgGA::GUIEventAdapter::ScrollingMotion scrollingMotionObj=ea.getScrollingMotion(); if (ea.getScrollingMotion() == osgGA::GUIEventAdapter::ScrollingMotion::SCROLL_UP) { camera_scale = camera_scale + 0.1f; } if (ea.getScrollingMotion() == osgGA::GUIEventAdapter::ScrollingMotion::SCROLL_DOWN) { camera_scale = camera_scale - 0.1f; } std::cout << "camera_scale:" << camera_scale << std::endl; return false; default: return false; } }
#########################
QQ 3087438119