本文整理汇总了Python中panda3d.core.GeomVertexWriter.reserveNumRows方法的典型用法代码示例。如果您正苦于以下问题:Python GeomVertexWriter.reserveNumRows方法的具体用法?Python GeomVertexWriter.reserveNumRows怎么用?Python GeomVertexWriter.reserveNumRows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.core.GeomVertexWriter
的用法示例。
在下文中一共展示了GeomVertexWriter.reserveNumRows方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __build_Tris
# 需要导入模块: from panda3d.core import GeomVertexWriter [as 别名]
# 或者: from panda3d.core.GeomVertexWriter import reserveNumRows [as 别名]
def __build_Tris(self, sphere, mode):
vdata = GeomVertexData("Data", self.__vformat[mode], Geom.UHStatic)
_num_rows = len(sphere.pts)
# Vertices.
vertices = GeomVertexWriter(vdata, "vertex")
vertices.reserveNumRows(_num_rows)
for pt in sphere.pts:
vertices.addData3f(*pt)
# Map coords.
if mode == "mid":
mapcoords = GeomVertexWriter(vdata, "mapcoord")
mapcoords.reserveNumRows(_num_rows)
for mc in sphere.coords:
u, v = mc[:2]
mapcoords.addData2f(u,v)
# Tris.
prim = GeomTriangles(Geom.UHStatic)
prim.reserveNumVertices(len(sphere.tris))
for tri in sphere.tris:
prim.addVertices(*tri)
prim.closePrimitive()
# Geom.
geom = Geom(vdata)
geom.addPrimitive(prim)
geom_node = GeomNode("geom")
geom_node.addGeom(geom)
geom_np = NodePath(geom_node)
return geom_np
示例2: __modify_Model
# 需要导入模块: from panda3d.core import GeomVertexWriter [as 别名]
# 或者: from panda3d.core.GeomVertexWriter import reserveNumRows [as 别名]
def __modify_Model(self, field, data):
geom = self.node.modifyGeom(0)
vdata = geom.modifyVertexData()
vwriter = GeomVertexWriter(vdata, field)
vwriter.reserveNumRows(len(data))
set_data = self.set_dict[field]
for datum in data:
set_data(vwriter, *datum)
geom.setVertexData(vdata)
示例3: __modify_Model
# 需要导入模块: from panda3d.core import GeomVertexWriter [as 别名]
# 或者: from panda3d.core.GeomVertexWriter import reserveNumRows [as 别名]
def __modify_Model(self, field, data):
set_dict = {
'vertex':GeomVertexWriter.setData3f,
'normal':GeomVertexWriter.setData3f,
'color':GeomVertexWriter.setData4f,
'texcoord':GeomVertexWriter.setData2f,
'info':GeomVertexWriter.setData4f,
'ref':GeomVertexWriter.setData3f,
'nbr':GeomVertexWriter.setData4i}
geom = self.NP.node().modifyGeom(0)
vdata = geom.modifyVertexData()
vwriter = GeomVertexWriter(vdata, field)
vwriter.reserveNumRows(len(data))
set_data = set_dict[field]
for datum in data:
set_data(vwriter, *datum)
geom.setVertexData(vdata)
示例4: __build_Patches
# 需要导入模块: from panda3d.core import GeomVertexWriter [as 别名]
# 或者: from panda3d.core.GeomVertexWriter import reserveNumRows [as 别名]
def __build_Patches(self, sphere):
vdata = GeomVertexData("Data", self.__vformat['high'], Geom.UHStatic)
vertices = GeomVertexWriter(vdata, "vertex")
mapcoords = GeomVertexWriter(vdata, "mapcoord")
texcoords = GeomVertexWriter(vdata, "texcoord")
_num_rows = len(sphere.pts)
vertices.reserveNumRows(_num_rows)
mapcoords.reserveNumRows(_num_rows)
texcoords.reserveNumRows(_num_rows)
# Pts.
for pt, uv, coords, in zip(sphere.pts, sphere.uvs, sphere.coords):
vertices.addData3f(*pt)
mapcoords.addData2f(*coords)
texcoords.addData2f(*uv) ## *.99+.01)
# Patches.
prim = GeomPatches(3, Geom.UHStatic)
prim.reserveNumVertices(len(sphere.tris))
for tri in sphere.tris:
prim.addVertices(*tri)
prim.closePrimitive()
# Geom.
geom = Geom(vdata)
geom.addPrimitive(prim)
geom_node = GeomNode("geom")
geom_node.addGeom(geom)
geom_np = NodePath(geom_node)
return geom_np