Beispiel #1
0
        private void AddStars()
        {
            Texture2D texture2D = this.CMProvider.Global.Load <Texture2D>("Other Textures/FullWhite");

            if (StarField.StarGeometry != null && !this.HasHorizontalTrails)
            {
                Group group = this.StarsMesh.AddGroup();
                group.Texture  = (Texture)texture2D;
                group.Geometry = StarField.StarGeometry;
            }
            else
            {
                Color[]   pointColors  = (Color[])null;
                Vector3[] pointPairs   = (Vector3[])null;
                float     num1         = 49f;
                float     num2         = num1;
                Vector3[] pointCenters = new Vector3[(int)((double)num2 * (double)num1 * (double)num2)];
                if (this.HasHorizontalTrails)
                {
                    pointColors = new Color[(int)((double)num2 * (double)num1 * (double)num2) * 2];
                    pointPairs  = new Vector3[(int)((double)num2 * (double)num1 * (double)num2) * 2];
                }
                Random random = RandomHelper.Random;
                int    num3   = 0;
                int    index1 = 0;
                for (int index2 = 0; (double)index2 < (double)num2; ++index2)
                {
                    for (int index3 = 0; (double)index3 < (double)num1; ++index3)
                    {
                        for (int index4 = 0; (double)index4 < (double)num2; ++index4)
                        {
                            Vector3 vector3 = new Vector3((float)(((double)index2 - (double)num2 / 2.0) * 100.0), (float)(((double)index3 - (double)num1 / 2.0) * 100.0), (float)(((double)index4 - (double)num2 / 2.0) * 100.0));
                            pointCenters[num3++] = vector3;
                            if (this.HasHorizontalTrails)
                            {
                                pointPairs[index1]     = vector3;
                                pointPairs[index1 + 1] = vector3;
                                byte num4 = (byte)random.Next(0, 256);
                                byte num5 = (byte)random.Next(0, 256);
                                pointColors[index1]     = new Color((int)num5, 0, (int)num4, 0);
                                pointColors[index1 + 1] = new Color((int)num5, 0, (int)num4, (int)byte.MaxValue);
                                index1 += 2;
                            }
                        }
                    }
                }
                Group group;
                StarField.AddPoints(group = this.StarsMesh.AddGroup(), pointCenters, (Texture)texture2D, 2f);
                StarField.StarGeometry    = group.Geometry;
                if (!this.HasHorizontalTrails)
                {
                    return;
                }
                this.TrailsMesh.AddLines(pointColors, pointPairs, true);
            }
        }
Beispiel #2
0
 private void AddStars()
 {
   Texture2D texture2D = this.CMProvider.Global.Load<Texture2D>("Other Textures/FullWhite");
   if (StarField.StarGeometry != null && !this.HasHorizontalTrails)
   {
     Group group = this.StarsMesh.AddGroup();
     group.Texture = (Texture) texture2D;
     group.Geometry = StarField.StarGeometry;
   }
   else
   {
     Color[] pointColors = (Color[]) null;
     Vector3[] pointPairs = (Vector3[]) null;
     float num1 = 49f;
     float num2 = num1;
     Vector3[] pointCenters = new Vector3[(int) ((double) num2 * (double) num1 * (double) num2)];
     if (this.HasHorizontalTrails)
     {
       pointColors = new Color[(int) ((double) num2 * (double) num1 * (double) num2) * 2];
       pointPairs = new Vector3[(int) ((double) num2 * (double) num1 * (double) num2) * 2];
     }
     Random random = RandomHelper.Random;
     int num3 = 0;
     int index1 = 0;
     for (int index2 = 0; (double) index2 < (double) num2; ++index2)
     {
       for (int index3 = 0; (double) index3 < (double) num1; ++index3)
       {
         for (int index4 = 0; (double) index4 < (double) num2; ++index4)
         {
           Vector3 vector3 = new Vector3((float) (((double) index2 - (double) num2 / 2.0) * 100.0), (float) (((double) index3 - (double) num1 / 2.0) * 100.0), (float) (((double) index4 - (double) num2 / 2.0) * 100.0));
           pointCenters[num3++] = vector3;
           if (this.HasHorizontalTrails)
           {
             pointPairs[index1] = vector3;
             pointPairs[index1 + 1] = vector3;
             byte num4 = (byte) random.Next(0, 256);
             byte num5 = (byte) random.Next(0, 256);
             pointColors[index1] = new Color((int) num5, 0, (int) num4, 0);
             pointColors[index1 + 1] = new Color((int) num5, 0, (int) num4, (int) byte.MaxValue);
             index1 += 2;
           }
         }
       }
     }
     Group group;
     StarField.AddPoints(group = this.StarsMesh.AddGroup(), pointCenters, (Texture) texture2D, 2f);
     StarField.StarGeometry = group.Geometry;
     if (!this.HasHorizontalTrails)
       return;
     this.TrailsMesh.AddLines(pointColors, pointPairs, true);
   }
 }