Esempio n. 1
0
    def set_texture(self,
                    texture: Texture,
                    mapping_mode: TextureMappingMode,
                    interpolate=True,
                    decal_mode=False,
                    repeat_along_u=False,
                    repeat_along_v=False,
                    uv_scaling=[1., 1.],
                    position: List[float] = None,
                    orientation: List[float] = None):
        """Applies a texture to a shape

        :param texture: The texture to add.
        :param mapping_mode: The texture mapping mode. One of:
            TextureMappingMode.PLANE
            TextureMappingMode.CYLINDER
            TextureMappingMode.SPHERE
            TextureMappingMode.CUBE
        :param interpolate: Adjacent texture pixels are not interpolated.
        :param decal_mode: Texture is applied as a decal (its appearance
            won't be influenced by light conditions).
        :param repeat_along_u: Texture will be repeated along the U direction.
        :param repeat_along_v: Texture will be repeated along the V direction.
        :param uv_scaling: A list of 2 values containig the texture scaling
            factors along the U and V directions.
        :param position: A list of (x,y,z) values that indicate the texture
            position on the shape. Can be None for default.
        :param orientation: A list of 3 Euler angles that indicate the texture
            orientation on the shape. Can be None for default.
        """
        options = 0
        if not interpolate:
            options |= 1
        if decal_mode:
            options |= 2
        if repeat_along_u:
            options |= 4
        if repeat_along_v:
            options |= 8
        sim.simSetShapeTexture(self.get_handle(), texture.get_texture_id(),
                               mapping_mode.value, options, list(uv_scaling),
                               position, orientation)
Esempio n. 2
0
 def get_texture(self):
     """Retrieves the texture from the shape.
     :return: The texture associated with this object.
     """
     return Texture(sim.simGetShapeTextureId(self.get_handle()))