当前位置: 首页>>代码示例>>Python>>正文


Python E.color方法代码示例

本文整理汇总了Python中collada.common.E.color方法的典型用法代码示例。如果您正苦于以下问题:Python E.color方法的具体用法?Python E.color怎么用?Python E.color使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在collada.common.E的用法示例。


在下文中一共展示了E.color方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from collada.common import E [as 别名]
# 或者: from collada.common.E import color [as 别名]
    def __init__(self, id, color, xmlnode = None):
        """Create a new directional 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.direction = numpy.array( [0, 0, -1], dtype=numpy.float32 )
        #Not documenting this because it doesn't make sense to set the direction
        # of an unbound light. The direction isn't set until binding in a scene.
        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.directional(
                        E.color(' '.join(map(str, self.color)))
                    )
                )
            , id=self.id, name=self.id)
开发者ID:pycollada,项目名称:pycollada,代码行数:35,代码来源:light.py

示例2: getPropNode

# 需要导入模块: from collada.common import E [as 别名]
# 或者: from collada.common.E import color [as 别名]
 def getPropNode(prop, value):
     propnode = E(prop)
     if type(value) is Map:
         propnode.append(copy.deepcopy(value.xmlnode))
     elif type(value) is float:
         propnode.append(E.float(str(value)))
     else:
         propnode.append(E.color(' '.join(map(str, value) )))
     return propnode
开发者ID:Bloemerang,项目名称:pycollada,代码行数:11,代码来源:material.py

示例3: getPropNode

# 需要导入模块: from collada.common import E [as 别名]
# 或者: from collada.common.E import color [as 别名]
 def getPropNode(prop, value):
     propnode = E(prop)
     if prop == 'transparent' and self.opaque_mode == OPAQUE_MODE.RGB_ZERO:
         propnode.set('opaque', OPAQUE_MODE.RGB_ZERO)
     if type(value) is Map:
         propnode.append(copy.deepcopy(value.xmlnode))
     elif type(value) is float:
         propnode.append(E.float(str(value)))
     else:
         propnode.append(E.color(' '.join(map(str, value) )))
     return propnode
开发者ID:A1kmm,项目名称:pycollada,代码行数:13,代码来源:material.py

示例4: __init__

# 需要导入模块: from collada.common import E [as 别名]
# 或者: from collada.common.E import color [as 别名]

#.........这里部分代码省略.........
          of :class:`collada.material.Map`
        :param specular:
          Either an RGBA-format tuple of four floats or an instance
          of :class:`collada.material.Map`
        :param shininess:
          Either a single float or an instance of :class:`collada.material.Map`
        :param reflective:
          Either an RGBA-format tuple of four floats or an instance
          of :class:`collada.material.Map`
        :param reflectivity:
          Either a single float or an instance of :class:`collada.material.Map`
        :param tuple transparent:
          Either an RGBA-format tuple of four floats or an instance
          of :class:`collada.material.Map`
        :param transparency:
          Either a single float or an instance of :class:`collada.material.Map`
        :param float index_of_refraction:
          A single float indicating the index of refraction for perfectly
          refracted light
        :param `collada.material.OPAQUE_MODE` opaque_mode:
          The opaque mode for the effect. If not specified, defaults to A_ONE.
        :param xmlnode:
          If loaded from xml, the xml node

        """
        self.id = id
        """The string identifier for the effect"""
        self.params = params
        """A list containing elements of type :class:`collada.material.Sampler2D`
          and :class:`collada.material.Surface`"""
        self.shadingtype = shadingtype
        """String with the type of the shading."""
        self.bumpmap = bumpmap
        """Either the bump map of the effect of type :class:`collada.material.Map`
        or None if there is none."""
        self.double_sided = double_sided
        """A boolean indicating whether or not the material should be rendered double sided"""
        self.emission = emission
        """Either an RGB-format tuple of three floats or an instance
          of :class:`collada.material.Map`"""
        self.ambient = ambient
        """Either an RGB-format tuple of three floats or an instance
          of :class:`collada.material.Map`"""
        self.diffuse = diffuse
        """Either an RGB-format tuple of three floats or an instance
          of :class:`collada.material.Map`"""
        self.specular = specular
        """Either an RGB-format tuple of three floats or an instance
          of :class:`collada.material.Map`"""
        self.shininess = shininess
        """Either a single float or an instance of :class:`collada.material.Map`"""
        self.reflective = reflective
        """Either an RGB-format tuple of three floats or an instance
          of :class:`collada.material.Map`"""
        self.reflectivity = reflectivity
        """Either a single float or an instance of :class:`collada.material.Map`"""
        self.transparent = transparent
        """Either an RGB-format tuple of three floats or an instance
          of :class:`collada.material.Map`"""
        self.transparency = transparency
        """Either a single float or an instance of :class:`collada.material.Map`"""
        self.index_of_refraction = index_of_refraction
        """A single float indicating the index of refraction for perfectly
          refracted light"""
        self.opaque_mode = OPAQUE_MODE.A_ONE if opaque_mode is None else opaque_mode
        """The opaque mode for the effect. An instance of :class:`collada.material.OPAQUE_MODE`."""

        if self.transparency is None:
            if self.opaque_mode == OPAQUE_MODE.A_ONE:
                self.transparency = 1.0
            else:
                self.transparency = 0.0

        self._fixColorValues()

        if xmlnode is not None:
            self.xmlnode = xmlnode
            """ElementTree representation of the effect"""
        else:
            shadnode = E(self.shadingtype)

            for prop in self.supported:
                value = getattr(self, prop)
                if value is None: continue
                propnode = E(prop)
                if prop == 'transparent' and self.opaque_mode == OPAQUE_MODE.RGB_ZERO:
                    propnode.set('opaque', OPAQUE_MODE.RGB_ZERO)
                shadnode.append( propnode )
                if type(value) is Map:
                    propnode.append(value.xmlnode)
                elif type(value) is float:
                    propnode.append(E.float(str(value)))
                else:
                    propnode.append(E.color(' '.join(map(str, value) )))

            effect_nodes = [param.xmlnode for param in self.params]
            effect_nodes.append(E.technique(shadnode, sid='common'))
            self.xmlnode = E.effect(
                E.profile_COMMON(*effect_nodes)
            , id=self.id, name=self.id)
开发者ID:A1kmm,项目名称:pycollada,代码行数:104,代码来源:material.py


注:本文中的collada.common.E.color方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。