Exemplo n.º 1
0
        private void button6_Click(object sender, EventArgs e)
        {
            if (lstEntries.SelectedItems.Count == 1)
            {
                MTNFEntry entry = this.simgeomfile.simgeom.mtnfChunk.entries[lstEntries.SelectedIndices[0]];

                switch (entry.dataType)
                {
                case 4:
                case 2:
                    if (entry.dataCount >= 1 && !String.IsNullOrEmpty(txtMtnfBox1.Text))
                    {
                        entry.dwords[0] = Convert.ToUInt32(txtMtnfBox1.Text);
                    }
                    if (entry.dataCount >= 2 && !String.IsNullOrEmpty(txtMtnfBox2.Text))
                    {
                        entry.dwords[1] = Convert.ToUInt32(txtMtnfBox2.Text);
                    }
                    if (entry.dataCount >= 3 && !String.IsNullOrEmpty(txtMtnfBox3.Text))
                    {
                        entry.dwords[2] = Convert.ToUInt32(txtMtnfBox3.Text);
                    }
                    if (entry.dataCount >= 4 && !String.IsNullOrEmpty(txtMtnfBox4.Text))
                    {
                        entry.dwords[3] = Convert.ToUInt32(txtMtnfBox4.Text);
                    }
                    break;

                case 1:
                    if (entry.dataCount >= 1 && !String.IsNullOrEmpty(txtMtnfBox1.Text))
                    {
                        entry.floats[0] = Convert.ToSingle(txtMtnfBox1.Text);
                    }
                    if (entry.dataCount >= 2 && !String.IsNullOrEmpty(txtMtnfBox2.Text))
                    {
                        entry.floats[1] = Convert.ToSingle(txtMtnfBox2.Text);
                    }
                    if (entry.dataCount >= 3 && !String.IsNullOrEmpty(txtMtnfBox3.Text))
                    {
                        entry.floats[2] = Convert.ToSingle(txtMtnfBox3.Text);
                    }
                    if (entry.dataCount >= 4 && !String.IsNullOrEmpty(txtMtnfBox4.Text))
                    {
                        entry.floats[3] = Convert.ToSingle(txtMtnfBox4.Text);
                    }
                    break;
                }

                this.simgeomfile.simgeom.mtnfChunk.entries[lstEntries.SelectedIndices[0]] = entry;
            }
        }
