本文整理匯總了Python中pandac.PandaModules.GeomVertexWriter.getWriteRow方法的典型用法代碼示例。如果您正苦於以下問題:Python GeomVertexWriter.getWriteRow方法的具體用法?Python GeomVertexWriter.getWriteRow怎麽用?Python GeomVertexWriter.getWriteRow使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pandac.PandaModules.GeomVertexWriter
的用法示例。
在下文中一共展示了GeomVertexWriter.getWriteRow方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from pandac.PandaModules import GeomVertexWriter [as 別名]
# 或者: from pandac.PandaModules.GeomVertexWriter import getWriteRow [as 別名]
def __init__(self, width=1, depth=1, height=1, origin=Point3(0, 0, 0)):
# Create vetex data format
gvf = GeomVertexFormat.getV3n3()
gvd = GeomVertexData("vertexData", gvf, Geom.UHStatic)
# Create vetex writers for each type of data we are going to store
gvwV = GeomVertexWriter(gvd, "vertex")
gvwN = GeomVertexWriter(gvd, "normal")
# Write out all points
for p in GetPointsForBox(width, depth, height):
gvwV.addData3f(Point3(p) - origin)
# Write out all the normals
for n in ((-1, 0, 0), (1, 0, 0), (0, -1, 0), (0, 1, 0), (0, 0, -1), (0, 0, 1)):
for i in range(4):
gvwN.addData3f(n)
geom = Geom(gvd)
for i in range(0, gvwV.getWriteRow(), 4):
# Create and add both triangles
geom.addPrimitive(GetGeomTriangle(i, i + 1, i + 2))
geom.addPrimitive(GetGeomTriangle(i, i + 2, i + 3))
# Init the node path, wrapping the box
geomNode = GeomNode("box")
geomNode.addGeom(geom)
NodePath.__init__(self, geomNode)