public WaveQueryTask(WaveSpectrumBase spectrum, float level, Vector3 offset, IEnumerable <WaveQuery> querys, Action <IEnumerable <WaveQuery> > callBack) : base(true)
        {
            IDisplacementBuffer buffer = spectrum.DisplacementBuffer;

            buffer.CopyAndCreateDisplacements(out m_displacements);

            m_querys   = querys;
            m_callBack = callBack;
            m_enabled  = buffer.EnabledBuffers();
            m_level    = level;

            Vector4 invGridSizes = new Vector4();

            invGridSizes.x = 1.0f / (spectrum.GridSizes.x * spectrum.GridScale);
            invGridSizes.y = 1.0f / (spectrum.GridSizes.y * spectrum.GridScale);
            invGridSizes.z = 1.0f / (spectrum.GridSizes.z * spectrum.GridScale);
            invGridSizes.w = 1.0f / (spectrum.GridSizes.w * spectrum.GridScale);

            m_scaling = new QueryGridScaling();
            m_scaling.invGridSizes = invGridSizes;
            m_scaling.choppyness   = spectrum.Choppyness * spectrum.GridScale;
            m_scaling.scaleY       = spectrum.GridScale;
            m_scaling.offset       = offset;
            //tmp buffer to reduce memory allocations.
            m_scaling.tmp = new float[QueryDisplacements.CHANNELS];
        }
Exemplo n.º 2
0
        public WaveQueryTask(WaveSpectrumBase spectrum, float level, Vector3 offset, IEnumerable<WaveQuery> querys, Action<IEnumerable<WaveQuery>> callBack)
            : base(true)
        {
            IDisplacementBuffer buffer = spectrum.DisplacementBuffer;

            buffer.CopyAndCreateDisplacements(out m_displacements);

            m_querys = querys;
            m_callBack = callBack;
            m_enabled = buffer.EnabledBuffers();
            m_level = level;

            Vector4 invGridSizes = new Vector4();
            invGridSizes.x = 1.0f / (spectrum.GridSizes.x * spectrum.GridScale);
            invGridSizes.y = 1.0f / (spectrum.GridSizes.y * spectrum.GridScale);
            invGridSizes.z = 1.0f / (spectrum.GridSizes.z * spectrum.GridScale);
            invGridSizes.w = 1.0f / (spectrum.GridSizes.w * spectrum.GridScale);

            m_scaling = new QueryGridScaling();
            m_scaling.invGridSizes = invGridSizes;
            m_scaling.choppyness = spectrum.Choppyness * spectrum.GridScale;
            m_scaling.scaleY = spectrum.GridScale;
            m_scaling.offset = offset;
            //tmp buffer to reduce memory allocations.
            m_scaling.tmp = new float[QueryDisplacements.CHANNELS];
        }
Exemplo n.º 3
0
        public WaveQueryTask(IEnumerable <WaveQuery> querys, Action <IEnumerable <WaveQuery> > callback, bool isThreaded)
            : base(isThreaded)
        {
            Querys   = querys;
            CallBack = callback;

            Scaling = new QueryGridScaling();
        }
Exemplo n.º 4
0
 public void QueryWaves(WaveQuery query, QueryGridScaling scaling)
 {
     int num = this.EnabledBuffers();
     if (num == 0)
     {
         return;
     }
     QueryDisplacements.QueryWaves(query, num, this.m_displacements, scaling);
 }
        public void QueryWaves(WaveQuery query, QueryGridScaling scaling)
        {
            int enabled = EnabledBuffers();

            //If no buffers are enabled there is nothing to sample.
            if(enabled == 0) return;

            QueryDisplacements.QueryWaves(query, enabled, m_displacements, scaling);
        }
Exemplo n.º 6
0
        public void QueryWaves(WaveQuery query, QueryGridScaling scaling)
        {
            int num = this.EnabledBuffers();

            if (num == 0)
            {
                return;
            }
            QueryDisplacements.QueryWaves(query, num, this.m_displacements, scaling);
        }
Exemplo n.º 7
0
        public void QueryWaves(WaveQuery query, QueryGridScaling scaling)
        {
            int num = this.EnabledBuffers();

            if (num == 0)
            {
                return;
            }
            InterpolatedArray2f[] readDisplacements = this.GetReadDisplacements();
            QueryDisplacements.QueryWaves(query, num, readDisplacements, scaling);
        }
