Пример #1
0
        public override void Draw(GL_ControlLegacy control)
        {
            control.ResetModelMatrix();
            GL.Begin(PrimitiveType.Quads);
            GL.Color3(1f, 0f, 0f);
            GL.Vertex3(-10f, -0.25f, 5f);

            GL.Color3(0f, 1f, 0f);
            GL.Vertex3(10f, -0.25f, 5f);

            GL.Color3(1f, 1f, 0f);
            GL.Vertex3(10f, -0.25f, -5f);

            GL.Color3(0f, 0f, 1f);
            GL.Vertex3(-10f, -0.25f, -5f);
            GL.End();

            control.ApplyModelTransform(Matrix4.CreateTranslation(-8, 0, 0));

            for (int i = 0; i < 5; i++)
            {
                GL.Begin(PrimitiveType.Quads);
                if (i + 1 == pickedIndex)
                {
                    GL.Color3(0f, 1f, 0f);
                }
                else
                {
                    GL.Color3(1f, 0f, 0f);
                }
                GL.Vertex3(-0.5f, 2f, 0f);
                GL.Vertex3(0.5f, 2f, 0f);
                GL.Vertex3(0.5f, 1.25f, 0f);
                GL.Vertex3(-0.5f, 1.25f, 0f);

                GL.Vertex3(-1.5f, 2.5f, 0f);
                GL.Vertex3(1.5f, 2.5f, 0f);
                GL.Vertex3(1.5f, 2f, 0f);
                GL.Vertex3(-1.5f, 2f, 0f);

                //trowsers
                if (i + 1 == selectedIndex)
                {
                    GL.Color3(1f, 1f, 1f);
                }
                else
                {
                    GL.Color3(0, 0.2f, 1f);
                }
                GL.Vertex3(-0.5f, 1.25f, 0f);
                GL.Vertex3(0.5f, 1.25f, 0f);
                GL.Vertex3(0.5f, 0.75f, 0f);
                GL.Vertex3(-0.5f, 0.75f, 0f);

                GL.Vertex3(-0.5f, 0.75f, 0f);
                GL.Vertex3(-0.125f, 0.75f, 0f);
                GL.Vertex3(-0.125f, -0.25f, 0f);
                GL.Vertex3(-0.5f, -0.25f, 0f);

                GL.Vertex3(0.125f, 0.75f, 0f);
                GL.Vertex3(0.5f, 0.75f, 0f);
                GL.Vertex3(0.5f, -0.25f, 0f);
                GL.Vertex3(0.125f, -0.25f, 0f);

                //stripes
                GL.Vertex3(-0.375f, 2.5f, -0.02f);
                GL.Vertex3(-0.125f, 2.5f, -0.02f);
                GL.Vertex3(-0.125f, 1.25f, -0.02f);
                GL.Vertex3(-0.375f, 1.25f, -0.02f);

                GL.Vertex3(0.125f, 2.5f, -0.02f);
                GL.Vertex3(0.375f, 2.5f, -0.02f);
                GL.Vertex3(0.375f, 1.25f, -0.02f);
                GL.Vertex3(0.125f, 1.25f, -0.02f);

                GL.Vertex3(-0.375f, 2.5f, 0.02f);
                GL.Vertex3(-0.125f, 2.5f, 0.02f);
                GL.Vertex3(-0.125f, 1.25f, 0.02f);
                GL.Vertex3(-0.375f, 1.25f, 0.02f);

                GL.Vertex3(0.125f, 2.5f, 0.02f);
                GL.Vertex3(0.375f, 2.5f, 0.02f);
                GL.Vertex3(0.375f, 1.25f, 0.02f);
                GL.Vertex3(0.125f, 1.25f, 0.02f);

                //knobs
                GL.Color3(1f, 1f, 0f);
                GL.Vertex3(-0.375f, 2.25f, 0.04f);
                GL.Vertex3(-0.125f, 2.25f, 0.04f);
                GL.Vertex3(-0.125f, 2f, 0.04f);
                GL.Vertex3(-0.375f, 2f, 0.04f);

                GL.Vertex3(0.125f, 2.25f, 0.04f);
                GL.Vertex3(0.375f, 2.25f, 0.04f);
                GL.Vertex3(0.375f, 2f, 0.04f);
                GL.Vertex3(0.125f, 2f, 0.04f);
                GL.End();

                control.ApplyModelTransform(Matrix4.CreateTranslation(4, 0, 0));
            }
        }
