Ejemplo n.º 1
0
        public static bool CanBeBatched(VolumetricLightBeam beamA, VolumetricLightBeam beamB, ref string reasons)
        {
            bool ret = true;

            if (!CanBeBatched(beamA, ref reasons))
            {
                ret = false;
            }

            if (!CanBeBatched(beamB, ref reasons))
            {
                ret = false;
            }

            if ((beamA.GetComponent <DynamicOcclusionAbstractBase>() == null) != (beamB.GetComponent <DynamicOcclusionAbstractBase>() == null))
            {
                AppendErrorMessage(ref reasons, string.Format("{0}/{1}: dynamically occluded and non occluded beams cannot be batched together", beamA.name, beamB.name));
                ret = false;
            }

            if (beamA.colorMode != beamB.colorMode)
            {
                AppendErrorMessage(ref reasons, "Color Mode mismatch");
                ret = false;
            }

            if (beamA.blendingMode != beamB.blendingMode)
            {
                AppendErrorMessage(ref reasons, "Blending Mode mismatch");
                ret = false;
            }

            if (beamA.isNoiseEnabled != beamB.isNoiseEnabled)
            {
                AppendErrorMessage(ref reasons, "3D Noise enabled mismatch");
                ret = false;
            }

            if (!forceEnableDepthBlend)
            {
#pragma warning disable 0162
                if ((beamA.depthBlendDistance > 0) != (beamB.depthBlendDistance > 0))
                {
                    AppendErrorMessage(ref reasons, "Opaque Geometry Blending mismatch");
                    ret = false;
                }
#pragma warning restore 0162
            }

            return(ret);
        }
Ejemplo n.º 2
0
        public static void AddComponentFromEditor <TComp>(VolumetricLightBeam self) where TComp : Component
        {
            if (self)
            {
                if (self.GetComponent <TComp>() == null)
                {
                    var comp = Undo.AddComponent <TComp>(self.gameObject);

                    if (comp is DynamicOcclusionRaycasting)
                    {
                        (comp as DynamicOcclusionRaycasting).dimensions = self.dimensions;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public static bool CanBeBatched(VolumetricLightBeam beam, ref string reason)
        {
            bool ret = true;

            if (beam.geomMeshType != MeshType.Shared)
            {
                AppendErrorMessage(ref reason, string.Format("{0} is not using shared mesh", beam.name));
                ret = false;
            }

            if (beam.GetComponent <DynamicOcclusion>())
            {
                AppendErrorMessage(ref reason, string.Format("{0}: dynamically occluded and non occluded beams cannot be batched together", beam.name));
                ret = false;
            }
            return(ret);
        }
Ejemplo n.º 4
0
        public static bool CanBeBatched(VolumetricLightBeam beam, ref string reasons)
        {
            bool ret = true;

            if (beam.geomMeshType != MeshType.Shared)
            {
                AppendErrorMessage(ref reasons, string.Format("{0} is not using shared mesh", beam.name));
                ret = false;
            }

            if (beam.GetComponent <DynamicOcclusionDepthBuffer>())
            {
                AppendErrorMessage(ref reasons, string.Format("{0} is using the DynamicOcclusion DepthBuffer feature", beam.name));
                ret = false;
            }
            return(ret);
        }
Ejemplo n.º 5
0
        public static bool CanBeBatched(VolumetricLightBeam beam, ref string reasons)
        {
            bool ret = true;

            if (Config.Instance.actualRenderingMode == RenderingMode.GPUInstancing)
            {
                if (beam.geomMeshType != MeshType.Shared)
                {
                    AppendErrorMessage(ref reasons, string.Format("{0} is not using shared mesh", beam.name));
                    ret = false;
                }
            }

            if (Config.Instance.featureEnabledDynamicOcclusion && beam.GetComponent <DynamicOcclusionDepthBuffer>() != null)
            {
                AppendErrorMessage(ref reasons, string.Format("{0} is using the DynamicOcclusion DepthBuffer feature", beam.name));
                ret = false;
            }
            return(ret);
        }
Ejemplo n.º 6
0
        public static bool CanBeBatched(VolumetricLightBeam beamA, VolumetricLightBeam beamB, ref string reasons)
        {
#pragma warning disable 0162 // warning CS0162: Unreachable code detected
            if (Config.Instance.renderPipeline == RenderPipeline.BuiltIn && !isGpuInstancingSupported)
            {
                reasons = "'GPU Instancing' is not supported on your setup.";
                return(false);
            }
#pragma warning restore 0162

            if (Config.Instance.actualRenderingMode != RenderingMode.GPUInstancing && Config.Instance.actualRenderingMode != RenderingMode.SRPBatcher)
            {
                reasons = string.Format("Current Render Pipeline is '{0}'. To enable batching, use 'GPU Instancing'", Config.Instance.renderPipeline);
                if (Config.Instance.renderPipeline != RenderPipeline.BuiltIn)
                {
                    reasons += " or 'SRP Batcher'";
                }
                return(false);
            }

            bool ret = true;

            if (!CanBeBatched(beamA, ref reasons))
            {
                ret = false;
            }

            if (!CanBeBatched(beamB, ref reasons))
            {
                ret = false;
            }

            if (Config.Instance.featureEnabledDynamicOcclusion)
            {
                if ((beamA.GetComponent <DynamicOcclusionAbstractBase>() == null) != (beamB.GetComponent <DynamicOcclusionAbstractBase>() == null))
                {
                    AppendErrorMessage(ref reasons, string.Format("{0}/{1}: dynamically occluded and non occluded beams cannot be batched together", beamA.name, beamB.name));
                    ret = false;
                }
            }

            if (Config.Instance.featureEnabledColorGradient != FeatureEnabledColorGradient.Off && beamA.colorMode != beamB.colorMode)
            {
                AppendErrorMessage(ref reasons, string.Format("'Color Mode' mismatch: {0} / {1}", beamA.colorMode, beamB.colorMode));
                ret = false;
            }

            if (beamA.blendingMode != beamB.blendingMode)
            {
                AppendErrorMessage(ref reasons, string.Format("'Blending Mode' mismatch: {0} / {1}", beamA.blendingMode, beamB.blendingMode));
                ret = false;
            }

            if (Config.Instance.featureEnabledNoise3D && beamA.isNoiseEnabled != beamB.isNoiseEnabled)
            {
                AppendErrorMessage(ref reasons, string.Format("'3D Noise' enabled mismatch: {0} / {1}", beamA.noiseMode, beamB.noiseMode));
                ret = false;
            }

            if (Config.Instance.featureEnabledDepthBlend && !forceEnableDepthBlend)
            {
#pragma warning disable 0162
                if ((beamA.depthBlendDistance > 0) != (beamB.depthBlendDistance > 0))
                {
                    AppendErrorMessage(ref reasons, string.Format("'Opaque Geometry Blending' mismatch: {0} / {1}", beamA.depthBlendDistance, beamB.depthBlendDistance));
                    ret = false;
                }
#pragma warning restore 0162
            }

            if (Config.Instance.featureEnabledShaderAccuracyHigh && beamA.shaderAccuracy != beamB.shaderAccuracy)
            {
                AppendErrorMessage(ref reasons, string.Format("'Shader Accuracy' mismatch: {0} / {1}", beamA.shaderAccuracy, beamB.shaderAccuracy));
                ret = false;
            }

            return(ret);
        }