Esempio n. 1
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                ReleaseCamera();

#if UNITY_EDITOR
                if (m_ModifiedResulution)
                {
                    m_ModifiedResolutionCount--;
                    if (m_ModifiedResolutionCount == 0)
                    {
                        GameViewSize.RestoreSize();
                    }
                }
#endif
            }

            base.Dispose(disposing);
        }
Esempio n. 2
0
        public override void BeginRecording(RecordingSession session)
        {
            m_quad = CreateFullscreenQuad();
            switch (cbSettings.source)
            {
            case EImageSource.GameDisplay:
            case EImageSource.MainCamera:
            {
                int screenWidth  = Screen.width;
                int screenHeight = Screen.height;
#if UNITY_EDITOR
                switch (cbSettings.m_RenderSize)
                {
                case EImageDimension.Window:
                {
                    GameViewSize.GetGameRenderSize(out screenWidth, out screenHeight);
                    outputWidth  = screenWidth;
                    outputHeight = screenHeight;

                    if (cbSettings.m_ForceEvenSize)
                    {
                        outputWidth  = (outputWidth + 1) & ~1;
                        outputHeight = (outputHeight + 1) & ~1;
                    }

                    break;
                }

                default:
                {
                    outputHeight = (int)cbSettings.m_RenderSize;
                    outputWidth  = (int)(outputHeight * AspectRatioHelper.GetRealAR(cbSettings.m_RenderAspect));

                    if (cbSettings.m_ForceEvenSize)
                    {
                        outputWidth  = (outputWidth + 1) & ~1;
                        outputHeight = (outputHeight + 1) & ~1;
                    }

                    var size = GameViewSize.SetCustomSize(outputWidth, outputHeight);
                    if (size == null)
                    {
                        size = GameViewSize.AddSize(outputWidth, outputHeight);
                    }

                    if (m_ModifiedResolutionCount == 0)
                    {
                        GameViewSize.BackupCurrentSize();
                    }
                    else
                    {
                        if (size != GameViewSize.currentSize)
                        {
                            Debug.LogError("Requestion a resultion change while a recorder's input has already requested one! Undefined behaviour.");
                        }
                    }
                    m_ModifiedResolutionCount++;
                    m_ModifiedResulution = true;
                    GameViewSize.SelectSize(size);
                    break;
                }
                }
#endif
                break;
            }

            case EImageSource.TaggedCamera:
            default:
                throw new ArgumentOutOfRangeException();
            }
        }