Inheritance: _DXRenderableObject
        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);
            }
        }
 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);
 }
示例#3
0
        public void ReadMatrices()
        {
            int pos = Props[Props.Count - 1].offend;

            Matrices = new List <Matrix>();
            for (int i = 0; i < Entries.Count; i++)
            {
                Matrix m = new Matrix();
                float[,] buff = new float[4, 4];
                for (int y = 0; y < 4; y++)
                {
                    for (int x = 0; x < 4; x++)
                    {
                        buff[x, y] = BitConverter.ToSingle(data, pos);
                        pos       += 4;
                    }
                }
                m.M11 = buff[0, 0];
                m.M12 = buff[1, 0];
                m.M13 = buff[2, 0];
                m.M14 = buff[3, 0];

                m.M21 = buff[0, 1];
                m.M22 = buff[1, 1];
                m.M23 = buff[2, 1];
                m.M24 = buff[3, 1];

                m.M31 = buff[0, 2];
                m.M32 = buff[1, 2];
                m.M33 = buff[2, 2];
                m.M34 = buff[3, 2];

                m.M41 = buff[0, 3];
                m.M42 = buff[1, 3];
                m.M43 = buff[2, 3];
                m.M44 = buff[3, 3];
                Matrices.Add(m);
                int idx = Entries[i];
                if (idx >= 0 && idx < pcc.Exports.Count && pcc.getObjectName(pcc.Exports[idx].idxClass) == "StaticMeshComponent")
                {
                    STMC[i] = new StaticMeshComponent(pcc, idx, m);
                }
            }
        }
        public void ReadMatrices()
        {
            int pos = Props[Props.Count - 1].offend;
            Matrices = new List<Matrix>();
            for (int i = 0; i < Entries.Count; i++)
            {
                Matrix m = new Matrix();
                float[,] buff = new float[4, 4];
                for (int y = 0; y < 4; y++)
                    for (int x = 0; x < 4; x++)
                    {
                        buff[x, y] = BitConverter.ToSingle(data, pos);
                        pos += 4;
                    }
                m.M11 = buff[0, 0];
                m.M12 = buff[1, 0];
                m.M13 = buff[2, 0];
                m.M14 = buff[3, 0];

                m.M21 = buff[0, 1];
                m.M22 = buff[1, 1];
                m.M23 = buff[2, 1];
                m.M24 = buff[3, 1];

                m.M31 = buff[0, 2];
                m.M32 = buff[1, 2];
                m.M33 = buff[2, 2];
                m.M34 = buff[3, 2];

                m.M41 = buff[0, 3];
                m.M42 = buff[1, 3];
                m.M43 = buff[2, 3];
                m.M44 = buff[3, 3];
                Matrices.Add(m);
                int idx = Entries[i];
                if (idx >= 0 && idx < pcc.Exports.Count && pcc.getObjectName(pcc.Exports[idx].idxClass) == "StaticMeshComponent")
                    STMC[i] = new StaticMeshComponent(pcc, idx, m);
            }
        }