本文整理汇总了C++中SolarSystem::createRotation方法的典型用法代码示例。如果您正苦于以下问题:C++ SolarSystem::createRotation方法的具体用法?C++ SolarSystem::createRotation怎么用?C++ SolarSystem::createRotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SolarSystem
的用法示例。
在下文中一共展示了SolarSystem::createRotation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
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 );
// create transformations for the earthMoonGroup
osg::MatrixTransform* aroundSunRotationEarthMoonGroup = solarSystem.createRotation( solarSystem._RorbitEarth, solarSystem._rotateSpeedEarthAndMoon );
// osg::MatrixTransform* earthMoonGroupPosition = solarSystem.createTranslationAndTilt( solarSystem._RorbitEarth, solarSystem._tiltEarth );
osg::MatrixTransform* earthMoonGroupPosition = solarSystem.createTranslationAndTilt( solarSystem._RorbitEarth, 0.0 );
//Group with earth and moon under it
osg::Group* earthMoonGroup = new osg::Group;
//transformation to rotate the earth around itself
osg::MatrixTransform* earthAroundItselfRotation = solarSystem.createRotation ( 0.0, solarSystem._rotateSpeedEarth );
//transformations for the moon
osg::MatrixTransform* moonAroundEarthRotation = solarSystem.createRotation( solarSystem._RorbitMoon, solarSystem._rotateSpeedMoon );
osg::MatrixTransform* moonTranslation = solarSystem.createTranslationAndTilt( solarSystem._RorbitMoon, 0.0 );
moonTranslation->addChild( moon );
moonAroundEarthRotation->addChild( moonTranslation );
earthMoonGroup->addChild( moonAroundEarthRotation );
earthAroundItselfRotation->addChild( earth );
earthMoonGroup->addChild( earthAroundItselfRotation );
earthMoonGroupPosition->addChild( earthMoonGroup );
aroundSunRotationEarthMoonGroup->addChild( earthMoonGroupPosition );
sunLight->addChild( aroundSunRotationEarthMoonGroup );
/*
*********************************************
** end earthMoonGroup and Transformations
*********************************************
*/