|
发表于 2013-1-19 11:17:30
|
显示全部楼层
- if(ea.getEventType() == osgGA::GUIEventAdapter::PUSH&& ea.getButtonMask() & osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON)
- {
- x = ea.getXnormalized();
- y = ea.getYnormalized();
- x_pick = ea.getX();
- y_pick = ea.getY();
- m_isDrag = true;
- update();
- return true;
- }
- if (ea.getEventType() == osgGA::GUIEventAdapter::DRAG&& ea.getButtonMask() & osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON)
- {
- if (m_isDrag)
- {
- float end_x = ea.getXnormalized();
- float end_y = ea.getYnormalized();
- if (m_geom)
- {
- osg::Vec3Array* vertex = new osg::Vec3Array(4);
- (*vertex)[0]=osg::Vec3(x,0,y);
- (*vertex)[1]=osg::Vec3(x,0,end_y);
- (*vertex)[2]=osg::Vec3(end_x,0,end_y);
- (*vertex)[3]=osg::Vec3(end_x,0,y);
- m_geom->setVertexArray(vertex);
- m_geom->dirtyDisplayList();
- }
- }
- return true;
- }
复制代码 |
|