private void CreateNode(ref Sunfish.Mode.Node[] nodes, short currentNode, NodeModel parent) { //if (p == 6) //{ //} //Matrix m = Matrix.CreateTranslation(new Vector3(vector3.X, vector3.Y, vector3.Z)); //m *= Matrix.CreateFromQuaternion(new Quaternion(quaternion.X, quaternion.Y, quaternion.Z, quaternion.W)); //m *= Matrix.CreateTranslation(new Vector3(nodes[p].Translation.X, nodes[p].Translation.Y, nodes[p].Translation.Z)); ////m *= Matrix.CreateFromQuaternion(new Quaternion(nodes[p].Rotation.X, nodes[p].Rotation.Y, nodes[p].Rotation.Z, nodes[p].Rotation.W)); //Vector3 v = Vector3.Transform(Vector3.Zero, m); NodeModel node = new NodeModel(nodes[currentNode]); //node.Rotation *= new Quaternion(nodes[p].Rotation.X, nodes[p].Rotation.Y, nodes[p].Rotation.Z, nodes[p].Rotation.W); //node.Position = v; //NodeModels.Add(NodeModel.Join(parent, node)); NodeModels.Add(node); parent.AddChild(node); //triangleList.AddRange(new short[] { nodes[p].ParentNodeIndex, p }); //Vertices[p] = new VertexPositionColor(v, Color.DarkBlue); if (nodes[currentNode].FirstSiblingNodeIndex > -1) CreateNode(ref nodes, nodes[currentNode].FirstSiblingNodeIndex, parent); if (nodes[currentNode].FirstChildNodeIndex > -1) { //Quaternion q; //Vector3 s, t; //m.Decompose(out s, out q, out t); CreateNode(ref nodes, nodes[currentNode].FirstChildNodeIndex, node); } }
public void AddChild(NodeModel child) { FirstChild = child; child.Parent = this; }
public static NodeModel Join(NodeModel a, NodeModel b) { return new NodeModel(a.joinTranslation, b.endTranslation); }
public NodeModel(NodeModel parent) : this() { Rotation = parent.Rotation; Position = parent.Position; }