public unsafe void AddWeits(MqoBone[] bones) { ushort vertex_id = 0; foreach (UVertex v in vertices) { ++vertex_id; uint idx0 = v.Idx; byte * idx = (byte *)(&idx0); Point4 wgt0 = v.Wgt; float *wgt = (float *)(&wgt0); for (int k = 0; k < 4; ++k) { if (wgt[k] > float.Epsilon) { MqoWeit weit = new MqoWeit(); weit.object_id = id; weit.vertex_id = vertex_id; weit.weit = wgt[k]; bones[idx[k]].weits.Add(weit); } } } }
public void CreateWeits() { weits = new MqoWeit[4]; for (int i = 0; i < 4; ++i) { weits[i] = new MqoWeit(); } }
public void Read(XmlReader reader) { this.id = int.Parse(reader.GetAttribute("id")); this.name = reader.GetAttribute("name"); float rtX = float.Parse(reader.GetAttribute("rtX")); float rtY = float.Parse(reader.GetAttribute("rtY")); float rtZ = float.Parse(reader.GetAttribute("rtZ")); this.world_position = new Point3(rtX, rtY, rtZ); reader.Read();//Bone while (reader.IsStartElement("P")) { int id = int.Parse(reader.GetAttribute("id")); reader.Read();//P this.pid = id; } while (reader.IsStartElement("C")) { int id = int.Parse(reader.GetAttribute("id")); reader.Read();//C this.cids.Add(id); } while (reader.IsStartElement("L")) { reader.Read();//L } while (reader.IsStartElement("W")) { MqoWeit weit = new MqoWeit(); weit.Read(reader); weit.node_id = this.node_id; this.weits.Add(weit); } reader.ReadEndElement();//Bone }