Exemplo n.º 1
0
        public TreeNode ToTree()
        {
            TreeNode t = new TreeNode("#E" + MyIndex.ToString("d6") + " : " + pcc.getObjectName(MyIndex + 1) + "(" + pcc.GetObjectClass(MyIndex + 1) + ")");

            t.Name = (MyIndex + 1).ToString();
            for (int i = 0; i < Objects.Count; i++)
            {
                if (Objects[i] == 0)
                {
                    continue;
                }
                TreeNode t2 = new TreeNode();
                if (Objects[i] > 0)
                {
                    t2.Text = "#E" + (Objects[i] - 1).ToString("d6") + " : " + pcc.getObjectName(Objects[i]) + "(" + pcc.GetObjectClass(Objects[i]) + ")";
                }
                else
                {
                    t2.Text = "#I" + (-Objects[i] - 1).ToString("d6") + " : " + pcc.getObjectName(Objects[i]) + "(" + pcc.GetObjectClass(Objects[i]) + ")";
                }
                t2.Name = Objects[i].ToString();
                if (Objects[i] > 0 && pcc.GetObjectClass(Objects[i]) != "Sequence")
                {
                    t2 = MakeSubObj(t2, Objects[i] - 1);
                }
                t.Nodes.Add(t2);
            }
            return(t);
        }
 public StaticMeshComponent(PCCPackage Pcc, int index, Matrix transform)
 {
     pcc = Pcc;
     MyIndex = index;
     byte[] buff = pcc.GetObjectData(index);
     Props = PropertyReader.getPropList(pcc, buff);
     ParentMatrix = transform;
     foreach (PropertyReader.Property p in Props)
     {
         string s = pcc.GetName(p.Name);
         switch (s)
         {
             case "StaticMesh":
                 idxSTM = p.Value.IntValue;
                 break;
             case "Scale":
                 Scale = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                 break;
             case "Scale3D":
                 Scale3D = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                       BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                       BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                 break;
             case "Rotation":
                 Rotation = new Vector3(BitConverter.ToInt32(p.raw, p.raw.Length - 12),
                                       BitConverter.ToInt32(p.raw, p.raw.Length - 8),
                                       BitConverter.ToInt32(p.raw, p.raw.Length - 4));
                 break;
             case "Translation":
                 Translation = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                       BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                       BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                 break;
             default:
                 break;
         }
     }
     MyMatrix = Matrix.Identity;
     MyMatrix *= Matrix.Scaling(Scale3D);
     MyMatrix *= Matrix.Scaling(new Vector3(Scale, Scale, Scale));
     Vector3 rot = DXHelper.RotatorToDX(Rotation);
     MyMatrix *= Matrix.RotationYawPitchRoll(rot.X, rot.Y, rot.Z);
     MyMatrix *= Matrix.Translation(Translation);
     Matrix t = MyMatrix * ParentMatrix;
     if (idxSTM > 0 && !pcc.getObjectName(idxSTM).ToLower().Contains("volumetric") && !pcc.getObjectName(idxSTM).ToLower().Contains("spheremesh"))
         STM = new StaticMesh(pcc, idxSTM - 1, t);
 }
Exemplo n.º 3
0
        public Level(PCCPackage Pcc, int index)
        {
            pcc     = Pcc;
            MyIndex = index;
            byte[] buff = pcc.GetObjectData(index);
            Props = PropertyReader.getPropList(pcc, buff);
            int off   = Props[Props.Count() - 1].offend + 4;
            int count = BitConverter.ToInt32(buff, off);

            Objects = new List <int>();
            for (int i = 0; i < count; i++)
            {
                int idx = BitConverter.ToInt32(buff, off + 4 + i * 4);
                Objects.Add(idx);
            }
            for (int i = 0; i < pcc.Exports.Count; i++)
            {
                if (pcc.Exports[i].idxLink - 1 == index)
                {
                    bool found = false;
                    foreach (int j in Objects)
                    {
                        if (j == i + 1)
                        {
                            found = true;
                        }
                    }
                    if (!found)
                    {
                        Objects.Add(i + 1);
                    }
                }
            }
            RenderObjects = new List <_DXRenderableObject>();
            foreach (int i in Objects)
            {
                if (i > 0)
                {
                    string c = pcc.getObjectName(pcc.Exports[i - 1].idxClass);
                    switch (c)
                    {
                    case "ModelComponent":
                        RenderObjects.Add(new ModelComponent(pcc, i - 1));
                        break;

                    case "StaticMeshActor":
                    case "InterpActor":
                        RenderObjects.Add(new StaticMeshActor(pcc, i - 1));
                        break;

                    case "StaticMeshCollectionActor":
                        RenderObjects.Add(new StaticMeshCollectionActor(pcc, i - 1));
                        break;

                    default: break;
                    }
                }
            }
        }
        public StaticMeshComponent(PCCPackage Pcc, int index, Matrix transform)
        {
            pcc     = Pcc;
            MyIndex = index;
            byte[] buff = pcc.GetObjectData(index);
            Props        = PropertyReader.getPropList(pcc, buff);
            ParentMatrix = transform;
            foreach (PropertyReader.Property p in Props)
            {
                string s = pcc.GetName(p.Name);
                switch (s)
                {
                case "StaticMesh":
                    idxSTM = p.Value.IntValue;
                    break;

                case "Scale":
                    Scale = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                    break;

                case "Scale3D":
                    Scale3D = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                          BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                          BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                    break;

                case "Rotation":
                    Rotation = new Vector3(BitConverter.ToInt32(p.raw, p.raw.Length - 12),
                                           BitConverter.ToInt32(p.raw, p.raw.Length - 8),
                                           BitConverter.ToInt32(p.raw, p.raw.Length - 4));
                    break;

                case "Translation":
                    Translation = new Vector3(BitConverter.ToSingle(p.raw, p.raw.Length - 12),
                                              BitConverter.ToSingle(p.raw, p.raw.Length - 8),
                                              BitConverter.ToSingle(p.raw, p.raw.Length - 4));
                    break;

                default:
                    break;
                }
            }
            MyMatrix  = Matrix.Identity;
            MyMatrix *= Matrix.Scaling(Scale3D);
            MyMatrix *= Matrix.Scaling(new Vector3(Scale, Scale, Scale));
            Vector3 rot = DXHelper.RotatorToDX(Rotation);

            MyMatrix *= Matrix.RotationYawPitchRoll(rot.X, rot.Y, rot.Z);
            MyMatrix *= Matrix.Translation(Translation);
            Matrix t = MyMatrix * ParentMatrix;

            if (idxSTM > 0 && !pcc.getObjectName(idxSTM).ToLower().Contains("volumetric") && !pcc.getObjectName(idxSTM).ToLower().Contains("spheremesh"))
            {
                STM = new StaticMesh(pcc, idxSTM - 1, t);
            }
        }
