public FourierTask(WaveSpectrumBufferCPU buffer, FourierCPU fourier, int index, int numGrids) : base(true) { if (m_index == -1) { throw new InvalidOperationException("Index can be -1. Fourier for multiple buffers is not being used"); } if (!(buffer is DisplacementBufferCPU)) //TODO - fix me { throw new InvalidOperationException("Fourier task currently only designed for displacement buffers"); } m_buffer = buffer as DisplacementBufferCPU; m_fourier = fourier; m_index = index; m_numGrids = numGrids; WaveSpectrumBufferCPU.Buffer b = m_buffer.GetBuffer(m_index); m_data = b.data; m_results = b.results; m_map = b.map; m_doublePacked = b.doublePacked; }
/// <summary> /// Reset task to inital state so it can be reran by the scheduler. /// Saves having to create a new object each frame. /// </summary> public void Reset(int index, int numGrids) { base.Reset(); if (m_index == -1) { throw new InvalidOperationException("Index can be -1. Fourier for multiple buffers is not being used"); } m_index = index; m_numGrids = numGrids; WaveSpectrumBufferCPU.Buffer b = m_buffer.GetBuffer(m_index); m_data = b.data; m_results = b.results; m_map = b.map; m_doublePacked = b.doublePacked; }