Exemple #1
0
        public static unsafe Bitmap BitmapFromCorImage(Corona.Image img)
        {
            Corona.Image temp = img.Convert(Corona.PixelFormat.R8G8B8A8);
            byte[] pixels = temp.GrabPixels();

            var bmp = new System.Drawing.Bitmap(temp.Width, temp.Height, PixelFormat.Format32bppArgb);
            var bmpdata = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
            fixed (byte* _srcp = &pixels[0])
            {
                byte* srcp = (byte*)_srcp;
                byte* destp = (byte*)bmpdata.Scan0.ToPointer();
                for (int y = 0; y < temp.Height; y++)
                {
                    for (int x = 0; x < temp.Width; x++)
                    {
                        destp[0] = srcp[2];
                        destp[1] = srcp[1];
                        destp[2] = srcp[0];
                        destp[3] = srcp[3];
                        destp += 4;
                        srcp += 4;
                    }
                    destp += bmpdata.Stride - temp.Width * 4;
                }
            }

            bmp.UnlockBits(bmpdata);
            temp.Dispose();
            return bmp;
        }
    // Update is called once per frame
    void Update()
    {
        if (VariablesGlobales.Cuero == false)
        {
            Cuero.SetActive(false);
        }
        else
        {
            Cuero.SetActive(true);
        }

        if (VariablesGlobales.Corona == false)
        {
            Corona.SetActive(false);
        }
        else
        {
            Corona.SetActive(true);
        }

        if (VariablesGlobales.Sello == false)
        {
            Sello.SetActive(false);
        }
        else
        {
            Sello.SetActive(true);
        }
    }
Exemple #3
0
        public Corona.Image ConvertDown(Corona.Image sourceImage, TextureFormat toFormat)
        {
            int bits = -1;
            if (toFormat == TextureFormat.Format2_I2) bits = 2;
            if (toFormat == TextureFormat.Format3_I4) bits = 4;
            if (toFormat == TextureFormat.Format4_I8) bits = 8;
            if (toFormat == TextureFormat.Format7_16bpp) bits = 16;

            int colors = 1<<bits;

            Corona.Image ret = null;

            using (Util.TempFile tmpIn = new Util.TempFile("png"), tmpOut = new Util.TempFile("png"))
            {
                sourceImage.Save(tmpIn.Path, Corona.FileFormat.PNG);

                string output = Run("-treedepth", 4, "-colors", colors, tmpIn, tmpOut);

                if (toFormat == TextureFormat.Format7_16bpp)
                    ret = Corona.Image.Open(tmpOut.Path, Corona.PixelFormat.R8G8B8A8, Corona.FileFormat.PNG);
                else
                    ret = Corona.Image.Open(tmpOut.Path, Corona.PixelFormat.I8, Corona.FileFormat.PNG);

            }
            return ret;
        }
Exemple #4
0
 internal SunCoronaInfo(Corona corona)
 {
     Radius    = corona.Radius;
     Energy    = corona.Energy;
     Particles = corona.Particles;
     Ions      = corona.Ions;
 }
    private void Start()
    {
        currentBudget = startingBudget;
        //Debug.Log("Population: " + population);
        var randomStateIndex = random.Next(states.Count);

        Debug.Log("Bundesland mit erstem Infiziertem: " + states[randomStateIndex].stateName);
        states[randomStateIndex].Infect();

        susceptibleHistory.Add(population);

        disease = new Corona();
    }
Exemple #6
0
 public CosmicCorona(Corona corona)
 {
     Radius = corona.Radius;
 }
