in tacto/renderer.py [0:0]
def __init__(self, width, height, background, config_path):
"""
:param width: scalar
:param height: scalar
:param background: image
:param config_path:
"""
self._width = width
self._height = height
if background is not None:
self.set_background(background)
else:
self._background_real = None
logger.info("Loading configuration from: %s" % config_path)
self.conf = OmegaConf.load(config_path)
self.force_enabled = (
self.conf.sensor.force is not None and self.conf.sensor.force.enable
)
if self.force_enabled:
self.min_force = self.conf.sensor.force.range_force[0]
self.max_force = self.conf.sensor.force.range_force[1]
self.max_deformation = self.conf.sensor.force.max_deformation
self.shadow_enabled = (
"shadow" in self.conf.sensor.lights and self.conf.sensor.lights.shadow
)
self.spot_light_enabled = (
"spot" in self.conf.sensor.lights and self.conf.sensor.lights.spot
)
self.flags_render = 0
# enable flags for rendering
if self.shadow_enabled:
# Please use spotlight for rendering shadows
# Reference: https://pyrender.readthedocs.io/en/latest/_modules/pyrender/light.html
assert self.spot_light_enabled == True
self.flags_render |= (
pyrender.constants.RenderFlags.RGBA
| pyrender.constants.RenderFlags.SHADOWS_SPOT
)
self._init_pyrender()