Пример #1
0
    def set_rgb(self, rgb):
        '''
        Set RGB value.

        @type rgb: tuple of three floats
        @param rgb: 
        '''
        _min = Color.COMPONENT_MIN
        _max = Color.COMPONENT_MAX
        r, g, b = [restrict_value(x, _min, _max) for x in rgb]
        self.red, self.green, self.blue = r, g, b
Пример #2
0
    def diffuse_to_specular(self, change):
        '''
        Compute specular color based on the diffuse color.
        Specular color is a lighter shade of diffuse color by default.
        To override that change the value of specular_change (0.0 to 1.0)

        @type change: float
        @param change: between 0.0 and 1.0
        '''
        h, s, v = self.diffuse.get_hsv()
        _min, _max = self.COMPONENT_MIN, self.COMPONENT_MAX
        v = restrict_value(v + (v * change), _min, _max)
        self.specular.set_hsv((h, s, v))
Пример #3
0
    def diffuse_to_ambient(self, change):
        '''
        Compute ambient color based on the diffuse color.
        Ambient color is a darker shade of diffuse color by default.
        To override that change the value of ambient_change (0.0 to 1.0)

        @type change: float
        @param change: between 0.0 and 1.0
        '''
        h, s, v = self.diffuse.get_hsv()
        _min, _max = self.COMPONENT_MIN, self.COMPONENT_MAX
        v = restrict_value(v + (v * change), _min, _max)
        self.ambient.set_hsv((h, s, v))