Beispiel #1
0
    public vrNode3D CreateNode(string iNodeName, MVRNodesMapper.ENodesSyncDirection iSyncDirection)
    {
        vrNode3D node = null;

        if (iNodeName != "")
        {
            vrDisplayManager displayManager = MiddleVR.VRDisplayMgr;
            if (displayManager.GetNode(iNodeName) == null)
            {
                node = displayManager.CreateNode(iNodeName);
                // Copy transformation from gameObject to node3d
                _SetNode(node, MVRNodesMapper.ENodesSyncDirection.UnityToMiddleVR, iSyncDirection);
            }
        }

        return(node);
    }
Beispiel #2
0
    // Private methods

    void InitializeVR()
    {
        mouseButtons[0] = mouseButtons[1] = mouseButtons[2] = false;

        if (m_displayLog)
        {
            GameObject gui = new GameObject();
            m_GUI = gui.AddComponent <GUIText>() as GUIText;
            gui.transform.localPosition = new UnityEngine.Vector3(0.5f, 0.0f, 0.0f);
            m_GUI.pixelOffset           = new UnityEngine.Vector2(15, 0);
            m_GUI.anchor = TextAnchor.LowerCenter;
        }

        MVRTools.IsEditor = Application.isEditor;

        if (MiddleVR.VRKernel != null)
        {
            MVRTools.Log(3, "[ ] VRKernel already alive, reset Unity Manager.");
            MVRTools.VRReset();
            m_isInit = true;
            // Not needed because this is the first execution of this script instance
            // m_isGeometrySet = false;
            m_FirstFrameAfterReset = MiddleVR.VRKernel.GetFrame();
        }
        else
        {
            if (CustomLicense)
            {
                MVRTools.CustomLicense     = true;
                MVRTools.CustomLicenseName = CustomLicenseName;
                MVRTools.CustomLicenseCode = CustomLicenseCode;
            }

            m_isInit = MVRTools.VRInitialize(ConfigFile);
        }


        if (SimpleClusterParticles)
        {
            _SetParticlesSeeds();
        }

        // Get AA from vrx configuration file
        m_AntiAliasingLevel = (int)MiddleVR.VRDisplayMgr.GetAntiAliasing();

        DumpOptions();

        if (!m_isInit)
        {
            GameObject gui = new GameObject();
            m_GUI = gui.AddComponent <GUIText>() as GUIText;
            gui.transform.localPosition = new UnityEngine.Vector3(0.2f, 0.0f, 0.0f);
            m_GUI.pixelOffset           = new UnityEngine.Vector2(0, 0);
            m_GUI.anchor = TextAnchor.LowerLeft;

            string txt = m_Kernel.GetLogString(true);
            print(txt);
            m_GUI.text = txt;

            return;
        }

        m_Kernel     = MiddleVR.VRKernel;
        m_DeviceMgr  = MiddleVR.VRDeviceMgr;
        m_DisplayMgr = MiddleVR.VRDisplayMgr;
        m_ClusterMgr = MiddleVR.VRClusterMgr;

        if (SimpleCluster)
        {
            SetupSimpleCluster();
        }

        if (DisableExistingCameras)
        {
            Camera[] cameras = GameObject.FindObjectsOfType(typeof(Camera)) as Camera[];

            foreach (Camera cam in cameras)
            {
                if (cam.targetTexture == null)
                {
                    cam.enabled = false;
                }
            }
        }

        MVRNodesCreator.Instance.CreateNodes(VRSystemCenterNode, DebugNodes, DebugScreens, GrabExistingNodes, TemplateCamera);

        MVRTools.CreateViewportsAndCameras(DontChangeWindowGeometry, m_AllowRenderTargetAA);

        //AttachCameraCB();

        MVRTools.Log(4, "[<] End of VR initialization script");
    }
