Ejemplo n.º 1
0
 private Vertex GetVertex(ByteReader io)
 {
     Vertex vertex;
     vertex.Position=io.GetVector3();
     vertex.Normal=io.GetVector3();
     vertex.UV=io.GetVector2();
     vertex.DeformType=(VERTEX_DEFORM)io.GetByte();
     vertex.BoneIndices=new int[4];
     vertex.BoneWeights=new float[4];
     switch(vertex.DeformType)
     {
         case VERTEX_DEFORM.BDEF1:
             vertex.BoneIndices[0]=GetBoneIndex(io);
             break;
         case VERTEX_DEFORM.BDEF2:
             vertex.BoneIndices[0]=GetBoneIndex(io);
             vertex.BoneIndices[1]=GetBoneIndex(io);
             vertex.BoneWeights[0]=io.GetFloat();
             break;
         case VERTEX_DEFORM.BDEF4:
             vertex.BoneIndices[0]=GetBoneIndex(io);
             vertex.BoneIndices[1]=GetBoneIndex(io);
             vertex.BoneIndices[2]=GetBoneIndex(io);
             vertex.BoneIndices[3]=GetBoneIndex(io);
             vertex.BoneWeights[0]=io.GetFloat();
             vertex.BoneWeights[1]=io.GetFloat();
             vertex.BoneWeights[2]=io.GetFloat();
             vertex.BoneWeights[3]=io.GetFloat();
             break;
         case VERTEX_DEFORM.SDEF:
             throw new PmxException("not implemented");
     }
     vertex.EdgeFactor=io.GetFloat();
     return vertex;
 }