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


Python TextureStage.setSort方法代码示例

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


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

示例1: render

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import setSort [as 别名]
	def render(self):
		LOG.debug("[SkyBox] Rendering")
		
		# If we are an orphan use render
		if self.parent is None: self.parent = render
		
		#LOG.debug("[SkyBox] model=%s"%self.modelFile)
		self.node  = loader.loadModel(self.modelFile)
		
		#print("tf1 = %s, tf2 = %s"%(self.texture1File,self.texture2File))
		
		if self.texture1File != '' and self.texture2File == '':
			#LOG.debug("[SkyBox] single texture = %s"%self.texture1File)
			t = loader.loadTexture(self.texture1File)
			self.node.setTexture(t)
			
		elif self.texture1File != '' and self.texture2File != '':
			#LOG.debug("[SkyBox] texture staging 1 = %s, 2 = %s"%(self.texture1File,self.texture2File))
			t1 = loader.loadTexture(self.texture1File)
			t1.setWrapU(Texture.WMClamp)
			t1.setWrapV(Texture.WMClamp)
			ts1 = TextureStage('Space')
			ts1.setSort(self.texture1Sort)
			
			t2 = loader.loadTexture(self.texture2File)
			t2.setWrapU(Texture.WMClamp)
			t2.setWrapV(Texture.WMClamp)
			ts2 = TextureStage('SpaceClouds')
			ts2.setSort(self.texture2Sort)
			self.node.setTexture(ts1, t1)
			self.node.setTexture(ts2, t2)
		if self.shaderFile:
			LOG.debug("[SkyBox] shader = %s"%self.shaderFile)
			#skyShader = Shader.load("./data/shaders/%s"%self.shaderFile)
			skyShader = Shader.load("%s"%self.shaderFile)
			self.node.setShader(skyShader)
		
		# Should this be scaled here or done to the model?
		# It doesn't look like scaling the objects looks any different.
		self.node.setScale(280)
		
		# make sure it's drawn first (this can be done with shaders?)
		self.node.setBin('background', 0)
		
		# dont set depth attribute when rendering the sky (this can be done with shaders?)
		self.node.setAttrib(DepthWriteAttrib.make(DepthWriteAttrib.MOff))
		
		# We don't want shadows on the skybox
		self.node.setLightOff()
		
		# Render
		self.node.reparentTo(self.parent)
		taskMgr.add(self.moveSkyTask, "Move the sky box with the cam")
开发者ID:crempp,项目名称:psg,代码行数:55,代码来源:SkyBox.py

示例2: loadAndSetCubeTexture2

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import setSort [as 别名]
 def loadAndSetCubeTexture2( self, nodePath1, nodePath2, fileName, textureStageName, texCoordName, sort ):
     #load texture from file
     texture = loader.loadCubeMap(fileName)
     
     #set texture stage
     textureStage=TextureStage(textureStageName)
     textureStage.setTexcoordName(texCoordName)
     textureStage.setSort(sort)
     
     #set texture and texture stage
     nodePath1.setTexture(textureStage,texture)
     nodePath2.setTexture(textureStage,texture)    
开发者ID:alexisheloir,项目名称:embr-character-animation-engine,代码行数:14,代码来源:shaders.py

示例3: loadAndSetTexture

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import setSort [as 别名]
 def loadAndSetTexture(self,nodePath,fileName,textureStageName,texCoordName,sort):
     #load texture from file
     texture=loader.loadTexture(fileName)
     texture.setWrapU(Texture.WMClamp)
     texture.setWrapV(Texture.WMClamp)
     
     #set texture stage
     textureStage=TextureStage(textureStageName)
     textureStage.setTexcoordName(texCoordName)
     textureStage.setSort(sort)
     
     #set texture and texture stage
     nodePath.setTexture(textureStage,texture)
开发者ID:alexisheloir,项目名称:embr-character-animation-engine,代码行数:15,代码来源:shaders.py

示例4: makeFadeIn

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import setSort [as 别名]
 def makeFadeIn(self, nodePath):
     # make a fade in of the new objects
     # our alpha gradient texture
     transTex = loader.loadTexture("data/textures/transSlider.tif")
     transTex.setWrapU(Texture.WMClamp)
     # our texture stage.  By default it's set to modulate.
     # we give it a high sort value since it needs to be
     #   'above' the rest.
     ts = TextureStage("alpha")
     ts.setSort(1000)
     # apply the texture
     nodePath.setTexture(ts, transTex)
     nodePath.setTexScale(ts, Vec2(0))
     nodePath.setTransparency(1)
     self.fadingNodepaths[nodePath] = [time.time(), ts]
开发者ID:borgified,项目名称:Hockfire,代码行数:17,代码来源:plants.py

