本文整理汇总了Python中panda3d.core.GeomVertexWriter.setColumn方法的典型用法代码示例。如果您正苦于以下问题:Python GeomVertexWriter.setColumn方法的具体用法?Python GeomVertexWriter.setColumn怎么用?Python GeomVertexWriter.setColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.core.GeomVertexWriter
的用法示例。
在下文中一共展示了GeomVertexWriter.setColumn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_nodepath
# 需要导入模块: from panda3d.core import GeomVertexWriter [as 别名]
# 或者: from panda3d.core.GeomVertexWriter import setColumn [as 别名]
def update_nodepath(pandaNode, refinements):
geom = pandaNode.modifyGeom(0)
vertdata = geom.modifyVertexData()
prim = geom.modifyPrimitive(0)
indexdata = prim.modifyVertices()
indexwriter = GeomVertexWriter(indexdata)
indexwriter.setColumn(0)
nextTriangleIndex = indexdata.getNumRows()
vertwriter = GeomVertexWriter(vertdata, 'vertex')
numverts = vertdata.getNumRows()
vertwriter.setRow(numverts)
normalwriter = GeomVertexWriter(vertdata, 'normal')
normalwriter.setRow(numverts)
uvwriter = GeomVertexWriter(vertdata, 'texcoord')
uvwriter.setRow(numverts)
for refinement in refinements:
for op_index in range(len(refinement)):
vals = refinement[op_index]
op = vals[0]
if op == PM_OP.TRIANGLE_ADDITION:
indexwriter.setRow(nextTriangleIndex)
nextTriangleIndex += 3
indexwriter.addData1i(vals[1])
indexwriter.addData1i(vals[2])
indexwriter.addData1i(vals[3])
elif op == PM_OP.INDEX_UPDATE:
indexwriter.setRow(vals[1])
indexwriter.setData1i(vals[2])
elif op == PM_OP.VERTEX_ADDITION:
numverts += 1
vertwriter.addData3f(vals[1], vals[2], vals[3])
normalwriter.addData3f(vals[4], vals[5], vals[6])
uvwriter.addData2f(vals[7], vals[8])