Пример #2
0
        public override void DrawPicking(GL_ControlLegacy control)
        {
            control.ResetModelMatrix();
            GL.Begin(PrimitiveType.Quads);
            GL.Color4(0, 0, 0, 0);
            GL.Vertex3(-10f, -0.25f, 5f);

            GL.Vertex3(10f, -0.25f, 5f);

            GL.Vertex3(10f, -0.25f, -5f);

            GL.Vertex3(-10f, -0.25f, -5f);
            GL.End();

            control.ApplyModelTransform(Matrix4.CreateTranslation(-8, 0, 0));

            for (int i = 0; i < 5; i++)
            {
                GL.Begin(PrimitiveType.Quads);
                GL.Color4(control.nextPickingColor());
                GL.Vertex3(-0.5f, 2f, 0f);
                GL.Vertex3(0.5f, 2f, 0f);
                GL.Vertex3(0.5f, 1.25f, 0f);
                GL.Vertex3(-0.5f, 1.25f, 0f);

                GL.Vertex3(-1.5f, 2.5f, 0f);
                GL.Vertex3(1.5f, 2.5f, 0f);
                GL.Vertex3(1.5f, 2f, 0f);
                GL.Vertex3(-1.5f, 2f, 0f);

                //trowsers
                GL.Vertex3(-0.5f, 1.25f, 0f);
                GL.Vertex3(0.5f, 1.25f, 0f);
                GL.Vertex3(0.5f, 0.75f, 0f);
                GL.Vertex3(-0.5f, 0.75f, 0f);

                GL.Vertex3(-0.5f, 0.75f, 0f);
                GL.Vertex3(-0.125f, 0.75f, 0f);
                GL.Vertex3(-0.125f, -0.25f, 0f);
                GL.Vertex3(-0.5f, -0.25f, 0f);

                GL.Vertex3(0.125f, 0.75f, 0f);
                GL.Vertex3(0.5f, 0.75f, 0f);
                GL.Vertex3(0.5f, -0.25f, 0f);
                GL.Vertex3(0.125f, -0.25f, 0f);

                //stripes
                GL.Vertex3(-0.375f, 2.5f, -0.02f);
                GL.Vertex3(-0.125f, 2.5f, -0.02f);
                GL.Vertex3(-0.125f, 1.25f, -0.02f);
                GL.Vertex3(-0.375f, 1.25f, -0.02f);

                GL.Vertex3(0.125f, 2.5f, -0.02f);
                GL.Vertex3(0.375f, 2.5f, -0.02f);
                GL.Vertex3(0.375f, 1.25f, -0.02f);
                GL.Vertex3(0.125f, 1.25f, -0.02f);

                GL.Vertex3(-0.375f, 2.5f, 0.02f);
                GL.Vertex3(-0.125f, 2.5f, 0.02f);
                GL.Vertex3(-0.125f, 1.25f, 0.02f);
                GL.Vertex3(-0.375f, 1.25f, 0.02f);

                GL.Vertex3(0.125f, 2.5f, 0.02f);
                GL.Vertex3(0.375f, 2.5f, 0.02f);
                GL.Vertex3(0.375f, 1.25f, 0.02f);
                GL.Vertex3(0.125f, 1.25f, 0.02f);

                //knobs
                GL.Vertex3(-0.375f, 2.25f, 0.04f);
                GL.Vertex3(-0.125f, 2.25f, 0.04f);
                GL.Vertex3(-0.125f, 2f, 0.04f);
                GL.Vertex3(-0.375f, 2f, 0.04f);

                GL.Vertex3(0.125f, 2.25f, 0.04f);
                GL.Vertex3(0.375f, 2.25f, 0.04f);
                GL.Vertex3(0.375f, 2f, 0.04f);
                GL.Vertex3(0.125f, 2f, 0.04f);
                GL.End();

                control.ApplyModelTransform(Matrix4.CreateTranslation(4, 0, 0));
            }
        }