Repository: Genesis-Embodied-AI/Genesis
File: genesis/ext/pyrender/mesh.py (Python)

Code before:

    @staticmethod
    def _get_trimesh_props(mesh, smooth=False, material=None):
        """Gets the vertex colors, texture coordinates, and material properties
        from a :class:`~trimesh.base.Trimesh`.
        """
        colors = None
        texcoords = None

        # If the trimesh visual is undefined, return none for both
        if not mesh.visual.defined:
            return colors, texcoords, material

        # Process vertex colors
        if material is None:
            if mesh.visual.kind == "vertex":
                vc = mesh.visual.vertex_colors.copy()
                if smooth:
                    colors = vc
                else:
                    if vc.ndim == 1:
                        colors = vc
                    else:
                        colors = vc[mesh.faces].reshape((3 * len(mesh.faces), vc.shape[1]))
                material = MetallicRoughnessMaterial(
                    alphaMode="OPAQUE" if (colors[..., 3] == 255).all() else "BLEND",
                    baseColorFactor=[1.0, 1.0, 1.0, 1.0],
                    metallicFactor=0.2,
                    roughnessFactor=0.8,
                )
            # Process face colors
            elif mesh.visual.kind == "face":
                if smooth:
                    raise ValueError("Cannot use face colors with a smooth mesh")
                else:
                    colors = np.repeat(mesh.visual.face_colors, 3, axis=0)

                material = MetallicRoughnessMaterial(
                    alphaMode="OPAQUE" if (colors[..., 3] == 255).all() else "BLEND",
                    baseColorFactor=[1.0, 1.0, 1.0, 1.0],
                    metallicFactor=0.2,
                    roughnessFactor=0.8,
                )

        # Process texture colors
        if mesh.visual.kind == "texture":
            # Configure UV coordinates
            if mesh.visual.uv is not None:
                uv = mesh.visual.uv.copy()
                if smooth:
                    texcoords = uv

Review comment (bug):
not sure if this is a correct fix. Basically, we will get an error if the color argument in draw_debug_arrow takes (r,g,b) instead of (r,g,b,a). You can reproduce it by reverting this change and running @duburcqa 
```
pytest -s -v tests/test_rigid_physics.py::test_examples_api
```



Code after:

    @staticmethod
    def _get_trimesh_props(mesh, smooth=False, material=None):
        """Gets the vertex colors, texture coordinates, and material properties
        from a :class:`~trimesh.base.Trimesh`.
        """
        colors = None
        texcoords = None

        # If the trimesh visual is undefined, return none for both
        if not mesh.visual.defined:
            return colors, texcoords, material

        # Process vertex colors
        if material is None:
            if mesh.visual.kind == "vertex":
                vc = mesh.visual.vertex_colors.copy()
                if smooth:
                    colors = vc
                else:
                    if vc.ndim == 1:
                        colors = vc
                    else:
                        colors = vc[mesh.faces].reshape((3 * len(mesh.faces), vc.shape[1]))
                material = MetallicRoughnessMaterial(
                    alphaMode="OPAQUE" if colors.shape[-1] < 4 or (colors[..., 3] == 255).all() else "BLEND",
                    baseColorFactor=[1.0, 1.0, 1.0, 1.0],
                    metallicFactor=0.2,
                    roughnessFactor=0.8,
                )
            # Process face colors
            elif mesh.visual.kind == "face":
                if smooth:
                    raise ValueError("Cannot use face colors with a smooth mesh")
                else:
                    colors = np.repeat(mesh.visual.face_colors, 3, axis=0)
                material = MetallicRoughnessMaterial(
                    alphaMode="OPAQUE" if colors.shape[-1] < 4 or (colors[..., 3] == 255).all() else "BLEND",
                    baseColorFactor=[1.0, 1.0, 1.0, 1.0],
                    metallicFactor=0.2,
                    roughnessFactor=0.8,
                )

        # Process texture colors
        if mesh.visual.kind == "texture":
            # Configure UV coordinates
            if mesh.visual.uv is not None:
                uv = mesh.visual.uv.copy()
                if smooth:
                    texcoords = uv
                else: