Ejemplo n.º 1
0
        public ref FrameSettings GetDefaultFrameSettings(FrameSettingsRenderType type)
        {
            switch (type)
            {
            case FrameSettingsRenderType.Camera:
                return(ref m_RenderingPathDefaultCameraFrameSettings);

            case FrameSettingsRenderType.CustomOrBakedReflection:
                return(ref m_RenderingPathDefaultBakedOrCustomReflectionFrameSettings);

            case FrameSettingsRenderType.RealtimeReflection:
                return(ref m_RenderingPathDefaultRealtimeReflectionFrameSettings);

            default:
                throw new ArgumentException("Unknown FrameSettingsRenderType");
            }
        }
Ejemplo n.º 2
0
        // deactivate this test for template package making issue
        //[Test]
        public void FrameSettingsAggregation()
        {
            for (int i = 0; i < 10; ++i)
            {
                //init
                FrameSettings             fs            = default;
                FrameSettingsOverrideMask fso           = default;
                FrameSettingsRenderType   defaultFSType = RandomUtilities.RandomEnumValue <FrameSettingsRenderType>(i);
                FrameSettings             defaultFS;
                FrameSettings             result            = FrameSettings.NewDefaultCamera();
                FrameSettings             tester            = default;
                RenderPipelineSettings    supportedFeatures = new RenderPipelineSettings();
                switch (defaultFSType)
                {
                case FrameSettingsRenderType.Camera:
                    defaultFS = FrameSettings.NewDefaultCamera();
                    break;

                case FrameSettingsRenderType.CustomOrBakedReflection:
                    defaultFS = FrameSettings.NewDefaultCustomOrBakeReflectionProbe();
                    break;

                case FrameSettingsRenderType.RealtimeReflection:
                    defaultFS = FrameSettings.NewDefaultRealtimeReflectionProbe();
                    break;

                default:
                    throw new ArgumentException("Unknown FrameSettingsRenderType");
                }

                //change randomly override values
                for (int j = 0; j < 10; ++j)
                {
                    FrameSettingsField field = RandomUtilities.RandomEnumValue <FrameSettingsField>((i + 0.5f) * (j + 0.3f));
                    fs.SetEnabled(field, RandomUtilities.RandomBool((i + 1) * j));
                    fso.mask[(uint)field] = true;
                }

                //create and init gameobjects
                var go = new GameObject("TestObject");
                m_ToClean = go;
                var cam = go.AddComponent <Camera>();

                var add = cam.GetComponent <HDAdditionalCameraData>() ?? cam.gameObject.AddComponent <HDAdditionalCameraData>();
                Assert.True(add != null && !add.Equals(null));

                add.renderingPathCustomFrameSettings             = fs;
                add.renderingPathCustomFrameSettingsOverrideMask = fso;
                add.defaultFrameSettings    = defaultFSType;
                add.customRenderingSettings = true;

                //gather data two different ways
                FrameSettings.AggregateFrameSettings(ref result, cam, add, ref defaultFS, supportedFeatures);

                foreach (FrameSettingsField field in Enum.GetValues(typeof(FrameSettingsField)))
                {
                    tester.SetEnabled(field, fso.mask[(uint)field] ? fs.IsEnabled(field) : defaultFS.IsEnabled(field));
                }
                tester.lodBias             = result.lodBias;
                tester.lodBiasMode         = result.lodBiasMode;
                tester.maximumLODLevel     = result.maximumLODLevel;
                tester.maximumLODLevelMode = result.maximumLODLevelMode;
                FrameSettings.Sanitize(ref tester, cam, supportedFeatures);

                //test
                Assert.AreEqual(result, tester);

                Object.DestroyImmediate(go);
            }
        }