Exemplo n.º 8
0
        public void QueryWaves(WaveQuery query, QueryGridScaling scaling)
        {
            int enabled = EnabledBuffers();

            //If no buffers are enabled there is nothing to sample.
            if (enabled == 0)
            {
                return;
            }

            QueryDisplacements.QueryWaves(query, enabled, m_displacements, scaling);
        }
Exemplo n.º 9
0
        public void QueryWaves(WaveQuery query, QueryGridScaling scaling)
        {
            int enabled = EnabledBuffers();

            //If no buffers are enabled there is nothing to sample.
            if (enabled == 0)
            {
                return;
            }

            InterpolatedArray2f[] displacements = GetReadDisplacements();

            QueryDisplacements.QueryWaves(query, enabled, displacements, scaling);
        }
Exemplo n.º 10
0
 public static void QueryWaves(WaveQuery query, int enabled, IList<InterpolatedArray2f> displacements, QueryGridScaling scaling)
 {
     if (displacements.Count != QueryDisplacements.GRIDS)
     {
         throw new InvalidOperationException("Query Displacements requires a displacement buffer for each of the " + QueryDisplacements.GRIDS + " grids.");
     }
     if (displacements[0].Channels != QueryDisplacements.CHANNELS)
     {
         throw new InvalidOperationException("Query Displacements requires displacement buffers have " + QueryDisplacements.CHANNELS + " channels.");
     }
     if (query.mode != QUERY_MODE.DISPLACEMENT && query.mode != QUERY_MODE.POSITION)
     {
         return;
     }
     float num = query.posX + scaling.offset.x;
     float num2 = query.posZ + scaling.offset.z;
     if (enabled == 0)
     {
         return;
     }
     if (enabled == 1 || query.mode == QUERY_MODE.DISPLACEMENT)
     {
         QueryDisplacements.SampleHeightOnly(query.result.displacement, displacements, query.sampleSpectrum, num, num2, scaling, scaling.tmp);
         query.result.height = query.result.displacement[0].y + query.result.displacement[1].y + query.result.displacement[2].y + query.result.displacement[3].y;
         query.result.displacementX = 0f;
         query.result.displacementZ = 0f;
         query.result.iterations = 0;
         query.result.error = 0f;
         query.result.height = Mathf.Clamp(query.result.height, -40f, 40f);
     }
     else
     {
         float num3 = num;
         float num4 = num2;
         float num5 = num;
         float num6 = num2;
         float num7 = query.minError;
         if (num7 < 0.1f)
         {
             num7 = 0.1f;
         }
         num7 *= num7;
         int num8 = 0;
         float num9;
         float num10;
         float num13;
         do
         {
             num5 += num - num3;
             num6 += num2 - num4;
             QueryDisplacements.Sample(query.result.displacement, displacements, query.sampleSpectrum, num5, num6, scaling, scaling.tmp);
             num9 = query.result.displacement[0].x + query.result.displacement[1].x + query.result.displacement[2].x + query.result.displacement[3].x;
             num10 = query.result.displacement[0].z + query.result.displacement[1].z + query.result.displacement[2].z + query.result.displacement[3].z;
             num3 = num5 + num9;
             num4 = num6 + num10;
             num8++;
             float num11 = num - num3;
             float num12 = num2 - num4;
             num13 = num11 * num11 + num12 * num12;
         }
         while (num13 > num7 && num8 <= WaveQuery.MAX_ITERATIONS);
         query.result.height = query.result.displacement[0].y + query.result.displacement[1].y + query.result.displacement[2].y + query.result.displacement[3].y;
         query.result.displacementX = num9;
         query.result.displacementZ = num10;
         query.result.iterations = num8;
         query.result.error = num13;
         query.result.height = Mathf.Clamp(query.result.height, -40f, 40f);
     }
 }