示例5: Texture

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import setSort [as 别名]
 def Texture(self):
   """Applies textures and if needed shaders to the terrain.
   Call this initially, and whenever you have changed the size of some important textures,
   or added/removed some textures or changed the lighting mode.
   This function is automatically called by Initialize()."""    
   if self.TextureMap == "": self.TextureMap = None
   if self.LightMap == "": self.LightMap = None
   
   # Does it have a detail map?
   if len(self.AlphaMaps) > 0:
     self._textureDetailed()
   elif self.TextureMap != None:
     self.Root.setTexture(self.TextureMap, 1)
     if self.LightMap != None:
       ts = TextureStage("LightMap")
       ts.setMode(TextureStage.MModulate)
       ts.setSort(2)
       self.Root.setTexture(ts, self.LightMap, 2)
   elif self.LightMap != None:
     self.Root.setTexture(ts, self.LightMap, 1)
开发者ID:KillerGoldFisch,项目名称:panda3d-editor,代码行数:22,代码来源:terrainShader.py

示例6: __init__

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import setSort [as 别名]
class ShipFactory:
    notify = DirectNotifyGlobal.directNotify.newCategory("ShipFactory")

    def __init__(self, phasedLoading=False):
        self.wantProws = config.GetBool("want-sprits", 0)
        self.hulls = {}
        self.texInfo = ({}, {}, {})
        self.models = {}
        self.mastSets = {}
        ShipBlueprints.setupWheel()
        ShipBlueprints.setupShipTextures()
        self.preprocessMast(ShipGlobals.Masts.Main_Tri)
        self.preprocessMast(ShipGlobals.Masts.Fore_Tri)
        self.preprocessHull(ShipGlobals.INTERCEPTORL1)
        self.preprocessMast(ShipGlobals.Masts.Skel_Main_A)
        self.preprocessMast(ShipGlobals.Masts.Skel_Main_B)
        self.preprocessMast(ShipGlobals.Masts.Skel_Tri)
        self.preprocessMast(ShipGlobals.Masts.Skel_Fore)
        self.preprocessMast(ShipGlobals.Masts.Skel_Aft)
        self.preprocessHull(ShipGlobals.SKEL_INTERCEPTORL3)
        self.preprocessHull(ShipGlobals.SKEL_WARSHIPL3)
        if not phasedLoading:
            self.handlePhase4()
            self.handlePhase5()

        self.baseLayer = TextureStage("base")
        self.colorLayer = TextureStage("color")
        self.logoLayer = TextureStage("logo")
        self.logoLayerNoColor = TextureStage("logoNoColor")
        self.vertLayer = TextureStage("vertex")
        self.colorLayer.setSort(1)
        self.colorLayer.setCombineRgb(TextureStage.CMReplace, TextureStage.CSTexture, TextureStage.COSrcColor)
        self.colorLayer.setCombineAlpha(TextureStage.CMReplace, TextureStage.CSTexture, TextureStage.COSrcAlpha)
        self.colorLayer.setTexcoordName("uvColor")
        self.logoLayer.setSort(2)
        self.logoLayer.setCombineRgb(
            TextureStage.CMInterpolate,
            TextureStage.CSTexture,
            TextureStage.COSrcColor,
            TextureStage.CSPrevious,
            TextureStage.COSrcColor,
            TextureStage.CSTexture,
            TextureStage.COSrcAlpha,
        )
        self.logoLayer.setCombineAlpha(TextureStage.CMReplace, TextureStage.CSPrevious, TextureStage.COSrcAlpha)
        self.logoLayer.setTexcoordName("uvLogo")
        self.logoLayerNoColor.setSort(2)
        self.logoLayerNoColor.setCombineRgb(
            TextureStage.CMInterpolate,
            TextureStage.CSTexture,
            TextureStage.COSrcColor,
            TextureStage.CSConstant,
            TextureStage.COSrcColor,
            TextureStage.CSTexture,
            TextureStage.COSrcAlpha,
        )
        self.logoLayerNoColor.setCombineAlpha(TextureStage.CMReplace, TextureStage.CSPrevious, TextureStage.COSrcAlpha)
        self.logoLayerNoColor.setTexcoordName("uvLogo")
        self.logoLayerNoColor.setColor((1, 1, 1, 1))
        self.vertLayer.setSort(3)
        self.vertLayer.setCombineRgb(
            TextureStage.CMModulate,
            TextureStage.CSPrevious,
            TextureStage.COSrcColor,
            TextureStage.CSPrimaryColor,
            TextureStage.COSrcColor,
        )
        self.vertLayer.setCombineAlpha(TextureStage.CMReplace, TextureStage.CSPrimaryColor, TextureStage.COSrcAlpha)
        self.baseLayer.setSort(4)
        self.baseLayer.setCombineRgb(
            TextureStage.CMModulate,
            TextureStage.CSTexture,
            TextureStage.COSrcColor,
            TextureStage.CSPrevious,
            TextureStage.COSrcColor,
        )
        self.baseLayer.setCombineAlpha(
            TextureStage.CMModulate,
            TextureStage.CSTexture,
            TextureStage.COSrcAlpha,
            TextureStage.CSPrevious,
            TextureStage.COSrcAlpha,
        )

    def handlePhase4(self):
        self.preprocessHull(ShipGlobals.INTERCEPTORL2)
        self.preprocessHull(ShipGlobals.INTERCEPTORL3)
        self.preprocessMast(ShipGlobals.Masts.Main_Square)
        self.preprocessMast(ShipGlobals.Masts.Aft_Tri)
        self.preprocessMast(ShipGlobals.Masts.Fore_Multi)
        self.preprocessHull(ShipGlobals.WARSHIPL1)
        self.preprocessHull(ShipGlobals.WARSHIPL2)
        self.preprocessHull(ShipGlobals.WARSHIPL3)
        self.preprocessHull(ShipGlobals.MERCHANTL1)
        self.preprocessHull(ShipGlobals.MERCHANTL2)
        self.preprocessHull(ShipGlobals.MERCHANTL3)
        self.preprocessHull(ShipGlobals.QUEEN_ANNES_REVENGE)
        self.sprits = ShipBlueprints.preprocessSprits()

    def handlePhase5(self):
