コード例 #1
0
 public CubeMapGraphics(AampFile aamp)
 {
     foreach (var obj in aamp.RootNode.childParams)
     {
         CubeMapObjects.Add(new CubeMapObject(obj));
     }
 }
コード例 #2
0
ファイル: AAMP.cs プロジェクト: week9/Switch-Toolbox
        public void Load(Stream stream)
        {
            CanSave = true;

            IsSaveDialog = IFileInfo != null && IFileInfo.InArchive;

            aampFile = AampFile.LoadFile(stream);
        }
コード例 #3
0
        static void Main(string[] args)
        {
            var aamp = "g3ds_packunslider.bgenv";

            AampFile file = AampFile.LoadFile(aamp);

            GetChildNodes(file.RootNode);
            ToYaml(file);
            file.Save("New.aamp");

            Console.Read();
        }
コード例 #4
0
        public AglLightMap(Stream stream)
        {
            var aamp = AampFile.LoadFile(stream);

            LightAreas.Clear();

            foreach (var ob in aamp.RootNode.paramObjects)
            {
                if (ob.HashString == "lut_param")
                {
                    //32 curves.
                    for (int i = 0; i < 32; i++)
                    {
                        LUTParameter param = new LUTParameter();
                        param.Name      = ob.GetEntryValue <StringEntry>($"name{i}").ToString();
                        param.Intensity = GetCurve(ob, $"intensity{i}")[0];
                        LutTable[i]     = param;
                    }
                }
            }
            foreach (var lightAreaParam in aamp.RootNode.childParams)
            {
                var lightArea = new LightArea();
                LightAreas.Add(lightArea);

                foreach (var ob in lightAreaParam.paramObjects)
                {
                    if (ob.HashString == "setting")
                    {
                        lightArea.Settings = new LightSettings(ob);
                    }
                }
                foreach (var c in lightAreaParam.childParams)
                {
                    if (c.HashString == "env_obj_ref_array")
                    {
                        foreach (var childObj in c.paramObjects)
                        {
                            lightArea.Lights.Add(new LightEnvObject(childObj));
                        }
                    }
                }
            }
            Console.WriteLine();
        }
コード例 #5
0
 public ShadowGraphics(AampFile aamp)
 {
     foreach (var obj in aamp.RootNode.paramObjects)
     {
         if (obj.HashString == "4137089673")
         {
             ShadowColors = new ShadowColorParams(obj);
         }
         else if (obj.HashString.Contains("depth_shadow_parameter_"))
         {
             DepthParams.Add(new DepthShadowParams(obj));
         }
         else if (obj.HashString.Contains("static_depth_shadow_parameter"))
         {
             StaticDepthShadowParams = new StaticDepthShadowParams(obj);
         }
         else if (obj.HashString.Contains("projection_shadow_"))
         {
             ProjectionParams.Add(new ProjectionShadowParams(obj));
         }
     }
 }
コード例 #6
0
 public void LoadFile(AampFile aampFile, TreeNode parentNode)
 {
     LoadChildNodes(aampFile.RootNode, parentNode);
 }
コード例 #7
0
 public ColorCorrection(AampFile aamp)
 {
     //Note this file always has only one object
     Parent = aamp.RootNode.paramObjects.FirstOrDefault();
 }
コード例 #8
0
        public EnvironmentGraphics(AampFile aamp)
        {
            Root = aamp.RootNode;

            HemisphereLights.Clear();
            FogObjects.Clear();
            DirectionalLights.Clear();
            BloomObjects.Clear();
            SpotLights.Clear();
            PointLights.Clear();

            foreach (var obj in aamp.RootNode.childParams)
            {
                switch (obj.HashString)
                {
                case "AmbientLight": break;

                case "DirectionalLight":
                    foreach (var child in obj.paramObjects)
                    {
                        DirectionalLights.Add(new DirectionalLight(child));
                    }
                    break;

                case "HemisphereLight":
                    foreach (var child in obj.paramObjects)
                    {
                        HemisphereLights.Add(new HemisphereLight(child));
                    }
                    break;

                case "Fog":
                    foreach (var child in obj.paramObjects)
                    {
                        FogObjects.Add(new Fog(child));
                    }
                    break;

                case "BloomObj":
                    foreach (var child in obj.paramObjects)
                    {
                        BloomObjects.Add(new BloomObj(child));
                    }
                    break;

                case "PointLightRig":
                    foreach (var child in obj.paramObjects)
                    {
                        PointLights.Add(new PointLightRig(child));
                    }
                    Console.WriteLine($"PointLights {PointLights.Count}");
                    break;

                case "SpotLightRig":
                    foreach (var child in obj.paramObjects)
                    {
                        SpotLights.Add(new SpotLightRig(child));
                    }
                    Console.WriteLine($"SpotLights {SpotLights.Count}");
                    break;

                case "OfxLargeLensFlareRig":
                    foreach (var child in obj.paramObjects)
                    {
                        LensFlareRigs.Add(new OfxLargeLensFlareRig(child));
                    }
                    break;
                }
            }
        }
コード例 #9
0
        static void ToYaml(AampFile file)
        {
            string yaml = YamlConverter.ToYaml(file);

            System.IO.File.WriteAllText("test.yaml", yaml);
        }
コード例 #10
0
        private ColorCorrection LoadColorCorrection(Stream file)
        {
            var aamp = AampFile.LoadFile(file);

            return(new ColorCorrection(aamp));
        }
コード例 #11
0
        private CubeMapGraphics LoadCubemapGraphics(Stream file)
        {
            var aamp = AampFile.LoadFile(file);

            return(new CubeMapGraphics(aamp));
        }
コード例 #12
0
        private ShadowGraphics LoadShadowGraphics(Stream file)
        {
            var aamp = AampFile.LoadFile(file);

            return(new ShadowGraphics(aamp));
        }
コード例 #13
0
        private EnvironmentGraphics LoadEnvironmentGraphics(Stream file)
        {
            var aamp = AampFile.LoadFile(file);

            return(new EnvironmentGraphics(aamp));
        }
コード例 #14
0
        private void LoadParameters(AampFile aamp)
        {
            if (aamp.EffectType == "Probe Data")
            {
                probeLightingConfig = new ProbeLighting();
                viewport.AddDrawable(probeLightingConfig);
                var probeRoot = new ProbeLightingWrapper(probeLightingConfig);
                treeView1.Nodes.Add(probeRoot);

                uint index = 0;
                foreach (var val in aamp.RootNode.childParams)
                {
                    var entry = new ProbeLighting.Entry();
                    entry.Index = index++;
                    probeLightingConfig.Entries.Add(entry);

                    probeRoot.Nodes.Add(new ProbeLightingEntryWrapper(entry));

                    foreach (var param in val.paramObjects)
                    {
                        switch (param.HashString)
                        {
                        case "param_obj":
                            foreach (var data in param.paramEntries)
                            {
                                if (data.HashString == "index")
                                {
                                    entry.Index = (uint)data.Value;
                                }
                                if (data.HashString == "type")
                                {
                                    entry.Type = (uint)data.Value;
                                }
                            }
                            break;

                        case "grid":
                            entry.Grid = LoadGridData(param.paramEntries);
                            break;

                        case "sh_index_buffer":
                            LoadIndexBuffer(param.paramEntries, entry);
                            break;

                        case "sh_data_buffer":
                            LoadDataBuffer(param.paramEntries, entry);
                            break;
                        }
                    }
                }

                aamp.Save($"{CourseFolder}/DEBUG_PROBE.aamp");

                foreach (var entry in probeLightingConfig.Entries)
                {
                    Console.WriteLine(entry.Name);
                    Console.WriteLine($"IndexType {entry.IndexType}");
                    Console.WriteLine($"DataType {entry.DataType}");
                    Console.WriteLine($"MaxIndexNum {entry.MaxIndexNum}");
                    Console.WriteLine($"UsedIndexNum {entry.UsedIndexNum}");
                    Console.WriteLine($"MaxShDataNum {entry.MaxShDataNum}");
                    Console.WriteLine($"UsedShDataNum {entry.UsedShDataNum}");

                    Console.WriteLine($"AABB_Max_Position {entry.Grid.AABB_Max_Position}");
                    Console.WriteLine($"AABB_Min_Position {entry.Grid.AABB_Min_Position}");
                    Console.WriteLine($"Voxel_Step_Position {entry.Grid.Voxel_Step_Position}");

                    Console.WriteLine($"DataBuffer {entry.DataBuffer.Length}");
                    Console.WriteLine($"IndexBuffer {entry.IndexBuffer.Length}");
                }
            }
        }
コード例 #15
0
 public static void Prepare(byte[] fileData)
 {
     ProbeLighting = new ProbeLighting();
     ProbeLighting.LoadValues(AampFile.LoadFile(new System.IO.MemoryStream(fileData)));
 }
コード例 #16
0
        public void LoadValues(AampFile aamp)
        {
            Params = new ProbeParams();
            foreach (var val in aamp.RootNode.paramObjects)
            {
                if (val.HashString == "root_grid")
                {
                    RootGrid = LoadGridData(val.paramEntries);
                }
                if (val.HashString == "param_obj")
                {
                    foreach (var param in val.paramEntries)
                    {
                        if (param.HashString == "version")
                        {
                            Params.Version = (uint)param.Value;
                        }
                        if (param.HashString == "dir_light_indirect")
                        {
                            Params.IndirectDirectionLight = (float)param.Value;
                        }
                        if (param.HashString == "point_light_indirect")
                        {
                            Params.IndirectPointLight = (float)param.Value;
                        }
                        if (param.HashString == "spot_light_indirect")
                        {
                            Params.IndirectSpotLight = (float)param.Value;
                        }
                        if (param.HashString == "emission_scale")
                        {
                            Params.EmissionScale = (float)param.Value;
                        }
                    }
                }
            }

            foreach (var val in aamp.RootNode.childParams)
            {
                ProbeVolume box = new ProbeVolume();
                Boxes.Add(box);

                foreach (var param in val.paramObjects)
                {
                    if (param.HashString == "grid")
                    {
                        box.Grid = LoadGridData(param.paramEntries);
                    }
                    if (param.HashString == "param_obj")
                    {
                        foreach (var p in param.paramEntries)
                        {
                            if (p.HashString == "index")
                            {
                                box.Index = (uint)p.Value;
                            }
                            if (p.HashString == "type")
                            {
                                box.Type = (uint)p.Value;
                            }
                        }
                    }
                    if (param.HashString == "sh_data_buffer")
                    {
                        box.DataBuffer = LoadDataBuffer(param.paramEntries);
                    }
                    if (param.HashString == "sh_index_buffer")
                    {
                        box.IndexBuffer = LoadIndexBuffer(param.paramEntries);
                    }
                }
            }
        }