コード例 #1
0
 public Sequence(PCCPackage Pcc, int index)
 {
     pcc     = Pcc;
     MyIndex = index;
     byte[] buff = pcc.GetObjectData(index + 1);
     Props   = PropertyReader.getPropList(pcc, buff);
     Objects = new List <int>();
     foreach (PropertyReader.Property p in Props)
     {
         string s = pcc.GetName(p.Name);
         switch (s)
         {
         case "SequenceObjects":
             int count = BitConverter.ToInt32(p.raw, 24);
             for (int i = 0; i < count; i++)
             {
                 Objects.Add(BitConverter.ToInt32(p.raw, 28 + i * 4));
             }
             break;
         }
     }
     for (int i = 0; i < pcc.Exports.Count; i++)
     {
         if (pcc.Exports[i].idxLink == MyIndex + 1)
         {
             Objects.Add(i + 1);
         }
     }
     Objects.Sort();
 }
コード例 #2
0
ファイル: Level.cs プロジェクト: Dybuk/ME3Explorer
        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.GetObject(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;
                    }
                }
            }
        }
コード例 #3
0
 public StaticMeshCollectionActor(PCCPackage Pcc, int index)
 {
     pcc = Pcc;
     MyIndex = index;
     data = pcc.GetObjectData(index);
     Props = PropertyReader.getPropList(pcc, data);
     ReadObjects();
     ReadMatrices();
 }
コード例 #4
0
 public StaticMeshCollectionActor(PCCPackage Pcc, int index)
 {
     pcc     = Pcc;
     MyIndex = index;
     data    = pcc.GetObjectData(index);
     Props   = PropertyReader.getPropList(pcc, data);
     ReadObjects();
     ReadMatrices();
 }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
        public StaticMesh(PCCPackage Pcc, int index, Matrix transform)
        {
            pcc     = Pcc;
            MyIndex = index;
            byte[] buff = pcc.GetObjectData(index);
            Props        = PropertyReader.getPropList(pcc, buff);
            ParentMatrix = transform;
            int off = Props[Props.Count() - 1].offend;

            DeserializeDump(buff, off);
        }
コード例 #7
0
        public StaticMeshActor(PCCPackage Pcc, int index)
        {
            pcc     = Pcc;
            MyIndex = index;
            byte[] buff = pcc.GetObjectData(index);
            Props = PropertyReader.getPropList(pcc, buff);
            foreach (PropertyReader.Property p in Props)
            {
                string s = pcc.GetName(p.Name);
                switch (s)
                {
                case "StaticMeshComponent":
                    idxSTM = p.Value.IntValue;
                    break;

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

                case "DrawScale3D":
                    DrawScale3D = 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":
                    Rotator = 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 "location":
                    location = 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(DrawScale3D);
            MyMatrix *= Matrix.Scaling(new Vector3(DrawScale, DrawScale, DrawScale));
            Vector3 rot = DXHelper.RotatorToDX(Rotator);

            MyMatrix *= Matrix.RotationYawPitchRoll(rot.X, rot.Y, rot.Z);
            MyMatrix *= Matrix.Translation(location);
            if (idxSTM != 0)
            {
                STMC = new StaticMeshComponent(pcc, idxSTM - 1, MyMatrix);
            }
        }
コード例 #8
0
 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);
 }
コード例 #9
0
ファイル: Level.cs プロジェクト: CreeperLava/ME3Explorer
 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.GetObject(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;
             }
         }
 }
