Esempio n. 1
0
        public void IndicatorIntersect(Ray ray, WatchView view)
        {
            IndicatorGroup result = null;
            float?         closestIntersection = float.MaxValue;

            foreach (IndicatorGroup group in indicatorView[view])
            {
                var intersectionResult = group.Intersects(ray);
                if (intersectionResult != null && intersectionResult < closestIntersection)
                {
                    closestIntersection = intersectionResult;
                    result = group;
                }
            }
            if (result != null)
            {
                foreach (var group in indicatorView[view])
                {
                    if (group.active)
                    {
                        group.Inactive();
                    }
                }
                result.Active();
            }
        }
Esempio n. 2
0
        public override void InitIndicators()
        {
            float offset = .2f;

            // init view dict
            indicatorView = new Dictionary <WatchView, List <IndicatorGroup> >();

            // side view
            List <IndicatorGroup> indicatorsSide = new List <IndicatorGroup>();

            // Indicators for height
            Indicator      ind_1     = new Indicator(new Vector3(-OutRadius - offset, -Height / 2, 0), Vector3.UnitY, Vector3.UnitZ, device);
            Indicator      ind_2     = new Indicator(new Vector3(-OutRadius - offset, Height / 2, 0), -Vector3.UnitY, Vector3.UnitZ, device);
            IndicatorGroup ig_height = new IndicatorGroup(Dimension.Height);

            ig_height.AddToGroup(ind_1);
            ig_height.AddToGroup(ind_2);
            ig_height.Active();

            indicatorsSide.Add(ig_height);

            indicatorView.Add(WatchView.Side, indicatorsSide);

            // front view
            List <IndicatorGroup> indicatorsFront = new List <IndicatorGroup>();

            // Indicators for Outer Radius
            Indicator      ind_3        = new Indicator(new Vector3((OutRadius + offset) / 1.4f, Height / 2, (OutRadius + offset) / 1.4f), new Vector3(-1, 0, -1), new Vector3(-1, 0, 1), device);
            Indicator      ind_4        = new Indicator(new Vector3((InRadius - offset) / 1.4f, Height / 2, (InRadius - offset) / 1.4f), new Vector3(1, 0, 1), new Vector3(1, 0, -1), device);
            IndicatorGroup ig_outradius = new IndicatorGroup(Dimension.OuterRadius);

            ig_outradius.AddToGroup(ind_3);
            ig_outradius.AddToGroup(ind_4);
            ig_outradius.Active();
            indicatorsFront.Add(ig_outradius);

            Indicator      ind_5   = new Indicator(new Vector3(0, Height / 2, (OutRadius + offset)), -Vector3.UnitZ, Vector3.UnitX, device);
            Indicator      ind_6   = new Indicator(new Vector3(0, Height / 2, -(OutRadius + offset)), Vector3.UnitZ, Vector3.UnitX, device);
            IndicatorGroup ig_vert = new IndicatorGroup(Dimension.Vertical);

            ig_vert.AddToGroup(ind_5);
            ig_vert.AddToGroup(ind_6);
            indicatorsFront.Add(ig_vert);

            Indicator      ind_7   = new Indicator(new Vector3((OutRadius + offset), Height / 2, 0), -Vector3.UnitX, Vector3.UnitZ, device);
            Indicator      ind_8   = new Indicator(new Vector3(-(OutRadius + offset), Height / 2, 0), Vector3.UnitX, Vector3.UnitZ, device);
            IndicatorGroup ig_hori = new IndicatorGroup(Dimension.Horizontal);

            ig_hori.AddToGroup(ind_7);
            ig_hori.AddToGroup(ind_8);
            indicatorsFront.Add(ig_hori);

            indicatorView.Add(WatchView.Front, indicatorsFront);
        }
Esempio n. 3
0
        public override void InitIndicators()
        {
            /***** Parameter reference
             * Height
             * BottomWidth
             * TopWidth
             * HalfSideWidth
             * SidePosition
             * StrapWidth
             * CaseRadius
             *
             * TopRight
             *******/

            float offset = .2f;

            // init view dict
            indicatorView = new Dictionary <WatchView, List <IndicatorGroup> >();

            // side view
            List <IndicatorGroup> indicatorsSide = new List <IndicatorGroup>();

            // Indicators for height
            Indicator      ind_1     = new Indicator(TopLeft * CaseRadius + Vector3.UnitZ * Height + Vector3.Left * TopWidth, -Vector3.UnitZ, Vector3.UnitY, device);
            Indicator      ind_2     = new Indicator(TopLeft * CaseRadius + Vector3.Left * BottomWidth, Vector3.UnitZ, Vector3.UnitY, device);
            IndicatorGroup ig_height = new IndicatorGroup(Dimension.Height);

            ig_height.AddToGroup(ind_1);
            ig_height.AddToGroup(ind_2);
            ig_height.Active();
            indicatorsSide.Add(ig_height);

            Indicator      ind_7   = new Indicator(TopLeft * CaseRadius + Vector3.UnitZ * Height / 2 + Vector3.Left * TopWidth + Vector3.Up * HalfSideWidth, -Vector3.UnitY, Vector3.UnitZ, device);
            Indicator      ind_8   = new Indicator(TopLeft * CaseRadius + Vector3.UnitZ * Height / 2 + Vector3.Left * TopWidth + Vector3.Down * HalfSideWidth, Vector3.UnitY, Vector3.UnitZ, device);
            IndicatorGroup ig_side = new IndicatorGroup(Dimension.SideWidth);

            ig_side.AddToGroup(ind_7);
            ig_side.AddToGroup(ind_8);
            indicatorsSide.Add(ig_side);

            indicatorView.Add(WatchView.Side, indicatorsSide);

            // front view
            List <IndicatorGroup> indicatorsFront = new List <IndicatorGroup>();

            // Indicators for Outer Radius
            Indicator      ind_3  = new Indicator(TopLeft * CaseRadius + Vector3.Up * (HalfSideWidth + offset) + Vector3.UnitZ * Height + Vector3.Left * TopWidth, Vector3.UnitX, Vector3.UnitZ, device);
            Indicator      ind_4  = new Indicator(TopLeft * CaseRadius + Vector3.Up * (HalfSideWidth + offset) + Vector3.UnitZ * Height, -Vector3.UnitX, Vector3.UnitZ, device);
            IndicatorGroup ig_top = new IndicatorGroup(Dimension.TopWidth);

            ig_top.AddToGroup(ind_3);
            ig_top.AddToGroup(ind_4);
            ig_top.Active();
            indicatorsFront.Add(ig_top);

            Indicator      ind_5  = new Indicator(TopLeft * CaseRadius + Vector3.Up * (HalfSideWidth + offset * 5) + Vector3.Left * BottomWidth, Vector3.UnitX, Vector3.UnitZ, device);
            Indicator      ind_6  = new Indicator(TopLeft * CaseRadius + Vector3.Up * (HalfSideWidth + offset * 5), -Vector3.UnitX, Vector3.UnitZ, device);
            IndicatorGroup ig_bot = new IndicatorGroup(Dimension.BottomWidth);

            ig_bot.AddToGroup(ind_5);
            ig_bot.AddToGroup(ind_6);
            indicatorsFront.Add(ig_bot);

            indicatorView.Add(WatchView.Front, indicatorsFront);
        }