本文整理汇总了Python中direct.particles.ParticleEffect.ParticleEffect.loadConfig方法的典型用法代码示例。如果您正苦于以下问题:Python ParticleEffect.loadConfig方法的具体用法?Python ParticleEffect.loadConfig怎么用?Python ParticleEffect.loadConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.particles.ParticleEffect.ParticleEffect
的用法示例。
在下文中一共展示了ParticleEffect.loadConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SmokeRing
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import loadConfig [as 别名]
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)
示例2: Water
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import loadConfig [as 别名]
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)
示例3: BlockDestroyedEffect
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import loadConfig [as 别名]
class BlockDestroyedEffect(object):
__base = None
__pos = None
def __init__(self, base, pos):
self.__base = base
self.__pos = pos
self.particleEffect()
def particleEffect(self):
self.p = ParticleEffect()
self.loadParticleConfig('particleEffect.ptf')
self.__base.taskMgr.doMethodLater(0.5, self.stopParticles, "stop")
self.__base.taskMgr.doMethodLater(2.0, self.cleanUpParticles, "cleanup")
def cleanUpParticles(self, task):
self.p.cleanup()
def stopParticles(self, task):
self.p.softStop()
def loadParticleConfig(self, file):
self.p.cleanup()
self.p = ParticleEffect()
self.p.loadConfig(Filename(file))
self.p.setPos(self.__pos.x, self.__pos.y, 2)
self.p.start(parent = self.__base.render, renderParent = self.__base.render)
示例4: Smoke
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import loadConfig [as 别名]
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)
示例5: ParticleDemo
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import loadConfig [as 别名]
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))
示例6: addEffects
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import loadConfig [as 别名]
def addEffects(self):
if self.mp.has_key('effects'):
base.enableParticles()
for effect in self.mp['effects']:
p = ParticleEffect()
p.loadConfig(GAME+'/particles/'+effect['file']+'.ptf')
p.start(render)
p.setPos(self.logic2terrain( effect['position'] ))
示例7: Flame
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import loadConfig [as 别名]
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)
示例8: initTorchParticles
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import loadConfig [as 别名]
def initTorchParticles(self):
torchTops = self.level.findAllMatches("**/TorchTop*")
fxList = ['TorchSmoke.ptf', 'TorchFire.ptf']
for torch in torchTops:
for fx in fxList:
p = ParticleEffect()
p.loadConfig(Filename(fx))
p.setPos(torch.getPos(render))
p.start(self.level)
示例9: load_particles
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import loadConfig [as 别名]
def load_particles (self, name):
p = ParticleEffect ()
p.loadConfig (Filename (name))
p.setLightOff ()
p.setTransparency (TransparencyAttrib.MAlpha)
p.setBin ('fixed', 0)
p.setDepthWrite (False)
p.setShaderOff ()
return p
示例10: init_player
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import loadConfig [as 别名]
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
示例11: shootParticles
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import loadConfig [as 别名]
def shootParticles(self,collision_result):
"Summons and explosion of particles where the player shot."
# Create Particle
p = ParticleEffect()
p.loadConfig("../../models/particle_shot.ptf")
# Put particle at shot point
p.setPos(collision_result.getHitPos())
p.start(parent = self.mainRef.render, renderParent = self.mainRef.render)
# Schedule particle effect cleanup
particle_timeout = 0.2 # Time in seconds for the particle effect to fade
taskMgr.doMethodLater(particle_timeout, self.releaseParticle, 'Particle Effect Cleanup', extraArgs = [p])
示例12: __createToonInterval
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import loadConfig [as 别名]
def __createToonInterval(self, delay):
track = Sequence(Wait(delay))
sprayEffect = ParticleEffect()
sprayEffect.loadConfig('phase_5/etc/soundWave.ptf')
sprayEffect.setDepthWrite(0)
sprayEffect.setDepthTest(0)
sprayEffect.setTwoSided(1)
I1 = 2.8
track.append(ActorInterval(self.avatar, 'sound', playRate=1.0, startTime=0.0, endTime=I1))
track.append(Func(self.setPosFromOther, sprayEffect, self.gag, Point3(0, 1.6, -0.18)))
track.append(self.__getPartTrack(sprayEffect, 0.0, 6.0, [sprayEffect, self.avatar, 0], softStop=-3.5))
track.append(ActorInterval(self.avatar, 'sound', playRate=1.0, startTime=I1))
return track
示例13: __init__
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import loadConfig [as 别名]
class FlameTest:
def __init__(self):
self.setupLights()
self.loadItem()
self.loadParticles()
def loadItem(self):
self.itemNode = loader.loadModel('../Models/torch')
self.itemNode.setColor(Vec4(1,1,1,1))
self.itemNode.setScale(2)
self.itemNode.reparentTo(render)
self.itemNode.setPos(0,0,0)
def loadParticles(self):
base.enableParticles()
self.rFlame = ParticleEffect()
self.rFlame.loadConfig("../Models/fire.ptf")
self.rFlame.start(self.itemNode)
pos = self.itemNode.getPos()
self.rFlame.setPos(pos[0], pos[1], pos[2] + 4)
lightNode = NodePath('flame')
lightNode.reparentTo(self.rFlame)
lightNode.setZ(lightNode.getZ() + 0.5)
flame = PointLight('flame-light')
flameNP = lightNode.attachNewNode(flame)
flameNP.node().setColor(Vec4(0.9, 0.7, 0.5, 1.0))
# flameNP.node().setAttenuation(Vec3(0, 0.001, 0.000009))
flameNP.setZ(flameNP.getZ() + 0.6)
render.setLight(flameNP)
def setupLights(self):
# set up an ambient light
self.ambientLight = AmbientLight("ambientLight")
#for setting colors, alpha is largely irrelevant
# slightly blue to try and produce a wintry, snowy look
self.ambientLight.setColor((0.1, 0.1, 0.1, 1.0))
#create a NodePath, and attach it directly into the scene
self.ambientLightNP = render.attachNewNode(self.ambientLight)
#the node that calls setLight is what's illuminated by the given light
#you can use clearLight() to turn it off
render.setLight(self.ambientLightNP)
示例14: smoke_emitter
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import loadConfig [as 别名]
class smoke_emitter():
def __init__(self, parent, _x, _y, _z):
self.x = _x
self.y = _y
self.z = _z
self.parent = parent
self.p = ParticleEffect()
self.load_config('steam.ptf')
self.p.setScale(200)
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)
示例15: Swarm
# 需要导入模块: from direct.particles.ParticleEffect import ParticleEffect [as 别名]
# 或者: from direct.particles.ParticleEffect.ParticleEffect import loadConfig [as 别名]
class Swarm(Unit):
'''
Subclass of Units, Tier 1 Swarm
'''
def __init__(self, host_planet, player):
'''
Constructor
@param host_planet : The planet where the unit is constructed
'''
base.enableParticles()
super(Swarm, self).__init__(host_planet, player, SWARM_VELOCITY, SWARM_MAX_ENERGY, SWARM_DAMAGE, [])
self.quad_path.setScale(2)
# self.quad_path.removeNode()
self._loadSounds("swarm")
self.model_path.setColor(Vec4(1,1,1,0.1))
self.model_path.setLightOff()
self.p = ParticleEffect()
self.p.loadConfig('models/units/swarm/swarm.ptf')
self.p.start(self.model_path)