本文整理汇总了Python中pandac.PandaModules.CardMaker.setFrame方法的典型用法代码示例。如果您正苦于以下问题:Python CardMaker.setFrame方法的具体用法?Python CardMaker.setFrame怎么用?Python CardMaker.setFrame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandac.PandaModules.CardMaker
的用法示例。
在下文中一共展示了CardMaker.setFrame方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pandac.PandaModules import CardMaker [as 别名]
# 或者: from pandac.PandaModules.CardMaker import setFrame [as 别名]
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: setupTexture
# 需要导入模块: from pandac.PandaModules import CardMaker [as 别名]
# 或者: from pandac.PandaModules.CardMaker import setFrame [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: __init__
# 需要导入模块: from pandac.PandaModules import CardMaker [as 别名]
# 或者: from pandac.PandaModules.CardMaker import setFrame [as 别名]
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: __init__
# 需要导入模块: from pandac.PandaModules import CardMaker [as 别名]
# 或者: from pandac.PandaModules.CardMaker import setFrame [as 别名]
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
示例5: loadFlatQuad
# 需要导入模块: from pandac.PandaModules import CardMaker [as 别名]
# 或者: from pandac.PandaModules.CardMaker import setFrame [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
示例6: __init__
# 需要导入模块: from pandac.PandaModules import CardMaker [as 别名]
# 或者: from pandac.PandaModules.CardMaker import setFrame [as 别名]
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
示例7: _initModel
# 需要导入模块: from pandac.PandaModules import CardMaker [as 别名]
# 或者: from pandac.PandaModules.CardMaker import setFrame [as 别名]
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()
示例8: genArrow
# 需要导入模块: from pandac.PandaModules import CardMaker [as 别名]
# 或者: from pandac.PandaModules.CardMaker import setFrame [as 别名]
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)
示例9: _createMapTextureCard
# 需要导入模块: from pandac.PandaModules import CardMaker [as 别名]
# 或者: from pandac.PandaModules.CardMaker import setFrame [as 别名]
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: _createSimpleMarker
# 需要导入模块: from pandac.PandaModules import CardMaker [as 别名]
# 或者: from pandac.PandaModules.CardMaker import setFrame [as 别名]
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
示例11: __init__
# 需要导入模块: from pandac.PandaModules import CardMaker [as 别名]
# 或者: from pandac.PandaModules.CardMaker import setFrame [as 别名]
def __init__(self,table=None,mask=None):
"""
@keyword table: filename of a table texture. See table_template.psd. Either
paint anywhere inside the mask for a complete background
or turn off the pads and spinner and paint in the table circle
for just a table texture that will have spinners and pads
put on top of it.
@type mask: str
@keyword mask: filename of a mask texture of the non-Jam-o-Drum area. probably
jod_mask.png that comes with the Jam-o-Drum library.
@type mask: str
"""
NodePath.__init__(self,"JamoDrum")
totalHeight = max(1.0,math.sqrt(2)/4.0+SPINNER_RADIUS)*2
cm = CardMaker("card")
cm.setFrame(-1,1,-1,1)
self.tableCard = self.attachNewNode(cm.generate())
self.tableCard.setP(-90)
self.tableCard.setScale(4.0/3.0)
self.tableCard.setLightOff()
self.tableCard.setBin("background",0)
self.tableCard.setDepthTest(0)
self.tableCard.setDepthWrite(0)
self.tableCard.hide()
if (table):
self.setTableTexture(loader.loadTexture(table))
if (mask):
cm = CardMaker("JOD Mask")
cm.setFrame(-4.0/3.0,4.0/3.0,-4.0/3.0,4.0/3.0)
self.mask = aspect2d.attachNewNode(cm.generate())
#self.mask.setP(-90)
self.mask.setTexture(loader.loadTexture(mask),1)
self.mask.setTransparency(1)
self.mask.setDepthTest(0)
else:
self.mask = None
self.stations = []
for i in range(4):
station = Station(self,i)
station.reparentTo(self)
self.stations.append(station)
self.reparentTo(render)
base.disableMouse()
self.lens = OrthographicLens()
self.lens.setFilmSize(totalHeight*base.getAspectRatio(),totalHeight)
base.cam.node().setLens(self.lens)
camera.setPosHpr(0,0,10.0, 0,-90,0)
base.setBackgroundColor(0,0,0)
self.audio3d = Audio3DManager(base.sfxManagerList[0],self)
self.audio3d.setDropOffFactor(0)
示例12: _initGUI
# 需要导入模块: from pandac.PandaModules import CardMaker [as 别名]
# 或者: from pandac.PandaModules.CardMaker import setFrame [as 别名]
def _initGUI(self):
base.loadingScreen.beginStep('init Gui', 4, 55)
cm = CardMaker('PotionBackground')
cm.setFrame(-10, 10, -10, 10)
cm.setColor(0, 0, 0, 1)
self.background = NodePath(cm.generate())
self.background.reparentTo(aspect2d)
self.background.setBin('background', -100)
self.xpBackground = NodePath('PotionXPBackground')
self.xpBackground.reparentTo(aspect2d)
self.xpBackground.setBin('background', -95)
base.loadingScreen.tick()
self.dialogs = NodePath('DialogBackground')
self.dialogs.reparentTo(aspect2d)
self.dialogs.setBin('background', -70)
self.buttonsBackground = NodePath('PotionButtonBackground')
self.buttonsBackground.reparentTo(base.a2dBottomRight)
self.buttonsBackground.setBin('background', -90)
textureCard = loader.loadModel('models/minigames/pir_m_gui_pot_textureCard')
self.stretchedBackgroundTextureCard = textureCard.find('**/pir_t_gui_pot_background')
self.stretchedBackgroundTextureCard.reparentTo(self.background)
self.stretchedBackgroundTextureCard.setScale(3.3999999999999999, 1.0, 3.3999999999999999)
self.stretchedBackgroundTextureCard.setPos(0.0, 20.0, 0.0)
fadecm = CardMaker('card')
fadecm.setFrameFullscreenQuad()
self.fadeIn = render2d.attachNewNode(fadecm.generate())
self.fadeIn.setBin('background', -50)
self.fadeIn.setPos(0.0, -30.0, 0.0)
self.fadeIn.setColor(0, 0, 0, 1.0)
self.fadeIn.setTransparency(True)
base.loadingScreen.tick()
cm = CardMaker('card')
cm.setFrame(0, 1, 0.01, 0.01)
self.foregroundLayer = aspect2d.attachNewNode(cm.generate())
self.foregroundTextureCard = textureCard.find('**/pir_t_gui_pot_foreground')
self.foregroundTextureCard.setScale(0.80000000000000004, 1.0, 0.40000000000000002)
self.foregroundTextureCard.setPos(-0.69999999999999996, -20.0, 0.80000000000000004)
self.foregroundTextureCard.setBin('background', -80)
self.foregroundTextureCard.copyTo(self.foregroundLayer)
self.repMeter = ReputationMeter.ReputationMeter(InventoryType.PotionsRep, width = 0.56000000000000005)
inv = localAvatar.getInventory()
self.repMeter.reparentTo(self.xpBackground)
self.repMeter.setPos(0, 0, -0.94999999999999996)
self.repMeter.update(inv.getAccumulator(InventoryType.PotionsRep))
localAvatar.guiMgr.registerReputationHandler(self.updateRepMeter)
base.loadingScreen.tick()
self.closeButton = GuiButton.GuiButton(image = (textureCard.find('**/pir_t_gui_pot_escape'), textureCard.find('**/pir_t_gui_pot_escapeOn'), textureCard.find('**/pir_t_gui_pot_escapeOn'), textureCard.find('**/pir_t_gui_pot_escape')), image_scale = (0.10000000000000001, 0.10000000000000001, 0.10000000000000001), image_pos = (0.074999999999999997, 0, 0.080000000000000002), hotkeys = [
'Escape'], hotkeyLabel = PLocalizer.PotionGui['ExitButton'], pos = (-0.40000000000000002, 0.0, 0.01), text0_fg = PotionGlobals.TextColor, text1_fg = PiratesGuiGlobals.TextFG0, text2_fg = PiratesGuiGlobals.TextFG15, text3_fg = PotionGlobals.TextColorDisabled, parent = self.buttonsBackground, command = self.confirmQuit)
self.returnButton = GuiButton.GuiButton(text = (PLocalizer.PotionGui['SwitchRecipe'], PLocalizer.PotionGui['SwitchRecipe'], PLocalizer.PotionGui['SwitchRecipe'], PLocalizer.PotionGui['SwitchRecipe']), pos = (-0.57999999999999996, 0.0, -0.62), text_scale = PiratesGuiGlobals.TextScaleExtraLarge, text_shadow = None, image = (None, None, None, None), text0_fg = PotionGlobals.TextColor, text1_fg = PiratesGuiGlobals.TextFG0, text2_fg = PiratesGuiGlobals.TextFG15, text3_fg = PotionGlobals.TextColorDisabled, parent = self.background, command = self.confirmReturn)
self.returnButton.stash()
self.hintsButton = GuiButton.GuiButton(text = (PLocalizer.PotionGui['ShowTutorial'], PLocalizer.PotionGui['ShowTutorial'], PLocalizer.PotionGui['ShowTutorial'], PLocalizer.PotionGui['ShowTutorial']), text_scale = PiratesGuiGlobals.TextScaleSmall, image_scale = (0.25, 0.10000000000000001, 0.17999999999999999), image_pos = (0, 0, 0), pos = (-0.53000000000000003, 0.0, 0.074999999999999997), parent = self.buttonsBackground, command = self.showLastHint)
self.InfoButton = GuiButton.GuiButton(text = (PLocalizer.PotionGui['IngredientList'], PLocalizer.PotionGui['IngredientList'], PLocalizer.PotionGui['IngredientList'], PLocalizer.PotionGui['IngredientList']), text_scale = PiratesGuiGlobals.TextScaleSmall, image_scale = (0.29999999999999999, 0.10000000000000001, 0.17999999999999999), image_pos = (0, 0, 0), pos = (-0.83999999999999997, 0.0, 0.074999999999999997), parent = self.buttonsBackground, command = self.showInfo)
textureCard.removeNode()
base.loadingScreen.endStep('init Gui')
示例13: make_vertical_wall
# 需要导入模块: from pandac.PandaModules import CardMaker [as 别名]
# 或者: from pandac.PandaModules.CardMaker import setFrame [as 别名]
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)
示例14: __init__
# 需要导入模块: from pandac.PandaModules import CardMaker [as 别名]
# 或者: from pandac.PandaModules.CardMaker import setFrame [as 别名]
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)
示例15: makeCard
# 需要导入模块: from pandac.PandaModules import CardMaker [as 别名]
# 或者: from pandac.PandaModules.CardMaker import setFrame [as 别名]
def makeCard(self, color, width, height, i, j, divisions):
divisions = float(divisions)
x = i / divisions
y = j / divisions
d = 1 / divisions
card = CardMaker("wall")
card.setColor(*color)
card.setFrame(width*(x*2-1), width*((x+d)*2-1), height*(y*2-1), height*((y+d)*2-1))
card.setUvRange(Point2(width*x, height*y), Point2(width*(x+d), height*(y+d)))
card.setHasUvs(True)
card.setHasNormals(True)
node = self.node.attachNewNode(card.generate())