Exemplo n.º 1
0
        /// <summary>
        /// Cargar un escenario de Quake 3
        /// </summary>
        private void loadLevel(string levelFile)
        {
            //Dispose del anterior
            if (bspMap != null)
            {
                bspMap.dispose();
                bspMap = null;
            }

            //Cargar escenario de Quake 3
            string    mediaPath = new DirectoryInfo(levelFile).Parent.Parent.FullName + "\\";
            BspLoader loader    = new BspLoader();

            bspMap = loader.loadBsp(levelFile, mediaPath);

            //Iniciar visiblidad
            bspMap.initVisibility();

            //Cargar posición inicial del escenario
            bspMap.CollisionManager.initCamera();
            bspMap.CollisionManager.Camera.RotationSpeed = 2f;


            //Acceso a metadata del escenario, por si se quiere obtener alguna información customizada (hay que parsearla)
            string entdata = bspMap.Data.entdata;
        }
        public override void render(float elapsedTime)
        {
            Device d3dDevice = GuiController.Instance.D3dDevice;

            //Ver si se seleccionó alguno nivel a empaquetar
            string selectedFile = (string)GuiController.Instance.Modifiers["BspFile"];
            if (selectedFile != currentFile)
            {
                currentFile = selectedFile;

                //Cargar nivel
                BspLoader loader = new BspLoader();
                BspMap bspMap = loader.loadBsp(currentFile, quake3MediaPath);

                //Empaquetar
                FileInfo info = new FileInfo(currentFile);
                string fileName = info.Name.Substring(0, info.Name.IndexOf('.'));
                string outputDir = info.DirectoryName + "\\" + fileName;

                loader.packLevel(bspMap, quake3MediaPath, outputDir);

                //Librer recursos
                bspMap.dispose();

                MessageBox.Show(GuiController.Instance.MainForm, "Empaquetado almacenado en: " + outputDir,
                    "Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 3
0
        public override void render(float elapsedTime)
        {
            Device d3dDevice = GuiController.Instance.D3dDevice;

            //Ver si se seleccionó alguno nivel a empaquetar
            string selectedFile = (string)GuiController.Instance.Modifiers["BspFile"];

            if (selectedFile != currentFile)
            {
                currentFile = selectedFile;

                //Cargar nivel
                BspLoader loader = new BspLoader();
                BspMap    bspMap = loader.loadBsp(currentFile, quake3MediaPath);

                //Empaquetar
                FileInfo info      = new FileInfo(currentFile);
                string   fileName  = info.Name.Substring(0, info.Name.IndexOf('.'));
                string   outputDir = info.DirectoryName + "\\" + fileName;

                loader.packLevel(bspMap, quake3MediaPath, outputDir);

                //Librer recursos
                bspMap.dispose();

                MessageBox.Show(GuiController.Instance.MainForm, "Empaquetado almacenado en: " + outputDir,
                                "Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 4
0
        public void LoadTextures(string mediaPath)
        {
            //string root = mediaPath;
            if (!map.Equals("anim"))
            {
                int extension_pos = map.LastIndexOf('.');
                if (extension_pos < 0)
                {
                    extension_pos = 0;
                }

                string texpath = BspLoader.FindTextureExtension(map.Substring(0, extension_pos), mediaPath);

                if (!texpath.Equals(""))
                {
                    //solo hay un mapa de bits
                    var tex = TextureLoader.FromFile(GuiController.Instance.D3dDevice, texpath);
                    textures.Add(new TgcTexture(Path.GetFileName(texpath), texpath, tex, false));
                    animFreq = 0;
                }
            }
            else
            {
                foreach (string tex in animMaps)
                {
                    int extension_pos = tex.LastIndexOf('.');
                    if (extension_pos < 0)
                    {
                        extension_pos = 0;
                    }

                    string texpath = BspLoader.FindTextureExtension(tex.Substring(0, extension_pos), mediaPath);

                    if (!texpath.Equals(""))
                    {
                        //solo hay un mapa de bits
                        var t = TextureLoader.FromFile(GuiController.Instance.D3dDevice, texpath);
                        textures.Add(new TgcTexture(Path.GetFileName(texpath), texpath, t, false));
                    }
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Cargar un escenario de Quake 3
        /// </summary>
        private void loadLevel(string levelFile)
        {
            //Dispose del anterior
            if (bspMap != null)
            {
                bspMap.dispose();
                bspMap = null;
            }

            //Cargar escenario de Quake 3
            string mediaPath = new DirectoryInfo(levelFile).Parent.Parent.FullName + "\\";
            BspLoader loader = new BspLoader();
            bspMap = loader.loadBsp(levelFile, mediaPath);

            //Iniciar visiblidad
            bspMap.initVisibility();

            //Cargar posición inicial del escenario
            bspMap.CollisionManager.initCamera();
            bspMap.CollisionManager.Camera.RotationSpeed = 2f;

            //Acceso a metadata del escenario, por si se quiere obtener alguna información customizada (hay que parsearla)
            string entdata = bspMap.Data.entdata;
        }