def _drawBVHJoint(joint, mesh): if joint.parent: position = joint.getPosition() parentPosition = joint.parent.getPosition() joint.p = primitive_drawing.addPrism(mesh, parentPosition, position, 'bone-' + joint.parent.name) for child in joint.children: _drawBVHJoint(child, mesh)
def draw(self, skeletonMesh): # Draw self if self.parent and self._draw: self.p = primitive_drawing.addPrism(skeletonMesh, self.parent.getPosition(), self.getPosition(), 'bone-' + self.name) # Draw children for c in self.children: c.draw(skeletonMesh)
def updateDrawing(self, skeletonMesh, index): if self.parent and self._draw: primitive_drawing.updatePrism(skeletonMesh, self.parent.getPosition(), self.getPosition(), index, self.p) index += 6 # Each prism consists of 6 verts (assuming fixed joint order) self.p = primitive_drawing.addPrism(skeletonMesh, self.parent.getPosition(), self.getPosition(), 'bone-' + self.name) # Draw children for child in self.children: index = child.updateDrawing(skeletonMesh, index) return index