mmatl / pyrender

Easy-to-use glTF 2.0-compliant OpenGL renderer for visualization of 3D scenes.
http://pyrender.readthedocs.io/
MIT License
1.31k stars 226 forks source link

how to change code from loop to sparate thread #185

Open azuryl opened 3 years ago

azuryl commented 3 years ago

orig_width=640 orig_height =640 renderer = Renderer(resolution=(orig_width, orig_height), orig_img=True,wireframe=False)

def show_render(vibe_results,renderer, img_vibe):

mesh_color = {k: colorsys.hsv_to_rgb(np.random.rand(), 0.5, 1.0) for k in  vibe_results.keys()}

for key, vibe_result in vibe_results.items():

    #print("\n key,vibe_result:\n",key,vibe_result)

    frame_verts = np.squeeze(vibe_result['verts']) 
    frame_cam =  np.squeeze(vibe_result['orig_cam'])
    mc =  mesh_color[key]

    mesh_filename = None

    img_vibe = renderer.render(
                img_vibe,
                frame_verts,
                cam=frame_cam,
                color=mc,
                mesh_filename=mesh_filename,
            )

return img_vibe }