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

Function render

pyPBD/examples/bunny_cloth.py:128–149  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

126
127# Render all bodies
128def render():
129 sim = pbd.Simulation.getCurrent()
130 model = sim.getModel()
131
132 # render meshes of rigid bodies
133 rbs = model.getRigidBodies()
134 for rb in rbs:
135 vd = rb.getGeometry().getVertexData()
136 mesh = rb.getGeometry().getMesh()
137 drawMesh(vd, mesh, 0, [0,0.2,0.7])
138
139 # render mesh of cloth model
140 pd = model.getParticles()
141 triModel = model.getTriangleModels()[0]
142 offset = triModel.getIndexOffset()
143 drawMesh(pd, triModel.getParticleMesh(), offset, [0,0.3,0.8])
144
145 # render time
146 glPushMatrix()
147 glLoadIdentity()
148 drawText([-0.95,0.9], "Time: {:.2f}".format(pbd.TimeManager.getCurrent().getTime()))
149 glPopMatrix()
150
151# Perform simulation steps
152def timeStep():

Callers 1

mainFunction · 0.70

Calls 7

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

Tested by

no test coverage detected