public void Init()
    {
        DisplayLayoutCamera[] arrCam = Object.FindObjectsOfType <DisplayLayoutCamera>();

        if (DisplayLayoutCamera.config != null)
        {
            foreach (var cam in arrCam)
            {
                cams.Add(cam.id, cam);
            }

            if (DisplayLayoutCamera.config.displays.Length == 3)
            {
                GameObject.Instantiate(Resources.Load("2POVPannel"));
            }

            return;
        }

        if (CircleVR.IsEditorPlatform())
        {
            return;
        }

        foreach (var cam in arrCam)
        {
            Destroy(cam.gameObject);
        }
    }
Exemplo n.º 2
0
    private AirVRStereoCameraRig CreateAirVRCameraRig(AirVRStereoCameraRig customizedRigPrefab)
    {
        int onAirVRPort = 9090;
        AirVRServerInitParams initParam = GameObject.FindObjectOfType<AirVRServerInitParams>();
        if (initParam)
            onAirVRPort = initParam.port;

        if (!customizedRigPrefab)
        {
            rig = FindObjectOfType<AirVRStereoCameraRig>();

            if(!rig)
                rig = CircleVR.DontDestroyInstantiate("AirVRCameraRig" , Vector3.zero , Quaternion.identity).AddComponent<AirVRStereoCameraRig>();
        }
        else
            rig = CircleVR.DontDestroyInstantiate(customizedRigPrefab.gameObject , Vector3.zero , Quaternion.identity).GetComponent<AirVRStereoCameraRig>();

        rig.trackingModel = AirVRStereoCameraRig.TrackingModel.ExternalTracker;

        if (!customizedRigPrefab)
        {
            rig.centerEyeAnchor.gameObject.AddComponent<AudioListener>();
            rig.centerEyeAnchor.gameObject.AddComponent<AirVRServerAudioOutputRouter>();
        }

        Debug.Log("[CircleVR Client] onAirVR Port : " + onAirVRPort.ToString());

        AirVRCameraRigManager.managerOnCurrentScene.Delegate = this;

        return rig;
    }
Exemplo n.º 3
0
    public bool AddConnectedUserIDs(string userID, out CircleVRErrorType error)
    {
        if (connectedUserIDs.Contains(userID))
        {
            Debug.Log("[CircleVR Host] Already Host Has User ID : " + userID.ToString());
            error = CircleVRErrorType.AlreadyHasUserID;
            return(false);
        }

        if (CircleVR.GetPair(userID) == null)
        {
            Debug.LogError("[CircleVR Host] Not Found User ID In Pairs : " + userID);
            error = CircleVRErrorType.NotFoundUserIDInPairs;
            return(false);
        }

        connectedUserIDs.Add(userID);

        CircleVRDisplay.Camera.SetDisplay(connectedUserIDs);

        foreach (var Event in events)
        {
            Event.OnAddConnectedUserID(userID);
        }

        Debug.Log("[CircleVR Host] Add UserID Succeed! : " + userID.ToString());

        error = 0;
        return(true);
    }
Exemplo n.º 4
0
    public void Init()
    {
        Camera = CircleVR.DontDestroyInstantiate("CameraManager", Vector3.zero, Quaternion.identity).AddComponent <CircleVRCameraManager>();
        Camera.Init();

        CircleVRTrackingSystem.onCreateTracker += onCreateTracker;

        Debug.Log("[CircleVR Display] Initialized");
    }
    private void RemoveConnectedPair(int connectionID)
    {
        UserIDAndConnectionIDPair pair = GetConnectedPair(connectionID);

        host.RemoveConnectedUserID(pair.userID);
        SetConnectedInPacket(pair.userID, false);
        connectedPairs.Remove(pair);
        CircleVRDisplay.GetHead(CircleVR.GetPair(pair.userID).trackerID).Connected = false;
        Debug.Log("[CircleVR Host Network] Disconnected User ID : " + pair.userID);
    }
Exemplo n.º 6
0
    private CircleVRHead CreateHead(Transform origin, string trackerID)
    {
        GameObject prefab = Resources.Load <GameObject>("head");

        CircleVRHead head = CircleVR.DontDestroyInstantiate(prefab, prefab.transform.localPosition, prefab.transform.localRotation).GetComponent <CircleVRHead>();

        head.Init(trackerID, origin);

        return(head);
    }
Exemplo n.º 7
0
    private void Start()
    {
        playBtn.onClick.AddListener(delegate { MenuButton(playBtn.name); });
        pauseBtn.onClick.AddListener(delegate { MenuButton(pauseBtn.name); });
        backBtn.onClick.AddListener(delegate { MenuButton(backBtn.name); });
        backBtn.onClick.AddListener(delegate { MenuButton(frontBtn.name); });
        HostUI.SetActive(false);

        circleVR = GameObject.Find("CircleVR").GetComponent <CircleVR>();
    }
Exemplo n.º 8
0
    public static void Init(Configuration config, Transform trackerOrigin)
    {
        origin = trackerOrigin;

        if (config.isHost || CircleVR.IsEditorPlatform())
        {
            HostSetup(config);
            return;
        }

        ClientSetup();
    }
Exemplo n.º 9
0
    private static void HostSetup(Configuration config)
    {
        Debug.Log("[TrackingSystem] Host Setup");

        if (OpenVR.System != null)
        {
            CircleVR.DontDestroyInstantiate("SteamVRTrackingDataFeeder", Vector3.zero, Quaternion.identity).AddComponent <CircleVRSteamVRTrackingDataFeeder>();
            return;
        }

        CircleVR.DontDestroyInstantiate("TrackingSimulator", Vector3.zero, Quaternion.identity).AddComponent <CircleVRTrackingSimulator>().Init(config);
    }
Exemplo n.º 10
0
    private void AddConnectedPair(UserIDAndConnectionIDPair pair)
    {
        Packet.TrackerData trackerData = GetTrackerDataInPacket(pair.userID);
        trackerData.connected = true;

        CircleVRNetwork.Send(CircleVRPacketType.HostInfo,
                             CircleVRNetwork.StringToByte(JsonUtility.ToJson(new HostInfo(config.circlevr.showBarrier, config.circlevr.safetyBarrierRadius))),
                             pair.connectionId, CircleVRNetwork.reliableChannel);

        connectedPairs.Add(pair);
        CircleVRDisplay.GetHead(CircleVR.GetPair(pair.userID).trackerID).Connected = true;

        Debug.Log("[CircleVR Host Network] Connected User ID : " + pair.userID);
    }
    public void OnBounded(string userID, AirVRStereoCameraRig rig)
    {
        this.userID = userID;

        Transform tracker = CircleVRTrackingSystem.GetTracker(CircleVR.GetPair(userID).trackerID);

        rig.externalTracker = tracker.Find("CenterAnchor");

        CircleVRErrorType error;

        if (host.AddConnectedUserIDs(userID, out error))
        {
            CircleVRDisplay.GetHead(CircleVR.GetPair(userID).trackerID).Connected = true;
            return;
        }

        Debug.Log("[Client Emulator] " + error.ToString());
    }
Exemplo n.º 12
0
    public void Init(float radius, Material mat, bool show)
    {
        circleVR    = CircleVR.Instance;
        this.radius = radius;
        MeshRenderer renderer = gameObject.AddComponent <MeshRenderer>();

        renderer.material = mat;


        filter = gameObject.AddComponent <MeshFilter>();

        if (show)
        {
            CreateMesh(radius, drawingHeight, mat);
        }

        initFinished = true;

        Debug.Log("[Barrier] Initialized");
    }
    public void Init(Configuration config)
    {
        if (config.cloudVRClient != null)
        {
            commandChannel = new CloudVRCommandChannel(config.cloudVRClient, "content");
            commandChannel.CommandReceived += onCloudVRCommandReceived;
            commandChannel.Open();
        }

        if (CircleVR.IsEditorPlatform())
        {
            CircleVRControlPannel.onCommand += controlPannelCommandReceived;
        }

        if (Event != null)
        {
            Event.OnInit();
        }

        Debug.Log("[CircleVR Content Server] Initialized");
    }
Exemplo n.º 14
0
    public static Transform CreateTracker(string ID)
    {
        Transform trackerTransform = CircleVR.DontDestroyInstantiate(ID, Vector3.zero, Quaternion.identity).transform;

        trackers.Add(ID, trackerTransform);

        CreateCenterAnchor(trackerTransform);

        Origin = Origin;

        if (onCreateTracker != null)
        {
            onCreateTracker(ID, trackerTransform);
        }


        Debug.Log("[CircleVR Tracking System] Create Tracker : " + ID);
        Debug.Log("[CircleVR Tracking System] Tracker Count : " + trackers.Count.ToString());

        return(trackerTransform);
    }
