Example #1
0
            public VmdExpressionFrame(BinaryReader reader)
            {
                byte[] buf = reader.ReadBytes(15);
                expressionName = FileEncoding.GetString(buf, 0, Array.IndexOf(buf, (byte)0));
                expressionName = NameDictionary.ToEnglish(expressionName);

                frameNumber = reader.ReadInt32();
                weight      = reader.ReadSingle();
            }
Example #2
0
            public PmdSkin(BinaryReader reader)
            {
                byte[] buf = reader.ReadBytes(20);
                name = FileEncoding.GetString(buf, 0, Array.IndexOf(buf, (byte)0));
                name = NameDictionary.ToEnglish(name);

                skinSize = reader.ReadUInt32();
                parm     = reader.ReadByte();

                for (int i = 0; i < skinSize; i++)
                {
                    verts.Add(new PmdSkinVertex(reader));
                }
            }
Example #3
0
            public VmdHeader(BinaryReader reader)
            {
                byte[] buf;

                buf          = reader.ReadBytes(26);
                headerString = FileEncoding.GetString(buf, 0, Array.IndexOf(buf, (byte)0));

                padding = reader.ReadBytes(4);

                if (headerString == "Vocaloid Motion Data file")
                {
                    pmdModelNameLength = 10;
                }
                else
                {
                    pmdModelNameLength = 20;
                }

                buf          = reader.ReadBytes(pmdModelNameLength);
                pmdModelName = FileEncoding.GetString(buf, 0, Array.IndexOf(buf, (byte)0));
                pmdModelName = NameDictionary.ToEnglish(pmdModelName);
            }
Example #4
0
            public VmdBoneFrame(BinaryReader reader)
            {
                byte[] buf = reader.ReadBytes(15);
                boneName = FileEncoding.GetString(buf, 0, Array.IndexOf(buf, (byte)0));
                boneName = NameDictionary.ToEnglish(boneName);

                frameNumber = reader.ReadInt32();

                float x, y, z, w;

                x        = reader.ReadSingle();
                y        = reader.ReadSingle();
                z        = reader.ReadSingle();
                position = new Vector3D(x, y, z);

                x           = reader.ReadSingle();
                y           = reader.ReadSingle();
                z           = reader.ReadSingle();
                w           = reader.ReadSingle();
                orientation = new Quaternion(x, y, z, w);

                padding = reader.ReadBytes(64);
            }
Example #5
0
            public PmdBone(BinaryReader reader)
            {
                byte[] buf = reader.ReadBytes(20);
                name = FileEncoding.GetString(buf, 0, Array.IndexOf(buf, (byte)0));
                name = NameDictionary.ToEnglish(name);

                for (int i = 0; i < data.Length; i++)
                {
                    int v = reader.ReadUInt16();
                    if (v == UInt16.MaxValue)
                    {
                        v = -1;
                    }
                    data[i] = v;
                }

                kind = reader.ReadByte();
                knum = reader.ReadUInt16();

                for (int i = 0; i < pos.Length; i++)
                {
                    pos[i] = reader.ReadSingle();
                }
            }