Exemplo n.º 11
0
        static void Sample(Vector3[] d, IList <InterpolatedArray2f> displacements, bool[] sample, float x, float z, QueryGridScaling scaling, float[] result)
        {
            float u, v;

            if (sample[0] && scaling.numGrids > 0)
            {
                u = x * scaling.invGridSizes.x;
                v = z * scaling.invGridSizes.x;

                displacements[0].Get(u, v, result);

                d[0].x = result[0] * scaling.choppyness.x;
                d[0].y = result[1] * scaling.scaleY;
                d[0].z = result[2] * scaling.choppyness.x;
            }

            if (sample[1] && scaling.numGrids > 1)
            {
                u = x * scaling.invGridSizes.y;
                v = z * scaling.invGridSizes.y;

                displacements[1].Get(u, v, result);

                d[1].x = result[0] * scaling.choppyness.y;
                d[1].y = result[1] * scaling.scaleY;
                d[1].z = result[2] * scaling.choppyness.y;
            }

            if (sample[2] && scaling.numGrids > 2)
            {
                u = x * scaling.invGridSizes.z;
                v = z * scaling.invGridSizes.z;

                displacements[2].Get(u, v, result);

                d[2].x = result[0] * scaling.choppyness.z;
                d[2].y = result[1] * scaling.scaleY;
                d[2].z = result[2] * scaling.choppyness.z;
            }

            if (sample[3] && scaling.numGrids > 3)
            {
                u = x * scaling.invGridSizes.w;
                v = z * scaling.invGridSizes.w;

                displacements[3].Get(u, v, result);

                d[3].x = result[0] * scaling.choppyness.w;
                d[3].y = result[1] * scaling.scaleY;
                d[3].z = result[2] * scaling.choppyness.w;
            }
        }
Exemplo n.º 12
0
        public static void QueryWaves(WaveQuery query, int enabled, IList <InterpolatedArray2f> displacements, QueryGridScaling scaling)
        {
            if (displacements.Count != GRIDS)
            {
                throw new InvalidOperationException("Query Displacements requires a displacement buffer for each of the " + GRIDS + " grids.");
            }

            if (displacements[0].Channels != CHANNELS)
            {
                throw new InvalidOperationException("Query Displacements requires displacement buffers have " + CHANNELS + " channels.");
            }

            //Only these modes are relevant to this code.
            if (query.mode != QUERY_MODE.DISPLACEMENT && query.mode != QUERY_MODE.POSITION)
            {
                return;
            }

            float x = query.posX + scaling.offset.x;
            float z = query.posZ + scaling.offset.z;

            if (enabled == 0)
            {
                return;
            }
            else if (enabled == 1 || query.mode == QUERY_MODE.DISPLACEMENT)
            {
                SampleHeightOnly(query.result.displacement, displacements, query.sampleSpectrum, x, z, scaling, scaling.tmp);

                query.result.height        = query.result.displacement[0].y + query.result.displacement[1].y + query.result.displacement[2].y + query.result.displacement[3].y;
                query.result.displacementX = 0.0f;
                query.result.displacementZ = 0.0f;
                query.result.iterations    = 0;
                query.result.error         = 0.0f;

                query.result.height = Mathf.Clamp(query.result.height, -Ocean.MAX_SPECTRUM_WAVE_HEIGHT, Ocean.MAX_SPECTRUM_WAVE_HEIGHT);
            }
            else
            {
                float lx, lz;
                float dx = x;
                float dz = z;
                float u  = x;
                float v  = z;

                float displacementX;
                float displacementZ;

                float minError2 = query.minError;
                if (minError2 < 0.1f)
                {
                    minError2 = 0.1f;
                }
                minError2 = minError2 * minError2;

                float error;
                int   i = 0;

                do
                {
                    u += x - dx;
                    v += z - dz;

                    Sample(query.result.displacement, displacements, query.sampleSpectrum, u, v, scaling, scaling.tmp);

                    displacementX = query.result.displacement[0].x + query.result.displacement[1].x + query.result.displacement[2].x + query.result.displacement[3].x;
                    displacementZ = query.result.displacement[0].z + query.result.displacement[1].z + query.result.displacement[2].z + query.result.displacement[3].z;

                    dx = u + displacementX;
                    dz = v + displacementZ;

                    i++;

                    lx = x - dx;
                    lz = z - dz;

                    error = lx * lx + lz * lz;
                }while (error > minError2 && i <= WaveQuery.MAX_ITERATIONS);

                query.result.height        = query.result.displacement[0].y + query.result.displacement[1].y + query.result.displacement[2].y + query.result.displacement[3].y;
                query.result.displacementX = displacementX;
                query.result.displacementZ = displacementZ;
                query.result.iterations    = i;
                query.result.error         = error;

                query.result.height = Mathf.Clamp(query.result.height, -Ocean.MAX_SPECTRUM_WAVE_HEIGHT, Ocean.MAX_SPECTRUM_WAVE_HEIGHT);
            }
        }
