public static void ChangeTextureColor(TgcMesh mesh, string newColor) { TgcTexture[] diffuseMaps = mesh.DiffuseMaps; string newTexturePath = ""; int index = 0; foreach (TgcTexture texture in diffuseMaps) { if (texture.FileName.Contains("Car Material")) { newTexturePath = texture.FilePath; break; } index++; } string oldColor = newTexturePath.Split('\\')[5].Split(' ')[2].Split('.')[0]; newTexturePath = newTexturePath.Replace(oldColor, newColor); var textureAux = TgcTexture.createTexture(D3DDevice.Instance.Device, newTexturePath.Split('\\')[5], newTexturePath); mesh.addDiffuseMap(textureAux); mesh.deleteDiffuseMap(index, diffuseMaps.Length - 1); }
/// <summary> /// Agregar una nueva textura al mesh /// </summary> public void addNexTexture(TgcTexture t) { mesh.addDiffuseMap(t); this.ModifyCaps.TextureNumbers = mesh.DiffuseMaps.Length; }