Exemple #1
0
    def __init__(self, id, color, xmlnode = None):
        """Create a new ambient light.

        :param str id:
          A unique string identifier for the light
        :param tuple color:
          Either a tuple of size 3 containing the RGB color value
          of the light or a tuple of size 4 containing the RGBA
          color value of the light
        :param xmlnode:
          If loaded from xml, the xml node

        """
        self.id = id
        """The unique string identifier for the light"""
        self.color = color
        """Either a tuple of size 3 containing the RGB color value
          of the light or a tuple of size 4 containing the RGBA
          color value of the light"""
        if xmlnode != None:
            self.xmlnode = xmlnode
            """ElementTree representation of the light."""
        else:
            self.xmlnode = E.light(
                E.technique_common(
                    E.ambient(
                        E.color(' '.join(map(str, self.color ) ))
                    )
                )
            , id=self.id, name=self.id)
Exemple #2
0
    def __init__(self, id, color, xmlnode=None):
        """Create a new ambient light.

        :Parameters:
          id
            Id for the object
          color
            Light color
          xmlnode
            If load form xml, the xml node

        """
        self.id = id
        """Id in the light library."""
        self.color = color
        """Light color."""
        if xmlnode != None:
            self.xmlnode = xmlnode
        else:
            self.xmlnode = E.light(
                E.technique_common(E.ambient(E.color(" ".join([str(v) for v in self.color])))), id=self.id, name=self.id
            )