Beispiel #1
0
    private void WorldGenerate()
    {
        if (player != null)
        {
            player.SetActive(false);
            player.transform.position = spawnPos;
            player.SetActive(true);
        }

        cubeManager.GenerateCubes();
        monsterManager.GenerateEnermys();
    }
Beispiel #2
0
        // Note: This will probably only work well with OBJ files generated by Pix4D
        // as I have only supported the subset of data types it outputs.
        static void Main(string[] args)
        {
            var opt = CliParser.Parse <Options>(args);

            foreach (string path in opt.Input)
            {
                // Check if we are processing an image or a mesh
                if (Path.GetExtension(path).ToUpper().EndsWith("JPG"))
                {
                    ImageTile tiler = new ImageTile(path, opt.xSize, opt.ySize);
                    tiler.GenerateTiles(opt.OutputPath);
                }
                else
                {
                    CubeManager manager = new CubeManager(path, opt.xSize, opt.ySize, opt.zSize);
                    manager.GenerateCubes(Path.Combine(opt.OutputPath, Path.GetFileNameWithoutExtension(path)));
                }
            }

            Console.WriteLine("Complete");
        }
Beispiel #3
0
        // Note: This will probably only work well with OBJ files generated by Pix4D
        // as I have only supported the subset of data types it outputs.
        static void Main(string[] args)
        {
            Options opt;

            // Setup a timer for all operations
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            try
            {
                opt = CliParser.Parse <Options>(args);

                foreach (string path in opt.Input)
                {
                    // Check if we are processing an image or a mesh
                    if (Path.GetExtension(path).ToUpper().EndsWith("JPG"))
                    {
                        ImageTile tiler = new ImageTile(path, opt.XSize, opt.YSize);
                        tiler.GenerateTiles(opt.OutputPath);
                    }
                    else if (Path.GetExtension(path).ToUpper().EndsWith("OBJ"))
                    {
                        // Generate subfolders named after input file
                        // if multiple input files are provided
                        string outputPath;
                        if (opt.Input.Count == 1)
                        {
                            outputPath = opt.OutputPath;
                        }
                        else
                        {
                            outputPath = Path.Combine(opt.OutputPath, Path.GetFileNameWithoutExtension(path));
                        }

                        if (opt.ForceCubical)
                        {
                            int longestGridSide = Math.Max(Math.Max(opt.XSize, opt.YSize), opt.ZSize);
                            opt.XSize = opt.YSize = opt.ZSize = longestGridSide;

                            Console.WriteLine("Due to -ForceCubical grid size is now {0},{0},{0}", longestGridSide);
                        }

                        var options = new SlicingOptions
                        {
                            OverrideMtl       = opt.MtlOverride,
                            GenerateEbo       = opt.Ebo,
                            GenerateOpenCtm   = opt.OpenCtm,
                            Debug             = opt.Debug,
                            GenerateObj       = opt.Obj,
                            Texture           = opt.Texture,
                            Obj               = path,
                            WriteMtl          = opt.WriteMtl,
                            TextureScale      = opt.ScaleTexture,
                            TextureSliceX     = opt.TextureXSize,
                            TextureSliceY     = opt.TextureYSize,
                            ForceCubicalCubes = opt.ForceCubical,
                            CubeGrid          = new Vector3 {
                                X = opt.XSize, Y = opt.YSize, Z = opt.ZSize
                            }
                        };

                        CubeManager manager = new CubeManager(options);

                        if (opt.MarkupUV)
                        {
                            Texture tex = new Texture(manager.ObjInstance);
                            tex.MarkupTextureFaces(opt.Texture);
                        }
                        else
                        {
                            manager.GenerateCubes(outputPath, options);
                        }
                    }
                    else
                    {
                        Console.WriteLine("PyriteCli only accepts .jpg and .obj files for input.");
                    }
                }
            }
            catch (ParserExit)
            {
                return;
            }
            catch (ParseException ex)
            {
                Console.WriteLine("usage: PyriteCli --help\n" + ex.ToString());
            }

            stopwatch.Stop();
            Trace.TraceInformation(stopwatch.Elapsed.ToString());
        }