예제 #1
0
    private static void DrawMarker(ARTrackedCamera tc, bool selected)
	{
        ARMarker m = tc.GetMarker();
        if (m == null) return;
		if (!m.gameObject.activeInHierarchy) return; // Don't attempt to load inactive ARMarkers.
		
		// Attempt to load. Might not work out if e.g. for a single marker, pattern hasn't been
		// assigned yet, or for an NFT marker, dataset hasn't been specified.
		if (m.UID == ARMarker.NO_ID) {
			m.Load();
		}

		Matrix4x4 pose = tc.gameObject.transform.parent.localToWorldMatrix;
		//ARController.Log("pose=" + pose.ToString("F3"));

        switch (m.MarkerType) {

            case MarkerType.Square:
            case MarkerType.SquareBarcode:
				DrawSingleMarker(m, pose, selected);
                break;

			case MarkerType.Multimarker:
				DrawMultiMarker(m, pose, selected);
			    break;
			
			case MarkerType.NFT:
				DrawNFTMarker(m, pose, selected);
			    break;

        }
    }
예제 #2
0
    public override void OnInspectorGUI()
    {
        ARTrackedCamera artc = (ARTrackedCamera)target;

        if (artc == null)
        {
            return;
        }
        artc.MarkerTag = EditorGUILayout.TextField("Marker tag", artc.MarkerTag);

        ARTrackable marker = artc.GetTrackable();

        EditorGUILayout.LabelField("Got marker", marker == null ? "no" : "yes");
        if (marker != null)
        {
            string type = ARTrackable.TrackableTypeNames[marker.Type];
            EditorGUILayout.LabelField("Marker UID", (marker.UID != ARTrackable.NO_ID ? marker.UID.ToString() : "Not loaded") + " (" + type + ")");
        }

        EditorGUILayout.Separator();
        artc.eventReceiver = (GameObject)EditorGUILayout.ObjectField("Event Receiver:", artc.eventReceiver, typeof(GameObject), true);

        EditorGUILayout.Separator();
        artc.secondsToRemainVisible = EditorGUILayout.FloatField("Stay visible", artc.secondsToRemainVisible);

        base.OnInspectorGUI();
    }
    private static void DrawMarker(ARTrackedCamera tc, bool selected)
    {
        ARTrackable m = tc.GetTrackable();

        if (m == null)
        {
            return;
        }
        if (!m.gameObject.activeInHierarchy)
        {
            return;                                          // Don't attempt to load inactive ARMarkers.
        }
        // Attempt to load. Might not work out if e.g. for a single marker, pattern hasn't been
        // assigned yet, or for an NFT marker, dataset hasn't been specified.
        if (m.UID == ARTrackable.NO_ID)
        {
            m.Load();
        }

        Matrix4x4 pose = tc.gameObject.transform.parent.localToWorldMatrix;

        //ARController.Log("pose=" + pose.ToString("F3"));

        switch (m.Type)
        {
        case ARTrackable.TrackableType.Square:
        case ARTrackable.TrackableType.SquareBarcode:
            DrawSingleMarker(m, pose, selected);
            break;

        case ARTrackable.TrackableType.Multimarker:
            DrawMultiMarker(m, pose, selected);
            break;

        case ARTrackable.TrackableType.NFT:
        case ARTrackable.TrackableType.TwoD:
            DrawNFTMarker(m, pose, selected);
            break;
        }
    }
    [DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.Pickable)] // Draw the gizmo if it is not selected and also no parent/ancestor object is selected. The gizmo can be picked in the editor. First argument of method is the type for which the Gizmo will be drawn.
#endif
    static void RenderARTrackedCameraGizmo(ARTrackedCamera mc, GizmoType gizmoType)
    {
        DrawMarker(mc, (gizmoType & GizmoType.Active) != 0);
    }
예제 #5
0
	[DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.Pickable)] // Draw the gizmo if it is not selected and also no parent/ancestor object is selected. The gizmo can be picked in the editor. First argument of method is the type for which the Gizmo will be drawn.
#endif
    static void RenderARTrackedCameraGizmo(ARTrackedCamera mc, GizmoType gizmoType)
    {
        DrawMarker(mc, (gizmoType & GizmoType.Active) != 0);
    }