예제 #1
0
        public override void DrawPicking(GL_ControlModern control)
        {
            control.CurrentShader = connectLinesShaderProgram;

            Matrix4 mtx = Matrix4.CreateTranslation(Position);

            control.UpdateModelMatrix(mtx);

            GL.Uniform4(connectLinesShaderProgram["color"], control.nextPickingColor());

            GL.Begin(PrimitiveType.Lines);
            for (int i = 1; i < pathPoints.Count; i++)
            {
                PathPoint p1 = pathPoints[i - 1];
                PathPoint p2 = pathPoints[i];

                GL.VertexAttrib3(1, p1.controlPoint2);
                GL.Vertex3(p1.position);

                GL.VertexAttrib3(1, p2.controlPoint1);
                GL.Vertex3(p2.position);
            }
            GL.End();

            control.CurrentShader = defaultShaderProgram;
            GL.Uniform1(defaultShaderProgram["scale"], 0.5f);
            GL.Begin(PrimitiveType.Points);
            foreach (PathPoint point in pathPoints)
            {
                System.Drawing.Color c = control.nextPickingColor();
                GL.VertexAttrib4(1, c.R / 256f, c.G / 256f, c.B / 256f, c.A / 256f);
                GL.VertexAttrib3(2, point.controlPoint1);
                GL.VertexAttrib3(3, point.controlPoint2);
                GL.Vertex3(point.position);
            }
            GL.End();
        }
예제 #2
0
        public override void Draw(GL_ControlModern control)
        {
            GL.LineWidth(2f);
            control.CurrentShader = defaultShaderProgram;

            Matrix4 mtx = Matrix4.CreateTranslation(Position);

            control.UpdateModelMatrix(mtx);

            GL.Uniform1(defaultShaderProgram["scale"], 0.5f);

            bool picked = EditorScene.IsHovered();

            GL.Begin(PrimitiveType.Points);
            {
                int i = 1;
                foreach (PathPoint point in pathPoints)
                {
                    GL.VertexAttrib4(1, (picked || EditorScene.IsHovered(i)) ? CubeColor * 0.5f + hoverColor * 0.5f : CubeColor);
                    GL.VertexAttrib3(2, point.controlPoint1);
                    GL.VertexAttrib3(3, point.controlPoint2);
                    GL.Vertex3(point.position);
                    i++;
                }
            }
            GL.End();

            control.CurrentShader = defaultLinesShaderProgram;
            GL.Uniform1(defaultLinesShaderProgram["scale"], 0.5f);

            GL.Begin(PrimitiveType.Points);
            {
                int i = 1;
                foreach (PathPoint point in pathPoints)
                {
                    GL.VertexAttrib4(1, (picked || EditorScene.IsHovered(i)) ? hoverColor : lineColor);
                    GL.VertexAttrib3(2, point.controlPoint1);
                    GL.VertexAttrib3(3, point.controlPoint2);
                    GL.Vertex3(point.position);
                    i++;
                }
            }
            GL.End();

            control.CurrentShader = connectLinesShaderProgram;

            GL.Uniform4(connectLinesShaderProgram["color"], picked ? hoverColor : CubeColor);

            GL.Begin(PrimitiveType.Lines);
            for (int i = 1; i < pathPoints.Count; i++)
            {
                PathPoint p1 = pathPoints[i - 1];
                PathPoint p2 = pathPoints[i];

                GL.VertexAttrib3(1, p1.controlPoint2);
                GL.Vertex3(p1.position);

                GL.VertexAttrib3(1, p2.controlPoint1);
                GL.Vertex3(p2.position);
            }
            GL.End();
        }