#include <osgViewer/Viewer> #include <osgViewer/ViewerEventHandlers> #include <osgGA/StateSetManipulator> #include <osgDB/ReadFile> #include <osgUtil/LineSegmentIntersector> #include <osgUtil/IntersectionVisitor> #include <osg/MatrixTransform> #include <osg/Group> #include <osg/Node> int main() { osg::ref_ptr<osg::Node> cow = osgDB::readNodeFile("cow.osg");//第一个节点 osg::ref_ptr<osg::Node> axes = osgDB::readNodeFile("axes.osg");//第二个节点 osg::ref_ptr<osg::MatrixTransform> mt_cow = new osg::MatrixTransform; mt_cow->setMatrix(osg::Matrix::scale(osg::Vec3(0.5,0.5,0.5))*osg::Matrix::translate(osg::Vec3(-10,0,0))); mt_cow->addChild(cow.get()); osg::ref_ptr<osg::MatrixTransform> mt_axes = new osg::MatrixTransform; mt_axes->addChild(axes.get()); osg::ref_ptr<osg::Group> root = new osg::Group; root->addC