void DisplayOcta(Bone bone){ var mat =bone.Offset.Inverted(); var head =mat.Column3.Xyz; var tail =bone.Children.Count>0 ? bone.Children[0].Offset.Inverted().Column3.Xyz : Vector3.Transform(Vector3.Zero,mat); //or borrow last length //Console.WriteLine ((copyMat-final).Length); draw_bone_solid_octahedral (ref mat,(head-tail).Length); foreach (var childBone in bone.Children) DisplayOcta (childBone); }
void bvh_to_vertices(Bone joint,ref List<Vector4> vertices, ref List<ushort> indices,ref List<Matrix4> matrices, ushort parentIndex = 0) { // vertex from current joint is in 4-th ROW (column-major ordering) var translatedVertex = joint.Offset.Inverted().Column3;//check column if wrong matrices.Add( joint.Offset.Inverted()); //Console.WriteLine(translatedVertex.W); // pushing current vertices.Add(translatedVertex); // avoid putting root twice ushort myindex =(ushort)(vertices.Count - 1); if( parentIndex != myindex ) { indices.Add(parentIndex); indices.Add(myindex); } // foreach child same thing foreach(var child in joint.Children) bvh_to_vertices(child,ref vertices,ref indices,ref matrices, myindex); }