/// <summary>
        /// Draws the specified object shadows
        /// </summary>
        /// <param name="graphics">Graphics</param>
        /// <param name="context">Context</param>
        /// <param name="c">Scene object</param>
        private void DrawShadows(Graphics graphics, DrawContextShadows context, SceneObject c)
        {
            graphics.SetRasterizerShadowMapping();
            graphics.SetDepthStencilShadowMapping();

            if (c.AlphaEnabled)
            {
                graphics.SetBlendTransparent();
            }
            else
            {
                graphics.SetBlendDefault();
            }

            c.Get <IDrawable>().DrawShadows(context);
        }
        /// <summary>
        /// Gets if the specified object is not culled by the cull index
        /// </summary>
        /// <param name="c">Scene object</param>
        /// <param name="cullIndex">Cull index</param>
        /// <returns>Returns true if the object is not culled</returns>
        private bool IsVisible(SceneObject c, int cullIndex)
        {
            if (!c.Is <Drawable>())
            {
                return(false);
            }

            var cull = c.Get <ICullable>();

            if (cull != null)
            {
                return(!this.cullManager.GetCullValue(cullIndex, cull).Culled);
            }

            return(true);
        }
        /// <summary>
        /// Draws an transparent object
        /// </summary>
        /// <param name="context">Drawing context</param>
        /// <param name="c">Component</param>
        protected virtual void DrawTransparent(DrawContext context, SceneObject c)
        {
            var graphics = this.Game.Graphics;

            Counters.MaxInstancesPerFrame += c.Count;

            graphics.SetRasterizerDefault();

            this.SetBlendStateTransparent(context);

            if (c.DepthEnabled)
            {
                graphics.SetDepthStencilZEnabled();
            }
            else
            {
                graphics.SetDepthStencilZDisabled();
            }

            c.Get <IDrawable>().Draw(context);
        }
        /// <summary>
        /// Sorts an object list by distance to culling point of view
        /// </summary>
        /// <param name="c1">Scene object one</param>
        /// <param name="c2">Scene object two</param>
        /// <param name="cullIndex">Cull index</param>
        /// <returns></returns>
        private int Sort(SceneObject c1, SceneObject c2, int cullIndex)
        {
            int res = c1.DepthEnabled.CompareTo(c2.DepthEnabled);

            if (res == 0)
            {
                var cull1 = c1.Get <ICullable>();
                var cull2 = c2.Get <ICullable>();

                var d1 = cull1 != null?this.cullManager.GetCullValue(cullIndex, cull1).Distance : float.MaxValue;

                var d2 = cull2 != null?this.cullManager.GetCullValue(cullIndex, cull2).Distance : float.MaxValue;

                res = -d1.CompareTo(d2);
            }

            if (res == 0)
            {
                res = c1.Order.CompareTo(c2.Order);
            }

            return(res);
        }
        /// <summary>
        /// Sorting transparent list comparer
        /// </summary>
        /// <param name="index">Cull index</param>
        /// <param name="c1">First component</param>
        /// <param name="c2">Second component</param>
        /// <returns>Returns sorting order (far first)</returns>
        protected virtual int SortTransparents(int index, SceneObject c1, SceneObject c2)
        {
            int res = c1.DepthEnabled.CompareTo(c2.DepthEnabled);

            if (res == 0)
            {
                var cull1 = c1.Get <ICullable>();
                var cull2 = c2.Get <ICullable>();

                var d1 = cull1 != null?this.cullManager.GetCullValue(index, cull1).Distance : float.MaxValue;

                var d2 = cull2 != null?this.cullManager.GetCullValue(index, cull2).Distance : float.MaxValue;

                res = -d1.CompareTo(d2);
            }

            if (res == 0)
            {
                res = -c1.Order.CompareTo(c2.Order);
            }

            return(-res);
        }