コード例 #1
0
        static void DrawArc(PanoramicCamera src, Vector3 normal, float positionInOtherDimension, float radius)
        {
            if (normal == Vector3.up)
            {
                //var from = new Vector3(Mathf.Sin(-(src.horizontalFieldOfView / 2f * Mathf.Deg2Rad)), 0, Mathf.Cos(-(src.horizontalFieldOfView / 2f * Mathf.Deg2Rad)));
                var from = new Vector3(0,
                                       Mathf.Sin((src.verticalFieldOfView * positionInOtherDimension * Mathf.Deg2Rad)),
                                       Mathf.Cos(-(src.verticalFieldOfView * positionInOtherDimension * Mathf.Deg2Rad)));;
                from = Quaternion.Euler(0, -src.horizontalFieldOfView * .5f, 0) * from;

                Handles.DrawWireArc(src.transform.position,
                                    src.transform.rotation * normal,
                                    src.transform.rotation * from,
                                    src.horizontalFieldOfView,
                                    radius);
            }
            else
            {
                var from = new Vector3(0, Mathf.Sin(-(src.verticalFieldOfView / 2f * Mathf.Deg2Rad)), Mathf.Cos(-(src.verticalFieldOfView / 2f * Mathf.Deg2Rad)));

                Handles.DrawWireArc(src.transform.position,
                                    src.transform.rotation * Quaternion.Euler(0, src.horizontalFieldOfView * positionInOtherDimension, 0) * normal,
                                    src.transform.rotation * Quaternion.Euler(0, src.horizontalFieldOfView * positionInOtherDimension, 0) * from,
                                    src.verticalFieldOfView,
                                    radius);
            }
        }
コード例 #2
0
        static void DrawLine(PanoramicCamera src, Vector2 angles)
        {
            var p = new Vector3(0, Mathf.Sin(-(src.verticalFieldOfView * angles.y * Mathf.Deg2Rad)), Mathf.Cos(-(src.verticalFieldOfView * angles.y * Mathf.Deg2Rad)));;

            p = Quaternion.Euler(0, -src.horizontalFieldOfView * angles.x, 0) * p;
            Handles.DrawLine(
                src.transform.TransformPoint(p * src.farClipPlane),
                src.transform.TransformPoint(p * src.nearClipPlane));
        }
コード例 #3
0
        static void RenderSelected(PanoramicCamera src, GizmoType gizmoType)
        {
            Handles.color = Color.gray;

            DrawDoubleArc(src, Vector3.up, 0f);
            DrawDoubleArc(src, Vector3.left, 0f);

            for (float i = 0.5f; i > 0f; i -= .25f)
            {
                DrawQuadrupleArc(src, Vector3.left, i);
                DrawQuadrupleArc(src, Vector3.up, i);
            }

            DrawLine(src, new Vector2(.5f, .5f));
            DrawLine(src, new Vector2(.5f, -.5f));
            DrawLine(src, new Vector2(-.5f, -.5f));
            DrawLine(src, new Vector2(-.5f, .5f));
        }
コード例 #4
0
 static void DrawDoubleArc(PanoramicCamera src, Vector3 normal, float positionInOtherDimension)
 {
     DrawArc(src, normal, positionInOtherDimension, src.nearClipPlane);
     DrawArc(src, normal, positionInOtherDimension, src.farClipPlane);
 }
コード例 #5
0
 static void DrawQuadrupleArc(PanoramicCamera src, Vector3 normal, float positionInOtherDimension)
 {
     DrawDoubleArc(src, normal, positionInOtherDimension);
     DrawDoubleArc(src, normal, -positionInOtherDimension);
 }