예제 #1
0
 private void CheckMaterial()
 {
     if (blitMaterial == null)
     {
         blitMaterial = new Material(OutlineEffect.LoadMaterial("TransparentBlit"));
     }
 }
예제 #2
0
        private void SetupOutline(Camera cameraToUse, OutlineParameters parametersToUse, bool isEditor)
        {
            UpdateBuffer(cameraToUse, parametersToUse.Buffer, false);
            UpdateParameters(parametersToUse, cameraToUse, isEditor);

            parametersToUse.Buffer.Clear();
            if (renderingStrategy == OutlineRenderingStrategy.Default)
            {
                OutlineEffect.SetupOutline(parametersToUse);
                parametersToUse.BlitMesh = null;
                parametersToUse.MeshPool.ReleaseAllMeshes();
            }
            else
            {
                temporaryOutlinables.Clear();
                temporaryOutlinables.AddRange(parametersToUse.OutlinablesToRender);

                parametersToUse.OutlinablesToRender.Clear();
                parametersToUse.OutlinablesToRender.Add(null);

                foreach (var outlinable in temporaryOutlinables)
                {
                    parametersToUse.OutlinablesToRender[0] = outlinable;
                    OutlineEffect.SetupOutline(parametersToUse);
                    parametersToUse.BlitMesh = null;
                }

                parametersToUse.MeshPool.ReleaseAllMeshes();
            }
        }
예제 #3
0
        private void LateUpdate()
        {
            parameters.Layers.Clear();
            Outlinable.GetAllActiveOutlinables(outlinables);
            foreach (var outlinable in outlinables)
            {
                parameters.Layers.Add(outlinable.Layer);
            }

#if UNITY_EDITOR
            ReAddBufferToEditorCamera();

            if (SceneView.lastActiveSceneView != null && SceneView.lastActiveSceneView.camera != null)
            {
                UpdateParameters(SceneView.lastActiveSceneView.camera, true);
                var targetTexture = SceneView.lastActiveSceneView.camera.targetTexture;
                var width         = targetTexture == null ? Screen.width : targetTexture.width;
                var height        = targetTexture == null ? Screen.height : targetTexture.height;

                SceneView.lastActiveSceneView.camera.forceIntoRenderTexture = true;
                OutlineEffect.SetupBuffer(parameters);
            }
#endif

            {
                UpdateParameters(targetCamera, false);
                targetCamera.forceIntoRenderTexture = true;
                OutlineEffect.SetupBuffer(parameters);
            }
        }