当前位置: 首页>>代码示例>>Python>>正文


Python CardMaker.generate方法代码示例

本文整理汇总了Python中panda3d.core.CardMaker.generate方法的典型用法代码示例。如果您正苦于以下问题:Python CardMaker.generate方法的具体用法?Python CardMaker.generate怎么用?Python CardMaker.generate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在panda3d.core.CardMaker的用法示例。


在下文中一共展示了CardMaker.generate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: FirstTry

# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import generate [as 别名]
class FirstTry(visual):
    def setup(self):
        self.tex1 = MovieTexture('videos/saturn5_apollo_launch.mp4')
        assert self.tex1.read('videos/saturn5_apollo_launch.mp4')
        self.tex2 = MovieTexture('videos/boards_eye_view.mp4')
        assert self.tex2.read('videos/boards_eye_view.mp4')

        self.cm1 = CardMaker('saturn')
        self.cm1.setFrameFullscreenQuad()
        self.cm1.setUvRange(self.tex1)
        self.card1 = NodePath(self.cm1.generate())
        self.card1.reparentTo(self.path)
        self.card1.setPos(0,0,10)
        self.card1.setP(50)

        self.cm2 = CardMaker('board')
        self.cm2.setFrameFullscreenQuad()
        self.cm2.setUvRange(self.tex2)
        self.card2 = NodePath(self.cm2.generate())
        self.card2.reparentTo(self.path)
        self.card2.setPos(0,0,-10)
        self.card2.setP(-50)

        self.card1.setTexture(self.tex1)
        self.card1.setTexScale(TextureStage.getDefault(), self.tex1.getTexScale())
        self.card2.setTexture(self.tex2)
        self.card2.setTexScale(TextureStage.getDefault(), self.tex2.getTexScale())

        self.card1.setScale(10)
        self.card2.setScale(10)

    def getBeat(self):
        pass
开发者ID:indygfx,项目名称:opticfoo,代码行数:35,代码来源:firsttry.py

示例2: __init__

# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import generate [as 别名]
        def __init__(self, scale=1, value=0, r=10, g=0, b=0): 
                NodePath.__init__(self, 'healthbar') 
                self.value = value
                self.scale = scale 
                self.range = 1.0
                self.buff = 0
                
                
                
                cmbg = CardMaker('bg') 
                cmbg.setFrame(- scale, scale, -0.1 * scale, 0.1 * scale) 
                self.bg = self.attachNewNode(cmbg.generate())
 
                self.bg.setColor(0.2, 0.2, 0.2, 1) 
                self.bg.setPos(0,0,5.8)
                
                
                cmfg = CardMaker('fg') 
                cmfg.setFrame(- scale,  scale, -0.1 * scale, 0.1 * scale)
                self.fg = self.bg.attachNewNode(cmfg.generate()) 
               
                self.fg.setColor(r, g, b, 1)             
                self.fg.setPos(0,-0.1,0)
                self.fg.setBillboardPointWorld()
                self.bg.setBillboardPointWorld()
                
                self.fg.clearShader()
                self.bg.clearShader()
       

                self.setValue(0)
开发者ID:jaimodha,项目名称:MMOG,代码行数:33,代码来源:HealthBar.py

示例3: iterate

# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import generate [as 别名]
	def iterate(self):
		cm = CardMaker('CardMaker-GameOver')
		tex = loadTexture('gameover.png')

		cm.setFrame(-1, 1, -1, 1)
		bg = self.node.attachNewNode(cm.generate())
		bg.setColor(0, 0, 0)
		bg.setPos(0, 0, 0)

		cm.setFrame(-0.4, 0.4, -0.2, 0.2)
		self.text = self.node.attachNewNode(cm.generate())
		self.text.setPos(0, 0, 0)
		self.text.setTexture(tex)
开发者ID:bjurkovski,项目名称:SeaOfPossibilities,代码行数:15,代码来源:gameOver.py

示例4: MatPlotLibDemo

# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import generate [as 别名]
class MatPlotLibDemo(ShowBase):
    def __init__(self):
        ShowBase.__init__(self)
        base.setFrameRateMeter(True)

        m = loader.loadModel("models/smiley")
        m.reparent_to(render)
        m.set_pos(0, 5, 0)

        x_size, y_size = 640, 480
        xy_ratio = float(y_size) / float(x_size)
        self.plot = Plot(x_size, y_size)

        self.input_img = PNMImage(x_size, y_size)
        self.input_tex = Texture()
        self.input_tex.load(self.input_img)

        self.card = CardMaker('pygame_card')
        self.card.setUvRange(Point2(0, 1),  # ll
                             Point2(1, 1),  # lr
                             Point2(1, 0),  # ur
                             Point2(0, 0))  # ul
        self.screen = render.attach_new_node(self.card.generate())
        self.screen.set_scale(1, 1, xy_ratio)
        self.screen.set_pos(-0.5, 2, -0.5 * xy_ratio)
        self.screen.setTexture(self.input_tex)
        # FIXME: Apparently mpl's print_to_buffer() doesn't write
        # alpha values properly. 
        self.screen.setTransparency(TransparencyAttrib.MAlpha)

        taskMgr.add(self.update, "update plot")

    def update(self, task):
        self.input_tex.set_ram_image_as(self.plot.draw(), "RGBA")
        return task.cont
开发者ID:TheCheapestPixels,项目名称:panda_examples,代码行数:37,代码来源:matplotlib_to_panda3d.py

示例5: _createMapTextureCard

# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import generate [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
开发者ID:nate97,项目名称:src,代码行数:27,代码来源:MazeMapGui.py

示例6: _createSimpleMarker

# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import generate [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
开发者ID:nate97,项目名称:src,代码行数:9,代码来源:MazeMapGui.py

示例7: __init__

# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import generate [as 别名]
	def __init__(self, world, attach, name = '', position = Vec3(0,0,0), orientation = Vec3(0,0,0), size = (32, 32)):
		cm=CardMaker('')
		cm.setFrame(0,1,0,1)
		floor = render.attachNewNode(PandaNode("floor"))
		tex = loader.loadTexture('media/'+'ground.png')
		tex.setMagfilter(Texture.FTNearest)
		tex.setMinfilter(Texture.FTNearest)
		for y in range(size[0]):
			for x in range(size[1]):
				nn = floor.attachNewNode(cm.generate())
				nn.setP(-90)
				nn.setPos((x), (y), 0)
		floor.setTexture(tex)
		floor.flattenStrong()



		myMaterial = Material()
		myMaterial.setShininess(0) #Make this material shiny
		myMaterial.setAmbient(VBase4(0.5,.5,.5,1)) #Make this material blue
		myMaterial.setDiffuse(VBase4(.5,.5,.5,1))
		nn.setMaterial(myMaterial)
		shape = BulletPlaneShape(Vec3(0, 0, 1), 0)

		StaticWorldObject.__init__(self, world, attach, name, position, shape, orientation) ##Mass must be zero.

		self._nodePath.node().setFriction(1)
开发者ID:ursulawolz,项目名称:tanCS,代码行数:29,代码来源:FloorStaticObject.py

示例8: makeCube

# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import generate [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())
开发者ID:TazeTSchnitzel,项目名称:BlockGame,代码行数:30,代码来源:render.py

示例9: constructModel

# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import generate [as 别名]
	def constructModel(self):
		self.obstacles = []
		self.blocks = []
		self.liftables = []

		if self.nodePath != None:
			self.nodePath.removeNode()
			self.cards = []

		self.nodePath = NodePath("Map")
		#the ground
		cm = CardMaker('CardMaker')
		cm.setFrame(-2,2,-2,2)
		card = self.nodePath.attachNewNode(cm.generate())
		card.setTexture(tex)

		for y in range(self.height):
			for x in range(self.width):
				# TO DO: MUDAR NOME
				a = {"block": self.blocks,
					 "obstacle": self.obstacles,
					 "tree": self.obstacles,
					 "bush" : self.obstacles,
					 "liftable": self.liftables}
				tType = self.tileType(Map.COLLISION, (x,y))

				if tType != 'free':
					a[tType].append(self.makeObject(tType, x,y))
开发者ID:bjurkovski,项目名称:SeaOfPossibilities,代码行数:30,代码来源:stage.py

示例10: __initSceneGraph

# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import generate [as 别名]
    def __initSceneGraph(self):
        
        self.point_path = self.host_planet.point_path.attachNewNode("unit_center_node")
        self.model_path = self.point_path.attachNewNode("unit_node")
        self.model_path.reparentTo(self.point_path)
        self.model_path.setPos(Vec3(0,6,0))
        
        self.model_path.setPythonTag('pyUnit', self)
        
        rad = 1
        cnode = CollisionNode("coll_sphere_node")
        cnode.addSolid(CollisionBox(Point3(-rad,-rad,-rad),Point3(rad,rad,rad)))
        cnode.setIntoCollideMask(BitMask32.bit(1))
        cnode.setTag('unit', str(id(self)))
        self.cnode_path = self.model_path.attachNewNode(cnode)
        #self.cnode_path.show()
        
        tex = loader.loadTexture("models/billboards/flare.png")
        cm = CardMaker('quad')
        cm.setFrameFullscreenQuad()
        self.quad_path = self.model_path.attachNewNode(cm.generate())
        self.quad_path.setTexture(tex)
        self.quad_path.setTransparency(TransparencyAttrib.MAlpha)
        self.quad_path.setBillboardPointEye()

        self.quad_path.setColor(self.player.color)
