Ejemplo n.º 1
0
        public static NativeSlice <T> GetVertexAttribute <T>(this Sprite sprite, VertexAttribute channel) where T : struct
        {
            SpriteDataAccessExtensions.CheckAttributeTypeMatchesAndThrow <T>(channel);
            SpriteChannelInfo channelInfo = SpriteDataAccessExtensions.GetChannelInfo(sprite, channel);
            NativeSlice <T>   result      = NativeSliceUnsafeUtility.ConvertExistingDataToNativeSlice <T>(channelInfo.buffer, channelInfo.offset, channelInfo.count, channelInfo.stride);

            NativeSliceUnsafeUtility.SetAtomicSafetyHandle <T>(ref result, sprite.GetSafetyHandle());
            return(result);
        }
Ejemplo n.º 2
0
 public static void SetVertexAttribute <T>(this Sprite sprite, VertexAttribute channel, NativeArray <T> src) where T : struct
 {
     SpriteDataAccessExtensions.CheckAttributeTypeMatchesAndThrow <T>(channel);
     SpriteDataAccessExtensions.SetChannelData(sprite, channel, src.GetUnsafeReadOnlyPtr <T>());
 }