Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Eliminar textura existente
 /// </summary>
 /// <param name="n"></param>
 public void deleteTexture(int n)
 {
     mesh.deleteDiffuseMap(n, 0);
     this.ModifyCaps.TextureNumbers = mesh.DiffuseMaps.Length;
 }