コード例 #10
0
 public StaticMeshActor(PCCPackage Pcc, int index)
 {
     pcc = Pcc;
     MyIndex = index;
     byte[]buff = pcc.GetObjectData(index);
     Props = PropertyReader.getPropList(pcc, buff);
     foreach (PropertyReader.Property p in Props)
     {
         string s = pcc.GetName(p.Name);
         switch (s)
         {
             case "StaticMeshComponent":
                 idxSTM = p.Value.IntValue;
                 break;
             case "DrawScale":
                 DrawScale = BitConverter.ToSingle(p.raw, p.raw.Length - 4);
                 break;
             case "DrawScale3D":
                 DrawScale3D = 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":
                 Rotator = 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 "location":
                 location = 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(DrawScale3D);
     MyMatrix *= Matrix.Scaling(new Vector3(DrawScale, DrawScale, DrawScale));
     Vector3 rot = DXHelper.RotatorToDX(Rotator);
     MyMatrix *= Matrix.RotationYawPitchRoll(rot.X, rot.Y, rot.Z);
     MyMatrix *= Matrix.Translation(location);
     if (idxSTM != 0)
         STMC = new StaticMeshComponent(pcc, idxSTM - 1, MyMatrix);
 }
コード例 #11
0
ファイル: Sequence.cs プロジェクト: CreeperLava/ME3Explorer
 public Sequence(PCCPackage Pcc, int index)
 {
     pcc = Pcc;
     MyIndex = index;
     byte[] buff = pcc.GetObjectData(index + 1);
     Props = PropertyReader.getPropList(pcc, buff);
     Objects = new List<int>();
     foreach (PropertyReader.Property p in Props)
     {
         string s = pcc.GetName(p.Name);
         switch (s)
         {
             case "SequenceObjects":
                 int count = BitConverter.ToInt32(p.raw, 24);                        
                 for (int i = 0; i < count; i++)
                     Objects.Add(BitConverter.ToInt32(p.raw, 28 + i * 4));
                 break;
         }
     }
     for (int i = 0; i < pcc.Exports.Count; i++)
         if (pcc.Exports[i].idxLink == MyIndex + 1)
             Objects.Add(i + 1);
     Objects.Sort();
 }
コード例 #12
0
        public TreeNode MakeSubObj(TreeNode t, int index)
        {
            byte[] buff = pcc.GetObjectData(index);
            List <PropertyReader.Property> Pr = PropertyReader.getPropList(pcc, buff);
            int      count, pos, count2, pos2;
            TreeNode t2, t3, t4;
            List <PropertyReader.Property> Pr2, Pr3;

            foreach (PropertyReader.Property p in Pr)
            {
                string s = pcc.GetName(p.Name);
                switch (s)
                {
                    #region InputLinks
                case "InputLinks":
                    t2    = new TreeNode("Input Links");
                    count = BitConverter.ToInt32(p.raw, 24);
                    pos   = 28;
                    for (int i = 0; i < count; i++)
                    {
                        t3  = new TreeNode(i.ToString());
                        Pr2 = PropertyReader.ReadProp(pcc, p.raw, pos);
                        foreach (PropertyReader.Property pp in Pr2)
                        {
                            string s2 = pcc.GetName(pp.Name);
                            switch (s2)
                            {
                            case "LinkDesc":
                                t3.Nodes.Add("Link Description : " + pp.Value.StringValue);
                                break;

                            case "LinkAction":
                                t3.Nodes.Add("Link Action : " + pcc.GetName(pp.Value.IntValue));
                                break;

                            case "LinkedOp":
                                t3.Nodes.Add("Linked Operation : #" + pp.Value.IntValue + " " + pcc.GetObjectPath(pp.Value.IntValue) + pcc.GetObject(pp.Value.IntValue));
                                break;
                            }
                        }
                        t2.Nodes.Add(t3);
                        pos = Pr2[Pr2.Count - 1].offend;
                    }
                    t.Nodes.Add(t2);
                    break;

                    #endregion
                    #region Output Links
                case "OutputLinks":
                    t2    = new TreeNode("Output Links");
                    count = BitConverter.ToInt32(p.raw, 24);
                    pos   = 28;
                    for (int i = 0; i < count; i++)
                    {
                        t3  = new TreeNode(i.ToString());
                        Pr2 = PropertyReader.ReadProp(pcc, p.raw, pos);
                        foreach (PropertyReader.Property pp in Pr2)
                        {
                            string s2 = pcc.GetName(pp.Name);
                            switch (s2)
                            {
                            case "LinkDesc":
                                t3.Nodes.Add("Link Description : " + pp.Value.StringValue);
                                break;

                            case "LinkAction":
                                t3.Nodes.Add("Link Action : " + pcc.GetName(pp.Value.IntValue));
                                break;

                            case "LinkedOp":
                                t3.Nodes.Add("Linked Operation : #" + pp.Value.IntValue + " " + pcc.GetObjectPath(pp.Value.IntValue) + pcc.GetObject(pp.Value.IntValue));
                                break;

                            case "Links":
                                t4     = new TreeNode("Links");
                                count2 = BitConverter.ToInt32(pp.raw, 24);
                                pos2   = 28;
                                for (int i2 = 0; i2 < count2; i2++)
                                {
                                    Pr3 = PropertyReader.ReadProp(pcc, pp.raw, pos2);
                                    string res = "#" + i2.ToString() + " : ";
                                    foreach (PropertyReader.Property ppp in Pr3)
                                    {
                                        string s3 = pcc.GetName(ppp.Name);
                                        switch (s3)
                                        {
                                        case "LinkedOp":
                                            res += "Linked Operation (" + ppp.Value.IntValue + " " + pcc.GetObjectPath(ppp.Value.IntValue) + pcc.GetObject(ppp.Value.IntValue) + ") ";
                                            break;

                                        case "InputLinkIdx":
                                            res += "Input Link Index(" + ppp.Value.IntValue + ")";
                                            break;
                                        }
                                    }
                                    t4.Nodes.Add(res);
                                    pos2 = Pr3[Pr3.Count - 1].offend;
                                }
                                t3.Nodes.Add(t4);
                                break;
                            }
                        }
                        t2.Nodes.Add(t3);
                        pos = Pr2[Pr2.Count - 1].offend;
                    }
                    t.Nodes.Add(t2);
                    break;

                    #endregion
                    #region Variable Links
                case "VariableLinks":
                    t2    = new TreeNode("Variable Links");
                    count = BitConverter.ToInt32(p.raw, 24);
                    pos   = 28;
                    for (int i = 0; i < count; i++)
                    {
                        t3  = new TreeNode(i.ToString());
                        Pr2 = PropertyReader.ReadProp(pcc, p.raw, pos);
                        foreach (PropertyReader.Property pp in Pr2)
                        {
                            string s2 = pcc.GetName(pp.Name);
                            switch (s2)
                            {
                            case "LinkDesc":
                                t3.Nodes.Add("Link Description : " + pp.Value.StringValue);
                                break;

                            case "LinkVar":
                                t3.Nodes.Add("Link Variable : " + pcc.GetName(pp.Value.IntValue));
                                break;

                            case "PropertyName":
                                t3.Nodes.Add("Property Name : " + pcc.GetName(pp.Value.IntValue));
                                break;

                            case "ExpectedType":
                                t3.Nodes.Add("Expected Type : #" + pp.Value.IntValue + " " + pcc.GetObjectPath(pp.Value.IntValue) + pcc.GetObject(pp.Value.IntValue));
                                break;

                            case "LinkedVariables":
                                t4     = new TreeNode("Linked Variables");
                                count2 = BitConverter.ToInt32(pp.raw, 24);
                                for (int i2 = 0; i2 < count2; i2++)
                                {
                                    int idx = BitConverter.ToInt32(pp.raw, 28 + i2 * 4);
                                    t4.Nodes.Add("#" + i2.ToString() + " : #" + idx + " " + pcc.GetObjectPath(idx) + pcc.GetObject(idx));
                                }
                                t3.Nodes.Add(t4);
                                break;
                            }
                        }
                        t2.Nodes.Add(t3);
                        pos = Pr2[Pr2.Count - 1].offend;
                    }
                    t.Nodes.Add(t2);
                    break;
                    #endregion
                }
            }
            return(t);
        }
コード例 #13
0
ファイル: StaticMesh.cs プロジェクト: CreeperLava/ME3Explorer
 public StaticMesh(PCCPackage Pcc, int index, Matrix transform)
 {
     pcc = Pcc;
     MyIndex = index;
     byte[] buff = pcc.GetObjectData(index);
     Props = PropertyReader.getPropList(pcc, buff);
     ParentMatrix = transform;
     int off = Props[Props.Count() - 1].offend;
     DeserializeDump(buff, off);
 }