本文整理汇总了C++中ogre::Image::flipAroundX方法的典型用法代码示例。如果您正苦于以下问题:C++ Image::flipAroundX方法的具体用法?C++ Image::flipAroundX怎么用?C++ Image::flipAroundX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::Image
的用法示例。
在下文中一共展示了Image::flipAroundX方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getTerrainImage
void getTerrainImage(bool flipX, bool flipY, Ogre::Image& img)
{
if(flipX)
img.flipAroundY();
if(flipY)
img.flipAroundX();
}
示例2: getTerrainImage
void getTerrainImage(bool flipX, bool flipY, Ogre::Image& img)
{
img.load("terrain1.bmp", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
if (flipX)
img.flipAroundY();
if (flipY)
img.flipAroundX();
}
示例3: GetTerrainImage
void TerrainManager::GetTerrainImage(bool flipX, bool flipY, Ogre::Image& img)
{
img.load(mHeightMapFileName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
if (flipX)
img.flipAroundY();
if (flipY)
img.flipAroundX();
}
示例4: getTerrainImage
/// FIXME
void getTerrainImage(bool flipX, bool flipY, Ogre::Image& img)
{
img.load("height_map.png", Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);
if (flipX)
img.flipAroundY();
if (flipY)
img.flipAroundX();
}
示例5: getTerrainImage
void OgreWidget::getTerrainImage(bool flipX, bool flipY, Ogre::Image& img)
{
img.load("terrain.png", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
qDebug() << "OgreWidget::getTerrainImage(): loaded terrain heightmap, width is" << img.getWidth();
if(flipX)
img.flipAroundY();
if(flipY)
img.flipAroundX();
}
示例6: getTerrainNormalData
Vector4* SnowTerrain::getTerrainNormalData()
{
PixelBox* terrainNormals;
// load from normals file
if(mSnowConfig->terrainSettings.normalsDataFile.length() > 0)
{
// get terrain normal data using image
Ogre::Image img;
img.load(mSnowConfig->terrainSettings.normalsDataFile, "General");
//img.flipAroundY();
//img.flipAroundX();
size_t size = img.getWidth();
assert(img.getWidth() == img.getHeight());
if (img.getWidth() != mTerrainSize || img.getHeight() != mTerrainSize)
img.resize(mTerrainSize, mTerrainSize);
terrainNormals = &img.getPixelBox();
Vector4* floats = convertNormalsToFloats(terrainNormals, true);
//OGRE_FREE(terrainNormals->data, Ogre::MEMCATEGORY_GENERAL);
// need to swap z and y vector due to different vertical axis in normal map and world space!
for(size_t i = 0;i<mTerrainSize*mTerrainSize;i++)
{
Vector4 v = floats[i];
floats[i].z = v.y;
floats[i].y = v.z;
}
return floats;
}
else
{
// need to wait until terrain is loaded
while (getTerrain()->isDerivedDataUpdateInProgress())
{
// we need to wait for this to finish
OGRE_THREAD_SLEEP(50);
Root::getSingleton().getWorkQueue()->processResponses();
}
// Get terrain normal data using official method
//terrainNormals = getTerrain()->calculateNormals(Ogre::Rect(0,0,mTerrainSize,mTerrainSize),Rect(0,0,mTerrainSize,mTerrainSize));
Ogre::Image img;
getTerrain()->getTerrainNormalMap()->convertToImage(img);
//img.flipAroundY();
img.flipAroundX();
//img.save("test_normals.bmp");
terrainNormals = &img.getPixelBox();
Vector4* floats = convertNormalsToFloats(terrainNormals, true);
//OGRE_FREE(terrainNormals->data, Ogre::MEMCATEGORY_GENERAL);
return floats;
}
}
示例7: terrainInit
void TerrainManager::terrainInit(Ogre::String file, OgreManager* o)
{
_OgreManager = o;
initialiseResources();
createLight();
setGlobalOptions();
_TerrainGroup = OGRE_NEW Ogre::TerrainGroup(_OgreManager->getSceneManager(), Ogre::Terrain::ALIGN_X_Z, 513, 12000.0f);
_TerrainGroup->setFilenameConvention(Ogre::String("GameTerrain"), Ogre::String("dat"));
_TerrainGroup->setOrigin(Ogre::Vector3::ZERO);
setDefaultImportSettings();
bool lTerrainsImported = false;
for (long x = 0; x <= 0; ++x)
{
for (long y = 0; y <= 0; ++y)
{
//Define terrain function
Ogre::String filename = _TerrainGroup->generateFilename(x, y);
if (Ogre::ResourceGroupManager::getSingleton().resourceExists(_TerrainGroup->getResourceGroup(), filename))
{
_TerrainGroup->defineTerrain(x, y);
}
else
{
Ogre::Image img;
//Get terrain image
Ogre::String tempFile = Ogre::StringConverter::toString(x * 10 + y);
tempFile.append(".bmp");
img.load("terrain.bmp", Ogre::String("TerrainResources"));
if (x % 2 != 0)
img.flipAroundY();
if (y % 2 != 0)
img.flipAroundX();
//Get terrain image end
_TerrainGroup->defineTerrain(x, y, &img);
lTerrainsImported = true;
}
//Define terrain function end
}
}
_TerrainGroup->loadAllTerrains(true);
if (lTerrainsImported)
{
Ogre::TerrainGroup::TerrainIterator ti = _TerrainGroup->getTerrainIterator();
while(ti.hasMoreElements())
{
Ogre::Terrain* t = ti.getNext()->instance;
//Init blend maps function start
Ogre::TerrainLayerBlendMap* blendMap0 = t->getLayerBlendMap(1);
Ogre::TerrainLayerBlendMap* blendMap1 = t->getLayerBlendMap(2);
Ogre::Real minHeight0 = -10;
Ogre::Real fadeDist0 = 0;//40;
Ogre::Real minHeight1 = -10;
Ogre::Real fadeDist1 = 0;//15;
float* pBlend0 = blendMap0->getBlendPointer();
float* pBlend1 = blendMap1->getBlendPointer();
for (Ogre::uint16 y = 0; y < t->getLayerBlendMapSize(); ++y)
{
for (Ogre::uint16 x = 0; x < t->getLayerBlendMapSize(); ++x)
{
Ogre::Real tx, ty;
blendMap0->convertImageToTerrainSpace(x, y, &tx, &ty);
Ogre::Real height = t->getHeightAtTerrainPosition(tx, ty);
Ogre::Real val = (height - minHeight0) / fadeDist0;
val = Ogre::Math::Clamp(val, (Ogre::Real)0, (Ogre::Real)1);
*pBlend0++ = val;
val = (height - minHeight1) / fadeDist1;
val = Ogre::Math::Clamp(val, (Ogre::Real)0, (Ogre::Real)1);
*pBlend1++ = val;
}
}
blendMap0->dirty();
blendMap1->dirty();
blendMap0->update();
blendMap1->update();
//Init blend maps end
}
}
_TerrainGroup->freeTemporaryResources();
_OgreManager->getSceneManager()->setSkyBox(true, "Examples/EarlyMorningSkyBox", 5000, true, Ogre::Quaternion::IDENTITY, "GameResources");
}