Exemplo n.º 13
0
 private static void SampleHeightOnly(Vector3[] d, IList <InterpolatedArray2f> displacements, bool[] sample, float x, float z, QueryGridScaling scaling, float[] result)
 {
     if (sample[0] && scaling.numGrids > 0)
     {
         float x2 = x * scaling.invGridSizes.x;
         float y  = z * scaling.invGridSizes.x;
         displacements[0].Get(x2, y, result);
         d[0].y = result[1] * scaling.scaleY;
     }
     if (sample[1] && scaling.numGrids > 1)
     {
         float x2 = x * scaling.invGridSizes.y;
         float y  = z * scaling.invGridSizes.y;
         displacements[1].Get(x2, y, result);
         d[1].y = result[1] * scaling.scaleY;
     }
     if (sample[2] && scaling.numGrids > 2)
     {
         float x2 = x * scaling.invGridSizes.z;
         float y  = z * scaling.invGridSizes.z;
         displacements[2].Get(x2, y, result);
         d[2].y = result[1] * scaling.scaleY;
     }
     if (sample[3] && scaling.numGrids > 3)
     {
         float x2 = x * scaling.invGridSizes.w;
         float y  = z * scaling.invGridSizes.w;
         displacements[3].Get(x2, y, result);
         d[3].y = result[1] * scaling.scaleY;
     }
 }
Exemplo n.º 14
0
        public static void QueryWaves(WaveQuery query, int enabled, IList <InterpolatedArray2f> displacements, QueryGridScaling scaling)
        {
            if (displacements.Count != QueryDisplacements.GRIDS)
            {
                throw new InvalidOperationException("Query Displacements requires a displacement buffer for each of the " + QueryDisplacements.GRIDS + " grids.");
            }
            if (displacements[0].Channels != QueryDisplacements.CHANNELS)
            {
                throw new InvalidOperationException("Query Displacements requires displacement buffers have " + QueryDisplacements.CHANNELS + " channels.");
            }
            if (query.mode != QUERY_MODE.DISPLACEMENT && query.mode != QUERY_MODE.POSITION)
            {
                return;
            }
            float num  = query.posX + scaling.offset.x;
            float num2 = query.posZ + scaling.offset.z;

            if (enabled == 0)
            {
                return;
            }
            if (enabled == 1 || query.mode == QUERY_MODE.DISPLACEMENT)
            {
                QueryDisplacements.SampleHeightOnly(query.result.displacement, displacements, query.sampleSpectrum, num, num2, scaling, scaling.tmp);
                query.result.height        = query.result.displacement[0].y + query.result.displacement[1].y + query.result.displacement[2].y + query.result.displacement[3].y;
                query.result.displacementX = 0f;
                query.result.displacementZ = 0f;
                query.result.iterations    = 0;
                query.result.error         = 0f;
                query.result.height        = Mathf.Clamp(query.result.height, -40f, 40f);
            }
            else
            {
                float num3 = num;
                float num4 = num2;
                float num5 = num;
                float num6 = num2;
                float num7 = query.minError;
                if (num7 < 0.1f)
                {
                    num7 = 0.1f;
                }
                num7 *= num7;
                int   num8 = 0;
                float num9;
                float num10;
                float num13;
                do
                {
                    num5 += num - num3;
                    num6 += num2 - num4;
                    QueryDisplacements.Sample(query.result.displacement, displacements, query.sampleSpectrum, num5, num6, scaling, scaling.tmp);
                    num9  = query.result.displacement[0].x + query.result.displacement[1].x + query.result.displacement[2].x + query.result.displacement[3].x;
                    num10 = query.result.displacement[0].z + query.result.displacement[1].z + query.result.displacement[2].z + query.result.displacement[3].z;
                    num3  = num5 + num9;
                    num4  = num6 + num10;
                    num8++;
                    float num11 = num - num3;
                    float num12 = num2 - num4;
                    num13 = num11 * num11 + num12 * num12;
                }while (num13 > num7 && num8 <= WaveQuery.MAX_ITERATIONS);
                query.result.height        = query.result.displacement[0].y + query.result.displacement[1].y + query.result.displacement[2].y + query.result.displacement[3].y;
                query.result.displacementX = num9;
                query.result.displacementZ = num10;
                query.result.iterations    = num8;
                query.result.error         = num13;
                query.result.height        = Mathf.Clamp(query.result.height, -40f, 40f);
            }
        }
