Ejemplo n.º 1
0
        void FillBloomMipsTextureHandles(BloomData bloomData, RenderGraph renderGraph, RenderGraphBuilder builder)
        {
            for (int i = 0; i < m_BloomMipCount; i++)
            {
                var scale     = new Vector2(m_BloomMipsInfo[i].z, m_BloomMipsInfo[i].w);
                var pixelSize = new Vector2Int((int)m_BloomMipsInfo[i].x, (int)m_BloomMipsInfo[i].y);

                bloomData.mipsDown[i] = builder.CreateTransientTexture(new TextureDesc(scale, true, true)
                {
                    colorFormat = m_ColorFormat, enableRandomWrite = true
                });

                if (i != 0)
                {
                    bloomData.mipsUp[i] = builder.CreateTransientTexture(new TextureDesc(scale, true, true)
                    {
                        colorFormat = m_ColorFormat, enableRandomWrite = true
                    });
                }
            }

            // the mip up 0 will be used by uber, so not allocated as transient.
            var mip0Scale = new Vector2(m_BloomMipsInfo[0].z, m_BloomMipsInfo[0].w);

            bloomData.mipsUp[0] = renderGraph.CreateTexture(new TextureDesc(mip0Scale, true, true)
            {
                name              = "Bloom final mip up",
                colorFormat       = m_ColorFormat,
                useMipMap         = false,
                enableRandomWrite = true
            });
        }
Ejemplo n.º 2
0
        public void SavePreset(Preset p)
        {
            // serialize data
            p.bloomData                     = BloomData.FromPreset(p);
            p.channelMixerData              = ChannelMixerData.FromPreset(p);
            p.chromaticAberrationData       = ChromaticAberrationData.FromPreset(p);
            p.colorAdjustementsData         = ColorAdjustementsData.FromPreset(p);
            p.colorCurvesData               = ColorCurvesData.FromPreset(p);
            p.depthOfFieldData              = DepthOfFieldData.FromPreset(p);
            p.filmGrainData                 = FilmGrainData.FromPreset(p);
            p.lensDistortionData            = LensDistortionData.FromPreset(p);
            p.liftGammaGainData             = LiftGammaGainData.FromPreset(p);
            p.motionBlurData                = MotionBlurData.FromPreset(p);
            p.paniniProjectionData          = PaniniProjectionData.FromPreset(p);
            p.physicalCameraData            = PhysicalCameraData.FromPreset(p);
            p.shadowsMidtonesHighlightsData = ShadowsMidtonesHighlightsData.FromPreset(p);
            p.splitToningData               = SplitToningData.FromPreset(p);
            p.toneMappingData               = ToneMappingData.FromPreset(p);
            p.vignetteData                  = VignetteData.FromPreset(p);
            p.whiteBalanceData              = WhiteBalanceData.FromPreset(p);

            // write to file
            var filepath = $"{Main.modEntry.Path}Presets\\{p.name}.preset.json";

            try {
                using (var writer = new StreamWriter(filepath)) {
                    //var serializedLine = JsonUtility.ToJson(p, true);
                    var serializedLine = JsonConvert.SerializeObject(p, Formatting.Indented);
                    writer.Write(serializedLine);
                }
            }
            catch (Exception) {
                Logger.Log($"Can't save {filepath}{p.name} preset");
            }
        }
Ejemplo n.º 3
0
        public Views()
        {
            DataTable Views = BloomData.GetViews();

            foreach (DataRow row in Views.Rows)
            {
                ViewofBloom view = new ViewofBloom();
                view._name        = row.Field <string>(0);
                view._description = row.Field <string>(1);
                view._allocated   = false;
                view._allocatedTo = -1;

                View.Add(view._name, view);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Constructor
        /// </summary>
        public CameraAngles()
        {
            DataTable angles = BloomData.GetCamera_Angle_Table();

            foreach (DataRow row in angles.Rows)
            {
                CameraAngle angle = new CameraAngle();
                angle._name        = row.Field <string>(0);
                angle._description = row.Field <string>(1);
                angle._imagename   = row.Field <string>(2);
                angle._allocated   = false;
                angle._allocatedTo = -1;

                cameraAngle.Add(angle._name, angle);
            }
        }
Ejemplo n.º 5
0
        public void TestEquality()
        {
            // Inited, both equal
            var bloom1 = new BloomData();
            var bloom2 = new BloomData();

            Assert.Equal(bloom1, bloom2);

            // Which is the same as initing with all 0s
            byte[] zeroedData = new byte[256];
            bloom2 = new BloomData(zeroedData);
            Assert.Equal(bloom1, bloom2);

            // Different value is not equal.
            byte[] differentData = new byte[256];
            differentData[2] = 16;
            bloom2           = new BloomData(differentData);
            Assert.NotEqual(bloom1, bloom2);
        }