Exemplo n.º 2
0
        private void showEntries()
        {
            lstEntries.Items.Clear();

            for (int i = 0; i < simgeomfile.simgeom.mtnfChunk.entries.Count; i++)
            {
                MTNFEntry    mtnf = simgeomfile.simgeom.mtnfChunk.entries[i];
                ListViewItem item = new ListViewItem();
                item.Text = i.ToString();
                foreach (uint fieldHash in Enum.GetValues(typeof(FieldTypes)))
                {
                    if (fieldHash == mtnf.fieldTypeHash)
                    {
                        item.SubItems.Add(Enum.GetName(typeof(FieldTypes), fieldHash));
                        break;
                    }
                }
                if (item.SubItems.Count == 1)
                {
                    item.SubItems.Add(mtnf.fieldTypeHash.ToString("X8"));
                }
                lstEntries.Items.Add(item);
            }

            listView1.Items.Clear();
            for (int i = 0; i < simgeomfile.simgeom.keytable.keys.Count; i++)
            {
                ListViewItem item = new ListViewItem();
                item.Text = "TGI #" + i.ToString();
                item.SubItems.Add(simgeomfile.simgeom.keytable.keys[i].ToString());
                listView1.Items.Add(item);
                item = null;
            }

            lstBones.Items.Clear();
            for (int i = 0; i < simgeomfile.simgeom.boneHashes.Count; i++)
            {
                ListViewItem item = new ListViewItem();
                item.Text = "#" + i.ToString();
                item.SubItems.Add(simgeomfile.simgeom.boneHashes[i].ToString());
                lstBones.Items.Add(item);
                item = null;
            }

            lstVertices.Visible = false;
            lstVertices.Items.Clear();

            for (int i = 0; i < simgeomfile.simgeom.vertices.Count; i++)
            {
                ListViewItem item = new ListViewItem();
                item.Text = "#" + i.ToString();
                for (int j = 0; j < simgeomfile.simgeom.vertexFormats.Count; j++)
                {
                    switch (simgeomfile.simgeom.vertexFormats[j].dataType)
                    {
                    case 1:
                        item.SubItems.Add(simgeomfile.simgeom.vertices[i].x.ToString() + " " + simgeomfile.simgeom.vertices[i].y.ToString() + " " + simgeomfile.simgeom.vertices[i].z.ToString());
                        break;

                    case 2:
                        item.SubItems.Add(simgeomfile.simgeom.normals[i].x.ToString() + " " + simgeomfile.simgeom.normals[i].y.ToString() + " " + simgeomfile.simgeom.normals[i].z.ToString());
                        break;

                    case 3:
                        item.SubItems.Add(simgeomfile.simgeom.uvs[i].u.ToString() + " " + simgeomfile.simgeom.uvs[i].v.ToString());
                        break;

                    case 4:
                        item.SubItems.Add(simgeomfile.simgeom.bones[i].ToString() + " " + simgeomfile.simgeom.bones[i].ToString("X4"));
                        break;

                    case 5:
                        item.SubItems.Add(simgeomfile.simgeom.weights[i].x.ToString() + " " + simgeomfile.simgeom.weights[i].y.ToString() + " " + simgeomfile.simgeom.weights[i].z.ToString() + " " + simgeomfile.simgeom.weights[i].w.ToString());
                        break;

                    case 6:
                        item.SubItems.Add(simgeomfile.simgeom.tangentNormals[i].x.ToString() + " " + simgeomfile.simgeom.tangentNormals[i].y.ToString() + " " + simgeomfile.simgeom.tangentNormals[i].z.ToString());
                        break;

                    case 7:
                        item.SubItems.Add(simgeomfile.simgeom.tagVals[i].ToString());
                        break;

                    case 10:
                        item.SubItems.Add(simgeomfile.simgeom.vertexIds[i].ToString());
                        break;
                    }
                }

                lstVertices.Items.Add(item);
                item = null;
            }
            lstVertices.Visible = true;
        }
Exemplo n.º 3
0
        private void showMtnfEntry(int entryNo)
        {
            MTNFEntry entry = this.simgeomfile.simgeom.mtnfChunk.entries[entryNo];

            txtMtnfDataType.Text = entry.dataType.ToString();
            txtMtnfCount.Text    = entry.dataCount.ToString();

            txtMtnfBox1.Text = "";
            txtMtnfBox2.Text = "";
            txtMtnfBox3.Text = "";
            txtMtnfBox4.Text = "";

            if (entry.dataCount >= 1)
            {
                switch (entry.dataType)
                {
                case 4:
                case 2:
                    txtMtnfBox1.Text = entry.dwords[0].ToString();
                    break;

                case 1:
                    txtMtnfBox1.Text = entry.floats[0].ToString();
                    break;
                }
            }
            if (entry.dataCount >= 2)
            {
                switch (entry.dataType)
                {
                case 4:
                case 2:
                    txtMtnfBox2.Text = entry.dwords[1].ToString();
                    break;

                case 1:
                    txtMtnfBox2.Text = entry.floats[1].ToString();
                    break;
                }
            }
            if (entry.dataCount >= 3)
            {
                switch (entry.dataType)
                {
                case 4:
                case 2:
                    txtMtnfBox3.Text = entry.dwords[2].ToString();
                    break;

                case 1:
                    txtMtnfBox3.Text = entry.floats[2].ToString();
                    break;
                }
            }
            if (entry.dataCount >= 4)
            {
                switch (entry.dataType)
                {
                case 4:
                case 2:
                    txtMtnfBox4.Text = entry.dwords[3].ToString();
                    break;

                case 1:
                    txtMtnfBox4.Text = entry.floats[3].ToString();
                    break;
                }
            }
        }