#.........这里部分代码省略.........
开发者ID:PiratesOnline,项目名称:PiratesOfTheCarribeanOnline,代码行数:103,代码来源:ShipFactory.py

示例7: TextureStage

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import setSort [as 别名]
camera.lookAt(0.0, 0.0, 0.0)

root = render.attachNewNode("Root")

textureArrow = loader.loadTexture("arrow.png")
textureArrow.setWrapU(Texture.WMClamp)
textureArrow.setWrapV(Texture.WMClamp)

"""
DIRTY
Like in the previous example, increase the setSort parameter and see what
happens, the influence of the order depends on the applied shader. Sometimes you
can see a difference, sometimes not.
"""
stageArrow = TextureStage("Arrow")
stageArrow.setSort(1)

textureCircle = loader.loadTexture("circle.png")
textureCircle.setWrapU(Texture.WMClamp)
textureCircle.setWrapV(Texture.WMClamp)

stageCircle = TextureStage("Circle")
stageCircle.setSort(2)

modelCube = loader.loadModel("cube.egg")

cubes = []
for x in [-3.0, 0.0, 3.0]:
    cube = modelCube.copyTo(root)
    cube.setPos(x, 0.0, 0.0)
    cubes += [ cube ]
开发者ID:Otofuji,项目名称:ProjetoFinal,代码行数:33,代码来源:7.py

示例8: RepairLeak

