public void CopyDepthNormalTech(GlassManager manager)
 {
     depthTechnique      = manager.depthTechnique;
     normalTechnique     = manager.normalTechnique;
     frontDepthTechnique = manager.frontDepthTechnique;
     enable54Workaround  = manager.enable54Workaround;
 }
Beispiel #2
0
        public static GlassDepthTechnique DepthTechFromNormal(GlassDepthTechnique currentDepthTechnique, GlassNormalTechnique inputNormalTechnique)
        {
            GlassDepthTechnique outputDepthTechnique = currentDepthTechnique;

            switch (inputNormalTechnique)
            {
            case GlassNormalTechnique.NORMAL_CAM_CUSTOM:
                switch (currentDepthTechnique)
                {
                case GlassDepthTechnique.DEPTH_CAM_UNITY:
                    outputDepthTechnique = GlassDepthTechnique.DEPTH_CAM_CUSTOM;
                    break;

                default:
                    break;
                }
                break;

            case GlassNormalTechnique.NORMAL_CAM_UNITY:
                switch (currentDepthTechnique)
                {
                case GlassDepthTechnique.DEPTH_CAM_CUSTOM:
                    outputDepthTechnique = GlassDepthTechnique.DEPTH_CAM_UNITY;
                    break;

                default:
                    break;
                }
                break;

            case GlassNormalTechnique.NORMAL_WORLD_CAM_SHADER:
                break;
            }

            return(outputDepthTechnique);
        }
Beispiel #3
0
        public static GlassFrontDepthTechnique FrontDepthTechFromDepth(GlassFrontDepthTechnique currentFrontDepthTechnique, GlassDepthTechnique inputDepthTechnique, bool _enable54Workaround = false)
        {
            //    TODO: replace this workaround for bug in 5.4 if better fix found
                        #if UNITY_5_4_OR_NEWER
            if (_enable54Workaround)
            {
                return(GlassFrontDepthTechnique.DEPTH_FRONT_SHADER_OFF);
            }
#endif
            return(currentFrontDepthTechnique);
        }
Beispiel #4
0
        public static void DepthNormalTechFromFrontDepth(GlassFrontDepthTechnique frontTechIn, ref GlassDepthTechnique depthTechOut, ref GlassNormalTechnique normalTechOut, bool _enable54Workaround = false)
        {
            //    TODO: replace this workaround for bug in 5.4 if better fix found
                        #if UNITY_5_4_OR_NEWER
            if (_enable54Workaround)
            {
                //	No need to change anything as long as front depth is off
            }
#endif
        }
Beispiel #5
0
        public void SetDepthTechnique(GlassDepthTechnique technique, bool forceUpdate = false)
        {
            if (!forceUpdate)
            {
                if (technique == depthTechnique)
                {
                    return;
                }
            }

            depthTechnique = technique;
            glassManager.depthTechnique = depthTechnique;

            //    TODO: replace this workaround for bug in 5.4 if better fix found
#if UNITY_5_4_OR_NEWER
            if (glassManager.enable54Workaround)
            {
                SetFrontDepthTechnique(GlassFrontDepthTechnique.DEPTH_FRONT_SHADER_OFF);
                //frontDepthTechnique = GlassFrontDepthTechnique.DEPTH_FRONT_SHADER_OFF;
            }
#endif

            Shader.EnableKeyword(DepthKeyword());

            switch (depthTechnique)
            {
            case GlassDepthTechnique.DEPTH_CAM_CUSTOM:
                switch (normalTechnique)
                {
                case GlassNormalTechnique.NORMAL_CAM_UNITY:
                    SetNormalTechnique(GlassNormalTechnique.NORMAL_CAM_CUSTOM);
                    break;

                default:
                    break;
                }
                break;

            case GlassDepthTechnique.DEPTH_CAM_UNITY:
                switch (normalTechnique)
                {
                case GlassNormalTechnique.NORMAL_CAM_CUSTOM:
                    SetNormalTechnique(GlassNormalTechnique.NORMAL_CAM_UNITY);
                    break;

                default:
                    break;
                }
                break;
            }

            switch (depthTechnique)
            {
            case GlassDepthTechnique.DEPTH_CAM_CUSTOM:
                Shader.DisableKeyword("DEPTH_CAM_UNITY");
                Shader.EnableKeyword("DEPTH_CAM_CUSTOM");
                break;

            case GlassDepthTechnique.DEPTH_CAM_UNITY:
                Shader.DisableKeyword("DEPTH_CAM_CUSTOM");
                Shader.EnableKeyword("DEPTH_CAM_UNITY");
                break;
            }
        }
 public void UpdateNormalTechnique()
 {
     depthTechnique      = GlassDepthCamera.DepthTechFromNormal(depthTechnique, normalTechnique);
     frontDepthTechnique = GlassDepthCamera.FrontDepthTechFromNormal(frontDepthTechnique, normalTechnique, enable54Workaround);
 }