Exemplo n.º 1
0
        private void Form1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            Vector2 cursorpos    = new Vector2((float)e.X, (float)e.Y);
            Vector3 pickingPoint = CRay.GetPickingPoint(this.device, this.myTerrain.v3vertices, cursorpos, this.worldMatrix, this.viewMatrix, this.projectionMatrix);

            if (pickingPoint != Vector3.Empty)
            {
                this.CenterX = pickingPoint.X / (float)this.myTerrain.WIDTH;
                this.CenterY = pickingPoint.Y / (float)this.myTerrain.HEIGHT;
            }
        }
Exemplo n.º 2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            Vector2 cursorpos    = new Vector2((float)this.LastMouseX2, (float)this.LastMouseY2);
            Vector3 pickingPoint = CRay.GetPickingPoint(this.device, this.myTerrain.v3vertices, cursorpos, this.worldMatrix, this.viewMatrix, this.projectionMatrix);

            if (pickingPoint != Vector3.Empty)
            {
                this.DoCao = -pickingPoint.Z * this.myTerrain.SCALE_FACTOR;
                this.OnPaint();
            }
            else
            {
                this.DoCao = 0f;
                this.OnPaint();
            }
            this.DoCao          = 0f;
            this.timer1.Enabled = false;
        }