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


Python ParticleEffect.ParticleEffect类代码示例

本文整理汇总了Python中direct.particles.ParticleEffect.ParticleEffect的典型用法代码示例。如果您正苦于以下问题:Python ParticleEffect类的具体用法?Python ParticleEffect怎么用?Python ParticleEffect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Smoke

def Smoke(self,model):
    p1 = ParticleEffect()
    p1.cleanup()
    p1 = ParticleEffect()
    p1.loadConfig(Filename(MYDIRPART+'smoke.ptf'))        
    p1.start(model)
    p1.setPos(3.000, 0.000, 2.250)
开发者ID:UIKit0,项目名称:Dota2War,代码行数:7,代码来源:Global.py

示例2: createEffect

def createEffect(values):
    p = ParticleEffect()
    loadValues(values, p)
    color_gradient=loader.loadTexture(values["color_gradient"])
    size_gradient=loader.loadTexture(values["size_gradient"])
    shape_gradient=loader.loadTexture(values["shape_gradient"])    
    blend_gradient=loader.loadTexture("data/blend.png", minfilter=Texture.FTNearest, magfilter=Texture.FTNearest)
    color_gradient.setWrapU(Texture.WMClamp)
    color_gradient.setWrapV(Texture.WMClamp)
    size_gradient.setWrapU(Texture.WMClamp)
    size_gradient.setWrapV(Texture.WMClamp)
    shape_gradient.setWrapU(Texture.WMClamp)
    shape_gradient.setWrapV(Texture.WMClamp)
    blend_gradient.setWrapU(Texture.WMClamp)
    blend_gradient.setWrapV(Texture.WMClamp)
    for geom in p.findAllMatches('**/+GeomNode'):       
        geom.setDepthWrite(False)
        geom.setBin("transparent", 31)
        #need to hide it from the water and shadow camera now... I don't know hot to get the geom later :(
        geom.hide(BitMask32.bit(1))
        geom.hide(BitMask32.bit(2))
        geom.setShader(Shader.load(Shader.SLGLSL, "shaders/vfx_v.glsl","shaders/vfx_f.glsl"), 1)
        geom.setShaderInput('distortion',0.9)
        #geom.setShaderInput("fog",  Vec4(0.4, 0.4, 0.4, 0.002))
        geom.setShaderInput("color_gradient", color_gradient)
        geom.setShaderInput("size_gradient",  size_gradient)
        geom.setShaderInput("shape_gradient", shape_gradient)
        geom.setShaderInput("blend_gradient", blend_gradient)
    #p.start(parent=self.root, renderParent = render) 
    return p  
开发者ID:FelixBucket,项目名称:koparka,代码行数:30,代码来源:vfx_loader.py

示例3: Water

def Water(self,model):
    p1 = ParticleEffect()
    p1.cleanup()
    p1 = ParticleEffect()
    p1.loadConfig(Filename(MYDIRPART+'fountain.ptf'))        
    p1.start(model)
    p1.setPos(3.000, 0.000, 2.250)
开发者ID:UIKit0,项目名称:Dota2War,代码行数:7,代码来源:Global.py

示例4: SmokeRing

def SmokeRing(self,model):
    p1 = ParticleEffect()
    p1.cleanup()
    p1 = ParticleEffect()
    p1.loadConfig(Filename(MYDIRPART+'smokering.ptf'))        
    p1.start(model)
    p1.setPos(0, 0.000, 0)
开发者ID:UIKit0,项目名称:Dota2War,代码行数:7,代码来源:Global.py

示例5: Flame

def Flame(self,model):
    p1 = ParticleEffect()
    p1.cleanup()
    p1 = ParticleEffect()
    p1.loadConfig(Filename('ee.ptf'))#'fireish.ptf'))        
    p1.start(model)
    p1.setPos(3.000, 0.000, 2.250)
    setupLights(self,model)
开发者ID:UIKit0,项目名称:Dota2War,代码行数:8,代码来源:Global.py

示例6: init_player

