Esempio n. 1
0
        /// <summary>
        /// Gets the data from the texture.
        /// </summary>
        /// <typeparam name="T">Type of data in the array</typeparam>
        /// <param name="data">The array of data</param>
        /// <exception cref="System.ArgumentNullException">Thrown if data is null.</exception>
        /// <exception cref="Tesla.Core.TeslaException">Thrown if there is an error reading from the texture
        /// or arguments are invalid, check the inner exception for additional details.</exception>
        /// <remarks>See implementors for details on other exceptions that can be thrown.</remarks>
        public void GetData <T>(T[] data) where T : struct
        {
            if (data == null || data.Length == 0)
            {
                throw new ArgumentNullException("Data cannot be null.");
            }

            try {
                _impl.GetData <T>(data, 0, 0, _impl.Width, 0, _impl.Height, 0, _impl.Depth, 0, data.Length);
            } catch (Exception e) {
                throw new TeslaException("Error writing to texture: \n" + e.Message, e);
            }
        }