Example #1
0
        public void UpdateModelPointer()
        {
            if (ModelPointer == 0)
            {
                _textBoxAddress.Text = ModelPointer == 0 ? "0x00000000" : "(None)";
                _dataGridViewVertices.Rows.Clear();
                _dataGridViewTriangles.Rows.Clear();
                _modelView?.ClearModel();
                return;
            }

            _textBoxAddress.Text = String.Format("0x{0:X8}", ModelPointer);

            uint           modelPtr  = ModelPointer;
            List <short[]> vertices  = GetVerticesFromModelPointer(ref modelPtr);
            List <int[]>   triangles = GetTrianglesFromContinuedModelPonter(modelPtr);

            _modelView?.ChangeModel(vertices, triangles);

            // TODO: transformation

            _dataGridViewVertices.Rows.Clear();
            for (int i = 0; i < vertices.Count; i++)
            {
                short[] v = vertices[i];
                _dataGridViewVertices.Rows.Add(i, v[0], v[1], v[2]);
            }

            _dataGridViewTriangles.Rows.Clear();
            for (int i = 0; i < triangles.Count; i++)
            {
                int[] t = triangles[i];
                _dataGridViewTriangles.Rows.Add(t[3], t[4], t[0], t[1], t[2]);
            }
        }
Example #2
0
        public void UpdateModelPointer()
        {
            if (ModelPointer == 0)
            {
                textBoxModelAddress.Text = "(None)";
                dataGridViewVertices.Rows.Clear();
                dataGridViewTriangles.Rows.Clear();
                _modelView?.ClearModel();
                return;
            }

            textBoxModelAddress.Text = HexUtilities.FormatValue(ModelPointer, 8);

            uint           modelPtr  = ModelPointer;
            List <short[]> vertices  = GetVerticesFromModelPointer(ref modelPtr);
            List <int[]>   triangles = GetTrianglesFromContinuedModelPointer(modelPtr);

            _modelView?.ChangeModel(vertices, triangles);

            // TODO: transformation

            dataGridViewVertices.Rows.Clear();
            for (int i = 0; i < vertices.Count; i++)
            {
                short[] v = vertices[i];
                dataGridViewVertices.Rows.Add(i, v[0], v[1], v[2]);
            }

            dataGridViewTriangles.Rows.Clear();
            for (int i = 0; i < triangles.Count; i++)
            {
                int[] t = triangles[i];
                dataGridViewTriangles.Rows.Add(t[3], t[4], t[0], t[1], t[2]);
            }
            dataGridViewTriangles.SelectAll();
            checkBoxModelLevel.Checked = false;
        }