本文整理汇总了Python中panda3d.core.GeomVertexWriter.addData4i方法的典型用法代码示例。如果您正苦于以下问题:Python GeomVertexWriter.addData4i方法的具体用法?Python GeomVertexWriter.addData4i怎么用?Python GeomVertexWriter.addData4i使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.core.GeomVertexWriter
的用法示例。
在下文中一共展示了GeomVertexWriter.addData4i方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MyApp
# 需要导入模块: from panda3d.core import GeomVertexWriter [as 别名]
# 或者: from panda3d.core.GeomVertexWriter import addData4i [as 别名]
#.........这里部分代码省略.........
primVerts = row - self.triStrips.getPrimitiveEnd(numPrims - 1)
if primVerts >= 4:
self.triStrips.closePrimitive()
if row >= 256:
print "Packing and starting anew"
newGeom = True
self.geom.unifyInPlace(row, False)
else:
newGeom = False
self.completePath()
if newGeom:
self.newVertexData()
self.newGeom()
if not newGeom:
self.triStrips.addConsecutiveVertices(row - 2, 2)
else:
self.drawQuadTo(prevPos, pos, 2)
self.leftColor[1] += 63
self.rightColor[2] += 37
self.prevPos = pos
return task.cont
def drawLineTo(self, pos, color):
self.vertexWriter.addData3f(pos.x, pos.y, pos.z)
# self.normalWriter.addData3f(0, 0, 1)
self.colorWriter.addData4i(color)
self.triStrips.addNextVertices(1)
def drawQuadTo(self, a, b, width):
""" a (to) b are vectors defining a line bisecting a new quad. """
into = b - a
if abs(into.x) + abs(into.y) < 1:
if not self.prevInto:
return
into = self.prevInto
print into
else:
into.normalize()
# the perpendicular of (a,b) is (-b,a); we want the path to be "flat" in Z=space
if self.vertexWriter.getWriteRow() == 0:
self.drawQuadRow(a, into, width)
self.drawQuadRow(b, into, width)
self.prevInto = into
def drawQuadRow(self, a, into, width):
""" a defines a point, with 'into' being the normalized direction. """
# the perpendicular of (a,b) is (-b,a); we want the path to be "flat" in Z=space
aLeft = Vec3(a.x - into.y * width, a.y + into.x * width, a.z)
aRight = Vec3(a.x + into.y * width, a.y - into.x * width, a.z)
row = self.vertexWriter.getWriteRow()
示例2: MyApp
# 需要导入模块: from panda3d.core import GeomVertexWriter [as 别名]
# 或者: from panda3d.core.GeomVertexWriter import addData4i [as 别名]
#.........这里部分代码省略.........
if numPrims == 0:
primVerts = row
else:
primVerts = row - self.triStrips.getPrimitiveEnd(numPrims-1)
if primVerts >= 4:
self.triStrips.closePrimitive()
if row >= 256:
print "Packing and starting anew"
newGeom = True
self.geom.unifyInPlace(row, False)
else:
newGeom = False
self.completeQuadPath()
if newGeom:
self.newVertexData()
self.newGeom()
if newGeom:
self.drawQuadTo(prevPos, pos, width)
else:
self.triStrips.addConsecutiveVertices(row - 2, 2)
def extendPathTunnel(self, prevPos, pos, width):
self.drawTunnelTo(prevPos, pos, width)
def drawLineTo(self, pos, color):
self.vertexWriter.addData3f(pos.x, pos.y, pos.z)
# self.normalWriter.addData3f(0, 0, 1)
self.colorWriter.addData4i(color)
self.triStrips.addNextVertices(1)
return 1
def drawQuadTo(self, a, b, width):
""" a (to) b are vectors defining a line bisecting a new quad. """
into = (b - a)
if abs(into.x) + abs(into.y) < 1:
# ensure that if we jump in place, we don't get a thin segment
if not self.prevInto:
return
into = self.prevInto
else:
into.normalize()
# the perpendicular of (a,b) is (-b,a); we want the path to be "flat" in Z=space
if self.vertexWriter.getWriteRow() == 0:
self.drawQuadRow(a, into, width)
verts = self.drawQuadRow(b, into, width)
self.prevInto = into
return verts
def drawQuadRow(self, a, into, width):
""" a defines a point, with 'into' being the normalized direction. """
# the perpendicular of (a,b) is (-b,a); we want the path to be "flat" in Z=space