Esempio n. 1
0
        // set render texture or colors if render texture is used (stills handled in AMTake)
        private void setRenderTexture(ITarget itarget, CameraFade cf, float frame, int firstTargetType, int secondTargetType, bool isReversed,
                                      CameraSwitcherKey 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 = Take.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;
                    }
                }
            }
        }
Esempio n. 2
0
        public cfTuple getCameraFadeTupleForFrame(ITarget itarget, int frame)
        {
            if (keys == null || keys.Count <= 0)
            {
                return(new cfTuple(0, 0, 0, null, null, false));
            }
            for (int i = 0; i < keys.Count; i++)
            {
                CameraSwitcherKey key = keys[i] as CameraSwitcherKey;
                // compact
                if (frame < key.frame)
                {
                    break;
                }
                else if (frame < key.endFrame)
                {
                    if (!key.still || key.cameraFadeType == (int)CameraSwitcherKey.Fade.None || key.targetsAreEqual(itarget))
                    {
                        break;
                    }
                    bool isReversed = key.isReversed();

                    if (isReversed)
                    {
                        return(new cfTuple(key.endFrame, key.typeEnd, key.type, key.GetCameraEnd(itarget), key.GetCamera(itarget), isReversed));
                    }
                    else
                    {
                        return(new cfTuple(key.frame, key.type, key.typeEnd, key.GetCamera(itarget), key.GetCameraEnd(itarget), isReversed));
                    }
                    //return new cfTuple((isReversed ? (cache[i] as AMCameraSwitcherAction).endFrame : (cache[i] as AMCameraSwitcherAction).startFrame),(cache[i] as AMCameraSwitcherAction).startCamera,(cache[i] as AMCameraSwitcherAction).endCamera,isReversed);
                }
            }
            return(new cfTuple(0, 0, 0, null, null, false));
        }
Esempio n. 3
0
            //private float[] mFadeParams;

            public void Apply(CameraSwitcherKey camSwitcher, int frameRate, ITarget itarget, Camera[] allCameras, bool backwards)
            {
                if (mCamSwitcher != camSwitcher)
                {
                    mCamSwitcher = camSwitcher;

                    float[] fadeParams = mCamSwitcher.cameraFadeParameters.ToArray();
                    mIsReversed = Utility.isTransitionReversed(mCamSwitcher.type, fadeParams);
                    mCam        = mCamSwitcher.GetCamera(itarget);
                    mCamEnd     = mCamSwitcher.GetCameraEnd(itarget);
                    mAllCams    = allCameras;

                    if (mCamSwitcher.cameraFadeType == (int)Fade.None)
                    {
                        mCamSwitcher.CameraFadeNoneTargets(mCamSwitcher.typeEnd, mCamSwitcher.colorEnd, mCamEnd, mAllCams);
                        mCamSwitcher.CameraEnd(mIsReversed, mCam, mCamEnd, mAllCams);
                    }
                    else
                    {
                        mCamSwitcher.CameraGenerateFadeTargets(mIsReversed, mCam, mCamEnd, mAllCams, fadeParams);
                    }
                }

                mBackwards = backwards;
            }
Esempio n. 4
0
        public override void previewFrame(ITarget itarget, float frame, int frameRate, bool play, float playSpeed)
        {
            if (keys == null || keys.Count <= 0)
            {
                return;
            }

            CameraFade.getCameraFade();

            // if before or equal to first frame, or is the only frame
            CameraSwitcherKey firstKey = keys[0] as CameraSwitcherKey;

            if (firstKey.endFrame == -1 || (frame <= (float)firstKey.frame && !firstKey.canTween))
            {
                CameraFade.reset();
                if (!firstKey.hasStartTarget(itarget))
                {
                    return;
                }

                if (firstKey.type == 0)
                {
                    Utility.SetTopCamera(firstKey.GetCamera(itarget), GetCachedCameras(itarget));
                }
                else
                {
                    showColor(firstKey.color);
                }
                return;
            }

            for (int i = 0; i < keys.Count; i++)
            {
                CameraSwitcherKey key     = keys[i] as CameraSwitcherKey;
                CameraSwitcherKey keyNext = i + 1 < keys.Count ? keys[i + 1] as CameraSwitcherKey : null;

                if (frame >= (float)key.endFrame && keyNext != null && (!keyNext.canTween || keyNext.endFrame != -1))
                {
                    continue;
                }
                // if no ease
                if (!key.canTween || keyNext == null)
                {
                    CameraFade.reset();
                    if (!key.hasStartTarget(itarget))
                    {
                        return;
                    }

                    if (key.type == 0)
                    {
                        Utility.SetTopCamera(key.GetCamera(itarget), GetCachedCameras(itarget));
                    }
                    else
                    {
                        showColor(key.color);
                    }
                    return;
                }
                // else find t using easing function

                if (!key.hasStartTarget(itarget) || !key.hasEndTarget(itarget))
                {
                    return;
                }
                //targets are equal
                if (key.targetsAreEqual(itarget))
                {
                    CameraFade.reset();
                    if (key.type == 0)
                    {
                        Utility.SetTopCamera(key.GetCamera(itarget), GetCachedCameras(itarget));
                    }
                    else
                    {
                        showColor(key.color);
                    }
                }
                else
                {
                    CameraFade.clearRenderTexture();
                    previewCameraFade(itarget, frame, key);
                }

                return;
            }
        }