in mujoco_py/modder.py [0:0]
def _cache_checker_matrices(self):
"""
Cache two matrices of the form [[1, 0, 1, ...],
[0, 1, 0, ...],
...]
and [[0, 1, 0, ...],
[1, 0, 1, ...],
...]
for each texture. To use for fast creation of checkerboard patterns
"""
self._geom_checker_mats = []
for geom_id in range(self.model.ngeom):
mat_id = self.model.geom_matid[geom_id]
tex_id = self.model.mat_texid[mat_id]
texture = self.textures[tex_id]
h, w = texture.bitmap.shape[:2]
self._geom_checker_mats.append(self._make_checker_matrices(h, w))
# add skybox
skybox_tex_id = -1
for tex_id in range(self.model.ntex):
skybox_textype = 2
if self.model.tex_type[tex_id] == skybox_textype:
skybox_tex_id = tex_id
if skybox_tex_id >= 0:
texture = self.textures[skybox_tex_id]
h, w = texture.bitmap.shape[:2]
self._skybox_checker_mat = self._make_checker_matrices(h, w)
else:
self._skybox_checker_mat = None