Beispiel #1
0
	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;
	}