本文整理匯總了Python中pandac.PandaModules.LineSegs.setVertexColor方法的典型用法代碼示例。如果您正苦於以下問題:Python LineSegs.setVertexColor方法的具體用法?Python LineSegs.setVertexColor怎麽用?Python LineSegs.setVertexColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pandac.PandaModules.LineSegs
的用法示例。
在下文中一共展示了LineSegs.setVertexColor方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __createLine
# 需要導入模塊: from pandac.PandaModules import LineSegs [as 別名]
# 或者: from pandac.PandaModules.LineSegs import setVertexColor [as 別名]
def __createLine(self, length=1, color=(1,1,1,1), endColor=None):
LS=LineSegs()
LS.setColor(*color)
LS.moveTo(0,0,0)
LS.drawTo(length*1,0,0)
node=LS.create()
if endColor:
LS.setVertexColor(1,*endColor)
return node
示例2: makeArc
# 需要導入模塊: from pandac.PandaModules import LineSegs [as 別名]
# 或者: from pandac.PandaModules.LineSegs import setVertexColor [as 別名]
def makeArc(angleDegrees=360, numSteps=16, color=Vec4(1, 1, 1, 1)):
ls = LineSegs()
angleRadians = deg2Rad(angleDegrees)
for i in range(numSteps + 1):
a = angleRadians * i / numSteps
y = math.sin(a)
x = math.cos(a)
ls.drawTo(x, y, 0)
node = ls.create()
if color != Vec4(1, 1, 1, 1):
for i in range(numSteps + 1):
ls.setVertexColor(i, color)
pass
return NodePath(node)
示例3: createRainDrop
# 需要導入模塊: from pandac.PandaModules import LineSegs [as 別名]
# 或者: from pandac.PandaModules.LineSegs import setVertexColor [as 別名]
def createRainDrop(self, x=0, y=0, doubleDrop=False, tripleDrop=False):
# Set up line geometry for rain.
id = str(uuid.uuid4())
dummy = NodePath('dummy'+id)
lineSegs = LineSegs('line'+id)
if self.tripleDrop:
lineSegs.setThickness(3.0)
elif self.doubleDrop:
lineSegs.setThickness(2.0)
else:
lineSegs.setThickness(1.0)
lineSegs.moveTo(0, 0, 0)
lineSegs.drawTo(0, 0, self.deltaZ*.1)
lineGeomNode = lineSegs.create()
# True: gray; False: white and red.
if True:
lineSegs.setVertexColor(0, Vec4(1, 1, 1, .4))
lineSegs.setVertexColor(1, Vec4(.3, .3, .3, 0))
pass
else:
lineSegs.setVertexColor(0, Vec4(1, 1, 1, .4))
lineSegs.setVertexColor(1, Vec4(1, 0, 0, 1))
linePath = dummy.attachNewNode(lineGeomNode)
linePath.setTransparency(True)
linePath.reparentTo(render)
# Add collision node with 'FROM' tag = 'rain'
pickerNode = CollisionNode('linecnode'+id)
pickerNode.setTag('FROM', 'rain')
rayCollider = linePath.attachNewNode(pickerNode)
# A small collision sphere is attached to the bottom of each rain drop.
rayCollider.node().addSolid(CollisionSphere(0, 0, 0, .25))
#base.cTrav.addCollider(rayCollider, collisionHandler)
# Sequence rain
Sequence(
LerpPosInterval(linePath, self.dropDuration, Point3(x, y, self.pt1.z), Point3(x, y, self.pt2.z), blendType='easeIn', fluid=1),
Parallel(Func(dummy.removeNode), Func(linePath.removeNode))
).start()