public string Comment; //256 模型说明 public void Read(BinaryReader reader) { PMDKey = GlobleFuncs.GetString(reader, 3); Version = reader.ReadInt32(); ModelName = GlobleFuncs.GetString(reader, 20); Comment = GlobleFuncs.GetString(reader, 256); }
public Vector3 Position; // 骨骼位置 public void Read(BinaryReader reader) { Name = GlobleFuncs.GetString(reader, 20); Parent = reader.ReadInt16(); To = reader.ReadInt16(); Kind = reader.ReadByte(); IKNum = reader.ReadInt16(); Position = GlobleFuncs.ReadVector3(reader); }
public SkinVertex[] VertexList; //=new SkinVertex[VertexListCount]; // 皮肤包含的所有顶点信息 public void Read(BinaryReader reader) { Name = GlobleFuncs.GetString(reader, 20); VertexListCount = reader.ReadUInt32(); Category = reader.ReadByte(); VertexList = new SkinVertex[VertexListCount]; for (int i = 0; i < VertexListCount; i++) { VertexList[i].Read(reader); } }
public void Read(BinaryReader reader) { Name = GlobleFuncs.GetString(reader, 20); BodyA = reader.ReadInt32(); BodyB = reader.ReadInt32(); Position = GlobleFuncs.ReadVector3(reader); Rotation = GlobleFuncs.ReadVector3(reader); Limit_MoveLow = GlobleFuncs.ReadVector3(reader); Limit_MoveHigh = GlobleFuncs.ReadVector3(reader); Limit_AngleLow = GlobleFuncs.ReadVector3(reader); Limit_AngleHigh = GlobleFuncs.ReadVector3(reader); SpConst_Move = GlobleFuncs.ReadVector3(reader); SpConst_Rotate = GlobleFuncs.ReadVector3(reader); }
public void Read(BinaryReader reader) { Name = GlobleFuncs.GetString(reader, 20); Bone = reader.ReadInt16(); Group = reader.ReadByte(); m_passGroupFlag = reader.ReadUInt16(); BoxType = reader.ReadByte(); BoxSize = GlobleFuncs.ReadVector3(reader); PositionFromBone = GlobleFuncs.ReadVector3(reader); Rotation = GlobleFuncs.ReadVector3(reader); Mass = reader.ReadSingle(); PositionDamping = reader.ReadSingle(); RotationDamping = reader.ReadSingle(); Restitution = reader.ReadSingle(); Friction = reader.ReadSingle(); Mode = reader.ReadByte(); }
public string Name; // 包含了纹理路径,使用*分割(应该包含了混合模式吧,枚举:NONE、ADD、MUL) public void Read(BinaryReader reader) { Diffuse = GlobleFuncs.ReadVector3(reader); Alpha = reader.ReadSingle(); Shininess = reader.ReadSingle(); Specular = GlobleFuncs.ReadVector3(reader); Ambient = GlobleFuncs.ReadVector3(reader); ToonNo = reader.ReadByte(); Edge = reader.ReadByte(); FaceVertexCount = reader.ReadInt32(); Name = GlobleFuncs.GetString(reader, 20); //暂时不处理sph纹理 if (Name.EndsWith("sph")) { Name = ""; } //包含了纹理路径,使用*分割(应该包含了混合模式吧,枚举:NONE、ADD、MUL) if (Name.EndsWith("spa")) { Name = Name.Split('*')[0]; } }
/// <summary> /// read vmd animation data /// </summary> /// <param name="reader"></param> public void Read(BinaryReader reader) { //1flagName vmdData.m_cFlagName = GlobleFuncs.GetString(reader, 30); //check version int version = int.Parse(vmdData.m_cFlagName.Substring(20)); if (version != 2) { throw new InvalidOperationException("VMD版本号不为2.0"); } //2motionName vmdData.m_cMotionName = GlobleFuncs.GetString(reader, 20); //3motionCount[TODO:ulong==int64] vmdData.m_iMotionCount = reader.ReadUInt32(); //4 it's keyframes now vmdData.m_pBoneMotions = new BoneMotionData[vmdData.m_iMotionCount]; //sorting the frame boneNames = new List <string>(); for (uint i = 0; i < vmdData.m_iMotionCount; i++) { BoneMotionData boneData = vmdData.m_pBoneMotions[i]; //fill the keyframe data boneData.m_cBoneName = GlobleFuncs.GetString(reader, 15); if (!boneNames.Contains(boneData.m_cBoneName)) { boneNames.Add(boneData.m_cBoneName); } boneData.m_uiFrameNum = reader.ReadUInt32(); //position boneData.m_vPos.X = reader.ReadSingle(); boneData.m_vPos.Y = reader.ReadSingle(); boneData.m_vPos.Z = reader.ReadSingle(); //quaternion boneData.m_qRot.X = reader.ReadSingle(); boneData.m_qRot.Y = reader.ReadSingle(); boneData.m_qRot.Z = reader.ReadSingle(); boneData.m_qRot.W = reader.ReadSingle(); //64 bytes boneData.m_bInterportation = new byte[64]; boneData.m_bInterportation = reader.ReadBytes(64); //relative bone index //boneData.m_iBoneNum=reader.ReadInt16(); vmdData.m_pBoneMotions[i] = boneData; } #region Keyframe in Bone Movement //arrange the bone keyframe keyframes = new List <Keyframe> [boneNames.Count]; for (int i = 0; i < boneNames.Count; i++) { keyframes[i] = new List <Keyframe>(); } for (uint i = 0; i < vmdData.m_iMotionCount; i++) { BoneMotionData boneData = vmdData.m_pBoneMotions[i]; Keyframe frame = new Keyframe(); frame.m_qRot = boneData.m_qRot; frame.m_uiFrameNum = boneData.m_uiFrameNum; //get the max frame number to calculate time if (frame.m_uiFrameNum > maxFrameNumber) { maxFrameNumber = frame.m_uiFrameNum; } frame.m_vPos = boneData.m_vPos; frame.m_strBoneName = boneData.m_cBoneName; //add this frame keyframes[boneNames.IndexOf(boneData.m_cBoneName)].Add(frame);; } //sort the frames by its frameNumber for (int i = 0; i < keyframes.Length; i++) { keyframes[i].Sort(); } #endregion //###################face motion################### #region everything for face motion uint nFaceMotionCount = reader.ReadUInt32(); vmdData.m_pFaceMotions = new FaceMotionFrame[nFaceMotionCount]; List <FaceMotionFrame> faceMotionFrames = new List <FaceMotionFrame>(); for (int i = 0; i < nFaceMotionCount; i++) { FaceMotionFrame faceData = new FaceMotionFrame(); //15char faceData.m_cName = GlobleFuncs.GetString(reader, 15); //index of frame faceData.m_bIndexOfFrame = reader.ReadUInt32(); //weight of [base] vertex faceData.m_bWeight = reader.ReadSingle(); faceMotionFrames.Add(faceData); //vmdData.m_pFaceMotions[i] = faceData; } faceMotionFrames.Sort(); vmdData.m_pFaceMotions = faceMotionFrames.ToArray(); #endregion }
public void Read(BinaryReader reader) { Name = GlobleFuncs.GetString(reader, 50); }