예제 #1
0
        private RTECamera _CreateCamera(Camera camera, CameraEvent cameraEvent, bool createMeshesCache, bool createRenderersCache)
        {
            bool wasActive = camera.gameObject.activeSelf;

            camera.gameObject.SetActive(false);
            RTECamera rteCamera = camera.gameObject.AddComponent <RTECamera>();

            rteCamera.Event = cameraEvent;

            if (createMeshesCache)
            {
                MeshesCache meshesCache = gameObject.AddComponent <MeshesCache>();
                meshesCache.RefreshMode = CacheRefreshMode.Manual;
                rteCamera.MeshesCache   = meshesCache;
            }

            if (createRenderersCache)
            {
                RenderersCache renderersCache = gameObject.AddComponent <RenderersCache>();
                rteCamera.RenderersCache = renderersCache;
            }

            camera.gameObject.SetActive(wasActive);

            return(rteCamera);
        }
        private static void CreateRTECamera(GameObject camera, CameraEvent cameraEvent, IRenderersCache cache, List <RTECamera> rteCameras)
        {
            RTECamera rteCamera = camera.AddComponent <RTECamera>();

            rteCamera.Event          = cameraEvent;
            rteCamera.RenderersCache = cache;
            rteCameras.Add(rteCamera);
        }
        private static void DestroyRTECameras(Camera camera, Data data)
        {
            List <RTECamera> rteCameras = data.RTECameras;

            for (int i = rteCameras.Count - 1; i >= 0; i--)
            {
                RTECamera rteCamera = rteCameras[i];
                if (rteCamera != null && rteCamera.gameObject == camera.gameObject)
                {
                    Destroy(rteCameras[i]);
                    rteCameras.RemoveAt(i);
                }
            }
        }
        private static void CreateRTECamera(GameObject camera, CameraEvent cameraEvent, IRenderersCache cache, List <RTECamera> rteCameras)
        {
            bool wasActive = camera.gameObject.activeSelf;

            camera.SetActive(false);

            RTECamera rteCamera = camera.AddComponent <RTECamera>();

            rteCamera.Event          = cameraEvent;
            rteCamera.RenderersCache = cache;
            rteCameras.Add(rteCamera);

            camera.SetActive(wasActive);
        }
        private RTECamera _CreateCamera(Camera camera, CameraEvent cameraEvent, bool createMeshesCache, bool createRenderersCache)
        {
            bool wasActive = camera.gameObject.activeSelf;

            camera.gameObject.SetActive(false);
            RTECamera rteCamera = camera.gameObject.AddComponent <RTECamera>();

            rteCamera.Event = cameraEvent;

            if (createMeshesCache)
            {
                rteCamera.CreateMeshesCache();
            }

            if (createRenderersCache)
            {
                rteCamera.CreateRenderersCache();
            }

            camera.gameObject.SetActive(wasActive);
            return(rteCamera);
        }
        public IRTECamera CreateCamera(Camera camera)
        {
            RenderersCache renderersCache = camera.gameObject.AddComponent <RenderersCache>();
            MeshesCache    meshesCache    = camera.gameObject.AddComponent <MeshesCache>();

            meshesCache.RefreshMode = CacheRefreshMode.Manual;

            RTECamera rteCamera = camera.gameObject.AddComponent <RTECamera>();

            rteCamera.RenderersCache = renderersCache;
            rteCamera.MeshesCache    = meshesCache;

            if (RenderPipelineInfo.Type == RPType.Standard)
            {
                rteCamera.Event = CameraEvent.BeforeImageEffects;
            }
            else
            {
                rteCamera.Event = CameraEvent.AfterImageEffectsOpaque;
            }

            return(rteCamera);
        }