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


Python TextureStage.getDefault方法代码示例

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


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

示例1: __init__

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import getDefault [as 别名]
 def __init__(self):      
    self.sphere = loader.loadModel("InvertedSphere.egg")
    # Load a sphere with a radius of 1 unit and the faces directed inward.
    
    self.sphere.setTexGen(TextureStage.getDefault(), TexGenAttrib.MWorldPosition)
    self.sphere.setTexProjector(TextureStage.getDefault(), render, self.sphere)
    self.sphere.setTexPos(TextureStage.getDefault(), 0, 0, 0)
    self.sphere.setTexScale(TextureStage.getDefault(), .5)
    # Create some 3D texture coordinates on the sphere. For more info on this, check the Panda3D manual.
    
    tex = loader.loadCubeMap("BlueGreenNebula_#.png")
    self.sphere.setTexture(tex)
    # Load the cube map and apply it to the sphere.
    
    self.sphere.setLightOff()
    # Tell the sphere to ignore the lighting.
       
    self.sphere.setScale(1000)
    # Increase the scale of the sphere so it will be larger than the scene.
    
    self.sphere.reparentTo(render)
    # Reparent the sphere to render so you can see it.
    
    result = self.sphere.writeBamFile("SkySphere.bam")
    # Save out the bam file.
    print(result)
开发者ID:shalinshah1993,项目名称:Carnival-Madness,代码行数:28,代码来源:sample.py

示例2: flipTexture

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import getDefault [as 别名]
 def flipTexture(self):
     """ Sets the texture coordinates of the texture to the current frame"""
     sU = self.offsetX * self.repeatX
     sV = self.offsetY * self.repeatY
     oU = 0 + self.frames[self.currentFrame].col * self.uSize
     oV = 1 - self.frames[self.currentFrame].row * self.vSize - self.offsetY
     if self.flip['x']:
         sU *= -1
         oU = self.uSize + self.frames[self.currentFrame].col * self.uSize
     if self.flip['y']:
         sV *= -1
         oV = 1 - self.frames[self.currentFrame].row * self.vSize
     self.node.setTexScale(TextureStage.getDefault(), sU, sV)
     self.node.setTexOffset(TextureStage.getDefault(), oU, oV)
开发者ID:DavidBernal,项目名称:tethical,代码行数:16,代码来源:Sprite2d.py

示例3: __setupLevel

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import getDefault [as 别名]
    def __setupLevel(self):
        """
        Originally planned to have multiple levels, that never happened.
        """
        level1 = render.attachNewNode("level 1 node path")
        
        execfile("rooms/room.py")

        self.room = loader.loadModel("rooms/room")
        self.room.findTexture("*").setMinfilter(Texture.FTLinearMipmapLinear)
        self.room.setScale(10,10,5)
        self.room.setTexScale(TextureStage.getDefault(), 10)
        self.room.reparentTo(render)
        self.room.find("**/Cube;+h").setTag("Room", "1")
        
        gate = loader.loadModel("models/box")
        
        gateTo2 = self.room.attachNewNode("gateTo2")
        gate.instanceTo(gateTo2)
        gateTo2.setPos(8, -10, 0)
        gateTo2.hide()
        
        self.physicsCollisionHandler.addInPattern("%fn-into-%in")
        self.physicsCollisionHandler.addOutPattern("%fn-out-%in")

        #messenger.toggleVerbose()
        self.gate = gate
开发者ID:Babi-Wan,项目名称:robotic-agent-path-planning-project,代码行数:29,代码来源:robotworld.py