Beispiel #3
0
    // Private methods

    private void InitializeVR()
    {
        mouseButtons[0] = mouseButtons[1] = mouseButtons[2] = false;

        if (m_displayLog)
        {
            GameObject gui = new GameObject();
            m_GUI = gui.AddComponent<GUIText>() as GUIText;
            gui.transform.localPosition = new UnityEngine.Vector3(0.5f, 0.0f, 0.0f);
            m_GUI.pixelOffset = new UnityEngine.Vector2(15, 0);
            m_GUI.anchor = TextAnchor.LowerCenter;
        }

        MVRTools.IsEditor = Application.isEditor;

        if( MiddleVR.VRKernel != null )
        {
            MVRTools.Log(3, "[ ] VRKernel already alive, reset Unity Manager.");
            MVRTools.VRReset();
            m_isInit = true;
            // Not needed because this is the first execution of this script instance
            // m_isGeometrySet = false;
            m_FirstFrameAfterReset = MiddleVR.VRKernel.GetFrame();

        }
        else
        {
            if( CustomLicense )
            {
                MVRTools.CustomLicense = true;
                MVRTools.CustomLicenseName = CustomLicenseName;
                MVRTools.CustomLicenseCode = CustomLicenseCode;
            }

            m_isInit = MVRTools.VRInitialize(ConfigFile);
        }


        if (SimpleClusterParticles)
        {
            _SetParticlesSeeds();
        }

        // Get AA from vrx configuration file
        m_AntiAliasingLevel = (int)MiddleVR.VRDisplayMgr.GetAntiAliasing();

        DumpOptions();

        if (!m_isInit)
        {
            GameObject gui = new GameObject();
            m_GUI = gui.AddComponent<GUIText>() as GUIText;
            gui.transform.localPosition = new UnityEngine.Vector3(0.2f, 0.0f, 0.0f);
            m_GUI.pixelOffset = new UnityEngine.Vector2(0, 0);
            m_GUI.anchor = TextAnchor.LowerLeft;

            string txt = m_Kernel.GetLogString(true);
            print(txt);
            m_GUI.text = txt;

            return;
        }

        m_Kernel = MiddleVR.VRKernel;
        m_DeviceMgr = MiddleVR.VRDeviceMgr;
        m_DisplayMgr = MiddleVR.VRDisplayMgr;
        m_ClusterMgr = MiddleVR.VRClusterMgr;

        if (SimpleCluster)
        {
            SetupSimpleCluster();
        }

        if (DisableExistingCameras)
        {
            Camera[] cameras = GameObject.FindObjectsOfType(typeof(Camera)) as Camera[];

            foreach (Camera cam in cameras)
            {
                if (cam.targetTexture == null)
                {
                    cam.enabled = false;
                }
            }
        }

        MVRNodesCreator.Instance.CreateNodes(
            VRSystemCenterNode,
            DebugNodes, DebugScreens,
            GrabExistingNodes, TemplateCamera);

        MVRTools.CreateViewportsAndCameras(DontChangeWindowGeometry, true);

        MVRTools.Log(4, "[<] End of VR initialization script");
    }
    // Private methods

    private void InitializeVR()
    {
        mouseButtons[0] = mouseButtons[1] = mouseButtons[2] = false;

        if (MiddleVR.VRKernel != null)
        {
            MVRTools.Log(3, "[ ] VRKernel already alive, reset Unity Manager.");
            MVRTools.VRReset();
            m_isInit = true;
            // Not needed because this is the first execution of this script instance
            // m_isGeometrySet = false;
            m_FirstFrameAfterReset = MiddleVR.VRKernel.GetFrame();
        }
        else
        {
            if (CustomLicense)
            {
                MVRTools.CustomLicense     = true;
                MVRTools.CustomLicenseName = CustomLicenseName;
                MVRTools.CustomLicenseCode = CustomLicenseCode;
            }

            m_isInit = MVRTools.VRInitialize(ConfigFile);
        }


        if (SimpleClusterParticles)
        {
            _SetParticlesSeeds();
        }

        // Get AA from vrx configuration file
        m_AntiAliasingLevel = (int)MiddleVR.VRDisplayMgr.GetAntiAliasing();

        DumpOptions();

        m_Kernel     = MiddleVR.VRKernel;
        m_DeviceMgr  = MiddleVR.VRDeviceMgr;
        m_DisplayMgr = MiddleVR.VRDisplayMgr;
        m_ClusterMgr = MiddleVR.VRClusterMgr;

        if (SimpleCluster)
        {
            SetupSimpleCluster();
        }

        if (DisableExistingCameras)
        {
            Camera[] cameras = GameObject.FindObjectsOfType(typeof(Camera)) as Camera[];

            foreach (Camera cam in cameras)
            {
                if (cam.targetTexture == null)
                {
                    cam.enabled = false;
                }
            }
        }

        MVRNodesCreator.Instance.CreateNodes(
            VRSystemCenterNode,
            DebugNodes, DebugScreens,
            GrabExistingNodes, TemplateCamera);

        MVRTools.CreateViewportsAndCameras(DontChangeWindowGeometry, true);

        MVRTools.Log(4, "[<] End of VR initialization script");
    }
    // Private methods

    void InitializeVR()
    {
        mouseButtons[0] = mouseButtons[1] = mouseButtons[2] = false;

        if (m_displayLog)
        {
            GameObject gui = new GameObject();
            m_GUI = gui.AddComponent("GUIText") as GUIText;
            gui.transform.localPosition = new UnityEngine.Vector3(0.5f, 0.0f, 0.0f);
            m_GUI.pixelOffset           = new UnityEngine.Vector2(15, 0);
            m_GUI.anchor = TextAnchor.LowerCenter;
        }

        MiddleVRTools.IsEditor = Application.isEditor;

        m_isInit = MiddleVRTools.VRInitialize(ConfigFile);

        DumpOptions();

        kernel     = MiddleVR.VRKernel;
        displayMgr = MiddleVR.VRDisplayMgr;

        if (!m_isInit)
        {
            GameObject gui = new GameObject();
            m_GUI = gui.AddComponent("GUIText") as GUIText;
            gui.transform.localPosition = new UnityEngine.Vector3(0.2f, 0.0f, 0.0f);
            m_GUI.pixelOffset           = new UnityEngine.Vector2(0, 0);
            m_GUI.anchor = TextAnchor.LowerLeft;

            string txt = kernel.GetLogString(true);
            print(txt);
            m_GUI.text = txt;

            return;
        }

        if (SimpleCluster)
        {
            SetupSimpleCluster();
        }

        if (ChangeWorldScale)
        {
            displayMgr.SetChangeWorldScale(true);
            displayMgr.SetWorldScale(WorldScale);
        }

        if (DisableExistingCameras)
        {
            Camera[] cameras = GameObject.FindObjectsOfType(typeof(Camera)) as Camera[];

            foreach (Camera cam in cameras)
            {
                if (cam.targetTexture == null)
                {
                    cam.enabled = false;
                }
            }
        }

        MiddleVRTools.CreateNodes(RootNode, DebugNodes, DebugScreens, GrabExistingNodes, TemplateCamera);
        MiddleVRTools.CreateViewportsAndCameras(DontChangeWindowGeometry);

        //AttachCameraCB();

        MiddleVRTools.Log(4, "[<] End of VR initialization script");
    }
