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


Python GeomNode.__reduce__方法代码示例

本文整理汇总了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
开发者ID:tgbugs,项目名称:desc,代码行数:37,代码来源:test_objects.py


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