12345678910111213141516171819202122232425262728 |
- def init_pyrender(self):
- # ==============================================================================
- # Light creation
- # ==============================================================================
- self.spot_l = pyrender.SpotLight(color=np.ones(3), intensity=3.0,
- innerConeAngle=np.pi / 16.0,
- outerConeAngle=np.pi / 6.0)
- # ==============================================================================
- # Camera creation
- # ==============================================================================
- cam = PerspectiveCamera(yfov=np.pi / 2.0)
- R = _get_cam_rotation(self.cam_p,
- np.zeros((3)),
- self.up_axis)
- self.cam_pose = conversions.Rp2T(R, self.cam_p)
- # ==============================================================================
- # Scene creation
- # ==============================================================================
- self.scene = Scene(ambient_light=np.array([0.1, 0.1, 0.1, 1.0]))
- self.spot_l_node = self.scene.add(self.spot_l, pose=self.cam_pose, name="spot_light")
- self.cam_node = self.scene.add(cam, pose=self.cam_pose, name="camera")
- self.r = OffscreenRenderer(viewport_width=320, viewport_height=240)
|