|
本帖最后由 nana 于 2015-12-16 11:54 编辑
大家好,请问怎么能够实现添加一个相机实现鼠标滚轮的控制,求大神指点一二?
class hudEvent:public osgGA::GUIEventHandler
{
private:
osgViewer::Viewer * viewer;
myCamera *hud;
public:
hudEvent(osgViewer::Viewer *vw1,myCamera *hu):viewer(vw1),hud(hu)
{
}
bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa)
{
osgViewer::Viewer *vw=dynamic_cast<osgViewer::Viewer*>(&aa);
if(!vw) return false;
switch(ea.getEventType())
{
case osgGA::GUIEventAdapter::SCROLL:
{
vw->getSceneData()->asGroup()->getChild(1)->setNodeMask(1);
vw->getSceneData()->asGroup()->getChild(0)->setNodeMask(0);
}
break;
这样算是添加相机控制吗? |
|