void Awake() { // Find camera controller QCameraController[] camera_controllers; camera_controllers = gameObject.GetComponentsInChildren<QCameraController>(); if (camera_controllers.Length == 0) { Debug.LogWarning("ThreeDimGUI: No QCameraController attached."); } else if (camera_controllers.Length > 1) Debug.LogWarning("ThreeDimGUI: More then 1 QCameraController attached."); else { m_camera_controller = camera_controllers[0]; } }
// Start new void Start() { base.Start (); // Get the QCameraController CameraController = gameObject.transform.parent.GetComponent<QCameraController>(); if(CameraController == null) Debug.LogWarning("WARNING: QCameraController not found!"); // NOTE: MSAA TEXTURES NOT AVAILABLE YET // Set CameraTextureScale (increases the size of the texture we are rendering into // for a better pixel match when post processing the image through lens distortion) #if MSAA_ENABLED CameraTextureScale = OVRDevice.DistortionScale(); #endif // If CameraTextureScale is not 1.0f, create a new texture and assign to target texture // Otherwise, fall back to normal camera rendering if((CameraTexture == null) && (CameraTextureScale > 1.0f)) { int w = (int)(Screen.width / 2.0f * CameraTextureScale); int h = (int)(Screen.height * CameraTextureScale); CameraTexture = new RenderTexture( w, h, 24); #if MSAA_ENABLED // NOTE: AA on RenderTexture not available yet //CameraTexture.antiAliasing = QualitySettings.antiAliasing; #endif } }
// SetQCameraController public void SetQCameraController(ref QCameraController camera_controller) { m_camera_controller = camera_controller; m_camera_controller.GetCamera(ref m_main_camera); if(m_camera_controller.PortraitMode == true) { float tmp = m_dead_zone_x; m_dead_zone_x = m_dead_zone_y; m_dead_zone_y = tmp; } }
// OnEnable void OnEnable() { m_Component = (QCameraController)target; }
// SetCameraController public void SetCameraController(ref QCameraController cameraController) { CameraController = cameraController; }