开发者ID:muadibbm,项目名称:COMP361Project,代码行数:28,代码来源:units.py

示例11: __createAnimationSequence__

# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import generate [as 别名]
 def __createAnimationSequence__(self,name,sprite_images,sprites_time,is_left = False):
   """
     Creates the sequence node that plays these images
   """
   
   seq = SpriteSequencePlayer(name)
   
   for i in range(0,len(sprite_images)):
       
     txtr = sprite_images[i]
     
     w = txtr.getXSize() 
     h = txtr.getYSize()       
     
     # creating CardMaker to hold the texture
     cm = CardMaker(name +    str(i))
     cm.setFrame(0,w,-h,0 )  # This configuration places the image's topleft corner at the origin
     card = NodePath(cm.generate())            
     card.setTexture(txtr)
     seq.addChild(card.node(),i)
     seq.addFrame(card.node(),i,sprites_time[i])
     
     # offseting image
     xoffset = float(txtr.axisx + (-w if is_left else 0))
     yoffset = float(txtr.axisy)
     card.setPos(Vec3(xoffset,0,yoffset))
     
     AnimationActor.LOGGER.debug("Animation %s Sprite [%i] image size %s and offset %s."%( name,i, str((w,h)), str((txtr.axisx,txtr.axisy)) ) ) 
    
              
   return seq     
   
   
开发者ID:jrgnicho,项目名称:platformer_games_project,代码行数:33,代码来源:animation_actor.py

示例12: __init__

# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import generate [as 别名]
    def __init__(self):
        ShowBase.__init__(self)

        cm = CardMaker('grass')
        cm.setFrame(-1, 1, -1, 1)

        grass1 = render.attachNewNode(cm.generate())
        grass2 = render.attachNewNode(cm.generate())

        grass1.setTexture(loader.loadTexture("data/env/grass1.png"), 1)
        grass2.setTexture(loader.loadTexture("data/env/grass2.png"), 1)

        grass1.setTransparency(True)
        grass2.setTransparency(True)

        grass1.setBillboardPointEye()
        grass2.setBillboardPointEye()

        grass1.setHpr(0, -40, 0)
        grass2.setHpr(0, -40, 0)

        grass1.setPos(0, 1, -0.4)
        grass2.setPos(0, 1, -0.3)

        self.taskMgr.add(self.panCameraTask, "PanCameraTask")
开发者ID:Aristonaut,项目名称:siliconsky,代码行数:27,代码来源:grassTest.py

示例13: genArrow

# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import generate [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)
开发者ID:nate97,项目名称:src,代码行数:36,代码来源:DistributedRace.py

示例14: renderQuadInto

# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import generate [as 别名]
    def renderQuadInto(self, xsize, ysize, colortex=None, cmode = GraphicsOutput.RTMBindOrCopy, auxtex = None):

        buffer = self.createBuffer("filter-stage", xsize, ysize, colortex, cmode, auxtex)

        if (buffer == None):
            return None

        cm = CardMaker("filter-stage-quad")
        cm.setFrameFullscreenQuad()
        quad = NodePath(cm.generate())
        quad.setDepthTest(0)
        quad.setDepthWrite(0)
        quad.setColor(Vec4(1,0.5,0.5,1))

        quadcamnode = Camera("filter-quad-cam")
        lens = OrthographicLens()
        lens.setFilmSize(2, 2)
        lens.setFilmOffset(0, 0)
        lens.setNearFar(-1000, 1000)
        quadcamnode.setLens(lens)
        quadcam = quad.attachNewNode(quadcamnode)
        
        buffer.getDisplayRegion(0).setCamera(quadcam)
        buffer.getDisplayRegion(0).setActive(1)

        return quad, buffer
开发者ID:croxis,项目名称:Panda-Core-Technology,代码行数:28,代码来源:AtmosphericScattering.py

示例15: register

# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import generate [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)
开发者ID:bjurkovski,项目名称:SeaOfPossibilities,代码行数:29,代码来源:pause.py


注:本文中的panda3d.core.CardMaker.generate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。