示例4: updateHeightField

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import getDefault [as 别名]
	def updateHeightField( self ):
		''' recalculate heightfield
		'''
		if self.mHeightFieldNode != None:
			self.mHeightFieldNode.removeNode()
		posX, posY = self.world2MapPos( ( self.cameraPos.getX(), self.cameraPos.getY() ) )
		self.mHeightFieldTesselator.setFocalPoint( int(posX), int(posY) )
		self.mHeightFieldNode = self.mHeightFieldTesselator.generate()
		self.mHeightFieldNode.setPos( MAPSIZE/2, MAPSIZE/2, 0 )
		self.mHeightFieldNode.setHpr( 270, 0, 0 )
		self.mHeightFieldNode.reparentTo(render) 
		
		self.mHeightFieldNode.setTexGen( TextureStage.getDefault(), TexGenAttrib.MWorldPosition )
		scale = 1.0/8.0
		self.mHeightFieldNode.setTexScale( TextureStage.getDefault(), scale, scale );
		
		self.mHeightFieldNode.setTexture( self.tex0, 1 )
开发者ID:borgified,项目名称:Hockfire,代码行数:19,代码来源:heightfield.py

示例5: ry_floor

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import getDefault [as 别名]
 def ry_floor(self, gso):
     tex = self.loader.loadTexture("wood_floor_tex_0.jpg")
     ts = TextureStage.getDefault()
     gso.setTexGen(ts, TexGenAttrib.MWorldPosition)
     gso.setTexProjector(ts, self.render, gso)
     gso.setTexture(ts, tex)
     gso.setTexScale(ts, Vec2(0.25, 0.25) * 10.)
     gso.setColor((0.99, 0.99, 0.99, 1.))
开发者ID:clebio,项目名称:pycon-2014-talk,代码行数:10,代码来源:stylers.py

示例6: __setupEnvironment

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import getDefault [as 别名]
 def __setupEnvironment(self):
     cm = CardMaker("ground")
     size = 200
     cm.setFrame(-size, size, -size, size)
     environment = render.attachNewNode(cm.generate())
     environment.lookAt(0, 0, -1)
     environment.setPos(100, -100, 0)
     environment.setCollideMask(BitMask32.allOn())
     environment.reparentTo(render)
     
     texture = loader.loadTexture("textures/ground.png")
     
     # This is so the textures can look better from a distance
     texture.setMinfilter(Texture.FTLinearMipmapLinear)
     
     environment.setTexGen(TextureStage.getDefault(), TexGenAttrib.MWorldPosition) 
     environment.setTexScale(TextureStage.getDefault(), 0.02, 0.02)
     environment.setTexture(texture, 1)
开发者ID:Babi-Wan,项目名称:robotic-agent-path-planning-project,代码行数:20,代码来源:world.py

示例7: add_texture

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import getDefault [as 别名]
	def add_texture(self,tex_path):
		plat_texture = loader.loadTexture(tex_path)
		#plat_texture.setWrapU(Texture.WMRepeat)
		#plat_texture.setWrapV(Texture.WMRepeat)
                self.model.setTexture(plat_texture,1)
        	ts = TextureStage.getDefault()
       	 	texture = self.model.getTexture()
		#self.model.setTexOffset(ts, -0.5, -0.5)
		self.model.setTexScale(ts, 2, 2)
开发者ID:cgaldamez14,项目名称:rolling-eve,代码行数:11,代码来源:platform.py

