Example #1
0
        /// <summary>
        /// Gets new device from deviceFactory (providing profile stub name in case if device not available).
        /// Gets profile from new device, sends it to leiaStateFactory.
        /// Gets default LeiaStateId if LeiaStateId is empty.
        /// Applies lState.
        /// </summary>
        public void UpdateDevice()
        {
            this.Debug("UpdateDevice");
            _leiaDevice = _deviceFactory.GetDevice(ProfileStubName);
            _stateFactory.SetDisplayConfig(GetDisplayConfig());

            RequestLeiaStateUpdate();
        }
        public virtual void UpdateState(LeiaStateDecorators decorators, ILeiaDevice device)
        {
            this.Debug("UpdateState");
            if (_material == null)
            {
                _material = CreateMaterial(decorators.AlphaBlending);
            }
            // by default UserNumViews will be same as NumViews
            _displayConfig.UserNumViews = _displayConfig.NumViews;
            // but in CheckRenderTechnique, override UserNumViews to have more accurate values
            CheckRenderTechnique(decorators);
            // once _displayConfig.UserNumViews is definitely containing appropriate viewCount x, call SetViewCount to cache viewCount x in _viewsWide.
            // Later, AbstractLeiaStateTemplate :: UpdateViews will retrieve _viewsWide and use it to call LeiaCamera :: SetViewCount
            SetViewCount(_displayConfig.UserNumViews.x, 1);

            RespectOrientation(decorators);
            UpdateEmissionPattern(decorators);
            var shaderParams = new ShaderFloatParams();

            shaderParams._width    = _displayConfig.UserPanelResolution.x;
            shaderParams._height   = _displayConfig.UserPanelResolution.y;
            shaderParams._viewResX = _displayConfig.UserViewResolution.x / _displayConfig.ResolutionScale;
            shaderParams._viewResY = _displayConfig.UserViewResolution.y / _displayConfig.ResolutionScale;

            var offset = new [] { (int)_displayConfig.AlignmentOffset.x, (int)_displayConfig.AlignmentOffset.y };

            shaderParams._offsetX = offset[0] + (decorators.ParallaxOrientation.IsInv() ? XOffsetWhenInverted() : 0);
            shaderParams._offsetY = offset[1] + (decorators.ParallaxOrientation.IsInv() ? YOffsetWhenInverted() : 0);

            shaderParams._viewsX = _displayConfig.NumViews.x;
            shaderParams._viewsY = _viewsHigh;

            shaderParams._orientation             = decorators.ParallaxOrientation.IsLandscape() ? 1 : 0;
            shaderParams._adaptFOVx               = decorators.AdaptFOV.x;
            shaderParams._adaptFOVy               = decorators.AdaptFOV.y;
            shaderParams._enableSwizzledRendering = 1;
            shaderParams._enableHoloRendering     = 1;
            shaderParams._enableSuperSampling     = 0;
            shaderParams._separateTiles           = 1;


            var is2d = shaderParams._viewsY == 1 && shaderParams._viewsX == 1;

            if (decorators.ShowTiles || is2d)
            {
                shaderParams._enableSwizzledRendering = 0;
                shaderParams._enableHoloRendering     = 0;
            }

            if (decorators.ShowTiles)
            {
                _material.EnableKeyword("ShowTiles");
            }
            else
            {
                _material.DisableKeyword("ShowTiles");
            }

            shaderParams._showCalibrationSquares = decorators.ShowCalibration ? 1 : 0;
            shaderParams.ApplyTo(_material);
        }
Example #3
0
 public override void UpdateState(LeiaStateDecorators decorators, ILeiaDevice device)
 {
     // this method was left blank intentionally
 }