private void SetupShotModelData(ShotModelData data)
        {
            Vertices.SetupVertices(data.Vertices, data.Indices, from m in data.Materials select m.FaceCount, Bones.BoneList.Count);

            Morphs.SetupMaterialMorph(data.Property, data.MaterialMorph, Materials.MaterialList.Count, data.Materials.Length);

            Materials.SetupMaterials(data.Property, data.Materials, data.Textures);

            Bones.SetupBone(data, data.Bones);
        }
 public void InitShotModelData(ShotModelData data)
 {
     if (data.Property.Type.HasMesh)
     {
         SetupShotModelData(data);
     }
     else
     {
         Bones.SetupBone(data, data.Bones[0]);
     }
 }
Ejemplo n.º 3
0
 public virtual void InitModelData(ShotModelData data)
 {
     if (data.Materials != null)
     {
         var prop = data.Property;
         foreach (var material in data.Materials)
         {
             material.Diffuse = new Vector4(prop.Red, prop.Green, prop.Blue, 1);
             material.Ambient = new Vector3(prop.Red, prop.Green, prop.Blue);
         }
     }
 }
        public void SetupBone(ShotModelData data, params PmxBoneData[] bones)
        {
            for (int i = 0; i < bones.Length; i++)
            {
                PmxBoneData bone = bones[i];

                bone.BoneName = $"B_{(BoneList.Count - 1).ToString()}";
                bone.Flag     = BoneFlags.ROTATE | BoneFlags.MOVE | BoneFlags.OP;
                bone.BoneId   = BoneList.Count + i;

                if (-1 < bone.ParentId && bone.ParentId < bones.Length)
                {
                    bone.ParentId = BoneList.IndexOf(bones[bone.ParentId]);
                }
                else
                {
                    bone.ParentId = 0;
                }
                BoneList.Add(bone);
            }
        }