def init_player(self, left_btn, right_btn, player_number ,pos=(0,0,0), heading=0):
    color = (configs.COLORS_MAP[player_number][0])

    nodePath = loadObject()
    nodePath.setPos(pos)
    nodePath.setScale(configs.SCALE*0.004)
    nodePath.setColor(color)

    p = ParticleEffect()
    p.loadConfig('textures/flare.ptf')
    p.start(parent = nodePath, renderParent = render)
    p0 = p.getParticlesList()[0]
    p0.emitter.setRadiateOrigin(Point3(0.05*cos(heading* pi/180), 0.0, 0.05*sin(heading* pi/180)))
    p.setPos(0,-1,0)
    # p.setBin("unsorted", 0)
    # p.setDepthTest(False)
    p.setTwoSided(True)

    text= TextNode('text') 
    text.setText(str("%s" % player_number))
    text.setTextColor(color)
    text.setAlign(TextNode.ACenter)
    # text.font = self.font
    text3d = NodePath(text) 
    text3d.setTwoSided(True)
    text3d.setPos(nodePath, -1,-3,-4)
    text3d.reparentTo(render)
    circle = loadObject(tex='circle.png')
    circle.reparentTo(render)
    circle.setPos(nodePath, 0,-2,0)
    text3d.setScale(0.13)
    circle.setScale(0.09)
    text3d.setColorScale(color)
    circle.setColorScale(color)


    new_line, line_vertex, line_node = start_new_line(self, pos[0], pos[2], color)
    line_id = configs.ENTITY_ID
    configs.ENTITIES[configs.ENTITY_ID] = {'CATEGORY':'line', 'GEOM':new_line, 'VERTEX':line_vertex, "NODE": line_node}
    configs.ENTITY_ID += 1
    speed = configs.FORWARD_SPEED
    right_angle = configs.FORCE_RIGHT_ANGLE_TURN
    # print left_btn
    # print right_btn
    self.accept(("%s" % left_btn),     player_controls, [configs.ENTITY_ID, 'TURN_LEFT', 1])
    self.accept(("%s-up" % left_btn),  player_controls, [configs.ENTITY_ID, 'TURN_LEFT', 0])
    self.accept(("%s" % right_btn),     player_controls, [configs.ENTITY_ID, 'TURN_RIGHT', 1])
    self.accept(("%s-up" % right_btn),  player_controls, [configs.ENTITY_ID, 'TURN_RIGHT', 0])

    configs.ENTITIES[configs.ENTITY_ID] = {'CATEGORY':'player','ALIVE':True, 'NODE':nodePath,'PARTICLE_PARENT':p, 'PARTICLE':p0, 
        'HEADING':heading, 'CURRENT_LINE':line_id, 'TICKNESS':configs.SCALE, 'TURN_LEFT':0, 'TURN_RIGHT':0, 'COLOR':color, 
        'PLAYER_ID':text3d, 'CIRCLE_NODE':circle, 'LEFT_ARMED':True, 'RIGHT_ARMED':True, 'PLAYER_NUMBER': player_number, 'SPEED':speed,
        'RIGHT_ANGLE_TURN':right_angle }
    configs.ENTITY_ID += 1
开发者ID:martinrioux,项目名称:Zatacka-Panda3D,代码行数:54,代码来源:players.py

示例7: ParticleDemo

class ParticleDemo(ShowBase):

    def __init__(self):
        ShowBase.__init__(self)

        # Standard title and instruction text
        self.title = OnscreenText(
            text="Panda3D: Tutorial - Particles",
            parent=base.a2dBottomCenter,
            style=1, fg=(1, 1, 1, 1), pos=(0, 0.1), scale=.08)
        self.escapeEvent = OnscreenText(
            text=HELP_TEXT, parent=base.a2dTopLeft,
            style=1, fg=(1, 1, 1, 1), pos=(0.06, -0.06),
            align=TextNode.ALeft, scale=.05)

        # More standard initialization
        self.accept('escape', sys.exit)
        self.accept('1', self.loadParticleConfig, ['steam.ptf'])
        self.accept('2', self.loadParticleConfig, ['dust.ptf'])
        self.accept('3', self.loadParticleConfig, ['fountain.ptf'])
        self.accept('4', self.loadParticleConfig, ['smoke.ptf'])
        self.accept('5', self.loadParticleConfig, ['smokering.ptf'])
        self.accept('6', self.loadParticleConfig, ['fireish.ptf'])

        self.accept('escape', sys.exit)
        base.disableMouse()
        base.camera.setPos(0, -20, 2)
        base.camLens.setFov(25)
        base.setBackgroundColor(0, 0, 0)

        # This command is required for Panda to render particles
        base.enableParticles()
        self.t = loader.loadModel("teapot")
        self.t.setPos(0, 10, 0)
        self.t.reparentTo(render)
        self.setupLights()
        self.p = ParticleEffect()
        self.loadParticleConfig('steam.ptf')

    def loadParticleConfig(self, filename):
        # Start of the code from steam.ptf
        self.p.cleanup()
        self.p = ParticleEffect()
        self.p.loadConfig(Filename(filename))
        # Sets particles to birth relative to the teapot, but to render at
        # toplevel
        self.p.start(self.t)
        self.p.setPos(3.000, 0.000, 2.250)

    # Setup lighting
    def setupLights(self):
        ambientLight = AmbientLight("ambientLight")
        ambientLight.setColor((.4, .4, .35, 1))
        directionalLight = DirectionalLight("directionalLight")
        directionalLight.setDirection(LVector3(0, 8, -2.5))
        directionalLight.setColor((0.9, 0.8, 0.9, 1))
        # Set lighting on teapot so steam doesn't get affected
        self.t.setLight(self.t.attachNewNode(directionalLight))
        self.t.setLight(self.t.attachNewNode(ambientLight))
