本文整理汇总了Python中pandac.PandaModules.CardMaker类的典型用法代码示例。如果您正苦于以下问题:Python CardMaker类的具体用法?Python CardMaker怎么用?Python CardMaker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CardMaker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
self.ticks=0
base.setBackgroundColor(224.0/255.0, 188.0/255.0, 112.0/255.0)
base.camera.setPos(100,100,100)
self.correctAspectRatio()
self.titleScreenTrack=loader.loadModel("models/titlescreentrack")
self.titleScreenTrack.setScale(1.0)
self.titleScreenTrack.reparentTo(render)
self.titleScreenTrack.setPos(0.0,-10,-2.5)
self.trackRotation=0
self.titleScreenTitle=loader.loadModel("models/gridleader")
self.titleScreenTitle.setScale(1.0)
self.titleScreenTitle.setH(180.0)
self.titleScreenTitle.reparentTo(render)
self.titleScreenTitle.setPos(0.0,-10,0.3)
self.titleScreenText=TitleScreenText()
startLineCm=CardMaker('card')
# left, right, top, bottom
startLineCm.setFrame(0,2.25,0,0.6)
startLineNode=self.titleScreenTrack.attachNewNode(startLineCm.generate())
startLineNode.setTwoSided(True)
startLineNode.setBillboardAxis()
startLineNode.setTransparency(TransparencyAttrib.MAlpha)
tex=loader.loadTexture('textures/titlestartline.png')
tex.setWrapU(Texture.WMClamp)
tex.setWrapV(Texture.WMClamp)
startLineNode.setTexture(tex)
startLineNode.setPos(-0.202,1.521,0)
self.startLineNode=startLineNode
base.accept('aspectRatioChanged',self.correctAspectRatio)
示例2: announceGenerate
def announceGenerate(self):
# TODO - for some reason this is getting called hundreds of times when there are multiple districts
DistributedObject.DistributedObject.announceGenerate(self)
self.sendUpdate("enteredParty", [])
globalClock.syncFrameTime()
self.startPartyClock()
base.localAvatar.chatMgr.chatInputSpeedChat.addInsidePartiesMenu()
self.spawnTitleText()
messenger.send(self.generatedEvent)
if config.GetBool("show-debug-party-grid", 0):
self.testGrid = NodePath("test_grid")
self.testGrid.reparentTo(base.cr.playGame.hood.loader.geom)
for i in xrange(len(self.grid)):
for j in xrange(len(self.grid[i])):
cm = CardMaker("gridsquare")
np = NodePath(cm.generate())
np.setScale(12)
np.setP(-90.0)
np.setPos(
PartyUtils.convertDistanceFromPartyGrid(j, 0) - 6.0,
PartyUtils.convertDistanceFromPartyGrid(i, 1) - 6.0,
0.1,
)
np.reparentTo(self.testGrid)
if self.grid[i][j]:
np.setColorScale(0.0, 1.0, 0.0, 1.0)
else:
np.setColorScale(1.0, 0.0, 0.0, 1.0)
示例3: __init__
def __init__( self, *args, **kwargs ):
colour = kwargs.pop( 'colour', (1, 1, 1, .2) )
p3d.SingleTask.__init__( self, *args, **kwargs )
# Create a card maker
cm = CardMaker( self.name )
cm.setFrame( 0, 1, 0, 1 )
# Init the node path, wrapping the card maker to make a rectangle
NodePath.__init__( self, cm.generate() )
self.setColor( colour )
self.setTransparency( 1 )
self.reparentTo( self.root2d )
self.hide()
# Create the rectangle border
ls = LineSegs()
ls.moveTo( 0, 0, 0 )
ls.drawTo( 1, 0, 0 )
ls.drawTo( 1, 0, 1 )
ls.drawTo( 0, 0, 1 )
ls.drawTo( 0, 0, 0 )
# Attach border to rectangle
self.attachNewNode( ls.create() )
示例4: _initModel
def _initModel(self):
baseName = '**/tt_t_gui_cmg_miniMap_'
cardModel = CogdoUtil.loadMazeModel('miniMap_cards', group='gui')
cm = CardMaker('bg')
cm.setFrame(-1.1, 1.1, -1.1, 1.1)
bg = self.attachNewNode(cm.generate())
bg.setColor(*self._bgColor)
bg.setBin('fixed', 0)
frame = cardModel.find(baseName + 'frame')
frame.reparentTo(self)
frame.setScale(2.5)
frame.setPos(0.01, 0, -0.01)
self._entrance = cardModel.find(baseName + 'entrance')
self._entrance.reparentTo(self)
self._entrance.setScale(0.35)
self._entrance.hide()
self._exit = NodePath('exit')
self._exit.setScale(0.35)
self._exit.reparentTo(self)
self._exitOpen = cardModel.find(baseName + 'exitOpen')
self._exitOpen.reparentTo(self._exit)
self._exitClosed = cardModel.find(baseName + 'exitClosed')
self._exitClosed.reparentTo(self._exit)
self._suitMarkerTemplate = cardModel.find(baseName + 'cogIcon')
self._suitMarkerTemplate.detachNode()
self._suitMarkerTemplate.setScale(0.225)
self._waterCoolerTemplate = cardModel.find(baseName + 'waterDrop')
self._waterCoolerTemplate.detachNode()
self._waterCoolerTemplate.setScale(0.225)
self._exit.hide()
cardModel.removeNode()
示例5: createCARD
def createCARD(self, tex, sizeCELLS, sizeRAWS):
card = CardMaker("tilesheet")
tile = NodePath(card.generate())
tile.reparentTo(render2d)
tile.setTexScale(self.ts,sizeCELLS,sizeRAWS)
tile.setTexture(self.ts, tex)
return tile
示例6: genArrow
def genArrow(self, pos, hpr, id):
factory = CardMaker('factory')
factory.setFrame(-.5, 0.5, -.5, 0.5)
arrowNode = factory.generate()
arrowRoot = NodePath('root')
baseArrow = NodePath(arrowNode)
baseArrow.setTransparency(1)
baseArrow.setTexture(self.boostArrowTexture)
baseArrow.reparentTo(arrowRoot)
arrow2 = baseArrow.copyTo(baseArrow)
arrow2.setPos(0, 0, 1)
arrow3 = arrow2.copyTo(arrow2)
arrowRoot.setPos(*pos)
arrowRoot.setHpr(*hpr)
baseArrow.setHpr(0, -90, 0)
baseArrow.setScale(24)
arrowRoot.reparentTo(self.geom)
trigger = 'boostArrow' + str(id)
cs = CollisionTube(Point3(0.6, -6, 0), Point3(0.6, 54, 0), 4.8)
cs.setTangible(0)
triggerEvent = 'imIn-' + trigger
cn = CollisionNode(trigger)
cn.addSolid(cs)
cn.setIntoCollideMask(BitMask32(32768))
cn.setFromCollideMask(BitMask32(32768))
cnp = NodePath(cn)
cnp.reparentTo(arrowRoot)
self.accept(triggerEvent, self.hitBoostArrow)
arrowVec = arrow2.getPos(self.geom) - baseArrow.getPos(self.geom)
arrowVec.normalize()
idStr = str(id)
cnp.setTag('boostId', idStr)
self.boostDir[idStr] = arrowVec
base.arrows.append(arrowRoot)
示例7: _createSimpleMarker
def _createSimpleMarker(self, size, color = (1, 1, 1)):
halfSize = size * 0.5
cm = CardMaker('mazemap_simple_marker')
cm.setFrame(-halfSize, halfSize, -halfSize, halfSize)
markerNP = self.maskedLayer.attachNewNode(cm.generate())
markerNP.setColor(*color)
return markerNP
示例8: __init__
def __init__(self, av, **kw):
DirectFrame.__init__(self, relief=None, sortOrder=50)
self.initialiseoptions(QuestMap)
self.container = DirectFrame(parent=self, relief=None)
self.marker = DirectFrame(parent=self.container, relief=None)
self.cogInfoFrame = DirectFrame(parent=self.container, relief=None)
cm = CardMaker('bg')
cm.setFrame(-0.5, 0.5, -0.5, 0.5)
bg = self.cogInfoFrame.attachNewNode(cm.generate())
bg.setTransparency(1)
bg.setColor(0.5, 0.5, 0.5, 0.5)
bg.setBin('fixed', 0)
self.cogInfoFrame['geom'] = bg
self.cogInfoFrame['geom_pos'] = (0, 0, 0)
self.cogInfoFrame['geom_scale'] = (6, 1, 2)
self.cogInfoFrame.setScale(0.05)
self.cogInfoFrame.setPos(0, 0, 0.6)
self.buildingMarkers = []
self.av = av
self.wantToggle = base.config.GetBool('want-toggle-quest-map', True)
self.updateMarker = True
self.cornerPosInfo = None
self.hqPosInfo = None
self.fishingSpotInfo = None
self.load()
self.setScale(1.5)
bg.removeNode()
self.hoodId = None
self.zoneId = None
self.suitPercentage = {}
for currHoodInfo in SuitPlannerBase.SuitPlannerBase.SuitHoodInfo:
tracks = currHoodInfo[SuitPlannerBase.SuitPlannerBase.SUIT_HOOD_INFO_TRACK]
self.suitPercentage[currHoodInfo[SuitPlannerBase.SuitPlannerBase.SUIT_HOOD_INFO_ZONE]] = tracks
return
示例9: _createMapTextureCard
def _createMapTextureCard(self):
mapImage = PNMImage(MAP_RESOLUTION, MAP_RESOLUTION)
mapImage.fill(*self._bgColor)
fgColor = VBase4D(*self._fgColor)
for x in xrange(self._mazeHeight):
for y in xrange(self._mazeWidth):
if self._mazeCollTable[y][x] == 1:
ax = float(x) / self._mazeWidth * MAP_RESOLUTION
invertedY = self._mazeHeight - 1 - y
ay = float(invertedY) / self._mazeHeight * MAP_RESOLUTION
self._drawSquare(mapImage, int(ax), int(ay), 10, fgColor)
mapTexture = Texture('mapTexture')
mapTexture.setupTexture(Texture.TT2dTexture, self._maskResolution, self._maskResolution, 1, Texture.TUnsignedByte, Texture.FRgba)
mapTexture.setMinfilter(Texture.FTLinear)
mapTexture.load(mapImage)
mapTexture.setWrapU(Texture.WMClamp)
mapTexture.setWrapV(Texture.WMClamp)
mapImage.clear()
del mapImage
cm = CardMaker('map_cardMaker')
cm.setFrame(-1.0, 1.0, -1.0, 1.0)
map = self.attachNewNode(cm.generate())
map.setTexture(mapTexture, 1)
return map
示例10: make_vertical_wall
def make_vertical_wall(self, pos):
x, y = pos
cm = CardMaker("wall")
cm.setFrame(0, 1, 0, 2)
front_card = cm.generate()
front = self.render.attachNewNode(front_card)
front.setH(0)
front.setPos(x,y,0)
back_card = cm.generate()
back = self.render.attachNewNode(back_card)
back.setH(180)
back.setPos(x+1,y,0)
示例11: __init__
def __init__(self, x1, y1, x2, y2, z):
Att_base.__init__(self, False, "Water1")
# Water surface
maker = CardMaker( 'water' )
maker.setFrame( x1, x2, y1, y2 )
self.waterNP = render.attachNewNode(maker.generate())
self.waterNP.setHpr(0,-90,0)
self.waterNP.setPos(0,0,z)
self.waterNP.setTransparency(TransparencyAttrib.MAlpha )
self.waterNP.setShader(loader.loadShader( 'Shaders/water1.sha' ))
# Reflection plane
self.waterPlane = Plane( Vec3( 0, 0, z+1 ), Point3( 0, 0, z ) )
planeNode = PlaneNode( 'waterPlane' )
planeNode.setPlane( self.waterPlane )
# Buffer and reflection camera
self.buffer = base.win.makeTextureBuffer( 'waterBuffer', 512, 512 )
self.buffer.setClearColor( Vec4( 0, 0, 0, 1 ) )
cfa = CullFaceAttrib.makeReverse( )
rs = RenderState.make(cfa)
self.watercamNP = base.makeCamera( self.buffer )
self.watercamNP.reparentTo(render)
sa = ShaderAttrib.make()
sa = sa.setShader(loader.loadShader('Shaders/splut3Clipped.sha') )
self.cam = self.watercamNP.node()
self.cam.getLens( ).setFov( base.camLens.getFov( ) )
self.cam.getLens().setNear(1)
self.cam.getLens().setFar(5000)
self.cam.setInitialState( rs )
self.cam.setTagStateKey('Clipped')
self.cam.setTagState('True', RenderState.make(sa))
# ---- water textures ---------------------------------------------
# reflection texture, created in realtime by the 'water camera'
tex0 = self.buffer.getTexture( )
tex0.setWrapU(Texture.WMClamp)
tex0.setWrapV(Texture.WMClamp)
ts0 = TextureStage( 'reflection' )
self.waterNP.setTexture( ts0, tex0 )
# distortion texture
tex1 = loader.loadTexture('Textures/water.png')
ts1 = TextureStage('distortion')
self.waterNP.setTexture(ts1, tex1)
示例12: _initVisuals
def _initVisuals(self):
RepairMincroGame._initVisuals(self)
self.model = loader.loadModel('models/gui/pir_m_gui_srp_pumping_main')
self.visual = self.attachNewNode('visual')
self.visual.setPos(-0.25, 0.0, 0.074999999999999997)
goalTopLoc = self.model.find('**/locator_top')
goalTopLoc.reparentTo(self.visual)
goalBottomLoc = self.model.find('**/locator_bottom')
goalBottomLoc.reparentTo(self.visual)
self.goalPositions = (goalBottomLoc.getPos(self), goalTopLoc.getPos(self))
self.greatLabel = DirectLabel(text = PLocalizer.Minigame_Repair_Pumping_Great, text_fg = (0.20000000000000001, 0.80000000000000004, 0.29999999999999999, 1.0), text_pos = (0.0, 0.59999999999999998), text_align = TextNode.ACenter, text_font = PiratesGlobals.getPirateFont(), relief = None, text_shadow = (0.0, 0.0, 0.0, 1.0), scale = (0.080000000000000002, 0.080000000000000002, 0.080000000000000002), pos = (-0.46500000000000002, 0.0, 0.0), parent = self)
self.failLabel = DirectLabel(text = PLocalizer.Minigame_Repair_Pumping_Fail, text_fg = (0.80000000000000004, 0.20000000000000001, 0.29999999999999999, 1.0), text_pos = (0.0, 0.59999999999999998), text_align = TextNode.ARight, text_font = PiratesGlobals.getPirateFont(), text_shadow = (0.0, 0.0, 0.0, 1.0), relief = None, scale = (0.080000000000000002, 0.080000000000000002, 0.080000000000000002), pos = (-0.625, 0.0, 0.0), parent = self)
self.shipBackground = self.model.find('**/static_ship_background')
self.shipBackground.reparentTo(self.visual)
self.waterMeter = self.model.find('**/sprite_waterBottom')
self.waterMeter.reparentTo(self.visual)
self.waterTop = self.model.find('**/sprite_waterTop')
self.waterTop.reparentTo(self.visual)
self.waterMeterTopLoc = self.waterMeter.find('**/locator_topOfShipWater')
self.pumpBackground = self.model.find('**/pumpBackground')
self.pumpBackground.reparentTo(self.visual)
self.pumpWaterTop = self.model.find('**/sprite_pumpWaterTop')
self.pumpWaterTop.reparentTo(self.visual)
self.pumpWaterBottom = self.model.find('**/sprite_pumpWaterBottom')
self.pumpWaterBottom.reparentTo(self.visual)
self.pumpWaterTopLoc = self.pumpWaterBottom.find('**/locator_topOfPumpWater')
self.pumpHandle = self.model.find('**/sprite_handle')
self.pumpHandle.reparentTo(self.visual)
self.pumpBar = self.model.find('**/static_pump')
self.pumpBar.reparentTo(self.visual)
self.goalBox = self.model.find('**/sprite_clickField')
self.goalBox.reparentTo(self.visual)
self.goalBox.setTransparency(1)
self.enableGoalBox()
self.pumpLine = self.model.find('**/sprite_bar')
self.pumpLine.reparentTo(self.visual)
self.ghostLine = self.visual.attachNewNode('ghostLine')
self.pumpLine.getChild(0).copyTo(self.ghostLine)
self.ghostLine.setScale(self.pumpLine.getScale())
self.ghostLine.setColor(1.0, 0.20000000000000001, 0.20000000000000001, 1.0)
self.shipForground = self.model.find('**/static_ship_foreground')
self.shipForground.reparentTo(self.visual)
cm = CardMaker('cardMaker')
cm.setFrame(-0.33000000000000002, 0.33000000000000002, 0.0, 1.0)
self.goalBox.setZ(self.goalPositions[TOP].getZ())
self.goalBoxStartScale = self.goalBox.getSz()
self.enableGoalBox()
self.pumpWaterUpLerp = LerpFunc(self.setPumpWater, fromData = -0.10000000000000001, toData = 1.0, duration = 0.5)
self.pumpWaterDownLerp = LerpFunc(self.setPumpWater, fromData = 1.0, toData = -0.10000000000000001, duration = 0.5)
self.model.removeNode()
del self.model
示例13: setupTexture
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()
示例14: loadFlatQuad
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
示例15: __init__
def __init__(self, name, nrplates, width, height, shaderfile, texturefile, uvlist, jitter=-1):
self.name = name
self.texturefile = texturefile
self.shaderfile = shaderfile
self.np = NodePath('leaf')
self.tex = loader.loadTexture('textures/' + texturefile)
self.tex.setMinfilter(Texture.FTLinearMipmapLinear)
self.tex.setMagfilter(Texture.FTLinearMipmapLinear)
self.tex.setAnisotropDegree(2)
self.np.setTexture(self.tex)
self.np.setTwoSided(True)
self.np.setTransparency(TransparencyAttrib.MAlpha)
self.np.setDepthWrite(False)
maker = CardMaker('leaf')
maker.setFrame(-width/2.0, width/2.0, 0, height)
#maker.setFrame(0,1,0,1)
for i in range(nrplates):
if uvlist != None:
maker.setUvRange(uvlist[i][0], uvlist[i][1])
else:
maker.setUvRange(Point2(0,0), Point2(1,0.98))
node = self.np.attachNewNode(maker.generate())
#node.setTwoSided(True)
node.setHpr(i * 180.0 / nrplates,0,0)
self.np.flattenStrong()
#np.flattenLight()
#np.setTwoSided(True)
if jitter == -1:
self.jitter = height/width/2
else:
self.jitter = jitter