/// <summary> /// 頂点を書き出します。 /// </summary> public void Write(BinaryWriter bw) { bw.Write(ref this.position); bw.Write(ref this.normal); bw.Write(this.u); bw.Write(this.v); int skin_weights_count = 0; SkinWeight[] skin_weights = new SkinWeight[4]; foreach (SkinWeight skin_weight in this.skin_weights) { if (skin_weight.weight == 0.0f) { continue; } skin_weights[skin_weights_count++] = skin_weight; } bw.Write(skin_weights_count); for (int i = 0; i < skin_weights_count; i++) { bw.Write(skin_weights[i].bone_index); bw.Write(skin_weights[i].weight); } }
public static void Write(BinaryWriter bw, ref vertex_field v) { Write(bw, ref v.position); Write(bw, ref v.normal); bw.Write(v.u); bw.Write(v.v); int bone_weight_entry_count = 0; SkinWeight[] skin_weights = new SkinWeight[4]; foreach (SkinWeight i in v.skin_weights) { if (i.weight == 0.0f) { continue; } skin_weights[bone_weight_entry_count++] = i; } bw.Write(bone_weight_entry_count); for (int i = 0; i < bone_weight_entry_count; i++) { bw.Write(skin_weights[i].index); bw.Write(skin_weights[i].weight); } }
/// <summary> /// 頂点を書き出します。 /// </summary> public void Write(BinaryWriter bw) { bw.Write(ref this.position); bw.Write(ref this.normal); bw.Write(this.u); bw.Write(this.v); int skin_weights_count = 0; SkinWeight[] skin_weights = new SkinWeight[4]; foreach (SkinWeight skin_weight in this.skin_weights) { if (skin_weight.weight == 0.0f) continue; skin_weights[skin_weights_count++] = skin_weight; } bw.Write(skin_weights_count); for (int i = 0; i < skin_weights_count; i++) { bw.Write(skin_weights[i].bone_index); bw.Write(skin_weights[i].weight); } }