Пример #1
0
 public void FixEffectOrder()
 {
     if (!SteamCam)
     {
         SteamCam = GetComponent <SteamVR_Camera>();
     }
     SteamCam.ForceLast();
     SteamCam = GetComponent <SteamVR_Camera>();
 }
Пример #2
0
        /// <summary>
        /// Doesn't really work yet.
        /// </summary>
        /// <param name="blueprint"></param>
        public void CopyFX(Camera blueprint)
        {
            CopyFX(blueprint.gameObject, gameObject, true);

            if (!SteamCam)
            {
                SteamCam = GetComponent <SteamVR_Camera>();
            }
            SteamCam.ForceLast();
            SteamCam = GetComponent <SteamVR_Camera>();
        }
Пример #3
0
        internal Camera Clone(bool copyEffects = true)
        {
            var clone = new GameObject("VRGIN_Camera_Clone").CopyComponentFrom(SteamCam.GetComponent <Camera>());

            if (copyEffects)
            {
                CopyFX(SteamCam.gameObject, clone.gameObject);
            }
            clone.transform.position = transform.position;
            clone.transform.rotation = transform.rotation;
            clone.nearClipPlane      = 0.01f;

            return(clone);
        }
Пример #4
0
 public void ToggleFX()
 {
     m_bFxEnabled = !m_bFxEnabled;
     foreach (var comp in SteamCam.GetComponents <MonoBehaviour>())
     {
         if (VR.Interpreter.IsAllowedEffect(comp))
         {
             comp.enabled = m_bFxEnabled;
             VRLog.Debug("Toggling FX : {0}, Enabled: {1}", comp.GetType().Name, comp.enabled);
         }
         else if (comp.GetType().Name.Equals("PostProcessingBehaviour"))
         {
             comp.enabled = m_bFxEnabled;
         }
     }
 }
Пример #5
0
        protected override void OnAwake()
        {
            VRLog.Info("Creating VR Camera");
            _Camera = gameObject.AddComponent <Camera>();
            gameObject.AddComponent <SteamVR_Camera>();
            SteamCam = GetComponent <SteamVR_Camera>();
            SteamCam.Expand(); // Expand immediately!

            if (!VR.Settings.MirrorScreen)
            {
                Destroy(SteamCam.head.GetComponent <SteamVR_GameView>());
                Destroy(SteamCam.head.GetComponent <Camera>()); // Save GPU power
            }

            // Set render scale to the value defined by the user
            SteamVR_Camera.sceneResolutionScale = VR.Settings.RenderScale;

            // Needed for the Camera Modifications mod to work. It's an artifact from DK2 days
            var legacyAnchor = new GameObject("CenterEyeAnchor");

            legacyAnchor.transform.SetParent(SteamCam.head);

            DontDestroyOnLoad(SteamCam.origin.gameObject);
        }
Пример #6
0
 private void ApplyToCameras(CameraOperation operation)
 {
     operation(SteamCam.GetComponent <Camera>());
     //operation(SteamCam.head.GetComponent<Camera>());
 }