private PickedGeometry RunPicking(RenderEventArgs arg, int x, int y)
        {
            lock (this.synObj)
            {
                // prepare pickable elements
                PickableRenderer pickable = this.rendererDict[this.SelectedModel].PickableRenderer;
                pickable.MVP = this.camera.GetProjectionMat4() * this.camera.GetViewMat4();

                PickedGeometry pickedGeometry = ColorCodedPicking.Pick(
                    arg, x, y,
                    pickable);

                return(pickedGeometry);
            }
        }
Пример #2
0
        private void glCanvas1_MouseMove(object sender, MouseEventArgs e)
        {
            if (rotator.MouseDownFlag)
            {
                rotator.MouseMove(e.X, e.Y);
                this.cameraUpdated = true;
            }

            {
                IColorCodedPicking pickable = this.renderer;
                pickable.MVP = this.camera.GetProjectionMat4() * this.camera.GetViewMat4();
                IPickedGeometry pickedGeometry = ColorCodedPicking.Pick(
                    this.camera, e.X, e.Y, this.glCanvas1.Width, this.glCanvas1.Height, pickable);
                if (pickedGeometry != null)
                {
                    this.bulletinBoard.SetContent(pickedGeometry.ToString());
                }
                else
                {
                    this.bulletinBoard.SetContent("picked nothing.");
                }
            }
        }