Exemple #7
0
    void Start()
    {
        MainCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>();
        GameObject goStars = new GameObject("Stars");
        //goStars.transform.localScale = new Vector3(-1f, 1f, 1f);
        MeshRenderer mr_stars   = goStars.AddComponent <MeshRenderer>();
        MeshFilter   mf_stars   = goStars.AddComponent <MeshFilter>();
        Mesh         mesh_stars = new Mesh();

        mesh_stars.name = "mesh_stars";
        mf_stars.mesh   = mesh_stars;
        Material mat_stars = Resources.Load <Material>("Materials/stars");

        mr_stars.material = mat_stars;

        Stars.build_stars(mesh_stars);


        GameObject goGrid = new GameObject("EarthGrid");

        goGrid.transform.localScale = new Vector3(-1f, -1f, 1f);
        MeshRenderer mr_grid   = goGrid.AddComponent <MeshRenderer>();
        MeshFilter   mf_grid   = goGrid.AddComponent <MeshFilter>();
        Mesh         mesh_grid = new Mesh();

        mesh_grid.name = "mesh_grid";
        Earth_Grid.build_earth_grid(mesh_grid);
        mf_grid.mesh     = mesh_grid;
        mat_grid         = Resources.Load <Material>("Materials/earth_grid");
        mr_grid.material = mat_grid;



        GameObject goCoast = new GameObject("Coast");

        goCoast.transform.localScale = new Vector3(-1f, 1f, 1f);
        MeshRenderer mr_coast   = goCoast.AddComponent <MeshRenderer>();
        MeshFilter   mf_coast   = goCoast.AddComponent <MeshFilter>();
        Mesh         mesh_coast = new Mesh();

        mesh_coast.name   = "mesh_coast";
        mf_coast.mesh     = mesh_coast;
        mat_coast         = Resources.Load <Material>("Materials/coast");
        mr_coast.material = mat_coast;


        goCountry = new GameObject("Countries");
        goCountry.transform.localScale = new Vector3(-1f, 1f, 1f);
        mr_country = goCountry.AddComponent <MeshRenderer>();
        MeshFilter mf_country = goCountry.AddComponent <MeshFilter>();

        mesh_country = new Mesh();
        mesh_country.subMeshCount = 4;
        mesh_country.name         = "mesh_country";
        mf_country.mesh           = mesh_country;

        mat_country          = Resources.Load <Material>("Materials/country");
        mat_country_pick     = Resources.Load <Material>("Materials/country_pick");
        mat_country_picked   = Resources.Load <Material>("Materials/country_picked");
        mat_border_picked    = Resources.Load <Material>("Materials/border_picked");
        mat_boundary         = Resources.Load <Material>("Materials/boundary");
        CountriesMats        = new Material[4];
        CountriesMats[0]     = mat_country;
        CountriesMats[1]     = mat_boundary;
        CountriesMats[2]     = mat_country_picked;
        CountriesMats[3]     = mat_border_picked;
        mr_country.materials = CountriesMats;

        CountriesPickMats    = new Material[1];
        CountriesPickMats[0] = mat_country_pick;



        //Country.load_map_json();
        Country.build_geometry(mesh_country, mesh_coast);

        goCorona = new GameObject("Corona");
        //goCorona.transform.localScale = new Vector3(-1f, 1f, 1f);
        MeshRenderer mr_corona   = goCorona.AddComponent <MeshRenderer>();
        MeshFilter   mf_corona   = goCorona.AddComponent <MeshFilter>();
        Mesh         mesh_corona = new Mesh();

        mesh_corona.name = "mesh_corona";
        Corona.build_corona(mesh_corona);
        mf_corona.mesh     = mesh_corona;
        mat_corona         = Resources.Load <Material>("Materials/corona");
        mr_corona.material = mat_corona;


        mesh_stars.bounds   = new Bounds(mesh_stars.bounds.center, new Vector3(100f, 100f, 100f));
        mesh_grid.bounds    = new Bounds(mesh_grid.bounds.center, new Vector3(100f, 100f, 100f));
        mesh_country.bounds = new Bounds(mesh_country.bounds.center, new Vector3(100f, 100f, 100f));
        mesh_coast.bounds   = new Bounds(mesh_coast.bounds.center, new Vector3(100f, 100f, 100f));
        mesh_corona.bounds  = new Bounds(mesh_corona.bounds.center, new Vector3(100f, 100f, 100f));

        mat_corona.SetColor("_Color0", new Color(0.07f, 0.25f, 0.16f));
        bChangeColor = true;
        bDark        = true;
        bSphere      = true;
        fDeform      = 1f;
        bChangeColor = true;

        Update();
        UpdateDeform();
    }