コード例 #1
0
        public void OnClicked(Mouse mouse, RayWrap ray)
        {
            var camera = Program.Camera;

            if (mouse.RightClicked)
            {
                var hitPoss       = HitPos(ray);
                var nearestHitted = hitPoss.MinValue(pos => (pos.HitPosition - camera.Position).Length());
                //hitted.ToString( ).DebugWrite( );
                // ドラッグしてるとき別のにフォーカス取られるのを避ける
                if (nearestHitted.HasValue && !LatticePointControl.IsDragging)
                {
                    HitResult value = nearestHitted.Value;
                    LatticePointControl.Position = value.HitPosition;
                    // Lattice の文字分消す
                    var index = value.Info.Remove(0, 7).Int();
                    HandlingIndex = new Some <int>(index);
                    //Lattice.LatticeData[index].Value
                }
            }

            if (HandlingIndex.HasValue)
            {
                LatticePointControl.OnClicked(mouse, ray);
                Lattice.LatticeData[HandlingIndex.Value].Value = new TexturedVertex(LatticePointControl.Position);
            }
        }
コード例 #2
0
        // hitpos からrayがくる
        public void OnClicked(Mouse mouse, RayWrap ray)
        {
            if (!mouse.Clicked)
            {
                state.EndClick( );
                return;
            }
            //Util.DebugWrite( $"DraggingState {state.IsDragging}" );
            if (state.IsDragging)
            {
                //Util.DebugWrite( $"Dragging {state.Axis}" );
                Dragging(ray);
                return;
            }

            foreach (Face item in Faces)
            {
                HitResult res = ray.IntersectFace(item);
                if (res.IsHit)
                {
                    // red redHead
                    // redRot
                    if (res.Info == "red" || res.Info == "redHead")
                    {
                        state.Update(res, ClickedAxis.X);
                        break;
                    }
                    if (res.Info == "redRot")
                    {
                        state.Update(res, ClickedAxis.XRot);
                        break;
                    }

                    if (res.Info == "green" || res.Info == "greenHead")
                    {
                        state.Update(res, ClickedAxis.Y);
                        break;
                    }
                    if (res.Info == "greenRot")
                    {
                        state.Update(res, ClickedAxis.YRot);
                        break;
                    }

                    if (res.Info == "blue" || res.Info == "blueHead")
                    {
                        state.Update(res, ClickedAxis.Z);
                        break;
                    }
                    if (res.Info == "blueRot")
                    {
                        state.Update(res, ClickedAxis.ZRot);
                        break;
                    }

                    //Util.DebugWrite( $"start {res.Info}" );
                }
            }
        }
コード例 #3
0
 IEnumerable <HitResult> HitPos(RayWrap ray)
 {
     foreach (var point in LatticePoint)
     {
         foreach (var hitResult in point.HitPos(ray))
         {
             yield return(hitResult);
         }
     }
 }
コード例 #4
0
 public IEnumerable <HitResult> HitPos(RayWrap ray)
 {
     foreach (Face item in Faces)
     {
         HitResult res = ray.IntersectFace(item);
         if (res.IsHit)
         {
             yield return(res);
         }
     }
 }
コード例 #5
0
        public void OnClicked(Mouse mouse, RayWrap ray)
        {
            for (int i = 0; i < Depth.Count; i++)
            {
                Vertice[Depth[i]].Position = ray.To;
            }
            foreach (var i in Near)
            {
                //i.SetPosition(ray.From);
            }

            Mesh.SetOnly(Vertice, Index.ToArray( ));
        }
コード例 #6
0
 public void Update(RayWrap ray)
 {
     Widget.UpdateCapture(Parent, ray);
 }
コード例 #7
0
 void Dragging(RayWrap ray)
 {
     state.Update(ray);
 }