本文整理汇总了Python中panda3d.core.GeomNode.__reduce__方法的典型用法代码示例。如果您正苦于以下问题:Python GeomNode.__reduce__方法的具体用法?Python GeomNode.__reduce__怎么用?Python GeomNode.__reduce__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.core.GeomNode
的用法示例。
在下文中一共展示了GeomNode.__reduce__方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeSimpleGeom
# 需要导入模块: from panda3d.core import GeomNode [as 别名]
# 或者: from panda3d.core.GeomNode import __reduce__ [as 别名]
def makeSimpleGeom(array, ctup, geomType = GeomPoints, fix = False):
fmt = GeomVertexFormat.getV3c4()
vertexData = GeomVertexData('points', fmt, Geom.UHDynamic) #FIXME use the index for these too? with setPythonTag, will have to 'reserve' some
cloudGeom = Geom(vertexData)
cloudNode = GeomNode('just some points')
verts = GeomVertexWriter(vertexData, 'vertex')
color = GeomVertexWriter(vertexData, 'color')
if fix:
if len(ctup) == len(array):
for point,c in zip(array, ctup):
verts.addData3f(*point)
color.addData4f(*c)
else:
for point in array:
verts.addData3f(*point)
color.addData4f(*ctup)
else:
for point in array:
verts.addData3f(*point)
color.addData4f(*ctup)
points = geomType(Geom.UHDynamic)
points.addConsecutiveVertices(0,len(array))
points.closePrimitive()
cloudGeom.addPrimitive(points)
cloudNode.addGeom(cloudGeom) #TODO figure out if it is faster to add and subtract Geoms from geom nodes...
if fix:
return cloudNode.__reduce__()
else:
return cloudNode # decoding fails becuase ForkingPickler is called for reasons beyond comprehension