开发者ID:AdrianF98,项目名称:Toontown-2-Revised,代码行数:59,代码来源:steam_example.py

示例8: __init__

    def __init__(self, pos, world):
        self.id = next(Dorf.idgen)
        self.world = world
        self.node = loader.loadModel('media/models/dorfPH.egg')
        self.text = core.TextNode('dorf')
        self.text.setText('Dorf {}'.format(self.id))
        self.text.setAlign(core.TextNode.ACenter)
        self.text.setTextColor(1, 1, 0.5, 1)
        self.text.setShadow(0.1, 0.1)
        self.text.setShadowColor(0, 0, 0, 0.8)
        self.textnode = self.node.attachNewNode(self.text)
        self.textnode.setBillboardPointEye()
        self.textnode.setPos(0, 0, 1.1)
        self.textnode.setScale(0.4)
        self.textnode.setDepthWrite(False)
        self.textnode.setDepthTest(False)
        self.textnode.setShaderOff()
        self.x = int(pos.x)
        self.y = int(pos.y)
        self.z = 0
        self.next = None
        self.dir = (1, 0)

        taskMgr.doMethodLater(0.5, self.move, 'Move dorf')

        self.set_z(int(pos.z))
        self.node.setPos(pos.x, pos.y, 0)

        self.particles = ParticleEffect()
        self.particles.loadConfig('media/sparks.ptf')
        self.particles.reparentTo(self.node)
开发者ID:anossov,项目名称:dorfdelf,代码行数:31,代码来源:dorf.py

示例9: useThunder

 def useThunder(self):
     self.onThunder = True
     self.pokeCandyCount -= 1
     self.thunder = ParticleEffect()
     self.thunder.loadConfig("thunder.ptf")
     self.thunder.start(parent=render, renderParent=render)
     self.use.play()
开发者ID:pavelkang,项目名称:Term_Project,代码行数:7,代码来源:ball.py

示例10: addParticle

 def addParticle(self, pipe):
     #Particle Effect: VERY SLOW
     self.particle = ParticleEffect()
     self.particle.loadConfig("../models/steam.ptf")
     self.particle.start(pipe)
     self.particle.setPos(100.00, 0.000, 0)
     self.particle.setScale(100.00, 80.00, 80.00)
开发者ID:kridily,项目名称:fall_and_fix,代码行数:7,代码来源:PipeGeneric.py

示例11: load_config

 def load_config(self, file_name):
     self.p.cleanup()
     self.p = ParticleEffect()
     self.p.loadConfig(file_name)
     self.p.start(render)
     self.p.setPos(self.x, self.y, self.z)
     self.p.reparentTo(self.parent)
开发者ID:daFthawk,项目名称:group-3,代码行数:7,代码来源:smoke_emitter.py

示例12: __init__

    def __init__(self):
        #Standard title and instruction text
        self.title = OnscreenText(
            text="Panda3D: Tutorial - Particles",
            style=1, fg=(1,1,1,1), pos=(0.8,-0.95), scale = .07)
        self.escapeEvent = OnscreenText(
            text=HELPTEXT,
            style=1, fg=(1,1,1,1), pos=(-1.3, 0.95),
            align=TextNode.ALeft, scale = .05)

        #More standard initialization
        self.accept('escape', sys.exit)
        self.accept('1', self.loadParticleConfig , ['steam.ptf'])
        self.accept('2', self.loadParticleConfig , ['dust.ptf'])
        self.accept('3', self.loadParticleConfig , ['fountain.ptf'])
        self.accept('4', self.loadParticleConfig , ['smoke.ptf'])
        self.accept('5', self.loadParticleConfig , ['smokering.ptf'])
        self.accept('6', self.loadParticleConfig , ['fireish.ptf'])
        
        self.accept('escape', sys.exit)
        base.disableMouse()
        camera.setPos(0,-20,2)
        base.setBackgroundColor( 0, 0, 0 )

        #This command is required for Panda to render particles
        base.enableParticles()
        self.t = loader.loadModel("models/teapot")
        self.t.setPos(0,10,0)
        self.t.reparentTo(render)
        self.setupLights()
        self.p = ParticleEffect()
        self.loadParticleConfig('steam.ptf')
开发者ID:FelixBucket,项目名称:ToontownFritzServer,代码行数:32,代码来源:Tut-Steam-Example.py

