MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/PositionBasedDynamics / render

Function render

pyPBD/examples/chain_model.py:73–94  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

71
72# Render all bodies
73def render():
74 sim = pbd.Simulation.getCurrent()
75 model = sim.getModel()
76
77 # render meshes of rigid bodies
78 rbs = model.getRigidBodies()
79 for rb in rbs:
80 vd = rb.getGeometry().getVertexData()
81 mesh = rb.getGeometry().getMesh()
82 drawMesh(vd, mesh, 0, [0,0.2,0.7])
83
84 # render constraints
85 cs = model.getConstraints()
86 for c in cs:
87 if (c.getTypeId() == pbd.BallJoint.TYPE_ID):
88 drawSphere(c.jointInfo[:,2], 0.15, [0.0, 0.6, 0.2])
89
90 # render time
91 glPushMatrix()
92 glLoadIdentity()
93 drawText([-0.95,0.9], "Time: {:.2f}".format(pbd.TimeManager.getCurrent().getTime()))
94 glPopMatrix()
95
96# Perform simulation steps
97def timeStep():

Callers 1

mainFunction · 0.70

Calls 7

drawMeshFunction · 0.85
drawSphereFunction · 0.85
drawTextFunction · 0.85
getModelMethod · 0.80
getTimeMethod · 0.80
getCurrentMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected