Exemplo n.º 1
0
        /// <summary>
        /// Query the waves at world position xz with a batch of querys in a task.
        /// This will run the querys on a separate thread.
        /// The call back function will be called when the batch has finished.
        /// </summary>
        public void QueryWavesWithAsyncTask(WaveQueryTask task)
        {
            if (task == null || m_scheduler == null)
            {
                return;
            }
            if (task.IsScheduled && !task.Done)
            {
                return;
            }

            if (enabled)
            {
                task.Reset(Spectrum, PositionOffset, level);

                if (task.SupportsOverlays)
                {
                    task.OverlaySampler = OverlayManager;
                }
                else
                {
                    task.OverlaySampler = null;
                }

                task.IsScheduled = true;
                m_scheduler.Run(task);
            }
        }
Exemplo n.º 2
0
        public void QueryWavesAsync(IEnumerable <WaveQuery> querys, Action <IEnumerable <WaveQuery> > callBack)
        {
            IDisplacementBuffer displacementBuffer = this.Spectrum.DisplacementBuffer;

            if (base.enabled && this.Spectrum != null && displacementBuffer != null && (!displacementBuffer.IsGPU || !this.Spectrum.DisableReadBack))
            {
                WaveQueryTask task = new WaveQueryTask(this.Spectrum, this.level, this.PositionOffset, querys, callBack);
                this.m_scheduler.Run(task);
            }
            else
            {
                foreach (WaveQuery waveQuery in querys)
                {
                    waveQuery.result.Clear();
                    waveQuery.result.height = this.level;
                }
                callBack(querys);
            }
        }
        /// <summary>
        /// Query the waves at world position xz
        /// with a batch of querys.
        /// This will run the querys on a separate thread.
        /// The call back function will be called when the
        /// batch has finished.
        /// Make sure the batch has finished before resubmitting it.
        ///
        /// NOTE - Currently will not sample the wave overlays.
        ///
        /// </summary>
        public void QueryWavesAsync(IEnumerable <WaveQuery> querys, Action <IEnumerable <WaveQuery> > callBack)
        {
            IDisplacementBuffer buffer = Spectrum.DisplacementBuffer;

            if (enabled && Spectrum != null && buffer != null && !(buffer.IsGPU && Spectrum.DisableReadBack))
            {
                WaveQueryTask task = new WaveQueryTask(Spectrum, level, PositionOffset, querys, callBack);
                m_scheduler.Run(task);
            }
            else
            {
                //There is no spectrum to query or its displacement
                //buffer does not support querys.
                //Clear results and call callback.
                foreach (WaveQuery query in querys)
                {
                    query.result.Clear();
                    query.result.height = level;
                }

                callBack(querys);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Query the waves at world position xz
        /// with a batch of querys.
        /// This will run the querys on a separate thread.
        /// The call back function will be called when the
        /// batch has finished.
        /// Make sure the batch has finished before resubmitting it.
        /// 
        /// NOTE - Currently will not sample the wave overlays.
        /// 
        /// </summary>
		public void QueryWavesAsync(IEnumerable<WaveQuery> querys, Action<IEnumerable<WaveQuery>> callBack)
		{

			IDisplacementBuffer buffer = Spectrum.DisplacementBuffer;

			if(enabled && Spectrum != null && buffer != null && !(buffer.IsGPU && Spectrum.DisableReadBack))
			{
				WaveQueryTask task = new WaveQueryTask(Spectrum, level, PositionOffset, querys, callBack);
				m_scheduler.Run(task);
			}
			else
			{
                //There is no spectrum to query or its displacement
                //buffer does not support querys.
                //Clear results and call callback.
				foreach(WaveQuery query in querys)
				{
					query.result.Clear();
					query.result.height = level;
				}

				callBack(querys);
			}
			
		}