in mujoco_worldgen/objs/material.py [0:0]
def _material_texture(self, random_state, texture, texture_type=None,
grid_layout=None, grid_size=None, rgba=None):
texture_attr = OrderedDict([
('@name', "texture_" + self.name),
('@type', '2d'),
('@builtin', 'none'),
('@file', texture),
])
if texture_type is None:
texture_type = "cube"
texture_attr["@type"] = texture_type
if texture_type == "cube":
texture_attr["@gridlayout"] = '.U..LFRB.D..' if grid_layout is None else grid_layout
texture_attr["@gridsize"] = '3 4' if grid_size is None else grid_size
material = OrderedDict([
('@name', self.name),
('@texture', "texture_" + self.name),
])
if rgba is not None:
material['@rgba'] = rgba
return OrderedDict([
('texture', [texture_attr]),
('material', [material]),
])