Exemple #1
0
 def test_geometry_material2(self):
     viewer = MeshcatViewer()
     box = Shape.create_box([0.2] * 3, Material())
     box.set_user_data(dict(color='#00ff0000'))
     mat = viewer._get_shape_material(box)
     self.assertEqual(mat.color, int('00ff00', base=16))
     self.assertAlmostEqual(mat.opacity, 0.)
Exemple #2
0
 def test_geometry_material_texture(self):
     viewer = MeshcatViewer()
     box = Shape.create_box([0.2] * 3, Material())
     texture = g.ImageTexture(
         image=g.PngImage.from_file(Path(os.path.realpath(__file__)).parent.joinpath('data/texture.png'))
     )
     box.set_user_data(dict(visual_mesh_texture=texture))
     mat = viewer._get_shape_material(box)
     self.assertEqual(mat.map, texture)
     self.assertAlmostEqual(mat.opacity, 1.)