Exemplo n.º 15
0
        static void Sample(Vector3[] d, IList <InterpolatedArray2f> displacements, bool[] sample, float x, float z, QueryGridScaling scaling)
        {
            float u, v;

            //The array needed to sample the results is kept in the scaling
            //class to reduce memory allocations.
            float[] result = scaling.result;

            if (sample[0] && scaling.numGrids > 0)
            {
                u = x * scaling.invGridSizes.x;
                v = z * scaling.invGridSizes.x;

                displacements[0].Get(u, v, result);

                d[0].x = result[0] * scaling.choppyness.x;
                d[0].y = result[1] * scaling.scaleY;
                d[0].z = result[2] * scaling.choppyness.x;
            }

            if (sample[1] && scaling.numGrids > 1)
            {
                u = x * scaling.invGridSizes.y;
                v = z * scaling.invGridSizes.y;

                displacements[1].Get(u, v, result);

                d[1].x = result[0] * scaling.choppyness.y;
                d[1].y = result[1] * scaling.scaleY;
                d[1].z = result[2] * scaling.choppyness.y;
            }

            if (sample[2] && scaling.numGrids > 2)
            {
                u = x * scaling.invGridSizes.z;
                v = z * scaling.invGridSizes.z;

                displacements[2].Get(u, v, result);

                d[2].x = result[0] * scaling.choppyness.z;
                d[2].y = result[1] * scaling.scaleY;
                d[2].z = result[2] * scaling.choppyness.z;
            }

            if (sample[3] && scaling.numGrids > 3)
            {
                u = x * scaling.invGridSizes.w;
                v = z * scaling.invGridSizes.w;

                displacements[3].Get(u, v, result);

                d[3].x = result[0] * scaling.choppyness.w;
                d[3].y = result[1] * scaling.scaleY;
                d[3].z = result[2] * scaling.choppyness.w;
            }
        }
Exemplo n.º 16
0
        public void QueryWaves(WaveQuery query, QueryGridScaling scaling)
        {
            int enabled = EnabledBuffers();

            //If no buffers are enabled there is nothing to sample.
            if(enabled == 0) return;

            InterpolatedArray2f[] displacements = GetReadDisplacements();

            QueryDisplacements.QueryWaves(query, enabled, displacements, scaling);
        }
Exemplo n.º 17
0
 private static void Sample(Vector3[] d, IList<InterpolatedArray2f> displacements, bool[] sample, float x, float z, QueryGridScaling scaling, float[] result)
 {
     if (sample[0] && scaling.numGrids > 0)
     {
         float x2 = x * scaling.invGridSizes.x;
         float y = z * scaling.invGridSizes.x;
         displacements[0].Get(x2, y, result);
         d[0].x = result[0] * scaling.choppyness.x;
         d[0].y = result[1] * scaling.scaleY;
         d[0].z = result[2] * scaling.choppyness.x;
     }
     if (sample[1] && scaling.numGrids > 1)
     {
         float x2 = x * scaling.invGridSizes.y;
         float y = z * scaling.invGridSizes.y;
         displacements[1].Get(x2, y, result);
         d[1].x = result[0] * scaling.choppyness.y;
         d[1].y = result[1] * scaling.scaleY;
         d[1].z = result[2] * scaling.choppyness.y;
     }
     if (sample[2] && scaling.numGrids > 2)
     {
         float x2 = x * scaling.invGridSizes.z;
         float y = z * scaling.invGridSizes.z;
         displacements[2].Get(x2, y, result);
         d[2].x = result[0] * scaling.choppyness.z;
         d[2].y = result[1] * scaling.scaleY;
         d[2].z = result[2] * scaling.choppyness.z;
     }
     if (sample[3] && scaling.numGrids > 3)
     {
         float x2 = x * scaling.invGridSizes.w;
         float y = z * scaling.invGridSizes.w;
         displacements[3].Get(x2, y, result);
         d[3].x = result[0] * scaling.choppyness.w;
         d[3].y = result[1] * scaling.scaleY;
         d[3].z = result[2] * scaling.choppyness.w;
     }
 }