Beispiel #6
0
    // Private methods
    void InitializeVR()
    {
        mouseButtons[0] = mouseButtons[1] = mouseButtons[2] = false;

        if (m_displayLog)
        {
            GameObject gui = new GameObject();
            m_GUI = gui.AddComponent("GUIText") as GUIText;
            gui.transform.localPosition = new UnityEngine.Vector3(0.5f, 0.0f, 0.0f);
            m_GUI.pixelOffset = new UnityEngine.Vector2(15, 0);
            m_GUI.anchor = TextAnchor.LowerCenter;
        }

        MiddleVRTools.IsEditor = Application.isEditor;

        m_isInit = MiddleVRTools.VRInitialize(ConfigFile);

        DumpOptions();

        kernel = MiddleVR.VRKernel;
        displayMgr = MiddleVR.VRDisplayMgr;

        if (!m_isInit)
        {
            GameObject gui = new GameObject();
            m_GUI = gui.AddComponent("GUIText") as GUIText;
            gui.transform.localPosition = new UnityEngine.Vector3(0.2f, 0.0f, 0.0f);
            m_GUI.pixelOffset = new UnityEngine.Vector2(0, 0);
            m_GUI.anchor = TextAnchor.LowerLeft;

            string txt = kernel.GetLogString(true);
            print(txt);
            m_GUI.text = txt;

            return;
        }

        if (SimpleCluster)
        {
            SetupSimpleCluster();
        }

        if (ChangeWorldScale)
        {
            displayMgr.SetChangeWorldScale(true);
            displayMgr.SetWorldScale(WorldScale);
        }

        if (DisableExistingCameras)
        {
            Camera[] cameras = GameObject.FindObjectsOfType(typeof(Camera)) as Camera[];

            foreach (Camera cam in cameras)
            {
                if (cam.targetTexture == null)
                {
                    cam.enabled = false;
                }
            }
        }

        MiddleVRTools.CreateNodes(RootNode, DebugNodes, DebugScreens, GrabExistingNodes,TemplateCamera);
        MiddleVRTools.CreateViewportsAndCameras(DontChangeWindowGeometry);

        //AttachCameraCB();

        MiddleVRTools.Log(4, "[<] End of VR initialization script");
    }