Exemplo n.º 1
0
        /// <summary>
        /// Get item enumerator based on viewpoint
        /// </summary>
        /// <param name="point"></param>
        /// <returns></returns>
        public IEnumerable <T> Select(Point3D viewpoint)
        {
            Halfspace halfspace = partition.Classify(viewpoint);

            if (halfspace == Halfspace.Negative)
            {
                if (front != null)
                {
                    foreach (var item in front.Select(viewpoint))
                    {
                        yield return(item);
                    }
                }
            }
            else if (back != null)
            {
                foreach (var item in back.Select(viewpoint))
                {
                    yield return(item);
                }
            }

            foreach (var item in items)
            {
                yield return(item);
            }

            if (halfspace == Halfspace.Negative)
            {
                if (back != null)
                {
                    foreach (var item in back.Select(viewpoint))
                    {
                        yield return(item);
                    }
                }
            }
            else if (front != null)
            {
                foreach (var item in front.Select(viewpoint))
                {
                    yield return(item);
                }
            }
        }
Exemplo n.º 2
0
        public void OnTick(object sender, EventArgs e)
        {
            if (tree != null)
            {
                var viewpoint = camera.GetRotationMatrix().Transform(camera.Position);
                var items     = tree.Select(viewpoint).ToArray();

                var animated  = ApplyAnimation();
                var reordered = Reorder(items);

                if (animated || reordered || needsRefresh)
                {
                    Refresh(items, viewpoint);
                }
            }

            timer.Begin();
        }