/// <summary> /// Random stars in a box, filling a buffer /// </summary> /// <param name="buffer">GL Buffer</param> /// <param name="number">Count</param> /// <param name="left">Left side of box</param> /// <param name="right">Right side of box</param> /// <param name="front">Front side of box</param> /// <param name="back">Back side of box</param> /// <param name="top">Top side of box</param> /// <param name="bottom">Bottom side of box</param> /// <param name="rnd">Random class to get values from, or null for autocreate</param> /// <param name="seed">Seed for random class if rnd=null </param> /// <param name="w">Value for Vector4.w</param> /// <returns>Vector4[]</returns> public static void RandomStars4(GLBuffer buffer, int number, float left, float right, float front, float back, float top, float bottom, Random rnd = null, int seed = 23, float w = 1) { if (rnd == null) { rnd = new Random(seed); } buffer.AlignFloat(); for (int s = 0; s < number; s++) { float[] a = new float[] { rnd.Next(100000) * (right - left) / 100000.0f + left, rnd.Next(100000) * (top - bottom) / 100000.0f + bottom, rnd.Next(100000) * (back - front) / 100000.0f + front, w }; buffer.WriteCont(a); } }