# 需要导入模块: from pandac.PandaModules import TextureStage [as 别名]
# 或者: from pandac.PandaModules.TextureStage import setSort [as 别名]
class RepairLeak(DirectButton, FSM.FSM):

    def __init__(self, name, parent, leakscale, **kw):
        self.name = name
        pitchingGui = loader.loadModel('models/gui/pir_m_gui_srp_pitching_main')
        self.hole = pitchingGui.find('**/hole')
        if random.random() > 0.5:
            self.holeFilled = pitchingGui.find('**/pitch1')
        else:
            self.holeFilled = pitchingGui.find('**/pitch2')
        optiondefs = (('relief', None, None), ('geom', (self.hole, self.hole, self.hole, self.holeFilled), None), ('rolloverSound', None, None), ('clickSound', None, None))
        self.defineoptions(kw, optiondefs)
        DirectButton.__init__(self, parent = parent)
        self.initialiseoptions(RepairLeak)
        FSM.FSM.__init__(self, 'leak_%sFSM' % self.name)
        self.onCleanup = None
        self.leakScale = leakscale
        self.pitchingGame = parent
        self._initVars()
        self._initVisuals()
        self._initIntervals()
        self.fadeSequence = None
        self.request('Idle')


    def _initVars(self):
        self.timeActive = 0.0
        self.pulseScale = 0.59999999999999998


    def _initVisuals(self):
        textureCard = loader.loadModel('models/minigames/pir_m_gam_srp_water')
        self.waterStream = textureCard.find('**/waterPlane')
        tex = textureCard.findTexture('pir_t_gui_srp_waterDrops')
        textureCard2 = loader.loadModel('models/minigames/pir_m_gam_srp_water')
        self.waterStream2 = textureCard2.find('**/waterPlane')
        tex2 = textureCard2.findTexture('pir_t_gui_srp_waterDrops')
        alphaCard = loader.loadModel('models/minigames/pir_m_gui_srp_waterDropsAlpha')
        self.alphaWaterStream = textureCard.find('**/pir_t_gui_srp_waterDropsAlpha')
        alphatex = alphaCard.find('**/pir_t_gui_srp_waterDropsAlpha').findTexture('*')
        self.alphaWaterStream2 = textureCard.find('**/pir_t_gui_srp_waterDropsAlpha2')
        alphatex2 = alphaCard.find('**/pir_t_gui_srp_waterDropsAlpha2').findTexture('*')
        alphaCard2 = loader.loadModel('models/minigames/pir_m_gui_srp_waterDropsAlpha')
        self.alphaWaterStream3 = textureCard.find('**/pir_t_gui_srp_waterDropsAlpha')
        alphatex3 = alphaCard2.findTexture('*')
        self.alphaWaterStream4 = textureCard.find('**/pir_t_gui_srp_waterDropsAlpha2')
        alphatex4 = alphaCard2.findTexture('*')
        tex.setWrapU(Texture.WMRepeat)
        tex.setWrapV(Texture.WMRepeat)
        alphatex.setWrapU(Texture.WMRepeat)
        alphatex.setWrapV(Texture.WMRepeat)
        tex2.setWrapU(Texture.WMRepeat)
        tex2.setWrapV(Texture.WMRepeat)
        alphatex3.setWrapU(Texture.WMRepeat)
        alphatex3.setWrapV(Texture.WMRepeat)
        self.setScale(2.5 * self.leakScale)
        self.waterStream.setScale(self.leakScale)
        self.waterStream.setPos(self.getX(), 0.0, -0.5 * self.leakScale + self.getZ())
        self.waterStream2.setScale(self.leakScale * 0.80000000000000004, self.leakScale, self.leakScale * 1.2)
        self.waterStream2.setPos(self.getX(), 0.0, -0.59999999999999998 * self.leakScale + self.getZ())
        self.waterStream.setColor(0.69999999999999996, 0.84999999999999998, 1.0, 1.0)
        self.waterStream2.setColor(0.5, 0.59999999999999998, 0.90000000000000002, 1.0)
        self.waterStream2.reparentTo(self.pitchingGame)
        self.waterStream.reparentTo(self.pitchingGame)
        self.waterStream2.setBin('fixed', 42)
        self.waterStream.setBin('fixed', 40)
        self.textureYOffset = random.random()
        self.textureYDelta = 0.25 + 0.025000000000000001 / self.leakScale
        self.textureYOffset2 = random.random()
        self.textureYDelta2 = 0.25412353999999998 + 0.058754645634 / self.leakScale
        self.textureYOffsetAlpha = 0.0
        self.textureYDeltaAlpha = 0.25 + 0.025000000000000001 / self.leakScale
        self.textureYOffsetAlpha2 = 0.0
        self.textureYDeltaAlpha2 = 0.25412353999999998 + 0.058754645634 / self.leakScale
        self.textureStage = self.waterStream.findTextureStage('*')
        self.textureStage2 = self.waterStream2.findTextureStage('*')
        self.textureStage3 = TextureStage('alphaLayer')
        self.textureStage3.setMode(TextureStage.MModulate)
        self.textureStage3.setSort(1)
        self.waterStream.setTexture(self.textureStage3, alphatex)
        self.textureStage4 = TextureStage('alphaLayer2')
        self.textureStage4.setMode(TextureStage.MModulate)
        self.textureStage4.setSort(2)
        self.waterStream.setTexture(self.textureStage4, alphatex2)
        trans = TransformState.makePos((0, 0.47999999999999998, 0))
        self.waterStream.setTexTransform(self.textureStage4, trans)
        self.textureStage5 = TextureStage('alphaLayer3')
        self.textureStage5.setMode(TextureStage.MModulate)
        self.textureStage5.setSort(1)
        self.waterStream2.setTexture(self.textureStage5, alphatex3)
        self.textureStage6 = TextureStage('alphaLayer4')
        self.textureStage6.setMode(TextureStage.MModulate)
        self.textureStage6.setSort(2)
        self.waterStream2.setTexture(self.textureStage6, alphatex4)
        trans = TransformState.makePos((0, 0.47999999999999998, 0))
        self.waterStream2.setTexTransform(self.textureStage6, trans)


    def repositionTo(self, newX, newZ):
        self.setPos(newX, 0.0, newZ)
#.........这里部分代码省略.........
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:103,代码来源:RepairLeak.py


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