public static void ConvertAnimation(
            EntityManager dstEntityManager,
            GameObjectConversionSystem conversionSystem,
            Component component)
        {
            var bakedData = Bakery.BakeClips(component.gameObject);

            if (bakedData == null || bakedData.AnimationCount <= 0)
            {
                return;
            }

            var offset        = 0;
            var animClipArray = new NativeList <AnimationClipInfo>(bakedData.AnimationCount, Allocator.Temp);

            foreach (var anim in bakedData.Animations)
            {
                animClipArray.Add(new AnimationClipInfo
                {
                    Offset     = offset,
                    ClipLength = anim.ClipLength,
                    FrameCount = anim.FramesCount,
                    WrapMode   = AnimationClipInfo.ToMode(anim.WrapMode),
                });
                offset += anim.FramesCount;
            }

            var animationBakedBuffer = new AnimationBakedBuffer(bakedData.Buffer);

            var renderers = component.GetComponentsInChildren <Renderer>();

            foreach (var renderer in renderers)
            {
                if (renderer == null)
                {
                    Debug.LogWarning("Missing renderer");
                    continue;
                }

                var primaryRendererEntity = conversionSystem.GetPrimaryEntity(renderer);

                dstEntityManager.AddComponent <BoneIndexOffset>(primaryRendererEntity);

                dstEntityManager.AddComponent <AnimatedTag>(primaryRendererEntity);
                dstEntityManager.AddComponent <AnimationState>(primaryRendererEntity);
                dstEntityManager.AddComponent <BoneIndexOffset>(primaryRendererEntity);
                dstEntityManager.AddComponentData(primaryRendererEntity, new BonesCount {
                    Value = bakedData.BonesCount
                });
                dstEntityManager.AddSharedComponentData(primaryRendererEntity, animationBakedBuffer);
                dstEntityManager.AddBuffer <AnimationClipInfo>(primaryRendererEntity).CopyFrom(animClipArray);

                foreach (var rendererEntity in conversionSystem.GetEntities(renderer))
                {
                    if (dstEntityManager.HasComponent <RenderMesh>(rendererEntity))
                    {
                        var renderMesh    = dstEntityManager.GetSharedComponentData <RenderMesh>(rendererEntity);
                        var renderMeshKey = ToHash128(ref renderMesh);
                        if (!sharedMesh.ContainsKey(renderMeshKey))
                        {
                            sharedMesh.Add(renderMeshKey, BakeryUtils.CopyAndFillBonesUV(renderMesh.mesh));
                        }
                        if (!sharedMaterial.ContainsKey(renderMeshKey))
                        {
                            var size    = BakeryUtils.NextPowerOfTwo((int)math.sqrt(animationBakedBuffer.Length));
                            var texture = new Texture2D(size, size, TextureFormat.RGBAFloat,
                                                        false)
                            {
                                wrapMode   = TextureWrapMode.Clamp,
                                filterMode = FilterMode.Point,
                                anisoLevel = 0,
                            };
                            animationBakedBuffer.SetPixels(texture);
                            texture.Apply(false, false);

                            var material = Object.Instantiate(renderMesh.material);
                            material.SetTexture(AnimationsNameId, texture);
                            material.SetVector(AnimationsSizeNameId, new Vector4(size, size));

                            sharedMaterial.Add(renderMeshKey, material);
                        }

                        renderMesh.mesh     = sharedMesh[renderMeshKey];
                        renderMesh.material = sharedMaterial[renderMeshKey];

                        dstEntityManager.SetSharedComponentData(rendererEntity, renderMesh);
                    }
                }
            }

            animClipArray.Dispose();
        }