Пример #1
0
        // set render texture or colors if render texture is used (stills handled in AMTake)
        private void setRenderTexture(AMITarget itarget, AMCameraFade cf, float frame, int firstTargetType, int secondTargetType, bool isReversed,
                                      AMCameraSwitcherKey action)
        {
            Camera firstCamera  = (isReversed ? action.getCameraEnd(itarget) : action.getCamera(itarget));
            Camera secondCamera = (isReversed ? action.getCamera(itarget) : action.getCameraEnd(itarget));

            if (isReversed && frame == action.frame)
            {
                if (firstTargetType == 0)
                {
                    Utility.SetTopCamera(firstCamera, GetCachedCameras(itarget));
                }
            }
            else
            {
                if (secondTargetType == 0)
                {
                    Utility.SetTopCamera(secondCamera, GetCachedCameras(itarget));
                }
            }

            if (action.still || (firstTargetType != 0 && secondTargetType != 0))
            {
                return;
            }

            bool isPro = AMTakeData.isProLicense;

            // first target is camera, set render texture
            if (firstTargetType == 0)
            {
                // if should update render texture
                if (/*!cf.tex ||*/ cf.shouldUpdateRenderTexture || (isPro && (!firstCamera.targetTexture || !cf.isRenderTextureSetupFor(firstCamera) /*|| firstCamera.targetTexture != cf.tex*/)))
                {
                    if (isPro)
                    {
                        cf.setupRenderTexture(firstCamera);
                    }
                    else
                    {
                        cf.useRenderTexture = false;
                        // show place-holder if non-pro
                        cf.colorTex    = Color.white;
                        cf.hasColorTex = false;
                        cf.clearScreenTex();
                        cf.placeholder = true;
                    }
                }
            }
        }
Пример #2
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;
        }