示例8: __init__

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import getDefault [as 别名]
    def __init__(self,cubeMapPath=None):
        yawOff=198
        self.sphere = loader.loadModel("InvertSphereBlend.egg")
        # self.sphere = loader.loadModel("InvertedSphere.egg")
        # Load a sphere with a radius of 1 unit and the faces directed inward.

        self.sphere.setTexGen(TextureStage.getDefault(),
                              TexGenAttrib.MWorldPosition)
        self.sphere.setTexProjector(TextureStage.getDefault(), render,
                                    self.sphere)
        self.sphere.setTexTransform(TextureStage.getDefault(),
                                    TransformState.makeHpr(VBase3(yawOff, 0, 0)))

        # Create some 3D texture coordinates on the sphere. For more info on this, check the Panda3D manual.
        self.sphere.setPos((0,0,0))
        self.sphere.setTexPos(TextureStage.getDefault(), 0, 0, 0)
        self.sphere.setTexScale(TextureStage.getDefault(), 1)

        # tex = loader.loadCubeMap(cubeMapPath)
        if cubeMapPath is None:
            cubeMapPath=renamer()
        tex = loader.loadCubeMap(cubeMapPath)
        self.sphere.setTexture(tex)
        # Load the cube map and apply it to the sphere.

        self.sphere.setLightOff()
        # Tell the sphere to ignore the lighting.

        self.sphere.setScale(10)

        # Increase the scale of the sphere so it will be larger than the scene.
        print self.sphere.getHpr()
        print self.sphere.getPos()
        self.sphere.reparentTo(render)


        # Reparent the sphere to render so you can see it.
        # result = self.sphere.writeBamFile(cubeMapPath.split('_#.tga')[0]+'.bam')
        print '/'.join(cubeMapPath.split('/')[:-1])+'.bam'
        base.saveCubeMap('streetscene_cube_#.jpg', size=512)
        result = self.sphere.writeBamFile('/'.join(cubeMapPath.split('/')[:-1])+'.bam')
        # Save out the bam file.
        print(result)
开发者ID:pvnkmrksk,项目名称:world,代码行数:45,代码来源:boxGen.py

示例9: applyTexture

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import getDefault [as 别名]
	def applyTexture(self):
		self.texture = loader.loadTexture("media/gray_stone_tile.png")
		self.texture.setWrapU(Texture.WMRepeat)
		self.texture.setWrapV(Texture.WMRepeat)
		self.model.setTexture(self.texture, 1)

		# Calculate and apply texture scale factors.
		sizes = entrywiseMult(vecInvert(self.tileDir), self.size)
		scales = []
		for i in sizes:
			scales.append(i) if i != 0 else None
		self.model.setTexScale(TextureStage.getDefault(), scales[0], scales[1])
开发者ID:Panda3D-google-code-repositories,项目名称:heavy-destruction,代码行数:14,代码来源:tile.py

示例10: flipTexture

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import getDefault [as 别名]
	def flipTexture(self):
		""" Sets the texture coordinates of the texture to the current frame"""
		for i in range(len(self.cards)):
			currentRow = self.rowPerFace[i]

			sU = self.offsetX * self.repeatX
			sV = self.offsetY * self.repeatY
			oU = 0 + self.currentFrame * self.uSize
			#oU = 0 + self.frames[self.currentFrame].col * self.uSize
			#oV = 1 - self.frames[self.currentFrame].row * self.vSize - self.offsetY
			oV = 1 - currentRow * self.vSize - self.offsetY
			if self.flip['x'] ^ i==1: ##hack to fix side view
				#print "flipping, i = ",i
				sU *= -1
				#oU = self.uSize + self.frames[self.currentFrame].col * self.uSize
				oU = self.uSize + self.currentFrame * self.uSize
			if self.flip['y']:
				sV *= -1
				#oV = 1 - self.frames[self.currentFrame].row * self.vSize
				oV = 1 - currentRow * self.vSize
			self.cards[i].setTexScale(TextureStage.getDefault(), sU, sV)
			self.cards[i].setTexOffset(TextureStage.getDefault(), oU, oV)
开发者ID:ChrisCraik,项目名称:tinygame,代码行数:24,代码来源:sprite.py