示例13: __init__

	def __init__(self):
		#sys.path.append('../game')
		#Standard title and instruction text
		self.title = OnscreenText(
			text="PSG: Test - Explosion",
			style=1, fg=(1,1,1,1), pos=(0.9,-0.95), scale = .07)
		self.escapeEvent = OnscreenText(
			text=HELPTEXT,
			style=1, fg=(1,1,1,1), pos=(-1.3, 0.95),
			align=TextNode.ALeft, scale = .05)

		#More standard initialization
		self.accept('escape', sys.exit)
		self.accept('1', self.loadParticleConfig , ['explosion1.ptf'])
		self.accept('2', self.loadParticleConfig , ['explosion2.ptf'])
		self.accept('3', self.loadParticleConfig , ['explosion3.ptf'])
		self.accept('4', self.loadParticleConfig , ['explosion4.ptf'])
		self.accept('5', self.loadParticleConfig , ['explosion5.ptf'])
		self.accept('6', self.loadParticleConfig , ['explosion6.ptf'])
		
		self.accept('escape', sys.exit)
		base.disableMouse()
		camera.setPos(0,-20,2)
		base.setBackgroundColor( 0, 0, 0 )

		#This command is required for Panda to render particles
		base.enableParticles()
		self.t = loader.loadModel("../data/models/ship_03.egg")
		self.t.setScale(0.5)
		self.t.setHpr(180, 0, 0)
		self.t.setPos(0,10,0)
		self.t.reparentTo(render)
		self.setupLights()
		self.p = ParticleEffect()
		self.loadParticleConfig('explosion1.ptf')
开发者ID:crempp,项目名称:psg,代码行数:35,代码来源:particleExplosion.py

示例14: __init__

    def __init__(self, main, username, pos = LVecBase3(-5, -5, 1), isCurrentPlayer = False, carId=3):
        self.username = username
        self.main = main
        self.isCurrentPlayer = isCurrentPlayer
        self.boostCount = 0
        self.boostActive = False
        self.boostStep = 2
        self.boostDuration = 0
        self.moveStartTime = self.startTime = self.boostStartTime = time.time()
        self.pos = pos
        self.boostFactor = 1.2
        self.specs = {"mass": 800.0,
                    "maxWheelForce": 2000.0,
                    "brakeForce": 100.0,
                    "steeringLock": 45.0,
                    "maxSpeed": 33.0,
                    "maxReverseSpeed": 10.0}
        self.vehicleControlState = {"throttle": 0, "reverse": False, "brake": 0.0, "steering": 0.0, "health": 1}

        # Steering change per second, normalised to steering lock
        # Eg. 45 degrees lock and 1.0 rate means 45 degrees per second
        self.steeringRate = 0.8
        self.centreingRate = 1.2
        self.speed = 0

        self.setupVehicle(main)

        self.props = VehicleProps(carId)

        self.currentPowerups = {"powerup1": None, "powerup2": None, "powerup3": None}
        if isCurrentPlayer:
            #This command is required for Panda to render particles
            base.enableParticles()
            self.p = ParticleEffect()
开发者ID:genusgant,项目名称:CS594-ThrottleThunder-GameClient,代码行数:34,代码来源:Vehicle.py

示例15: drain

 def drain(self, task):
     if self.draining and task.time - self.drainTime > DRAIN_DELAY:
         carpos = self.staticCars[self.target].getPos()
         playerpos = self.player.getPos()
         dist = math.sqrt( (carpos[0] - playerpos[0])**2 + (carpos[1] - playerpos[1])**2 + (carpos[2] - playerpos[2])**2 )
         if self.gasList[self.target] > 0 and dist < DRAIN_DIST:
             if not self.gasPlaying:
                 self.gasP.reset()
                 self.gasP = ParticleEffect()  
                 self.gasP.loadConfig(Filename('oil.ptf'))        
                 self.gasP.start(self.player)
                 self.gasNode.lookAt(self.staticCars[self.target])
                 self.gasP.setPos(0,0,2)
                 self.gasP.setScale(1.5)
                 self.gasP.setLightOff()
                 self.gasPlaying = True
                 self.alan_var = False
             self.gasNode.lookAt(self.staticCars[self.target])
             self.gasP.setHpr(self.gasNode.getH() + 180, 90, 0)
             self.player.totalGas = self.player.totalGas + 1
             self.gasList[self.target] = self.gasList[self.target] - 1
         else:
             self.alan_var = True
         # print "TotalGas: " + str(self.player.totalGas)
         self.drainTime = task.time
     elif not self.draining or self.alan_var:
         self.gasP.softStop()
         self.drainSound.stop()
         self.gasPlaying = False
     return Task.cont
开发者ID:Splime,项目名称:ProjectThree,代码行数:30,代码来源:world.py


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