本文整理汇总了C++中SolarSystem::createSunLight方法的典型用法代码示例。如果您正苦于以下问题:C++ SolarSystem::createSunLight方法的具体用法?C++ SolarSystem::createSunLight怎么用?C++ SolarSystem::createSunLight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SolarSystem
的用法示例。
在下文中一共展示了SolarSystem::createSunLight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
std::cout << "\t--mapSun: string" << std::endl;
std::cout << "\t--mapMercury: string" << std::endl;
std::cout << "\t--mapVenus: string" << std::endl;
std::cout << "\t--mapEarth: string" << std::endl;
std::cout << "\t--mapEarthNight: string" << std::endl;
std::cout << "\t--mapMoon: string" << std::endl;
std::cout << "\t--mapMars: string" << std::endl;
std::cout << "\t--mapJupiter: string" << std::endl;
std::cout << "\t--rotateSpeedFactor: string" << std::endl;
std::cout << "\t--RorbitFactor: string" << std::endl;
std::cout << "\t--radiusFactor: string" << std::endl;
return 1;
}
// any option left unread are converted into errors to write out later.
arguments.reportRemainingOptionsAsUnrecognized();
// report any errors if they have occurred when parsing the program arguments.
if (arguments.errors())
{
arguments.writeErrorMessages(std::cout);
return 1;
}
osg::Group* root = new osg::Group;
osg::ClearNode* clearNode = new osg::ClearNode;
clearNode->setClearColor(osg::Vec4(0.0f,0.0f,0.0f,1.0f));
root->addChild(clearNode);
osg::Group* sunLight = solarSystem.createSunLight();
root->addChild(sunLight);
// create the sun
osg::Node* solarSun = solarSystem.createPlanet( solarSystem._radiusSun, "Sun", osg::Vec4( 1.0f, 1.0f, 1.0f, 1.0f), solarSystem._mapSun );
osg::StateSet* sunStateSet = solarSun->getOrCreateStateSet();
osg::Material* material = new osg::Material;
material->setEmission( osg::Material::FRONT_AND_BACK, osg::Vec4( 1.0f, 1.0f, 0.0f, 0.0f ) );
sunStateSet->setAttributeAndModes( material, osg::StateAttribute::ON );
osg::Billboard* sunBillboard = new osg::Billboard();
sunBillboard->setMode(osg::Billboard::POINT_ROT_EYE);
sunBillboard->addDrawable(
createSquare(osg::Vec3(-150.0f,0.0f,-150.0f),osg::Vec3(300.0f,0.0f,0.0f),osg::Vec3(0.0f,0.0f,300.0f),createBillboardImage( osg::Vec4( 1.0, 1.0, 0, 1.0f), 64, 1.0) ),
osg::Vec3(0.0f,0.0f,0.0f));
sunLight->addChild( sunBillboard );
// stick sun right under root, no transformations for the sun
sunLight->addChild( solarSun );
// create light source in the sun
/*
*********************************************
** earthMoonGroup and Transformations
*********************************************
*/
// create earth and moon
osg::Node* earth = solarSystem.createPlanet( solarSystem._radiusEarth, "Earth", osg::Vec4( 1.0f, 1.0f, 1.0f, 1.0f), solarSystem._mapEarth, solarSystem._mapEarthNight );
osg::Node* moon = solarSystem.createPlanet( solarSystem._radiusMoon, "Moon", osg::Vec4( 1.0f, 1.0f, 1.0f, 1.0f), solarSystem._mapMoon );