Exemplo n.º 1
0
        void CameraGenerateFadeTargets(bool isReversed, Camera cam, Camera camEnd, Camera[] allCams, float[] parameters)
        {
            AMCameraFade cf = AMCameraFade.getCameraFade();

            cf.incrementKeepAlives(true);

            if (cf.keepAliveColor)
            {
                cf.keepAliveColor = false;
            }
            cf.isReset = false;

            Camera firstCamera  = null;
            Camera secondCamera = null;
            Color? firstColor   = null;
            Color? secondColor  = null;

            if (isReversed)
            {
                if (camEnd)
                {
                    firstCamera = camEnd;
                }
                else if (typeEnd == 1)
                {
                    firstColor = colorEnd;
                }
                if (cam)
                {
                    secondCamera = cam;
                }
                else if (type == 1)
                {
                    secondColor = color;
                }
            }
            else
            {
                if (cam)
                {
                    firstCamera = cam;
                }
                else if (type == 1)
                {
                    firstColor = color;
                }
                if (camEnd)
                {
                    secondCamera = camEnd;
                }
                else if (typeEnd == 1)
                {
                    secondColor = colorEnd;
                }
            }
            // setup first target
            if (firstCamera)
            {
                // camera
                if (!still)
                {
                    cf.setupRenderTexture(firstCamera);
                }
                else
                {
                    AMUtil.SetTopCamera(firstCamera, allCams);
                    firstCamera.Render();
                    cf.refreshScreenTex();
                    cf.useRenderTexture = false;
                    cf.hasColorTex      = false;
                }
            }
            else
            {
                // color
                cf.colorTex    = (Color)firstColor;
                cf.hasColorTex = true;
            }
            // setup second target
            if (secondCamera)
            {
                // camera
                AMUtil.SetTopCamera(secondCamera, allCams);
                cf.hasColorBG = false;
            }
            else
            {
                // color
                cf.colorBG    = (Color)secondColor;
                cf.hasColorBG = true;
            }
            // iris shape
            if (irisShape)
            {
                cf.irisShape = irisShape;
                //cf.setupMaterials();
            }
            cf.mode = cameraFadeType;
            // setup camera fade
            cf.setupMaterials();
            cf.r       = parameters;
            cf.value   = 1f;
            cf.percent = 0f;
        }
Exemplo n.º 2
0
        private void renderCameraSwitcherStill(AMITarget itarget, float _frame)
        {
            if (!cameraSwitcher)
            {
                return;
            }

            AMCameraSwitcherTrack.cfTuple tuple = cameraSwitcher.getCameraFadeTupleForFrame(itarget, (int)_frame);
            if (tuple.frame != 0)
            {
                AMCameraFade cf = AMCameraFade.getCameraFade();
                cf.isReset = false;
                // create render texture still
                //bool isPro = PlayerSettings.advancedLicense;
                bool isPro = isProLicense;
                if (!cf.screenTex || cf.shouldUpdateStill || (isPro && cf.cachedStillFrame != tuple.frame))
                {
                    if (isPro)
                    {
                        int firstTargetType  = (tuple.isReversed ? tuple.type2 : tuple.type1);
                        int secondTargetType = (tuple.isReversed ? tuple.type1 : tuple.type2);
                        if (firstTargetType == 0)
                        {
                            if (cf.screenTex)
                            {
                                Object.DestroyImmediate(cf.screenTex);
                            }
                            previewFrame(itarget, tuple.frame, false, false);
                            // set top camera
                            //bool isReversed = tuple.isReversed;
                            Camera firstCamera = (tuple.isReversed ? tuple.camera2 : tuple.camera1);



                            Utility.SetTopCamera(firstCamera, cameraSwitcher.getAllCameras(itarget));

                            // set cached frame to 0 if bad frame
                            if (cf.width <= 0 || cf.height <= 0)
                            {
                                if (Application.isPlaying)
                                {
                                    cf.width  = Screen.width;
                                    cf.height = Screen.height;
                                }
                                else
                                {
                                    cf.width             = 200;
                                    cf.height            = 100;
                                    cf.shouldUpdateStill = true;
                                }
                            }
                            else
                            {
                                cf.shouldUpdateStill = false;
                            }

                            cf.refreshScreenTex(firstCamera);
                            cf.cachedStillFrame = tuple.frame;
                            cf.placeholder      = false;

                            if (secondTargetType == 0)
                            {
                                Camera secondCamera = (tuple.isReversed ? tuple.camera1 : tuple.camera2);
                                Utility.SetTopCamera(secondCamera, cameraSwitcher.getAllCameras(itarget));
                            }
                        }
                    }
                    else
                    {
                        cf.clearScreenTex();
                        cf.placeholder = true;
                    }
                }
                cf.useRenderTexture = false;
            }
        }