本文整理汇总了C++中Terrain::GetTextureSet方法的典型用法代码示例。如果您正苦于以下问题:C++ Terrain::GetTextureSet方法的具体用法?C++ Terrain::GetTextureSet怎么用?C++ Terrain::GetTextureSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Terrain
的用法示例。
在下文中一共展示了Terrain::GetTextureSet方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetTexture
TextureEntity* CGlobalTerrain::GetTexture(float x, float y, int nIndex)
{
Terrain * pTerrain = GetTerrainAtPoint(x, y);
if (pTerrain)
{
if (nIndex >= 0)
{
if (pTerrain->GetTextureSet())
{
Texture * pTex = pTerrain->GetTextureSet()->GetTexture(nIndex);
if (pTex)
{
return pTex->GetTextureEntity();
}
}
}
else if (nIndex == -1)
{
// -1: common texture, which is repeated several times over each terrain tile surface.
TextureEntity* pTex = CGlobals::GetAssetManager()->LoadTexture("", pTerrain->GetTerrainCommonTextureFile(), TextureEntity::StaticTexture);
return pTex;
}
else if (nIndex == -2)
{
// -2: main texture, which is chopped and mapped to the entire terrain surface.
TextureEntity* pTex = CGlobals::GetAssetManager()->LoadTexture("", pTerrain->GetTerrainBaseTextureFile(), TextureEntity::StaticTexture);
return pTex;
}
}
return NULL;
}
示例2: GetTextureCount
int CGlobalTerrain::GetTextureCount(float x, float y)
{
Terrain * pTerrain = GetTerrainAtPoint(x, y);
if (pTerrain)
{
if (pTerrain->GetTextureSet())
{
return pTerrain->GetTextureSet()->GetNumTextures();
}
}
return 0;
}
示例3: ReplaceTexture
bool CGlobalTerrain::ReplaceTexture(float x, float y, int nIndex, TextureEntity* TextureAsset)
{
Terrain * pTerrain = GetTerrainAtPoint(x, y);
if (pTerrain && (nIndex >= 0 || TextureAsset != 0))
{
if (nIndex >= 0)
{
if (pTerrain->GetTextureSet())
{
if (TextureAsset)
{
if (pTerrain->GetTextureSet()->ReplaceTexture(nIndex, TextureAsset))
{
pTerrain->SetModified(true, MODIFIED_TEXTURE);
return true;
}
}
else
{
// True to normalize mask of the undeleted layers.
bool bNormalizeMask = true;
pTerrain->GetTextureSet()->RemoveTexture(nIndex, pTerrain, bNormalizeMask);
}
}
}
else if (nIndex == -1)
{
// -1: common texture, which is repeated several times over each terrain tile surface.
pTerrain->SetTerrainCommonTextureFile(TextureAsset->GetKey());
return true;
}
else if (nIndex == -2)
{
// -2: main texture, which is chopped and mapped to the entire terrain surface.
pTerrain->SetTerrainBaseTextureFile(TextureAsset->GetKey());
return true;
}
}
return false;
}