Exemplo n.º 5
0
 public Level(PCCPackage Pcc, int index)
 {
     pcc = Pcc;
     MyIndex = index;
     byte[] buff = pcc.GetObjectData(index);
     Props = PropertyReader.getPropList(pcc, buff);
     int off = Props[Props.Count() - 1].offend + 4;
     int count = BitConverter.ToInt32(buff, off);
     Objects = new List<int>();
     for (int i = 0; i < count; i++)
     {
         int idx = BitConverter.ToInt32(buff, off + 4 + i * 4);
         Objects.Add(idx);
     }
     for (int i = 0; i < pcc.Exports.Count; i++)
         if (pcc.Exports[i].idxLink - 1 == index)
         {
             bool found = false;
             foreach (int j in Objects)
                 if (j == i + 1)
                     found = true;
             if (!found)
                 Objects.Add(i + 1);
         }
     RenderObjects = new List<_DXRenderableObject>();
     foreach (int i in Objects)
         if (i > 0)
         {
             string c = pcc.getObjectName(pcc.Exports[i - 1].idxClass);
             switch (c)
             {
                 case "ModelComponent":
                     RenderObjects.Add(new ModelComponent(pcc, i - 1));
                     break;
                 case "StaticMeshActor":
                 case "InterpActor":
                     RenderObjects.Add(new StaticMeshActor(pcc, i - 1));
                     break;
                 case "StaticMeshCollectionActor":
                     RenderObjects.Add(new StaticMeshCollectionActor(pcc, i - 1));
                     break;
                 default: break;
             }
         }
 }
Exemplo n.º 6
0
        public TreeNode ToTree()
        {
            TreeNode t = new TreeNode("E#" + MyIndex.ToString("d6") + " : Level");

            t.Name = (MyIndex + 1).ToString();
            foreach (int i in Objects)
            {
                if (i > 0)
                {
                    string c     = pcc.getObjectName(pcc.Exports[i - 1].idxClass);
                    bool   found = false;
                    foreach (_DXRenderableObject m in RenderObjects)
                    {
                        if (m.MyIndex == i - 1)
                        {
                            t.Nodes.Add(m.ToTree());
                            found = true;
                            break;
                        }
                    }
                    if (!found)
                    {
                        TreeNode t2 = new TreeNode("E#" + (i - 1).ToString("d6") + " : " + pcc.getObjectName(i));
                        t2.Name = i.ToString();
                        t.Nodes.Add(t2);
                    }
                }
                else if (i < 0)
                {
                    TreeNode t2 = new TreeNode("I#" + (-i - 1).ToString("d6") + " : " + pcc.getObjectName(i));
                    t2.Name = i.ToString();
                    t.Nodes.Add(t2);
                }
                else
                {
                    TreeNode t2 = new TreeNode("#000000 : \"this\"");
                    t2.Name = i.ToString();
                    t.Nodes.Add(t2);
                }
            }
            t.Expand();
            return(t);
        }
Exemplo n.º 7
0
 public void Init(PCCPackage pcc, int index)
 {
     comboBox1.Items.Clear();
     comboBox2.Items.Clear();
     for (int i = 0; i < pcc.Header.ExportCount; i++)
     {
         comboBox1.Items.Add(i.ToString("d6") + " : " + pcc.GetObjectPath(i + 1) + pcc.getObjectName(i + 1));
     }
     for (int i = 0; i < pcc.Header.ImportCount; i++)
     {
         comboBox2.Items.Add(i.ToString("d6") + " : " + pcc.GetObjectPath(-i - 1) + pcc.getObjectName(-i - 1));
     }
     comboBox1.SelectedIndex = comboBox2.SelectedIndex = 0;
     if (index == 0)
     {
         r1.Checked = true;
     }
     if (index > 0)
     {
         comboBox1.SelectedIndex = index - 1;
         r2.Checked = true;
     }
     if (index < 0)
     {
         comboBox2.SelectedIndex = -index - 1;
         r3.Checked = true;
     }
 }