コード例 #1
0
        public override bool OnMouseMove(OpenGL gl, MouseEventArgs e)
        {
            //	We only update the radius if the left button is
            //	down, and the buildingObject isn't null.
            Polygon plane = (Polygon)buildingObject;
            Click   click = new Click(gl, e);

            if (e.Button == MouseButtons.Left)
            {
                //	If we have clicked once, then we are setting the other corner.
                Vertex v = PointToVertexOnPlane(gl, Plane.xz, click.OpenGLx,
                                                click.OpenGLy);

                if (v != null)
                {
                    BuildingGrid grid = new BuildingGrid();
                    grid.Clamp(v);

                    Vertex v0 = plane.Vertices[0];
                    Vertex v3 = plane.Vertices[3] = v;

                    plane.Vertices[1].Set(v3.X, 0, v0.Z);
                    plane.Vertices[2].Set(v0.X, 0, v3.Z);
                }

                buildingObject.Modified = true;

                return(true);
            }

            return(base.OnMouseMove(gl, e));
        }
コード例 #2
0
        public override bool OnMouseMove(OpenGL gl, MouseEventArgs e)
        {
            //	We only update the radius if the left button is
            //	down, and the buildingObject isn't null.

            Click click = new Click(gl, e);

            if (e.Button == MouseButtons.Left)
            {
                //	If we have clicked once, then we are setting the radius.
                Vertex v = PointToVertexOnPlane(gl, Plane.xz, click.OpenGLx,
                                                click.OpenGLy);

                if (v != null)
                {
                    Vertex       v2   = clicks[0].vertex;
                    BuildingGrid grid = new BuildingGrid();
                    grid.Clamp(v);
                    grid.Clamp(v2);



                    Vertex between = v - v2;
                    ((Quadrics.Sphere)buildingObject).Radius = between.Magnitude();
                }

                buildingObject.Modified = true;

                return(true);
            }

            return(base.OnMouseMove(gl, e));
        }
コード例 #3
0
        public override SceneObject OnMouseDown(OpenGL gl, MouseEventArgs e)
        {
            base.OnMouseDown(gl, e);

            Polygon plane = (Polygon)buildingObject;

            //	When the user presses the mouse down, we create the corner
            //	of the plane.

            Vertex v = PointToVertexOnPlane(gl, Plane.xz,
                                            clicks[0].OpenGLx, clicks[0].OpenGLy);

            BuildingGrid grid = new BuildingGrid();

            grid.Clamp(v);

            if (v != null)
            {
                plane.Vertices[0] = v;
            }

            return(null);
        }
コード例 #4
0
        public override SceneObject OnMouseDown(OpenGL gl, MouseEventArgs e)
        {
            base.OnMouseDown(gl, e);

            //	When the user presses the mouse down, we create the centre of the
            //	sphere.

            buildingObject = new Quadrics.Sphere();

            Vertex v = PointToVertexOnPlane(gl, Plane.xz,
                                            clicks[0].OpenGLx, clicks[0].OpenGLy);

            BuildingGrid grid = new BuildingGrid();

            grid.Clamp(v);

            if (v != null)
            {
                clicks[0].vertex         = v;
                buildingObject.Translate = v;
            }

            return(null);
        }
コード例 #5
0
ファイル: Builder.cs プロジェクト: nromik/sharpgl
        public override bool OnMouseMove(OpenGL gl, MouseEventArgs e)
        {
            //	We only update the radius if the left button is
            //	down, and the buildingObject isn't null.

            Click click = new Click(gl, e);

            if(e.Button == MouseButtons.Left)
            {

                //	If we have clicked once, then we are setting the radius.
                Vertex v = PointToVertexOnPlane(gl, Plane.xz, click.OpenGLx,
                    click.OpenGLy);

                if(v != null)
                {
                    Vertex v2 = clicks[0].vertex;
                    BuildingGrid grid = new BuildingGrid();
                    grid.Clamp(v);
                    grid.Clamp(v2);

                    Vertex between = v - v2;
                    ((Quadrics.Sphere)buildingObject).Radius = between.Magnitude();
                }

                buildingObject.Modified = true;

                return true;
            }

            return base.OnMouseMove (gl, e);
        }
コード例 #6
0
ファイル: Builder.cs プロジェクト: nromik/sharpgl
        public override SceneObject OnMouseDown(OpenGL gl, MouseEventArgs e)
        {
            base.OnMouseDown(gl, e);

            //	When the user presses the mouse down, we create the centre of the
            //	sphere.

            buildingObject = new Quadrics.Sphere();

            Vertex v = PointToVertexOnPlane(gl, Plane.xz,
                clicks[0].OpenGLx, clicks[0].OpenGLy);

            BuildingGrid grid = new BuildingGrid();
            grid.Clamp(v);

            if(v != null)
            {
                clicks[0].vertex = v;
                buildingObject.Translate = v;
            }

            return null;
        }
コード例 #7
0
ファイル: Builder.cs プロジェクト: nromik/sharpgl
        public override bool OnMouseMove(OpenGL gl, MouseEventArgs e)
        {
            //	We only update the radius if the left button is
            //	down, and the buildingObject isn't null.
            Polygon plane = (Polygon)buildingObject;
            Click click = new Click(gl, e);

            if(e.Button == MouseButtons.Left)
            {
                //	If we have clicked once, then we are setting the other corner.
                Vertex v = PointToVertexOnPlane(gl, Plane.xz, click.OpenGLx,
                    click.OpenGLy);

                if(v != null)
                {
                    BuildingGrid grid = new BuildingGrid();
                    grid.Clamp(v);

                    Vertex v0 = plane.Vertices[0];
                    Vertex v3 = plane.Vertices[3] = v;

                    plane.Vertices[1].Set(v3.X, 0, v0.Z);
                    plane.Vertices[2].Set(v0.X, 0, v3.Z);

                }

                buildingObject.Modified = true;

                return true;
            }

            return base.OnMouseMove (gl, e);
        }
コード例 #8
0
ファイル: Builder.cs プロジェクト: nromik/sharpgl
        public override SceneObject OnMouseDown(OpenGL gl, MouseEventArgs e)
        {
            base.OnMouseDown(gl, e);

            Polygon plane = (Polygon)buildingObject;

            //	When the user presses the mouse down, we create the corner
            //	of the plane.

            Vertex v = PointToVertexOnPlane(gl, Plane.xz,
                clicks[0].OpenGLx, clicks[0].OpenGLy);

            BuildingGrid grid = new BuildingGrid();
            grid.Clamp(v);

            if(v != null)
            {
                plane.Vertices[0] = v;
            }

            return null;
        }