Esempio n. 1
0
        void ProcessCameraIndicator()
        {
            int FI;
            int YI;

            bool BS  = false;
            bool GS  = false;
            bool RS  = false;
            bool RS1 = false;
            bool GS1 = false;
            bool BS1 = false;
            bool OS  = false;

            if (requestClick && MiniGL.GetClickBufferData(130 - (GL.RenderWidth - rcX), 128 - (GL.RenderHeight - (this.ClientSize.Height - rcY)), out FI, out YI))
            {
                if (YI == 1) //BLUE
                {
                    TargetPosition = new Vector3(0, 0, DistanceCenter) + ModelCenter;
                    TargetRotation = new Vector3(0, 0, 180);
                }
                else if (YI == 2) //RED
                {
                    TargetPosition = new Vector3(DistanceCenter, 0, 0) + ModelCenter;
                    TargetRotation = new Vector3(0, 0, -90);
                }
                else if (YI == 3) //GREEN
                {
                    TargetPosition = new Vector3(0, DistanceCenter, 0) + ModelCenter;
                    TargetRotation = new Vector3(0, 90, 0);
                }
                else if (YI == 4) //WHITE
                {
                    if (TMatrix == 1f)
                    {
                        TMatrix = 0f;
                    }
                    else
                    {
                        TMatrix = 1f;
                    }
                }
                else if (YI == 5) //BLUE1
                {
                    TargetPosition = new Vector3(0, 0, -DistanceCenter) + ModelCenter;
                    TargetRotation = new Vector3(0, 0, 0);
                }
                else if (YI == 6) //GREEN1
                {
                    TargetPosition = new Vector3(0, -DistanceCenter, 0) + ModelCenter;
                    TargetRotation = new Vector3(0, -90, 0);
                }
                else if (YI == 7) //RED1
                {
                    TargetPosition = new Vector3(-DistanceCenter, 0, 0) + ModelCenter;
                    TargetRotation = new Vector3(0, 0, 90);
                }

                if (YI != 4)
                {
                    requestHome = true;
                }
                requestClick = false;
            }

            int sourceX = 0;
            int sourceY = 0;

            this.Invoke((Action) delegate(){
                sourceX = this.PointToClient(Cursor.Position).X;
                sourceY = this.PointToClient(Cursor.Position).Y;
            });

            if (MiniGL.GetClickBufferData(130 - (GL.RenderWidth - sourceX), 128 - (GL.RenderHeight - (this.ClientSize.Height - sourceY)), out FI, out YI))
            {
                BS  = YI == 1;
                RS  = YI == 2;
                GS  = YI == 3;
                OS  = YI == 4;
                BS1 = YI == 5;
                GS1 = YI == 6;
                RS1 = YI == 7;
            }


            MiniGL.Clear();
            MiniGL.ClearClickBuffer();
            MiniGL.ClearDepth();

            //DRAW CENTER AXIS INDICATOR PIECE
            MiniGL.SetClickBufferInt(4);
            MiniGL.SelectBuffer(CICVertex);
            CI_RAngle = new Vector3(0, 0, 0);
            CI_Color  = new Vector3(1f, 1f, 1f);
            if (OS)
            {
                CI_Color = CI_Color * 0.5f;
            }
            SMPLT = true; MiniGL.Draw(); SMPLT = false;

            MiniGL.SelectBuffer(CIPVertex);

            //DRAW BLUE AXIS INDICATOR
            MiniGL.SetClickBufferInt(1);
            CI_Color = new Vector3(1, 0.69f, 0.14f);
            if (BS)
            {
                CI_Color = CI_Color * 0.5f;
            }
            CI_RAngle = new Vector3(0, 0, 180);
            MiniGL.Draw();

            //DRAW RED AXIS INDICATOR
            MiniGL.SetClickBufferInt(2);
            CI_Color = new Vector3(0, 0, 1);
            if (RS)
            {
                CI_Color = CI_Color * 0.5f;
            }
            CI_RAngle = new Vector3(0, 0, 90);
            MiniGL.Draw();

            MiniGL.SetClickBufferInt(7);
            CI_Color = new Vector3(1, 1, 1);
            if (RS1)
            {
                CI_Color = CI_Color * 0.5f;
            }
            CI_RAngle = new Vector3(0, 0, 270);
            MiniGL.Draw();


            MiniGL.SetClickBufferInt(5);
            CI_Color = new Vector3(1, 1, 1);
            if (BS1)
            {
                CI_Color = CI_Color * 0.5f;
            }
            CI_RAngle = new Vector3(0, 0, 0);
            MiniGL.Draw();


            MiniGL.SetClickBufferInt(3);
            CI_Color = new Vector3(0, 1, 0);
            if (GS)
            {
                CI_Color = CI_Color * 0.5f;
            }
            CI_RAngle = new Vector3(0, -90, 0);
            MiniGL.Draw();

            MiniGL.SetClickBufferInt(6);
            CI_Color = new Vector3(1, 1, 1);
            if (GS1)
            {
                CI_Color = CI_Color * 0.5f;
            }
            CI_RAngle = new Vector3(0, 90, 0);
            MiniGL.Draw();
        }