地表放置机场和飞机(十)
代码实现如下:
void COSGObject::addAirport()
{
csn = new osg::CoordinateSystemNode;
csn->setEllipsoidModel(new osg::EllipsoidModel());
airport = osgDB::readNodeFile("D:/Project/OSG/bili35/builder/data/Module/airport.ive");
airport->getOrCreateStateSet()->setMode(GL_RESCALE_NORMAL, osg::StateAttribute::ON);//给obj增加法线 不加就黑色物体
airport->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::ON);
airport->getOrCreateStateSet()->setMode(GL_LIGHT0, osg::StateAttribute::ON);
airport->getOrCreateStateSet()->setMode(GL_LIGHT1, osg::StateAttribute::ON);
mtAirport = new osg::MatrixTransform;
mtAirport->addChild(airport);
mRoot->addChild(mtAirport);
osg::Matrixd mtT