示例11: renderObject

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import getDefault [as 别名]
	def renderObject(self,scale,hpr,collisionOn=False):
		(x_scale,y_scale,z_scale) = scale
		(h,p,r) = hpr
		if collisionOn is True:
			if self.name is 'wide_ramp':
				(x_c,y_c,z_c) = (x_scale + .2,y_scale+2.5,z_scale+1.75)
			if self.name is 'tree1':
				(x_c,y_c,z_c) = (x_scale,y_scale,z_scale)
			if self.name is 'tree2':
				(x_c,y_c,z_c) = (x_scale,y_scale,z_scale)
			if self.name is 'rock1':
				(x_c,y_c,z_c) = (x_scale * 2,y_scale * 2,z_scale*2)
			if self.name is 'rock2':
				(x_c,y_c,z_c) = (x_scale*100,y_scale*100,z_scale*100)
			if self.name is 'gate':
				(x_c,y_c,z_c) = (x_scale * 10,y_scale,z_scale*3.5)
			if self.name is 'statue':
				(x_c,y_c,z_c) = (x_scale,y_scale,z_scale)

       			mesh = BulletTriangleMesh()
        		for geomNP in self.model.findAllMatches('**/+GeomNode'):
            			geomNode = geomNP.node()
            			ts = geomNP.getTransform(self.model)
          		for geom in geomNode.getGeoms():
                		mesh.addGeom(geom, ts)

        		shape = BulletTriangleMeshShape(mesh, dynamic=False)

            		node = BulletRigidBodyNode(self.name)
            		node.setMass(0)
            		node.addShape(shape)

			np = self.__game.render.attachNewNode(node)
			np.setPos(self.x,self.y,self.z)
			np.setHpr(h,p,r)
			np.setScale(x_c,y_c,z_c)

			self.__game.world.attachRigidBody(node)
		self.model.setPos(self.x,self.y,self.z)
		self.model.setHpr(h,p,r)
		self.model.setScale(x_scale,y_scale,z_scale)
		self.model.reparentTo(self.__game.render)
		
		if self.name is 'statue':
			plat_texture = loader.loadTexture('models/textures/rocky.jpg')
		        self.model.setTexture(plat_texture,1)
			ts = TextureStage.getDefault()
	       	 	texture = self.model.getTexture()
			self.model.setTexScale(ts, 1, 1)
开发者ID:cgaldamez14,项目名称:rolling-eve,代码行数:51,代码来源:envobject.py

示例12: loadIcon

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import getDefault [as 别名]
 def loadIcon(self, iconsFile, name):
     retVal = iconsFile.find(name)
     retVal.setBillboardAxis()
     retVal.reparentTo(self)
     dark = retVal.copyTo(NodePath())
     dark.reparentTo(retVal)
     dark.setColor(0.5, 0.5, 0.5, 1)
     retVal.setEffect(DecalEffect.make())
     retVal.setTransparency(TransparencyAttrib.MAlpha, 1)
     ll, ur = dark.getTightBounds()
     center = retVal.attachNewNode('center')
     center.setPos(0, 0, ll[2])
     dark.wrtReparentTo(center)
     dark.setTexProjector(TextureStage.getDefault(), center, retVal)
     retVal.hide()
     return (retVal, center)
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leaked-Source,代码行数:18,代码来源:DinerStatusIndicator.py

示例13: createSpritesNodeSetup

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import getDefault [as 别名]
 def createSpritesNodeSetup(self): 
 
     aspect_ratio = self.mainRef.render2d.getScale()[0]    
      
     screenOrigin = self.mainRef.render2d.attachNewNode('screen_origin') 
     screenNode = screenOrigin.attachNewNode('screen_node') 
     
     screenOrigin.setPos(-1.0/aspect_ratio, 0.0, 1.0) 
     screenOrigin.setScale(2.0, 1.0, -2.0) 
     
     screenNode.setPos(0, 0, 0) 
      
     screenNode.setScale(1.0/(aspect_ratio*self.winSizeX), 1.0, 1.0/self.winSizeY) 
     screenNode.setTexScale(TextureStage.getDefault(), 1.0, -1.0)  
      
     return screenNode 
开发者ID:vitutc,项目名称:anim-jogos-2012-1,代码行数:18,代码来源:PlayerHUD.py

