CloudLayer* CloudsManager::add(const CloudLayer::Options& o) { CloudLayer *NewCloudLayer = new CloudLayer(mSkyX, o); // TODO #if (OGRE_VERSION < ((1 << 16) | (9 << 8) | 0)) NewCloudLayer->_registerCloudLayer(static_cast<Ogre::MaterialPtr>( Ogre::MaterialManager::getSingleton().getByName(mSkyX->getGPUManager()->getSkydomeMaterialName())) ->getTechnique(0)->createPass()); #else NewCloudLayer->_registerCloudLayer( Ogre::MaterialManager::getSingleton().getByName(mSkyX->getGPUManager()->getSkydomeMaterialName()).staticCast<Ogre::Material>() ->getTechnique(0)->createPass()); #endif mCloudLayers.push_back(NewCloudLayer); bool changeOrder = false; // Short layers by height for (unsigned int k = 0; k < mCloudLayers.size(); k++) { if (k+1 < mCloudLayers.size()) { if (mCloudLayers.at(k)->getOptions().Height < mCloudLayers.at(k+1)->getOptions().Height) { // Swap CloudLayer* cl = mCloudLayers.at(k); mCloudLayers.at(k) = mCloudLayers.at(k+1); mCloudLayers.at(k+1) = cl; changeOrder = true; k = 0; } } } if (changeOrder) { unregisterAll(); registerAll(); } return NewCloudLayer; }
CloudLayer* CloudsManager::add(const CloudLayer::Options& o) { CloudLayer *NewCloudLayer = new CloudLayer(mSkyX, o); // TODO NewCloudLayer->_registerCloudLayer(); mCloudLayers.push_back(NewCloudLayer); bool changeOrder = false; // Short layers by height for (unsigned int k = 0; k < mCloudLayers.size(); k++) { if (k+1 < mCloudLayers.size()) { if (mCloudLayers.at(k)->getOptions().Height < mCloudLayers.at(k+1)->getOptions().Height) { // Swap CloudLayer* cl = mCloudLayers.at(k); mCloudLayers.at(k) = mCloudLayers.at(k+1); mCloudLayers.at(k+1) = cl; changeOrder = true; k = 0; } } } if (changeOrder) { unregisterAll(); registerAll(); } return NewCloudLayer; }
void onInitialize(Atmosphere& atmosphere) { CloudLayer cumulus = CloudLayerFactory::Create(CUMULUS_CONGESTUS); cumulus.SetIsInfinite(true); cumulus.SetBaseAltitude(3000); cumulus.SetThickness(50); cumulus.SetBaseLength(100000); cumulus.SetBaseWidth(100000); cumulus.SetDensity(1.0); cumulus.SetLayerPosition(0,0); cumulus.SetFadeTowardEdges(true); cumulus.SetAlpha(0.8); cumulus.SetCloudAnimationEffects(0.1, false, 0, 0); cumulus.SeedClouds(atmosphere); atmosphere.GetConditions().AddCloudLayer(cumulus); atmosphere.EnableLensFlare(true); }