Exemple #1
0
void CGlobalTerrain::GetTexturesInCell(float x, float y, std::vector<int>& indices)
{
	Terrain * pTerrain = GetTerrainAtPoint(x, y);
	if (pTerrain)
	{
		TextureCell * pCell = pTerrain->GetTextureCellW(x, y);
		if (pCell)
		{
			indices.resize(pCell->GetNumberOfDetails(), 0);
			for (int i = 0; i < pCell->GetNumberOfDetails(); i++)
			{
				indices[i] = pCell->GetDetail(i)->GetTexture()->GetSharedIndex();
			}
		}
	}
}
Exemple #2
0
bool CGlobalTerrain::RemoveTextureInCell(float x, float y, int nIndex)
{
	Terrain * pTerrain = GetTerrainAtPoint(x, y);
	if (pTerrain)
	{
		TextureCell * pCell = pTerrain->GetTextureCellW(x, y);
		if (pCell)
		{
			for (int i = 0; i < pCell->GetNumberOfDetails(); i++)
			{
				if (pCell->GetDetail(i)->GetTexture()->GetSharedIndex() == nIndex)
				{
					// remove this texture
					pCell->RemoveDetail(i);
					pCell->NormalizeMask(-1);
				}
			}
		}
	}
	return true;
}