Beispiel #1
0
 private void FindRanges()
 {
     if (this.disableReadBack && this.DisplacementBuffer.IsGPU)
     {
         this.MaxDisplacement = new Vector2(0f, 40f * this.gridScale);
     }
     else if (this.m_findRangeTask == null || this.m_findRangeTask.Done)
     {
         if (this.m_findRangeTask == null)
         {
             this.m_findRangeTask = new FindRangeTask(this);
         }
         this.m_findRangeTask.Reset();
         this.m_scheduler.Run(this.m_findRangeTask);
     }
 }
Beispiel #2
0
 private void Release()
 {
     if (this.m_displacementBuffer != null)
     {
         this.m_displacementBuffer.Release();
         this.m_displacementBuffer = null;
     }
     if (this.m_slopeBuffer != null)
     {
         this.m_slopeBuffer.Release();
         this.m_slopeBuffer = null;
     }
     if (this.m_jacobianBuffer != null)
     {
         this.m_jacobianBuffer.Release();
         this.m_jacobianBuffer = null;
     }
     if (this.m_readBuffer != null)
     {
         this.m_readBuffer.Release();
         this.m_readBuffer = null;
     }
     if (this.m_conditions != null && this.m_conditions[0] != null && this.m_conditions[0].Done)
     {
         this.CacheCondition(this.m_conditions[0]);
         if (this.m_conditionCache == null || !this.m_conditionCache.ContainsKey(this.m_conditions[0].Key))
         {
             this.m_conditions[0].Release();
             this.m_conditions[0] = null;
         }
     }
     if (this.m_conditions != null && this.m_conditions[1] != null && this.m_conditions[1].Done && (this.m_conditionCache == null || !this.m_conditionCache.ContainsKey(this.m_conditions[1].Key)))
     {
         this.m_conditions[1].Release();
         this.m_conditions[1] = null;
     }
     this.m_conditions    = null;
     this.m_findRangeTask = null;
     RTUtility.ReleaseAndDestroy(this.m_displacementMaps);
     this.m_displacementMaps = null;
     RTUtility.ReleaseAndDestroy(this.m_slopeMaps);
     this.m_slopeMaps = null;
     RTUtility.ReleaseAndDestroy(this.m_foamMaps);
     this.m_foamMaps = null;
 }
Beispiel #3
0
		/// <summary>
		/// Finds the max range of the displacement data.
		/// Used to determine the range the waves cover.
		/// </summary>
		void FindRanges()
		{

			if(disableReadBack && DisplacementBuffer.IsGPU)
			{
				//If using GPU and readback disabled then have to set
				//max disable to the max possible. This may cause 
				//loss of some resolution in the projected grid.
				MaxDisplacement = new Vector2(0.0f, Ocean.MAX_SPECTRUM_WAVE_HEIGHT * gridScale);
			}
			else if(m_findRangeTask == null || m_findRangeTask.Done)
			{
				if(m_findRangeTask == null)
					m_findRangeTask = new FindRangeTask(this);
				
				m_findRangeTask.Reset();
				m_scheduler.Run(m_findRangeTask);
			}

            //Debug.Log(Time.frameCount + " " + MaxDisplacement.y);

		}
Beispiel #4
0
        /// <summary>
        /// Release all data.
        /// </summary>
        void Release()
        {
            if (m_displacementBuffer != null)
            {
                m_displacementBuffer.Release();
                m_displacementBuffer = null;
            }

            if (m_slopeBuffer != null)
            {
                m_slopeBuffer.Release();
                m_slopeBuffer = null;
            }

            if (m_jacobianBuffer != null)
            {
                m_jacobianBuffer.Release();
                m_jacobianBuffer = null;
            }

            if (m_readBuffer != null)
            {
                m_readBuffer.Release();
                m_readBuffer = null;
            }

			if(m_conditions != null && m_conditions[0] != null && m_conditions[0].Done)
            {

                //Cache the condition so it can be resued.
                CacheCondition(m_conditions[0]);

                //if not a cached condition then release it.
                if (m_conditionCache == null || !m_conditionCache.ContainsKey(m_conditions[0].Key))
                {
                    m_conditions[0].Release();
                    m_conditions[0] = null;
                }
     
            }

			if(m_conditions != null && m_conditions[1] != null && m_conditions[1].Done)
            {
                //if not a cached condition then release it.
                if (m_conditionCache == null || !m_conditionCache.ContainsKey(m_conditions[1].Key))
                {
                    m_conditions[1].Release();
                    m_conditions[1] = null;
                }
            }

            m_conditions = null;
			m_findRangeTask = null;

            RTUtility.ReleaseAndDestroy(m_displacementMaps);
            m_displacementMaps = null;

            RTUtility.ReleaseAndDestroy(m_slopeMaps);
            m_slopeMaps = null;

            RTUtility.ReleaseAndDestroy(m_foamMaps);
            m_foamMaps = null;

        }
Beispiel #5
0
 private void Release()
 {
     if (this.m_displacementBuffer != null)
     {
         this.m_displacementBuffer.Release();
         this.m_displacementBuffer = null;
     }
     if (this.m_slopeBuffer != null)
     {
         this.m_slopeBuffer.Release();
         this.m_slopeBuffer = null;
     }
     if (this.m_jacobianBuffer != null)
     {
         this.m_jacobianBuffer.Release();
         this.m_jacobianBuffer = null;
     }
     if (this.m_readBuffer != null)
     {
         this.m_readBuffer.Release();
         this.m_readBuffer = null;
     }
     if (this.m_conditions != null && this.m_conditions[0] != null && this.m_conditions[0].Done)
     {
         this.CacheCondition(this.m_conditions[0]);
         if (this.m_conditionCache == null || !this.m_conditionCache.ContainsKey(this.m_conditions[0].Key))
         {
             this.m_conditions[0].Release();
             this.m_conditions[0] = null;
         }
     }
     if (this.m_conditions != null && this.m_conditions[1] != null && this.m_conditions[1].Done && (this.m_conditionCache == null || !this.m_conditionCache.ContainsKey(this.m_conditions[1].Key)))
     {
         this.m_conditions[1].Release();
         this.m_conditions[1] = null;
     }
     this.m_conditions = null;
     this.m_findRangeTask = null;
     RTUtility.ReleaseAndDestroy(this.m_displacementMaps);
     this.m_displacementMaps = null;
     RTUtility.ReleaseAndDestroy(this.m_slopeMaps);
     this.m_slopeMaps = null;
     RTUtility.ReleaseAndDestroy(this.m_foamMaps);
     this.m_foamMaps = null;
 }
Beispiel #6
0
 private void FindRanges()
 {
     if (this.disableReadBack && this.DisplacementBuffer.IsGPU)
     {
         this.MaxDisplacement = new Vector2(0f, 40f * this.gridScale);
     }
     else if (this.m_findRangeTask == null || this.m_findRangeTask.Done)
     {
         if (this.m_findRangeTask == null)
         {
             this.m_findRangeTask = new FindRangeTask(this);
         }
         this.m_findRangeTask.Reset();
         this.m_scheduler.Run(this.m_findRangeTask);
     }
 }