Пример #1
0
        /// <summary>
        /// Gets an array of values to the associated parameter in the constant buffer.
        /// </summary>
        /// <typeparam name = "T">The type of the value to read from the buffer.</typeparam>
        /// <returns>The value of this parameter.</returns>
        public T[] GetValueArray <T>(int count) where T : struct
        {
            int size;

            if (AlignedToFloat4 <T>(out size))
            {
                var values      = new T[count];
                int localOffset = offset;
                for (int i = 0; i < values.Length; i++, localOffset += size)
                {
                    buffer.Get(localOffset, out values[i]);
                }

                return(values);
            }
            return(buffer.GetRange <T>(offset, count));
        }
Пример #2
0
 /// <summary>
 /// Gets an array of values to the associated parameter in the constant buffer.
 /// </summary>
 /// <typeparam name = "T">The type of the value to read from the buffer.</typeparam>
 /// <returns>The value of this parameter.</returns>
 public T[] GetValueArray <T>(int count) where T : struct
 {
     return(buffer.GetRange <T>(offset, count));
 }