private bool ViewBoxHitTest(Point p)
        {
            if (!(Camera is ProjectionCamera camera))
            {
                return(false);
            }

            var ray  = this.UnProject(p);
            var hits = new List <HitTestResult>();

            if (viewCube.HitTest(RenderContext, ray, ref hits))
            {
                var normal = hits[0].NormalAtHit;
                if (Vector3.Cross(normal, ModelUpDirection).LengthSquared() < 1e-5)
                {
                    var vecLeft = new Vector3(-normal.Y, -normal.Z, -normal.X);
                    ViewCubeClicked(hits[0].NormalAtHit, vecLeft);
                }
                else
                {
                    ViewCubeClicked(hits[0].NormalAtHit, ModelUpDirection);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        private bool ViewBoxHitTest(Point p)
        {
            if (!(Camera is ProjectionCamera camera))
            {
                return(false);
            }

            var ray  = this.UnProject(p);
            var hits = new List <HitTestResult>();

            if (viewCube.HitTest(RenderContext, ray, ref hits))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }