Beispiel #1
0
        private void lightEdit()
        {
            this.Text      = "Light" + this.Text;
            panel3.Visible = true;
            LightLUT lightlut = LUTUtil.getLightLUTFromName(name, luts.lightLUT);

            textBox6.Text    = (lightlut.type == 1) ? "Diffuse" : "Ambient";
            textBox7.Text    = lightlut.lightSubData.label.labelLine.ToString();
            textBox8.Text    = lightlut.lightSubData.label.labelName;
            textBox9.Text    = Color.FromArgb((byte)(lightlut.col[0] * 255), (byte)(lightlut.col[1] * 255), (byte)(lightlut.col[2] * 255)).ToString();
            textBox10.Text   = lightlut.rawLightData;
            panel4.BackColor = Color.FromArgb((byte)(lightlut.col[0] * 255), (byte)(lightlut.col[1] * 255), (byte)(lightlut.col[2] * 255));
        }
Beispiel #2
0
        public void initF3D()
        {
            int n = -1;

            foreach (string line in dldata)
            {
                n++;
                if (!(line.Contains("gsSP") || line.Contains("gsDP")))
                {
                    continue;
                }
                vals = MISCUtils.ParseAsmbd(line);
                if (vals[0] == "gsSPVertex")
                {
                    List <Vtx> verteces = new List <Vtx>();
                    Vtx        twvtx    = new Vtx();
                    VtxLUT     vl       = new VtxLUT();
                    int[]      vert     = new int[9];
                    string[]   cs       = new string[0];
                    vl.vtxSubData.label       = LakiTool.LUT.Utils.LabelUtil.findLabelFromName(vals[1], curFile);
                    vl.vtxSubData.gData.GFile = curFile;
                    vl.vtxSubData.gData.GLine = (uint)n + 1;
                    uint l = vl.vtxSubData.label.labelLine;
                    while (true)
                    {
                        if (dldata[l].Length < 6 || dldata[l][0] != 'v')
                        {
                            break;
                        }
                        l++;
                        cs = MISCUtils.ParseAsmbd(dldata[l - 1]);
                        for (int v = 0; v < vert.Length; v++)
                        {
                            string c = cs[v + 1];
                            vert[v] = MISCUtils.ParseInt(c);
                        }
                        twvtx.X = (short)vert[0];
                        twvtx.Y = (short)vert[1];
                        twvtx.Z = (short)vert[2];
                        twvtx.S = (short)vert[3];
                        twvtx.T = (short)vert[4];
                        twvtx.R = (byte)vert[5];
                        twvtx.G = (byte)vert[6];
                        twvtx.B = (byte)vert[7];
                        twvtx.A = (byte)vert[8];
                        verteces.Add(twvtx);
                    }
                    vl.vtces = verteces;
                    luts.vtxLUT.Add(vl);
                }
                if (vals[0] == "gsSPLight")
                {
                    LightLUT ll = new LightLUT();
                    ll.lightSubData.label       = LakiTool.LUT.Utils.LabelUtil.findLabelFromName(vals[1], curFile);
                    ll.lightSubData.gData.GFile = curFile;
                    ll.lightSubData.gData.GLine = (uint)n + 1;
                    float[] light = new float[4];
                    for (int v = 0; v < light.Length; v++)
                    {
                        string c = MISCUtils.ParseAsmbd(dldata[ll.lightSubData.label.labelLine])[v + 1];
                        light[v] = (float)MISCUtils.ParseInt(c) / 255f;
                    }
                    ll.col          = light;
                    ll.type         = (uint)MISCUtils.ParseInt(vals[2]);
                    ll.rawLightData = dldata[ll.lightSubData.label.labelLine];
                    luts.lightLUT.Add(ll);
                }
                if (vals[0] == "gsDPSetTextureImage")
                {
                    TexLUT tl = new TexLUT();
                    tl.texSubData.label       = LakiTool.LUT.Utils.LabelUtil.findLabelFromName(vals[4], curFile, fbpath, true);
                    tl.texSubData.gData.GFile = curFile;
                    tl.texSubData.gData.GLine = (uint)n + 1;
                    tl.incbinFile             = MISCUtils.ParseAsmbd(File.ReadAllLines(tl.texSubData.label.labelFile)[tl.texSubData.label.labelLine])[1].Replace("\"", "");
                    if (tl.texSubData.label.labelFound)
                    {
                        string tp = fbpath + "/" + tl.incbinFile;
                        if (File.Exists(tp + ".png"))
                        {
                            tl.texFileName = tp + ".png";
                        }
                        else if (File.Exists(fbpath + "/" + "textures" + tl.incbinFile.Substring(3) + ".png"))
                        {
                            tl.texFileName = fbpath + "/" + "textures" + tl.incbinFile.Substring(3) + ".png";
                        }
                    }
                    else
                    {
                        tl.texFileName = "placeholder.png";
                    }
                    tl.tex = (Bitmap)Bitmap.FromFile(tl.texFileName);
                    luts.texLUT.Add(tl);
                }
            }
        }