Exemplo n.º 15
0
    private void UpdatePacket(Packet.TrackerData trackerData)
    {
        if (!CircleVR.HasUserIDInPairs(trackerData.onAirVRUserID))
        {
            //TODO : must be notify in gui
            return;
        }

        Configuration.TrackerAndUserIDPair pair = CircleVR.GetPair(trackerData.onAirVRUserID);

        Transform tracker = CircleVRTrackingSystem.GetTracker(pair.trackerID);

        if (tracker == null)
        {
            //TODO : must be notify in gui
            return;
        }

        trackerData.position = tracker.localPosition;
        trackerData.oriented = tracker.localRotation;
    }
    public void SetDisplay(List <string> connectedUserIDs)
    {
        Queue <string> connectedQueue = new Queue <string>();

        foreach (var connection in connectedUserIDs)
        {
            connectedQueue.Enqueue(connection);
        }

        List <DisplayLayoutCamera> list = cams.Values.ToList();

        Transform t1;
        Transform t2;
        Transform t3;
        Transform t4;

        switch (connectedQueue.Count)
        {
        case 0:
            foreach (var cam in cams.Values)
            {
                if (cam.id == "observer")
                {
                    continue;
                }

                DisplayLayoutFade fade = cam.GetComponent <DisplayLayoutFade>();
                if (fade)
                {
                    cam.StartCoroutine(fade.Fade(false));
                }
            }
            break;

        case 1:
            t1 = CircleVRTrackingSystem.GetTracker(CircleVR.GetPair(connectedQueue.Dequeue()).trackerID).transform.Find("CenterAnchor");

            foreach (var key in cams.Keys)
            {
                if (key == "observer")
                {
                    continue;
                }

                ActivateDisplay(key, t1);
            }
            return;

        case 2:
            t1 = CircleVRTrackingSystem.GetTracker(CircleVR.GetPair(connectedQueue.Dequeue()).trackerID).transform.Find("CenterAnchor");
            t2 = CircleVRTrackingSystem.GetTracker(CircleVR.GetPair(connectedQueue.Dequeue()).trackerID).transform.Find("CenterAnchor");

            ActivateDisplay("display1", t1);

            switch (DisplayLayoutCamera.config.displays.Length)
            {
            case 3:
                ActivateDisplay("display2", t2);
                return;

            case 4:
                ActivateDisplay("display2", t2);
                ActivateDisplay("display3", t1);
                return;

            case 5:
                ActivateDisplay("display2", t2);
                ActivateDisplay("display3", t1);
                ActivateDisplay("display4", t2);
                return;
            }

            return;

        case 3:
            t1 = CircleVRTrackingSystem.GetTracker(CircleVR.GetPair(connectedQueue.Dequeue()).trackerID).transform.Find("CenterAnchor");
            t2 = CircleVRTrackingSystem.GetTracker(CircleVR.GetPair(connectedQueue.Dequeue()).trackerID).transform.Find("CenterAnchor");
            t3 = CircleVRTrackingSystem.GetTracker(CircleVR.GetPair(connectedQueue.Dequeue()).trackerID).transform.Find("CenterAnchor");

            ActivateDisplay("display1", t1);
            ActivateDisplay("display2", t2);
            ActivateDisplay("display3", t3);
            ActivateDisplay("display4", t2);
            return;

        case 4:
            t1 = CircleVRTrackingSystem.GetTracker(CircleVR.GetPair(connectedQueue.Dequeue()).trackerID).transform.Find("CenterAnchor");
            t2 = CircleVRTrackingSystem.GetTracker(CircleVR.GetPair(connectedQueue.Dequeue()).trackerID).transform.Find("CenterAnchor");
            t3 = CircleVRTrackingSystem.GetTracker(CircleVR.GetPair(connectedQueue.Dequeue()).trackerID).transform.Find("CenterAnchor");
            t4 = CircleVRTrackingSystem.GetTracker(CircleVR.GetPair(connectedQueue.Dequeue()).trackerID).transform.Find("CenterAnchor");

            ActivateDisplay("display1", t1);
            ActivateDisplay("display2", t2);
            ActivateDisplay("display3", t3);
            ActivateDisplay("display4", t4);
            return;
        }
    }
Exemplo n.º 17
0
 private void SetupContentServer(Configuration config)
 {
     CircleVR.DontDestroyInstantiate("ContentServer", Vector3.zero, Quaternion.identity).AddComponent <CircleVRContentServer>().Init(config);
 }
Exemplo n.º 18
0
 private void SetupContentClient()
 {
     CircleVR.DontDestroyInstantiate("ContentClient", Vector3.zero, Quaternion.identity).AddComponent<CircleVRContentClient>();
 }
Exemplo n.º 19
0
 private static void ClientSetup()
 {
     CircleVR.DontDestroyInstantiate("ClientTrackingDataFeeder", Vector3.zero, Quaternion.identity).AddComponent <CircleVRClientTrackingDataFeeder>();
     Debug.Log("[TrackingSystem] Client Setup");
 }
Exemplo n.º 20
0
 public static void InitBarrier(float barrierRadius, bool showBarrier)
 {
     barrier = CircleVR.DontDestroyInstantiate("Barrier", Vector3.zero, Quaternion.identity).AddComponent <CircleVRBarrier>();
     barrier.Init(barrierRadius, Object.FindObjectOfType <CircleVR>().barrierMaterial, showBarrier);
 }
 public void OnUnbound()
 {
     host.RemoveConnectedUserID(userID);
     CircleVRDisplay.GetHead(CircleVR.GetPair(userID).trackerID).Connected = false;
 }