예제 #1
0
        /// <summary>
        /// A constructor of SRDCameras.
        /// </summary>
        /// <param name="manager">Must set a SRDManager object in the current scene</param>
        public SRDCameras(SRDManager manager)
        {
            _srdManager = manager;

            var watcherAnchorName = SRDHelper.SRDConstants.WatcherGameObjDefaultName;

            _watcherAnchorObj = SRDSceneEnvironment.GetOrCreateChild(_srdManager.transform, watcherAnchorName);

            var watcherCameraName = SRDHelper.SRDConstants.WatcherCameraGameObjDefaultName;

            _watcherCameraObj = SRDSceneEnvironment.GetOrCreateChild(_watcherAnchorObj.transform, watcherCameraName);

            _watcherCamera = SRDSceneEnvironment.GetOrAddComponent <Camera>(_watcherCameraObj);
            _eyeCameras    = new Dictionary <EyeType, Camera>();
        }
        private void Initialize()
        {
            _srdManager = SRDSceneEnvironment.GetSRDManager();
            _srdCameras = new SRDCameras(_srdManager);

            foreach (var type in _eyeTypes)
            {
                var eyeCameraObj = _srdCameras.GetOrCreateEyeCameraObj(type);
                _eyeCamera[type] = SRDSceneEnvironment.GetOrAddComponent <Camera>(eyeCameraObj);
                _eyeCamera[type].targetTexture = _eyeCamRenderTextureCache[type];

                var eyeAnchorName = SRDHelper.EyeSideName[type] + SRDHelper.SRDConstants.EyeAnchorGameObjDefaultName;
                var eyeAnchor     = SRDSceneEnvironment.GetOrCreateChild(_srdCameras.AnchorTransform, eyeAnchorName);
                _eyeTransform[type] = eyeAnchor.transform;
            }
            _srdCameras.RemoveSourceCamera();
        }