本文整理汇总了Python中panda3d.core.GeomNode.unify方法的典型用法代码示例。如果您正苦于以下问题:Python GeomNode.unify方法的具体用法?Python GeomNode.unify怎么用?Python GeomNode.unify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.core.GeomNode
的用法示例。
在下文中一共展示了GeomNode.unify方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: buildGeom
# 需要导入模块: from panda3d.core import GeomNode [as 别名]
# 或者: from panda3d.core.GeomNode import unify [as 别名]
def buildGeom(self, meshData):
prims = meshData["prims"]
vertices = meshData["vertices"]
normals = meshData["normals"]
texcoords = meshData["texcoords"]
vdata = GeomVertexData('mesh', GeomVertexFormat.getV3n3t2(), Geom.UHStatic)
vwriter = GeomVertexWriter(vdata, 'vertex')
nvwriter = GeomVertexWriter(vdata, 'normal')
tvwriter = GeomVertexWriter(vdata, 'texcoord')
for i in range(len(vertices)):
v = vertices[i]
n = normals[i]
t = texcoords[i]
vwriter.addData3f(v)
nvwriter.addData3f(n)
tvwriter.addData2f(t)
prim = GeomTriangles(Geom.UHStatic)
for i in range(len(prims)):
A, B, C = prims[i]
prim.addVertices(A, B, C)
prim.closePrimitive()
geom = Geom(vdata)
geom.addPrimitive(prim)
geomNode = GeomNode('trig')
geomNode.addGeom(geom)
geomNode.unify(1, True)
return geomNode