Esempio n. 1
0
        /// <summary>
        /// Perform a set of random fault line increments on the height texture.
        /// </summary>
        /// <param name="count">The number of lines to push.</param>
        /// <param name="push">How much to push the height texture up or down per line.</param>
        public void Fault(int count, float push)
        {
            Vector4nb[] lines   = TemporaryData;
            int         maxPass = 4000;

            while (count > 0)
            {
                int passCount = Math.Min(count, maxPass);
                for (int i = 0; i < passCount; i++)
                {
                    lines[i] = new Vector4nb(Rng.NextVector4d());
                }
                Fault(lines, passCount, push);
                count -= passCount;
            }
        }
Esempio n. 2
0
 /// <summary>Read an array of <c>Vector4nb</c> values.</summary>
 public static Vector4nb[] ReadArrayVector4nb(this BinaryReader reader, int count)
 {
     Vector4nb[] array = new Vector4nb[count]; reader.ReadArray(array, 0, count); return array;
 }
Esempio n. 3
0
 /// <summary>Read a <see cref="Vector4nb"/>.</summary>
 public static void ReadVector4nb(this BinaryReader reader , out Vector4nb result)
 {
     result.X = reader.ReadNormalizedByte();
                                 result.Y = reader.ReadNormalizedByte();
                                 result.Z = reader.ReadNormalizedByte();
                                 result.W = reader.ReadNormalizedByte();
             return;
 }
Esempio n. 4
0
        void WriteTemporaryTexture(Vector4nb[] data, int count)
        {
            if (data == null)
                throw new ArgumentNullException("lines");
            if (count > data.Length || count < 0)
                throw new ArgumentOutOfRangeException("count");

            throw new NotImplementedException();
            /*int width = TemporaryTexture.Width;
            int rows = data.Length / width, remainder = data.Length % width;

            Program.Parameters["TemporaryTexture"].SetValue((Texture2D)null);
            Program.CurrentTechnique.Passes[0].Apply();

            if (rows > 0)
                TemporaryTexture.SetData(0, new Rectangle(0, 0, width, rows), data, 0, rows * width);
            if (remainder > 0)
                TemporaryTexture.SetData(0, new Rectangle(0, rows, remainder, 1), data, rows * width, remainder);

            Program.Parameters["TemporaryTexture"].SetValue(TemporaryTexture);*/
        }
Esempio n. 5
0
        /// <summary>
        /// Perform a set of random fault line increments on the height texture.
        /// </summary>
        /// <param name="count">The number of lines to push.</param>
        /// <param name="push">How much to push the height texture up or down per line.</param>
        public void Fault(int count, float push)
        {
            Vector4nb[] lines = TemporaryData;
            int maxPass = 4000;

            while (count > 0)
            {
                int passCount = Math.Min(count, maxPass);
                for (int i = 0; i < passCount; i++)
                    lines[i] = new Vector4nb(Rng.NextVector4d());
                Fault(lines, passCount, push);
                count -= passCount;
            }
        }
Esempio n. 6
0
 /// <summary>
 /// Perform a set of fault line increments on the height texture.
 /// </summary>
 /// <param name="lines">Each pair of values is a line to separate the texture. Any point on the left of the line is pushed down, any point on the right of the line is pulled up.</param>
 /// <param name="count">The number of lines to push.</param>
 /// <param name="push">How much to push the height texture up or down.</param>
 public void Fault(Vector4nb[] lines, int count, float push)
 {
     WriteTemporaryTexture(lines, count);
     Program.Uniforms["FaultCount"].Set(count);
     Program.Uniforms["FaultPush"].Set(push);
     ProcessHeightAll("Fault");
 }