示例14: __init__

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import getDefault [as 别名]
	def __init__(self, world, parent, pos, dir, width, height, color, name, textureFilename=None):
		self.node = parent.attachNewNode("")
		self.node.setPos(*pos)
		self.node.lookAt(self.node, *dir)
		self.name = name

		divisions = 1
		for i in range(divisions):
			for j in range(divisions):
				self.makeCard(color, width, height, i, j, divisions)

		if textureFilename == None:
			self.texture = None
		else:
			self.texture = loader.loadTexture(textureFilename)
			self.texture.setWrapU(Texture.WMRepeat)
			self.texture.setWrapV(Texture.WMRepeat)
			self.node.setTexture(self.texture)
			self.node.setTexScale(TextureStage.getDefault(), 0.5, 0.5)

		self.geom = OdePlaneGeom(world.space, makeVec4FromPointAndNormal(pos, dir))
		world.space.setSurfaceType(self.geom, world.surfaces["plane"])
开发者ID:Panda3D-google-code-repositories,项目名称:heavy-destruction,代码行数:24,代码来源:plane.py

示例15: getShip

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import getDefault [as 别名]

#.........这里部分代码省略.........
        for data in [
            (0, "location_mainmast_0"),
            (1, "location_mainmast_1"),
            (2, "location_mainmast_2"),
            (3, "location_aftmast*"),
            (4, "location_foremast*"),
        ]:
            mastData = mastSetup.get(data[0])
            if mastData:
                mast = self.mastSets[mastData[0]].getMastSet(mastData[1] - 1, customMasts)
                mastRoot = hull.locators.find("**/%s" % data[1]).getTransform(hull.locators)
                model = NodePath(mast.charRoot)
                model.setTransform(mastRoot)
                if complexCustomization:
                    model.setTexture(shipTextureSail)

                useLogoTex = logoTex
                if placeLogos:
                    mastNum = data[0]
                    if mastNum not in ShipGlobals.MAST_LOGO_PLACEMENT.get(modelClass):
                        useLogoTex = None

                charBundle = mast.charRoot.getBundle(0)
                if data[0] < 3:
                    for side in ["left", "right"]:
                        ropeNode = hull.locators.find("**/location_ropeLadder_%s_%s" % (side, data[0]))
                        if ropeNode:
                            transform = ropeNode.getTransform(NodePath(mast.charRoot))
                            charBundle.findChild("def_ladder_0_%s" % side).applyFreeze(transform)
                            continue

                if sailPatternTex and useLogoTex:
                    for node in model.findAllMatches("**/sails"):
                        node.setTextureOff(TextureStage.getDefault())
                        node.setTexture(self.colorLayer, sailPatternTex)
                        node.setTexture(self.logoLayer, logoTex)
                        node.setTexture(self.vertLayer, shipTextureSail)
                        node.setTexture(self.baseLayer, shipTextureSail)

                elif sailPatternTex:
                    for node in model.findAllMatches("**/sails"):
                        node.setTextureOff(TextureStage.getDefault())
                        node.setTexture(self.colorLayer, sailPatternTex)
                        node.setTexture(self.vertLayer, shipTextureSail)
                        node.setTexture(self.baseLayer, shipTextureSail)

                elif useLogoTex:
                    for node in model.findAllMatches("**/sails"):
                        node.setTextureOff(TextureStage.getDefault())
                        node.setTexture(self.logoLayerNoColor, logoTex)
                        node.setTexture(self.vertLayer, shipTextureSail)
                        node.setTexture(self.baseLayer, shipTextureSail)

                model.flattenLight()
                if detailLevel == 0:
                    model.find("**/low").copyTo(high)
                    model.find("**/low").copyTo(low)
                    model.find("**/superlow").copyTo(superlow)
                elif detailLevel == 1:
                    model.find("**/med").copyTo(high)
                    model.find("**/med").copyTo(med)
                    low.node().stealChildren(model.find("**/low").node())
                    superlow.node().stealChildren(model.find("**/superlow").node())
                elif detailLevel == 2:
                    high.node().stealChildren(model.find("**/high").node())
                    med.node().stealChildren(model.find("**/med").node())
开发者ID:PiratesOnline,项目名称:PiratesOfTheCarribeanOnline,代码行数:70,代码来源:ShipFactory.py


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