Exemplo n.º 18
0
        static void SampleHeightOnly(Vector3[] d, IList<InterpolatedArray2f> displacements, bool[] sample, float x, float z, QueryGridScaling scaling, float[] result)
        {
            float u, v;

            if(sample[0] && scaling.numGrids > 0)
            {
                u = x * scaling.invGridSizes.x;
                v = z * scaling.invGridSizes.x;

                displacements[0].Get(u, v, result);
                d[0].y = result[1] * scaling.scaleY;
            }

            if(sample[1] && scaling.numGrids > 1)
            {
                u = x * scaling.invGridSizes.y;
                v = z * scaling.invGridSizes.y;

                displacements[1].Get(u, v, result);
                d[1].y = result[1] * scaling.scaleY;
            }

            if(sample[2] && scaling.numGrids > 2)
            {
                u = x * scaling.invGridSizes.z;
                v = z * scaling.invGridSizes.z;

                displacements[2].Get(u, v, result);
                d[2].y = result[1] * scaling.scaleY;
            }

            if(sample[3] && scaling.numGrids > 3)
            {
                u = x * scaling.invGridSizes.w;
                v = z * scaling.invGridSizes.w;

                displacements[3].Get(u, v, result);
                d[3].y = result[1] * scaling.scaleY;
            }
        }
Exemplo n.º 19
0
        public static void QueryWaves(WaveQuery query, int enabled, IList<InterpolatedArray2f> displacements, QueryGridScaling scaling)
        {
            if(displacements.Count != GRIDS)
                throw new InvalidOperationException("Query Displacements requires a displacement buffer for each of the " + GRIDS + " grids.");

            if(displacements[0].Channels != CHANNELS)
                throw new InvalidOperationException("Query Displacements requires displacement buffers have " + CHANNELS + " channels.");

            //Only these modes are relevant to this code.
            if (query.mode != QUERY_MODE.DISPLACEMENT && query.mode != QUERY_MODE.POSITION) return;

            float x = query.posX + scaling.offset.x;
            float z = query.posZ + scaling.offset.z;

            if (enabled  == 0)
            {
                return;
            }
            else if(enabled  == 1 || query.mode == QUERY_MODE.DISPLACEMENT)
            {
                SampleHeightOnly(query.result.displacement, displacements, query.sampleSpectrum, x, z, scaling, scaling.tmp);

                query.result.height = query.result.displacement[0].y + query.result.displacement[1].y + query.result.displacement[2].y + query.result.displacement[3].y;
                query.result.displacementX = 0.0f;
                query.result.displacementZ = 0.0f;
                query.result.iterations = 0;
                query.result.error = 0.0f;

                query.result.height = Mathf.Clamp(query.result.height, -Ocean.MAX_SPECTRUM_WAVE_HEIGHT, Ocean.MAX_SPECTRUM_WAVE_HEIGHT);
            }
            else
            {
                float lx, lz;
                float dx = x;
                float dz = z;
                float u = x;
                float v = z;

                float displacementX;
                float displacementZ;

                float minError2 = query.minError;
                if(minError2 < 0.1f) minError2 = 0.1f;
                minError2 = minError2*minError2;

                float error;
                int i = 0;

                do
                {
                    u += x - dx;
                    v += z - dz;

                    Sample(query.result.displacement, displacements, query.sampleSpectrum, u, v, scaling, scaling.tmp);

                    displacementX = query.result.displacement[0].x + query.result.displacement[1].x + query.result.displacement[2].x + query.result.displacement[3].x;
                    displacementZ = query.result.displacement[0].z + query.result.displacement[1].z + query.result.displacement[2].z + query.result.displacement[3].z;

                    dx = u + displacementX;
                    dz = v + displacementZ;

                    i++;

                    lx = x-dx;
                    lz = z-dz;

                    error = lx*lx + lz*lz;
                }
                while (error > minError2 && i <= WaveQuery.MAX_ITERATIONS);

                query.result.height = query.result.displacement[0].y + query.result.displacement[1].y + query.result.displacement[2].y + query.result.displacement[3].y;
                query.result.displacementX = displacementX;
                query.result.displacementZ = displacementZ;
                query.result.iterations = i;
                query.result.error = error;

                query.result.height = Mathf.Clamp(query.result.height, -Ocean.MAX_SPECTRUM_WAVE_HEIGHT, Ocean.MAX_SPECTRUM_WAVE_HEIGHT);

            }
        }