本文整理汇总了Python中panda3d.core.CardMaker.setColor方法的典型用法代码示例。如果您正苦于以下问题:Python CardMaker.setColor方法的具体用法?Python CardMaker.setColor怎么用?Python CardMaker.setColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.core.CardMaker
的用法示例。
在下文中一共展示了CardMaker.setColor方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: loadFlatQuad
# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import setColor [as 别名]
def loadFlatQuad(self, fullFilename):
cm = CardMaker('cm-%s' % fullFilename)
cm.setColor(1.0, 1.0, 1.0, 1.0)
aspect = base.camLens.getAspectRatio()
htmlWidth = 2.0 * aspect * WEB_WIDTH_PIXELS / float(WIN_WIDTH)
htmlHeight = 2.0 * float(WEB_HEIGHT_PIXELS) / float(WIN_HEIGHT)
cm.setFrame(-htmlWidth / 2.0, htmlWidth / 2.0, -htmlHeight / 2.0, htmlHeight / 2.0)
bottomRightX = WEB_WIDTH_PIXELS / float(WEB_WIDTH + 1)
bottomRightY = WEB_HEIGHT_PIXELS / float(WEB_HEIGHT + 1)
cm.setUvRange(Point2(0, 1 - bottomRightY), Point2(bottomRightX, 1))
card = cm.generate()
quad = NodePath(card)
jpgFile = PNMImage(WEB_WIDTH, WEB_HEIGHT)
smallerJpgFile = PNMImage()
readFile = smallerJpgFile.read(Filename(fullFilename))
if readFile:
jpgFile.copySubImage(smallerJpgFile, 0, 0)
guiTex = Texture('guiTex')
guiTex.setupTexture(Texture.TT2dTexture, WEB_WIDTH, WEB_HEIGHT, 1, Texture.TUnsignedByte, Texture.FRgba)
guiTex.setMinfilter(Texture.FTLinear)
guiTex.load(jpgFile)
guiTex.setWrapU(Texture.WMClamp)
guiTex.setWrapV(Texture.WMClamp)
ts = TextureStage('webTS')
quad.setTexture(ts, guiTex)
quad.setTransparency(0)
quad.setTwoSided(True)
quad.setColor(1.0, 1.0, 1.0, 1.0)
result = quad
else:
result = None
Texture.setTexturesPower2(1)
return result
示例2: setupTexture
# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import setColor [as 别名]
def setupTexture(self):
cm = CardMaker('quadMaker')
cm.setColor(1.0, 1.0, 1.0, 1.0)
aspect = base.camLens.getAspectRatio()
htmlWidth = 2.0 * aspect * WEB_WIDTH_PIXELS / float(WIN_WIDTH)
htmlHeight = 2.0 * float(WEB_HEIGHT_PIXELS) / float(WIN_HEIGHT)
cm.setFrame(-htmlWidth / 2.0, htmlWidth / 2.0, -htmlHeight / 2.0, htmlHeight / 2.0)
bottomRightX = WEB_WIDTH_PIXELS / float(WEB_WIDTH + 1)
bottomRightY = WEB_HEIGHT_PIXELS / float(WEB_HEIGHT + 1)
cm.setUvRange(Point2(0, 1 - bottomRightY), Point2(bottomRightX, 1))
card = cm.generate()
self.quad = NodePath(card)
self.quad.reparentTo(self.parent_)
self.guiTex = Texture('guiTex')
self.guiTex.setupTexture(Texture.TT2dTexture, WEB_WIDTH, WEB_HEIGHT, 1, Texture.TUnsignedByte, Texture.FRgba)
self.guiTex.setMinfilter(Texture.FTLinear)
self.guiTex.setKeepRamImage(True)
self.guiTex.makeRamImage()
self.guiTex.setWrapU(Texture.WMRepeat)
self.guiTex.setWrapV(Texture.WMRepeat)
ts = TextureStage('webTS')
self.quad.setTexture(ts, self.guiTex)
self.quad.setTexScale(ts, 1.0, -1.0)
self.quad.setTransparency(0)
self.quad.setTwoSided(True)
self.quad.setColor(1.0, 1.0, 1.0, 1.0)
self.calcMouseLimits()
示例3: register
# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import setColor [as 别名]
def register(self, render, camera, keys):
State.register(self, render, camera, keys)
cm = CardMaker('CardMaker-Pause')
cm.setFrame(0.5, -0.5, 0.5, -0.5)
cm.setColor(0,0,0, 0.1)
self.bg = self.node.attachNewNode(cm.generate())
self.bg.setPos(0, 0, 0)
menuActions = {'up': (Menu.previousOpt, self.menu),
'down': (Menu.nextOpt, self.menu),
'action': (self.selectOption, None),
'cancel': (self.selectOption, 0) }
self.menu.registerKeys(keys, menuActions)
self.title = OnscreenText(text="Game Paused", mayChange = True , style=1, fg=(1,1,1,1), pos=(0,0.35), scale = .1)
self.text = {}
id=0
for opt in self.menu.options:
self.text[opt] = OnscreenText(text=opt, mayChange = True , style=1, fg=(1,1,1,1), pos=(0,0.1 - 0.1*id), scale = .06)
id+=1
self.title.reparentTo(self.node)
for opt in self.text.keys():
self.text[opt].reparentTo(self.node)
示例4: makeCube
# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import setColor [as 别名]
def makeCube(geom, x, y, z, scale=1.0, texpos=None, colors=False):
"""
Function that adds six cards to a GeomNode to form a cube
geom: GeomNode to add cards to
x, y, z: Position offset
scale: Optional, Scale factor, cube is 1x1x1 by default
texpos: Optional, Dictionary of tuples with texture co-ordinates
Tuple has Point2 for top-left and Point2 for bottom-right
Faces are "front", "back", "left", "right", "top", "bottom"
colors: Optional, if True set different color for each face for debugging
(see cardcolors)
"""
cardmaker = CardMaker("cardmaker")
mycards = deepcopy(CARDS)
for k, i in mycards.iteritems():
points = i
for j in points:
j += Point3(x, y, z)
j *= scale
cardmaker.setFrame(*points)
if texpos:
cardmaker.setUvRange(*texpos[k])
if colors:
cardmaker.setColor(*CARDCOLORS[k])
geom.addGeomsFrom(cardmaker.generate())
示例5: initSwitchSigns
# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import setColor [as 别名]
def initSwitchSigns(self):
self.switchSigns = []
for i in range(11):
cm = CardMaker('card%d'%i)
cm.setColor(0,0,0,0)
cm.setFrame(-0.5, 0.5, -0.5, 0.5)
card = self.level.attachNewNode(cm.generate())
card.setAttrib(TransparencyAttrib.make(TransparencyAttrib.M_alpha))
tex = loader.loadTexture('%d.png'%i)
ts = TextureStage('ts')
ts.setMode(TextureStage.MReplace)
card.setTexture(ts, tex)
card.setEffect(BillboardEffect.makePointEye())
card.hide()
self.switchSigns.append(card)
示例6: setupRightTexture
# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import setColor [as 别名]
def setupRightTexture(self):
cm = CardMaker('quadMaker')
cm.setColor(1.0, 1.0, 1.0, 1.0)
aspect = base.camLens.getAspectRatio()
htmlWidth = 2.0 * aspect * WEB_WIDTH / float(WIN_WIDTH)
htmlHeight = 2.0 * float(WEB_HEIGHT) / float(WIN_HEIGHT)
cm.setFrame(0, htmlWidth / 2.0, -htmlHeight / 2.0, htmlHeight / 2.0)
card = cm.generate()
self.rightQuad = NodePath(card)
self.rightQuad.reparentTo(self.parent_)
self.rightGuiTex = Texture('guiTex')
self.rightGuiTex.setupTexture(Texture.TT2dTexture, WEB_HALF_WIDTH, WEB_HEIGHT, 1, Texture.TUnsignedByte, Texture.FRgba)
self.rightGuiTex.setKeepRamImage(True)
self.rightGuiTex.makeRamImage()
self.rightGuiTex.setWrapU(Texture.WMClamp)
self.rightGuiTex.setWrapV(Texture.WMClamp)
ts = TextureStage('rightWebTS')
self.rightQuad.setTexture(ts, self.rightGuiTex)
self.rightQuad.setTexScale(ts, 1.0, -1.0)
self.rightQuad.setTransparency(0)
self.rightQuad.setTwoSided(True)
self.rightQuad.setColor(1.0, 1.0, 1.0, 1.0)
示例7: __init__
# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import setColor [as 别名]
def __init__(self):
# create a texture into which we can copy the main window.
self.tex = Texture()
self.tex.setMinfilter(Texture.FTLinear)
base.win.addRenderTexture(self.tex, GraphicsOutput.RTMTriggeredCopyTexture)
# Create another 2D camera. Tell it to render before the main camera.
self.backcam = base.makeCamera2d(base.win, sort=-10)
self.background = NodePath("background")
self.backcam.reparentTo(self.background)
self.background.setDepthTest(0)
self.background.setDepthWrite(0)
self.backcam.node().getDisplayRegion(0).setClearDepthActive(0)
# Obtain two texture cards. One renders before the dragon, the other after.
self.bcard = base.win.getTextureCard()
self.bcard.reparentTo(self.background)
self.bcard.setTransparency(1)
self.fcard = base.win.getTextureCard()
self.fcard.reparentTo(render2d)
self.fcard.setTransparency(1)
# Initialize one of the nice effects.
self.chooseEffectGhost()
# Add the task that initiates the screenshots.
taskMgr.add(self.takeSnapShot, "takeSnapShot")
# Create some black squares on top of which we will
# place the instructions.
blackmaker = CardMaker("blackmaker")
blackmaker.setColor(0,0,0,1)
blackmaker.setFrame(-1.00, -0.50, 0.65, 1.00)
instcard = NodePath(blackmaker.generate())
instcard.reparentTo(render2d)
blackmaker.setFrame(-0.5, 0.5, -1.00, -0.85)
titlecard = NodePath(blackmaker.generate())
titlecard.reparentTo(render2d)
# Panda does its best to hide the differences between DirectX and
# OpenGL. But there are a few differences that it cannot hide.
# One such difference is that when OpenGL copies from a
# visible window to a texture, it gets it right-side-up. When
# DirectX does it, it gets it upside-down. There is nothing panda
# can do to compensate except to expose a flag and let the
# application programmer deal with it. You should only do this
# in the rare event that you're copying from a visible window
# to a texture.
if (base.win.getGsg().getCopyTextureInverted()):
print "Copy texture is inverted."
self.bcard.setScale(1,1,-1)
self.fcard.setScale(1,1,-1)
# Put up the instructions
title = OnscreenText(text="Panda3D: Tutorial - Motion Trails",
style=1, fg=(1,1,1,1),
pos=(0,-0.95), scale = .07)
instr0 = addInstructions(0.95, "Press ESC to exit")
instr1 = addInstructions(0.90, "Press 1: Ghost effect")
instr2 = addInstructions(0.85, "Press 2: PaintBrush effect")
instr3 = addInstructions(0.80, "Press 3: Double Vision effect")
instr4 = addInstructions(0.75, "Press 4: Wings of Blue effect")
instr5 = addInstructions(0.70, "Press 5: Whirlpool effect")
# enable the key events
self.accept("escape", sys.exit, [0])
self.accept("1", self.chooseEffectGhost)
self.accept("2", self.chooseEffectPaintBrush)
self.accept("3", self.chooseEffectDoubleVision)
self.accept("4", self.chooseEffectWingsOfBlue)
self.accept("5", self.chooseEffectWhirlpool)
示例8: __init__
# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import setColor [as 别名]
def __init__(self):
# Initialize the ShowBase class from which we inherit, which will
# create a window and set up everything we need for rendering into it.
ShowBase.__init__(self)
self.disableMouse()
self.camera.setPos(0, -26, 4)
self.setBackgroundColor(0, 0, 0)
# Create a texture into which we can copy the main window.
# We set it to RTMTriggeredCopyTexture mode, which tells it that we
# want it to copy the window contents into a texture every time we
# call self.win.triggerCopy().
self.tex = Texture()
self.tex.setMinfilter(Texture.FTLinear)
self.win.addRenderTexture(self.tex,
GraphicsOutput.RTMTriggeredCopyTexture)
# Set the initial color to clear the texture to, before rendering it.
# This is necessary because we don't clear the texture while rendering,
# and otherwise the user might see garbled random data from GPU memory.
self.tex.setClearColor((0, 0, 0, 1))
self.tex.clearImage()
# Create another 2D camera. Tell it to render before the main camera.
self.backcam = self.makeCamera2d(self.win, sort=-10)
self.background = NodePath("background")
self.backcam.reparentTo(self.background)
self.background.setDepthTest(0)
self.background.setDepthWrite(0)
self.backcam.node().getDisplayRegion(0).setClearDepthActive(0)
# Obtain two texture cards. One renders before the dragon, the other
# after.
self.bcard = self.win.getTextureCard()
self.bcard.reparentTo(self.background)
self.bcard.setTransparency(1)
self.fcard = self.win.getTextureCard()
self.fcard.reparentTo(self.render2d)
self.fcard.setTransparency(1)
# Initialize one of the nice effects.
self.chooseEffectGhost()
# Add the task that initiates the screenshots.
taskMgr.add(self.takeSnapShot, "takeSnapShot")
# Create some black squares on top of which we will
# place the instructions.
blackmaker = CardMaker("blackmaker")
blackmaker.setColor(0, 0, 0, 1)
blackmaker.setFrame(-1.00, -0.50, 0.65, 1.00)
instcard = NodePath(blackmaker.generate())
instcard.reparentTo(self.render2d)
blackmaker.setFrame(-0.5, 0.5, -1.00, -0.85)
titlecard = NodePath(blackmaker.generate())
titlecard.reparentTo(self.render2d)
# Panda does its best to hide the differences between DirectX and
# OpenGL. But there are a few differences that it cannot hide.
# One such difference is that when OpenGL copies from a
# visible window to a texture, it gets it right-side-up. When
# DirectX does it, it gets it upside-down. There is nothing panda
# can do to compensate except to expose a flag and let the
# application programmer deal with it. You should only do this
# in the rare event that you're copying from a visible window
# to a texture.
if self.win.getGsg().getCopyTextureInverted():
print("Copy texture is inverted.")
self.bcard.setScale(1, 1, -1)
self.fcard.setScale(1, 1, -1)
# Put up the instructions
title = OnscreenText(text="Panda3D: Tutorial - Motion Trails",
fg=(1, 1, 1, 1), parent=base.a2dBottomCenter,
pos=(0, 0.1), scale=.08)
instr0 = addInstructions(0.06, "Press ESC to exit")
instr1 = addInstructions(0.12, "Press 1: Ghost effect")
instr2 = addInstructions(0.18, "Press 2: PaintBrush effect")
instr3 = addInstructions(0.24, "Press 3: Double Vision effect")
instr4 = addInstructions(0.30, "Press 4: Wings of Blue effect")
instr5 = addInstructions(0.36, "Press 5: Whirlpool effect")
# Enable the key events
self.accept("escape", sys.exit, [0])
self.accept("1", self.chooseEffectGhost)
self.accept("2", self.chooseEffectPaintBrush)
self.accept("3", self.chooseEffectDoubleVision)
self.accept("4", self.chooseEffectWingsOfBlue)
self.accept("5", self.chooseEffectWhirlpool)
示例9: generateWater
# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import setColor [as 别名]
def generateWater(self, style):
print "Generate Water:", self.waterXMin, self.waterXMax, self.waterYMin, self.waterYMax
'''Generates water
style 0: blue card
style 1: reflective card
style 2: reflective card with shaders
'''
self.waterHeight = 22.0
if self.water:
self.water.removeNode()
if style is 0:
cm = CardMaker("water")
#cm.setFrame(-1, 1, -1, 1)
cm.setFrame(self.waterXMin, self.waterXMax, self.waterYMin, self.waterYMax)
cm.setColor(0, 0, 1, 0.9)
self.water = render.attachNewNode(cm.generate())
if self.waterYMax > self.waterXMax:
size = self.waterYMax
else:
size = self.waterXMax
self.water.lookAt(0, 0, -1)
self.water.setZ(self.waterHeight)
messenger.send('makePickable', [self.water])
elif style is 1:
# From Prosoft's super awesome terrain demo
cm = CardMaker("water")
#cm.setFrame(-1, 1, -1, 1)
cm.setFrame(self.waterXMin, self.waterXMax, self.waterYMin, self.waterYMax)
self.water = render.attachNewNode(cm.generate())
if self.waterYMax > self.waterXMax:
size = self.waterYMax
else:
size = self.waterXMax
#self.water.setScale(size)
self.water.lookAt(0, 0, -1)
self.water.setZ(self.waterHeight)
self.water.setShaderOff(1)
self.water.setLightOff(1)
self.water.setAlphaScale(0.5)
self.water.setTransparency(TransparencyAttrib.MAlpha)
wbuffer = base.win.makeTextureBuffer("water", 512, 512)
wbuffer.setClearColorActive(True)
wbuffer.setClearColor(base.win.getClearColor())
self.wcamera = base.makeCamera(wbuffer)
self.wcamera.reparentTo(render)
self.wcamera.node().setLens(base.camLens)
self.wcamera.node().setCameraMask(BitMask32.bit(1))
self.water.hide(BitMask32.bit(1))
wtexture = wbuffer.getTexture()
wtexture.setWrapU(Texture.WMClamp)
wtexture.setWrapV(Texture.WMClamp)
wtexture.setMinfilter(Texture.FTLinearMipmapLinear)
self.wplane = Plane(Vec3(0, 0, 1), Point3(0, 0, self.water.getZ()))
wplanenp = render.attachNewNode(PlaneNode("water", self.wplane))
tmpnp = NodePath("StateInitializer")
tmpnp.setClipPlane(wplanenp)
tmpnp.setAttrib(CullFaceAttrib.makeReverse())
self.wcamera.node().setInitialState(tmpnp.getState())
self.water.projectTexture(TextureStage("reflection"), wtexture, self.wcamera)
messenger.send('makePickable', [self.water])
elif style is 2:
# From Clcheung just as super awesome demomaster
self.water_level = Vec4(0.0, 0.0, self.waterHeight, 1.0)
self.water = water.WaterNode(self.waterXMin, self.waterYMin, self.waterXMax, self.waterYMax, self.water_level.getZ())
self.water.setStandardControl()
self.water.changeParams(None)
wl=self.water_level
wl.setZ(wl.getZ()-0.05)
#root.setShaderInput('waterlevel', self.water_level)
render.setShaderInput('time', 0)
messenger.send('makePickable', [self.water.waterNP])
示例10: __init__
# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import setColor [as 别名]
def __init__(self,
parent = None,
pos = (0,0,0),
fading = False,
fading_position_offset = (0,0,0),
fading_duration = 0.5,
backgroundImage = None,
backgroundColor = None,
enableMask = False,
noFocus = False,
shownFunc = None,
hiddenFunc = None,
funcExtraArgs = [],
sort = None
):
'''if fading enabled, it will apply a fading effect on show()&hide()
Important Attributes:
enableMask: This creates a big transparent plane (DirectButton) off screen so the directGui below won't be
clicked (However due to this trick we won't be able to accept mouse events (I have paid back 'mouse3' by
self.__maskClick))
noFocus: if it is true, it doesn't need SogalBase to manage its focus state (it will not affect
other Sogalforms' focus state
'''
self.__fading = fading
self.__fadingPositionOffset = fading_position_offset
self.__fadingDuration = fading_duration
self.__originPos = pos
self.__currentInterval = None
self.__maskEnabled = enableMask
self.__noFocus = noFocus
self.__shownFunc = shownFunc
self.__hiddenFunc = hiddenFunc
self.__eventExtraArgs = funcExtraArgs
self.__mask = None
if self.__maskEnabled:
self.__mask = DialogMask()
#self.__mask = DirectButton(parent = aspect2d, frameColor =(1,1,1,0.1), relief = DGG.FLAT,commandButtons = [DGG.RMB],command = self.__maskClick)
self.__mask.hide()
self.__backgroundImage = backgroundImage
self.__backgroundColor = backgroundColor
self.__bgPath = None
self.__imagePath = None
self.__hidden = True
NodePath.__init__(self,self.__class__.__name__)
parent = parent or aspect2d
if sort:
self.reparentTo(parent, sort = sort)
else:
self.reparentTo(parent)
self.setPos(pos)
if self.__backgroundColor:
self.__bgPath = NodePath('bgPath')
self.__bgPath.setTransparency(TransparencyAttrib.MAlpha)
cm = CardMaker('cm')
cm.setFrameFullscreenQuad()
cm.setColor(self.__backgroundColor)
self.__bgPath.attachNewNode(cm.generate())
self.__bgPath.reparentTo(aspect2d,self.getSort())
self.__bgPath.hide()
#TODO: backgroundImage
self.setTransparency(TransparencyAttrib.MAlpha)
self.accept('window-event', self.windowResize)
self.windowResize(None)
NodePath.hide(self)
示例11: __init__
# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import setColor [as 别名]
class RaceGUI:
GagPie = 0
gagRoot = 'phase_3.5/maps/inventory_'
class RacerInfo:
def __init__(self, face, mapSpot):
self.curvetime = 0
self.maxlaphit = 0
self.face = face
self.mapspot = mapSpot
self.place = 1
self.enabled = True
self.finished = False
self.gag = None
return
def update(self, curvetime = None, maxlaphit = None, faceX = None, mapspotPt = None, place = None, finished = None):
if self.enabled:
if not curvetime == None:
self.curvetime = curvetime
if not maxlaphit == None:
self.maxlaphit = maxlaphit
if not faceX == None:
self.face.setX(faceX)
if not mapspotPt == None:
self.mapspot.setPos(mapspotPt)
if not place == None:
self.place = place
if not finished == None:
self.finished = finished
return
def disable(self):
self.enabled = False
if not self.finished:
self.face.hide()
self.mapspot.hide()
def enable(self):
self.enabled = True
self.face.show()
self.mapspot.show()
def __init__(self, distRace):
self.race = distRace
self.timerEnabled = False
self.maxLapHit = 0
self.photoFinish = False
toonInteriorTextures = loader.loadModel('phase_3.5/models/modules/toon_interior_textures')
invTextures = loader.loadModel('phase_3.5/models/gui/inventory_icons')
racingTextures = loader.loadModel('phase_6/models/karting/racing_textures')
self.gagTextures = [toonInteriorTextures.find('**/couch'),
invTextures.find('**/inventory_bannana_peel'),
racingTextures.find('**/boost_arrow'),
invTextures.find('**/inventory_anvil'),
invTextures.find('**/inventory_creampie')]
self.gagTextures[1].setScale(7.5)
self.gagTextures[3].setScale(7.5)
self.gagTextures[4].setScale(7.5)
self.cardMaker = CardMaker('card')
self.racerDict = {}
self.render2dRoot = render2d.attachNewNode('RaceGuiRender2dRoot')
self.render2dRoot.setDepthWrite(1)
self.directObjList = []
self.aspect2dRoot = aspect2d.attachNewNode('RaceGuiAspect2dRoot')
self.aspect2dRoot.setDepthWrite(1)
self.raceModeRoot = self.aspect2dRoot.attachNewNode('RaceModeRoot')
gui = loader.loadModel('phase_3.5/models/gui/avatar_panel_gui')
self.closeButton = DirectButton(image=(gui.find('**/CloseBtn_UP'),
gui.find('**/CloseBtn_DN'),
gui.find('**/CloseBtn_Rllvr'),
gui.find('**/CloseBtn_UP')), relief=None, scale=1.05, text=TTLocalizer.KartRace_Leave, text_scale=0.04, text_pos=(0, -0.07), text_fg=VBase4(1, 1, 1, 1), pos=(-0.99, 0, 0.925), command=self.race.leaveRace)
self.closeButton.reparentTo(self.aspect2dRoot)
self.directObjList.append(self.closeButton)
self.raceTimeDelta = 0
self.raceModeReady = False
self.resultModeReady = False
self.gagCycleSound = base.loader.loadSfx('phase_3.5/audio/sfx/tick_counter.ogg')
if hasattr(self.gagCycleSound, 'setPlayRate'):
self.gagCycleSound.setPlayRate(0.2)
self.gagCycleSound.setLoop(1)
self.gagAcquireSound = base.loader.loadSfx('phase_6/audio/sfx/SZ_MM_gliss.ogg')
self.disable()
return
def initRaceMode(self):
self.mapScene = base.a2dTopRight.attachNewNode('MapScene')
self.mapScene.setPos(-0.2, 0, -0.2)
self.mapScene.setScale(0.25, 0.001, 0.25)
maxT = self.race.curve.getMaxT()
pt = Vec3(0, 0, 0)
ls = LineSegs('MapLines')
ls.setColor(1, 1, 1, 1)
ls.setThickness(2)
for x in xrange(101):
self.race.curve.getPoint(x / 100.0 * maxT, pt)
if x == 0:
ls.moveTo(pt[0], pt[1], pt[2])
else:
#.........这里部分代码省略.........