本文整理汇总了Python中collada.E.polygons方法的典型用法代码示例。如果您正苦于以下问题:Python E.polygons方法的具体用法?Python E.polygons怎么用?Python E.polygons使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类collada.E
的用法示例。
在下文中一共展示了E.polygons方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from collada import E [as 别名]
# 或者: from collada.E import polygons [as 别名]
def __init__(self, sources, material, polygons, xmlnode=None):
"""A Polygons should not be created manually. Instead, call the
:meth:`collada.geometry.Geometry.createPolygons` method after
creating a geometry instance.
"""
max_offset = max([ max([input[0] for input in input_type_array])
for input_type_array in sources.itervalues() if len(input_type_array) > 0])
vcounts = numpy.zeros(len(polygons), dtype=numpy.int32)
for i, poly in enumerate(polygons):
vcounts[i] = len(poly) / (max_offset + 1)
indices = numpy.concatenate(polygons)
super(Polygons, self).__init__(sources, material, indices, vcounts, xmlnode)
if xmlnode is not None: self.xmlnode = xmlnode
else:
acclen = len(polygons)
self.xmlnode = E.polygons(count=str(acclen), material=self.material)
all_inputs = []
for semantic_list in self.sources.itervalues():
all_inputs.extend(semantic_list)
for offset, semantic, sourceid, set, src in all_inputs:
inpnode = E.input(offset=str(offset), semantic=semantic, source=sourceid)
if set is not None:
inpnode.set('set', str(set))
self.xmlnode.append(inpnode)
for poly in polygons:
self.xmlnode.append(E.p(' '.join(map(str, poly.flatten().tolist()))))