コード例 #1
0
 public override void FireEvent()
 {
     if (this.m_LinkerCamera != null)
     {
         string     path       = "plot_c/plotcam_fastbloom";
         GameObject gameObject = Resources.Load(path) as GameObject;
         if (gameObject != null)
         {
             Camera     component   = this.m_LinkerCamera.GetComponent <Camera>();
             GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(gameObject);
             gameObject2.transform.SetParent(this.m_LinkerCamera.transform, false);
             Camera component2 = gameObject2.GetComponent <Camera>();
             component2.fieldOfView = component.fieldOfView;
             FastBloom component3 = gameObject2.GetComponent <FastBloom>();
             component3.threshhold     = this.threshhold;
             component3.intensity      = this.intensity;
             component3.blurSize       = this.blurSize;
             component3.resolution     = this.resolution;
             component3.blurIterations = this.blurIterations;
             component3.blurType       = this.blurType;
             if (component != null)
             {
                 component.enabled = false;
             }
         }
     }
 }
コード例 #2
0
ファイル: SystemLogic.cs プロジェクト: kimch2/PackageClient
    public void OnFloodlight()
    {
        FastBloom curCompont = (FastBloom)Camera.main.gameObject.GetComponent("FastBloom");

        if (m_Floodlight.value == false)
        {
            PlayerPreferenceData.SystemFloodlight = 0;
            if (curCompont != null)
            {
                curCompont.enabled = false;
#if  UNITY_WP8 && !UNITY_EDITOR
                //彻底删除FastBloom
                GameObject.Destroy(curCompont);
#endif
            }

            m_Floodlight_Lab.color = m_NoChooseColor;
        }
        else
        {
            PlayerPreferenceData.SystemFloodlight = 1;
            if (curCompont != null)
            {
                curCompont.enabled = true;
            }

            m_Floodlight_Lab.color = m_ChooseColor;
コード例 #3
0
    void OnLevelWasLoaded(int level)
    {
        //SceneManager.instance.showStopWatchTimer (" LoginState OnLevelWasLoaded start");
        if (Application.loadedLevelName == "LoginScene")
        {
            CameraManager.instance.transform.position               = Vector3.zero;
            CameraManager.instance.transform.eulerAngles            = Vector3.zero;
            CameraManager.instance.mainCamera.transform.position    = loginSceneCameraPos;
            CameraManager.instance.mainCamera.transform.eulerAngles = loginSceneCameraAngles;
            CameraManager.instance.mainCamera.fieldOfView           = 47;

            //MapEnvironmentSetting(Application.loadedLevelName);
            //여기는 로딩전이라 손으로 셋팅하자
            FastBloom bloom = CameraManager.instance.mainCamera.gameObject.GetComponentInChildren <FastBloom>();
            bloom.enabled        = false;
            bloom.threshhold     = 0.47f;
            bloom.intensity      = 0.05f;
            bloom.blurSize       = 2.47f;
            bloom.blurIterations = 1;

            if (!FirstLogin)//로그아웃했을경우 이쪽
            {
                LoginPhase();
                UIMgr.Open("UIPanel/LoginPanel", false);
                //LoadingPhase();
            }
            else//최초 실행시 이쪽부터
            {
                //UIBasePanel basePanel = UIMgr.GetUIBasePanel("UIPanel/LogoPanel");
                //if (basePanel != null)
                //{
                //(basePanel as LogoPanel).EndLogoStay();

                //(basePanel as LogoPanel).EndCallBack = () =>
                //{
                //    FirstLogin = false;
                //    AssetDownLoad.instance.isLoad = true;

                //    LoginPhase();
                //};
                //}

                LoginPanel loginPanel = UIMgr.Open("UIPanel/LoginPanel", true).GetComponent <LoginPanel>();
                loginPanel.EndCallBack = () => {
                    //AssetDownLoad.instance.isLoad = true;

                    LoginPhase();
                };
                //LoginPhase();
            }
        }

        //SceneManager.instance.showStopWatchTimer (" LoginState OnLevelWasLoaded end");
        //SceneManager.instance.sw.Stop ();
    }
コード例 #4
0
//        private bool m_HasFastBloom = false;
        void Start()
        {
            GameObject go = GameObject.Find("Main Camera");

            if (go != null)
            {
                ScreenCopySDK.Maincamera camera = go.GetComponent <ScreenCopySDK.Maincamera>();
                if (camera)
                {
                    FastBloom fb = GetComponent <FastBloom>();
                    if (fb && GetComponent <Camera>() != null)
                    {
                        camera.PushFastBloomCamera(GetComponent <Camera>());
                    }
                }
            }
        }
コード例 #5
0
ファイル: UtilsOut.cs プロジェクト: atom-chen/rongyaojt
        public static void setFastBloomParm(GameObject go, float intensity)
        {
            FastBloom component = go.GetComponent <FastBloom>();

            if (component == null)
            {
                return;
            }
            if (intensity < 0f)
            {
                return;
            }
            if (intensity > 2.5f)
            {
                return;
            }
            component.intensity = intensity;
        }
コード例 #6
0
 public override void FireEvent()
 {
     if (this.m_LinkerCamera != null)
     {
         string     path       = "plot_c/plotcam_dof_and_bloom";
         GameObject gameObject = Resources.Load(path) as GameObject;
         if (gameObject != null)
         {
             Camera     component   = this.m_LinkerCamera.GetComponent <Camera>();
             GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(gameObject);
             gameObject2.transform.SetParent(this.m_LinkerCamera.transform, false);
             Camera component2 = gameObject2.GetComponent <Camera>();
             component2.fieldOfView = component.fieldOfView;
             DepthOfField34 component3 = gameObject2.GetComponent <DepthOfField34>();
             component3.quality          = this.quality;
             component3.resolution       = this.resolution_dof;
             component3.simpleTweakMode  = this.simpleTweakMode;
             component3.focalPoint       = this.focalPoint;
             component3.smoothness       = this.smoothness;
             component3.focalZDistance   = this.focalZDistance;
             component3.focalZStartCurve = this.focalZStartCurve;
             component3.focalZEndCurve   = this.focalZEndCurve;
             component3.objectFocus      = this.objectFocus;
             component3.focalSize        = this.focalSize;
             component3.bluriness        = this.bluriness;
             component3.maxBlurSpread    = this.maxBlurSpread;
             FastBloom component4 = gameObject2.GetComponent <FastBloom>();
             component4.threshhold     = this.threshhold;
             component4.intensity      = this.intensity;
             component4.blurSize       = this.blurSize;
             component4.resolution     = this.resolution_bloom;
             component4.blurIterations = this.blurIterations;
             component4.blurType       = this.blurType;
             if (component != null)
             {
                 component.enabled = false;
             }
         }
     }
 }
コード例 #7
0
//        private bool m_ForeceIt = false;
        void Start()
        {
            blitShader = Shader.Find(Configure.BlitName);
            blitMaterial = new Material(blitShader);

            GetComponent<Camera>().targetTexture = RTManager.Instance.GetScene();
            int lay = LayerMask.NameToLayer(Configure.LayerName);
            GetComponent<Camera>().cullingMask &= ~(1 << lay);
            
            Subcamera subcamera;
            {
                GameObject go = new GameObject(Configure.CameraName);
                go.transform.parent = GetComponent<Camera>().transform;
                go.transform.localPosition = Vector3.zero;
                go.transform.localRotation = Quaternion.identity;
                Camera sub = go.AddComponent<Camera>();
                sub.depth = GetComponent<Camera>().depth + 1;
                sub.fieldOfView = GetComponent<Camera>().fieldOfView;
                sub.clearFlags = CameraClearFlags.Nothing;
                sub.nearClipPlane = GetComponent<Camera>().nearClipPlane;
                sub.farClipPlane = GetComponent<Camera>().farClipPlane;
                subcamera = go.AddComponent<Subcamera>();
            }
            
            {
                FastBloom fb = GetComponent<FastBloom>();
                subcamera.isBloomActived = false;
                if (null != fb)
                {
                    subcamera.isBloomActived = true;
                    subcamera.threshhold = fb.threshhold;
                    subcamera.blurIterations = fb.blurIterations;
                    subcamera.blurSize = fb.blurSize;
                    subcamera.blurType = fb.blurType;
                    subcamera.intensity = fb.intensity;
                    subcamera.resolution = fb.resolution;
                    DestroyImmediate(fb);//防止unity犯傻,readpixel
                }
            }
        }
コード例 #8
0
    /// <summary>
    /// 添加、设置摄像机效果
    /// </summary>
    /// <param name="cameraObj"></param>
    private void AddCameraEffect(GameObject cameraObj)
    {
        MotionBlur blur = cameraObj.GetComponent <MotionBlur>();

        if (blur == null)
        {
            blur            = cameraObj.AddComponent <MotionBlur>();
            blur.blurAmount = 0.4f;
            if (blur.shader == null)
            {
                blur.shader = Shader.Find("Hidden/MotionBlur");
            }

            blur.enabled = false;
        }

        FastBloom bloom = cameraObj.GetComponent <FastBloom>();

        if (bloom == null)
        {
            bloom                = cameraObj.AddComponent <FastBloom>();
            bloom.threshhold     = 0.1f;
            bloom.intensity      = 0.35f;
            bloom.blurSize       = 1.79f;
            bloom.resolution     = FastBloom.Resolution.Low;
            bloom.blurIterations = 1;
            bloom.blurType       = FastBloom.BlurType.Standard;

            if (bloom.fastBloomShader == null)
            {
                bloom.fastBloomShader = Shader.Find("Hidden/FastBloom");
            }

            bloom.enabled = true;
        }
    }
コード例 #9
0
ファイル: PostProcessSwitcher.cs プロジェクト: belzecue/C3DE
        public override void Start()
        {
            var graphics = Application.GraphicsDevice;

            // Setup PostProcess.
#if !DESKTOP
            var ssao = new ScreenSpaceAmbientObscurance(graphics);
            AddPostProcess(ssao);

            // var ssgi = new ScreenSpaceGlobalIllumination(graphics);
            //AddPostProcess(ssgi);
#endif
            var fastBloom = new FastBloom(graphics);
            AddPostProcess(fastBloom);

            AddPostProcess(new C64Filter(graphics));
            AddPostProcess(new CGAFilter(graphics));
            AddPostProcess(new ConvolutionFilter(graphics));
            AddPostProcess(new FilmFilter(graphics));
            AddPostProcess(new GrayScaleFilter(graphics));
            AddPostProcess(new AverageColorFilter(graphics));
            AddPostProcess(new MotionBlur(graphics));

            var refractionPass = new Refraction(graphics);
            AddPostProcess(refractionPass);
            refractionPass.RefractionTexture = Application.Content.Load <Texture2D>("Textures/hexagrid");
            refractionPass.TextureTiling     = new Vector2(0.5f);

            var vignette = new Vignette(graphics);
            AddPostProcess(vignette);

            AddPostProcess(new GlobalFog(graphics));

            AddPostProcess(new FXAA(graphics));

            // Setup UI
            var titles = new List <string>();

#if !DESKTOP
            titles.AddRange(new string[] {
                "Ambient Obscurance",
                // "SSGI"
            });
#endif

            titles.AddRange(new string[]
            {
                "Bloom", "C64 Filter",
                "CGA Filter", "Convolution", "Film",
                "GrayScale", "Average Color", "Motion Blur",
                "Refraction", "Vignette", "Global Fog", "FXAA"
            });

            var count = titles.Count;
            _boxRect = new Rectangle(Screen.VirtualWidth - 220, 10, 210, 45 * count);
            _widgets = new Widget[count];

            for (int i = 0; i < count; i++)
            {
                _widgets[i]      = new Widget();
                _widgets[i].Name = titles[i];

                if (i == 0)
                {
                    _widgets[i].Rect = new Rectangle(_boxRect.X + 10, _boxRect.Y + 30, _boxRect.Width - 20, 30);
                }
                else
                {
                    _widgets[i].Rect = new Rectangle(_boxRect.X + 10, _widgets[i - 1].Rect.Y + 40, _boxRect.Width - 20, 30);
                }

                _widgets[i].RectExt = new Rectangle(_widgets[i].Rect.X - 1, _widgets[i].Rect.Y - 1, _widgets[i].Rect.Width + 1, _widgets[i].Rect.Height + 1);
            }

            _backgroundTexture = GraphicsHelper.CreateTexture(Color.CornflowerBlue, 1, 1);

            var renderSettings = Scene.current.RenderSettings;
            renderSettings.FogDensity = 0.0085f;
            renderSettings.FogMode    = FogMode.Linear;
            renderSettings.Skybox.OverrideSkyboxFog(FogMode.Exp2, 0.05f, 0, 0);
        }
コード例 #10
0
 // Use this for initialization
 void Start()
 {
     fastBloom = GetComponent <FastBloom>();
     BloomIn();
 }
コード例 #11
0
    public void MapEnvironmentSetting(string MapName)
    {
        GameObject mainlightobj = GameObject.Find("main light");

        if (MapName == "tutorial_0101")
        {
            MapName = "single_0101";
        }

        /*else if (MapName == "1zone")
         * {
         *  MapName = "maintown";
         * }
         *      else*/if (MapName == "maintown_cutscene")
        {
            MapName = "maintown";
        }

        Map.MapDataInfo mapdata = _LowDataMgr.instance.GetMapData(MapName);

        if (mainlightobj != null)
        {
            Light light = mainlightobj.GetComponent <Light>();

            light.cullingMask  = 0;
            light.cullingMask  = 1 << LayerMask.NameToLayer("Map");
            light.cullingMask ^= 1 << LayerMask.NameToLayer("Unit");
            light.cullingMask ^= 1 << LayerMask.NameToLayer("Focus");

            if (mapdata != null)
            {
                //if(mapdata.AddIntensity != 0)
                //    light.intensity = mapdata.AddIntensity;
                //else
                //    light.intensity = 0.7f;

                light.shadowStrength     = mapdata.ShadowStrength;
                light.shadows            = LightShadows.Hard;
                light.shadowBias         = 0.05f;
                light.shadowSoftness     = 4;
                light.shadowSoftnessFade = 1;

                //만약을 위해 예외처리
                if (mapdata.AddColorR == 0 &&
                    mapdata.AddColorG == 0 &&
                    mapdata.AddColorB == 0)
                {
                    //_mapLightColor = light.color;
                    _mapLightColor = new Color(1f, 1f, 1f, 1f);
                }
                else
                {
                    _mapLightColor = new Color32(mapdata.AddColorR, mapdata.AddColorG, mapdata.AddColorB, 255);
                }

                if (mapdata.AddIntensity == 0)
                {
                    _mapIntensity = 1f;
                }
                else
                {
                    _mapIntensity = mapdata.AddIntensity;
                }
            }
        }

        //로우퀄리티에는 필요없다
        if (QualityManager.instance.GetQuality() == QUALITY.QUALITY_LOW)
        {
            mainlightobj.SetActive(false);
        }

        if (mapdata != null)
        {
            //블룸셋팅
            if (mapdata.Bloom_Enable == 1)
            {
                FastBloom bloom = CameraManager.instance.mainCamera.gameObject.GetComponentInChildren <FastBloom>();
                bloom.enabled        = true;
                bloom.threshhold     = mapdata.Bloom_Threshhold;
                bloom.intensity      = mapdata.Bloom_Intensity;
                bloom.blurSize       = mapdata.Bloom_BlurSize;
                bloom.blurIterations = (int)mapdata.Bloom_BlurIterations;
            }
            else
            {
                CameraManager.instance.mainCamera.gameObject.GetComponentInChildren <FastBloom>().enabled = false;
            }
        }
        else
        {
            CameraManager.instance.mainCamera.gameObject.GetComponentInChildren <FastBloom>().enabled = false;
        }
    }
コード例 #12
0
 // Use this for initialization
 void Start()
 {
     fastBloom = GetComponent<FastBloom>();
     BloomIn();
 }
コード例 #13
0
ファイル: CameraManager.cs プロジェクト: kimch2/PackageClient
    /// <summary>
    /// 初始化MainCamera效果
    /// </summary>
    private void InitMainCameraEffect()
    {
        if (m_CameraComponent == null)
        {
            return;
        }

        if (MobileHardwareInfo.Instance.HardwareLevel != Games.GlobeDefine.GameDefine_Globe.HardwardLevel.LEVEL_HIGH)
        {
            return;
        }

        //Bloom 效果添加
        if (m_FastBloom == null)
        {
            m_FastBloom = m_CameraComponent.GetComponent <FastBloom>();

            //不再主动挂FastBloom,改为场景制作完成之后,美术确定MainCamera挂还是不挂,挂的话参数是多少
            //if (m_FastBloom == null)
            //{
            //    m_FastBloom = m_CameraComponent.gameObject.AddComponent<FastBloom>();
            //}
            //m_FastBloom.enabled = false;

            //m_FastBloom.threshhold = 0.4f;
            //m_FastBloom.intensity = 0.45f;

            if (m_FastBloom && m_FastBloom.fastBloomShader == null)
            {
                m_FastBloom.fastBloomShader = Shader.Find("Hidden/FastBloom");
            }
#if UNITY_EDITOR
            //因为打包格式的问题,编辑器模式下直接打包完毕是看不出来Bloom效果的。FastBloom会被禁掉。这里新加一个FastBloom,为了在编辑器情况下预览。
            if (m_FastBloom)
            {
                FastBloom temp = m_CameraComponent.gameObject.AddComponent <FastBloom>();
                temp.enabled         = true;
                temp.threshhold      = m_FastBloom.threshhold;
                temp.intensity       = m_FastBloom.intensity;
                temp.blurSize        = m_FastBloom.blurSize;
                temp.resolution      = m_FastBloom.resolution;
                temp.blurIterations  = m_FastBloom.blurIterations;
                temp.blurType        = m_FastBloom.blurType;
                temp.fastBloomShader = Shader.Find("Hidden/FastBloom");
            }
#endif
        }

        if (m_MotionBlur == null)
        {
            m_MotionBlur = m_CameraComponent.GetComponent <MotionBlur>();
            if (m_MotionBlur == null)
            {
                m_MotionBlur = m_CameraComponent.gameObject.AddComponent <MotionBlur>();
            }
            m_MotionBlur.enabled = false;

            if (m_MotionBlur.shader == null)
            {
                m_MotionBlur.shader = Shader.Find("Hidden/MotionBlur");
            }
        }
    }
コード例 #14
0
 // Use this for initialization
 void Start()
 {
     bloomEffect = GetComponent <FastBloom>();
     allSamples  = new float[numberOfSamples];
 }
コード例 #15
0
    void Start()
    {
        fastBloom = Camera.main.gameObject.GetComponent<FastBloom>();

        if( fastBloom )
        {
            fastBloom.enabled = true;
            StartCoroutine( "DoBloomFade" );
        }

        blur = Camera.main.gameObject.GetComponent<Blur> ();

        if( blur )
        {
            blur.enabled = true;
            StartCoroutine( "DoBlurFade" );
        }
    }