Exemplo n.º 1
0
        internal static AtomicSafetyHandle GetSafetyHandle([NotNull("ArgumentNullException")] this Sprite sprite)
        {
            AtomicSafetyHandle result;

            SpriteDataAccessExtensions.GetSafetyHandle_Injected(sprite, out result);
            return(result);
        }
Exemplo n.º 2
0
        private static SpriteChannelInfo GetChannelInfo([NotNull("ArgumentNullException")] Sprite sprite, VertexAttribute channel)
        {
            SpriteChannelInfo result;

            SpriteDataAccessExtensions.GetChannelInfo_Injected(sprite, channel, out result);
            return(result);
        }
Exemplo n.º 3
0
        private static SpriteChannelInfo GetIndicesInfo([NotNull("ArgumentNullException")] Sprite sprite)
        {
            SpriteChannelInfo result;

            SpriteDataAccessExtensions.GetIndicesInfo_Injected(sprite, out result);
            return(result);
        }
Exemplo n.º 4
0
        public static NativeArray <ushort> GetIndices(this Sprite sprite)
        {
            SpriteChannelInfo    indicesInfo = SpriteDataAccessExtensions.GetIndicesInfo(sprite);
            NativeArray <ushort> result      = NativeArrayUnsafeUtility.ConvertExistingDataToNativeArray <ushort>(indicesInfo.buffer, indicesInfo.count, Allocator.Invalid);

            NativeArrayUnsafeUtility.SetAtomicSafetyHandle <ushort>(ref result, sprite.GetSafetyHandle());
            return(result);
        }
Exemplo n.º 5
0
        public static NativeArray <Matrix4x4> GetBindPoses(this Sprite sprite)
        {
            SpriteChannelInfo       bindPoseInfo = SpriteDataAccessExtensions.GetBindPoseInfo(sprite);
            NativeArray <Matrix4x4> result       = NativeArrayUnsafeUtility.ConvertExistingDataToNativeArray <Matrix4x4>(bindPoseInfo.buffer, bindPoseInfo.count, Allocator.Invalid);

            NativeArrayUnsafeUtility.SetAtomicSafetyHandle <Matrix4x4>(ref result, sprite.GetSafetyHandle());
            return(result);
        }
Exemplo n.º 6
0
        public unsafe static NativeSlice <T> GetVertexAttribute <T>(this Sprite sprite, VertexAttribute channel) where T : struct
        {
            SpriteDataAccessExtensions.CheckAttributeTypeMatchesAndThrow <T>(channel);
            SpriteChannelInfo channelInfo = SpriteDataAccessExtensions.GetChannelInfo(sprite, channel);
            byte *            dataPointer = (byte *)channelInfo.buffer + channelInfo.offset;
            NativeSlice <T>   result      = NativeSliceUnsafeUtility.ConvertExistingDataToNativeSlice <T>((void *)dataPointer, channelInfo.stride, channelInfo.count);

            NativeSliceUnsafeUtility.SetAtomicSafetyHandle <T>(ref result, sprite.GetSafetyHandle());
            return(result);
        }
Exemplo n.º 7
0
        internal unsafe static void SetDeformableBuffer(this SpriteRenderer spriteRenderer, NativeArray <byte> src)
        {
            if (spriteRenderer.sprite == null)
            {
                throw new ArgumentException(String.Format("spriteRenderer does not have a valid sprite set."));
            }

            if (src.Length != SpriteDataAccessExtensions.GetPrimaryVertexStreamSize(spriteRenderer.sprite))
            {
                throw new InvalidOperationException(String.Format("custom sprite vertex data size must match sprite asset's vertex data size {0} {1}", src.Length, SpriteDataAccessExtensions.GetPrimaryVertexStreamSize(spriteRenderer.sprite)));
            }

            SetDeformableBuffer(spriteRenderer, src.GetUnsafeReadOnlyPtr(), src.Length);
        }
Exemplo n.º 8
0
        internal static void SetDeformableBuffer(this SpriteRenderer spriteRenderer, NativeArray <byte> src)
        {
            bool flag = spriteRenderer.sprite == null;

            if (flag)
            {
                throw new ArgumentException(string.Format("spriteRenderer does not have a valid sprite set.", new object[0]));
            }
            bool flag2 = src.Length != SpriteDataAccessExtensions.GetPrimaryVertexStreamSize(spriteRenderer.sprite);

            if (flag2)
            {
                throw new InvalidOperationException(string.Format("custom sprite vertex data size must match sprite asset's vertex data size {0} {1}", src.Length, SpriteDataAccessExtensions.GetPrimaryVertexStreamSize(spriteRenderer.sprite)));
            }
            SpriteRendererDataAccessExtensions.SetDeformableBuffer(spriteRenderer, src.GetUnsafeReadOnlyPtr <byte>(), src.Length);
        }
Exemplo n.º 9
0
 public static void SetIndices(this Sprite sprite, NativeArray <ushort> src)
 {
     SpriteDataAccessExtensions.SetIndicesData(sprite, src.GetUnsafeReadOnlyPtr <ushort>(), src.Length);
 }
Exemplo n.º 10
0
 public static void SetBindPoses(this Sprite sprite, NativeArray <Matrix4x4> src)
 {
     SpriteDataAccessExtensions.SetBindPoseData(sprite, src.GetUnsafeReadOnlyPtr <Matrix4x4>(), src.Length);
 }
Exemplo n.º 11
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>());
 }
Exemplo n.º 12
0
 public static void SetBones(this Sprite sprite, SpriteBone[] src)
 {
     SpriteDataAccessExtensions.SetBoneData(sprite, src);
 }
Exemplo n.º 13
0
 public static SpriteBone[] GetBones(this Sprite sprite)
 {
     return(SpriteDataAccessExtensions.GetBoneInfo(sprite));
 }