private string AddFileToProject(string filename)
        {
            string openFile = Program.Instance.OpenFile;

            if (openFile != null)
            {
                string projectFolder = string.Concat(new FileInfo(openFile).DirectoryName, "\\");
                string newFileName   = new FileInfo(filename).Name;
                string copiedName    = string.Concat(projectFolder, newFileName);
                if (!File.Exists(copiedName))
                {
                    File.Copy(filename, copiedName);
                    if (filename.EndsWith(".x"))
                    {
                        XMesh mesh = new XMesh(filename);
                        for (int i = 0; i < mesh.NumberTextures; i++)
                        {
                            TextureBase texture = mesh.GetTexture(i);
                            if ((texture != null) && (!string.IsNullOrEmpty(texture.FileName)))
                            {
                                AddFileToProject(texture.FileName);
                            }
                        }
                        mesh.Dispose();
                    }
                }
                return(copiedName);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Clean up.
 /// </summary>
 public override void Dispose()
 {
     count--;
     if (count == 0)
     {
         meshWindSock.Dispose();
         meshWindSock = null;
         flagShader.Dispose();
         flagShader = null;
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Clean up.
 /// </summary>
 public override void Dispose()
 {
     count--;
     if (count == 0)
     {
         meshFixed.Dispose();
         meshFixed = null;
         meshFrontWheels.Dispose();
         meshFrontWheels = null;
         meshRearWheels.Dispose();
         meshRearWheels = null;
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Clean up.
 /// </summary>
 public override void Dispose()
 {
     count--;
     if (count == 0)
     {
         meshFixed.Dispose();
         meshFixed = null;
         meshTurbine.Dispose();
         meshTurbine = null;
         meshBlades.Dispose();
         meshBlades = null;
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Clean up.
 /// </summary>
 public override void Dispose()
 {
     count--;
     if (count == 0)
     {
         meshPole.Dispose();
         meshPole = null;
         meshFlag.Dispose();
         meshFlag = null;
         flagShader.Dispose();
         flagShader = null;
     }
     pole.Dispose();
     flag.Dispose();
 }
Exemplo n.º 6
0
        private void LoadMesh(string filename)
        {
            lock (meshLock)
            {
                if (mesh != null)
                {
                    mesh.Dispose();
                    mesh = null;
                }

                worldMatrix = Matrix4x4F.Identity;

                XMesh meshT = meshManager.Open(filename);

                meshT.ShowWireFrame = cbWireframe.Checked;

                mesh = meshT;
            };
        }
Exemplo n.º 7
0
        /// <summary>
        /// Clean up.
        /// </summary>
        public void Dispose()
        {
            Program.Instance.CenterHud.ShowGameText("", 1000);
            foreach (CornField field in cornfields)
            {
                field.Dispose();
            }
            cornfields.Clear();
            if (birds != null)
            {
                birds.Dispose();
                birds = null;
            }

            if (arrow != null)
            {
                arrow.Dispose();
                arrow = null;
            }
            cornMesh.Dispose();
        }