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


Python core.DirectionalLight类代码示例

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


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

示例1: __init__

    def __init__(self, base, USE_RP):
        self.base = base
        """ direct.showbase.ShowBase """

        if not USE_RP:
            alight = AmbientLight('alight')
            alnp = self.base.render.attachNewNode(alight)
            alight.setColor((0.2, 0.2, 0.2, 1))
            self.base.render.setLight(alnp)

            # Put lighting on the main scene

            dlight = DirectionalLight('dlight')
            dlnp = self.base.render.attachNewNode(dlight)
            dlnp.setPos(0, 5, 5)
            dlight.setColor((0.8, 0.8, 0.5, 1))
            dlnp.setHpr(0, 60, 0)
            self.base.render.setLight(dlnp)

            plight = PointLight('plight')
            plnp = self.base.render.attachNewNode(plight)
            plnp.setPos(0, -50, 50)
            plnp.setHpr(0, 60, 0)
            self.base.render.setLight(plnp)

        self.sounds = {}
开发者ID:eswartz,项目名称:panda3d-stuff,代码行数:26,代码来源:world.py

示例2: __init__

 def __init__(self, base, name, speed, scale, color, mask, relA, xyz, relB, lookat, life):
     an = ActorNode()
     self.anp = base.render.attachNewNode(an)
     base.physicsMgr.attachPhysicalNode(an)
     self.anpo = an.getPhysicsObject()
     fn = ForceNode("force-missile")
     self.anp.attachNewNode(fn)
     bft = LinearVectorForce(Vec3(0, 1, 0)*speed)
     fn.addForce(bft)
     an.getPhysical(0).addLinearForce(bft)
     missile = base.loader.loadModel("./mdl/missile.egg")
     missile.setColor(color)
     missile.setScale(scale)
     missile.reparentTo(self.anp)
     missile.setTag(name, '1')
     missile_from_obj = missile.attachNewNode(CollisionNode(name))
     missile_from_obj.node().addSolid(CollisionSphere(0, 0, 0, 1))
     missile_from_obj.node().setFromCollideMask(mask)
     missile_from_obj.setCollideMask(mask)
     base.pusher.addCollider(missile_from_obj, self.anp)
     base.cTrav.addCollider(missile_from_obj, base.pusher)
     self.anp.setPos(relA, xyz)
     self.anp.lookAt(relB, lookat)
     # light the missile
     mlight = DirectionalLight('mlight')
     mlight.setColor(VBase4(1., 1., 1., 1))
     mlnp = base.render.attachNewNode(mlight)
     mlnp.setHpr(self.anp.getHpr())
     self.anp.setLightOff()
     self.anp.setLight(mlnp)
     # remove the missile
     base.taskMgr.doMethodLater(life, self.remove_missile, 'task-remove-missile', extraArgs=[self.anp], appendTask=True)
开发者ID:freevryheid,项目名称:spanda3D,代码行数:32,代码来源:missile.py

示例3: loadPrisonCrater

def loadPrisonCrater():
    ## Sky color
    base.win.setClearColor(Vec4(.46,.824,.904,1))

    ## Load Ground
    sand = loader.loadModel("data/models/sand.bam")
    sand.reparentTo(render)
    sand.setTexScale(TextureStage.getDefault(),5000,5000)

    craterwalls = loader.loadModel("data/models/craterwalls.bam")
    craterwalls.reparentTo(render)
    craterwalls.setTexScale(TextureStage.getDefault(),500,50)

    ## World Effects
    fog = Fog("Fog")
    fog.setColor(255,215,143)
    fog.setExpDensity(.0000001)
    render.setFog(fog)

    alight = render.attachNewNode(AmbientLight("Abient"))
    alight.node().setColor(Vec4(.9,.9,.9,1))
    render.setLight(alight)

    sun = DirectionalLight('Sun')
    sun.setColor(Vec4(1,1,1,1))
    sunNP = render.attachNewNode(sun)
    sunNP.setPos(0,0,4000)
    sunNP.setHpr(0,-90,0)
    render.setLight(sunNP)
开发者ID:DDH-Harding,项目名称:maleficium,代码行数:29,代码来源:world.py

示例4: __init__

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

        ambLight = AmbientLight("ambient")
        ambLight.setColor(Vec4(0.1,0.11,0.12,1.0))
        ambNode = render.attachNewNode(ambLight)
        render.setLight(ambNode)

        dirLight = DirectionalLight("directional")
        dirLight.setColor(Vec4(0.7,0.7,0.68,1.0))
        dirNode = render.attachNewNode(dirLight)
        dirNode.setHpr(60,-40,90)
        render.setLight(dirNode)

        sptLight = Spotlight("spot")
        sptLens = PerspectiveLens()
        sptLight.setLens(sptLens)
        sptLight.setColor(Vec4(0.6,0.6,0.6,1.0))
        sptLight.setShadowCaster(True)
        sptNode = render.attachNewNode(sptLight)
        sptNode.setPos(0,0,20)
        sptNode.lookAt(0,0,0)
        render.setLight(sptNode)

        render.setShaderAuto()

        base.camLens.setFov(70)
        base.camLens.setNear(0.1)
        base.camLens.setFar(50)

        self.cam.setPos(-1,-4,4)
        self.cam.lookAt(0,-1,1)
开发者ID:scottjrodgers,项目名称:RobotLab,代码行数:32,代码来源:base_app.py

示例5: __init__

  def __init__(self):
    base.setBackgroundColor(0.1, 0.1, 0.8, 1)
    base.setFrameRateMeter(True)

    base.cam.setPos(0, -60, 20)
    base.cam.lookAt(0, 0, 0)

    # Light
    alight = AmbientLight('ambientLight')
    alight.setColor(Vec4(0.5, 0.5, 0.5, 1))
    alightNP = render.attachNewNode(alight)

    dlight = DirectionalLight('directionalLight')
    dlight.setDirection(Vec3(1, 1, -1))
    dlight.setColor(Vec4(0.7, 0.7, 0.7, 1))
    dlightNP = render.attachNewNode(dlight)

    render.clearLight()
    render.setLight(alightNP)
    render.setLight(dlightNP)

    # Input
    self.accept('escape', self.doExit)
    self.accept('r', self.doReset)
    self.accept('f1', self.toggleWireframe)
    self.accept('f2', self.toggleTexture)
    self.accept('f3', self.toggleDebug)
    self.accept('f5', self.doScreenshot)

    # Task
    taskMgr.add(self.update, 'updateWorld')

    # Physics
    self.setup()
开发者ID:Changuito,项目名称:juan_example,代码行数:34,代码来源:23_SoftbodyPressure.py

示例6: __init__

	def __init__(self):
		# call superclass init (no implicit chaining)
		ShowBase.__init__(self)

		self.pnode = loader.loadModel("models/queen")
		self.pnode.reparentTo(render)
		self.pnode.setPos(0, 5, -1)
		self.pnode.setH(-60)

		self.pnode2 = loader.loadModel("models/pawn")
		self.pnode2.reparentTo(self.pnode)
		self.pnode2.setScale(0.5)
		self.ground = 1.2
		self.pnode2.setPos(1, 0, self.ground)
		self.vz = 0
		self.vx = 0
		self.vy = 0

		############ lighting #############
	 	alight = AmbientLight('alight')
	 	alight.setColor((.7, .3, .3, 1))

	 	self.alnp = render.attachNewNode(alight)
	 	render.setLight(self.alnp)

	 	slight = DirectionalLight('slight')
	 	slight.setColor((1, .5, .5, 1))
	 	slight.setDirection(LVector3(-0.8, 0, 0))

	 	self.slnp = render.attachNewNode(slight)
	 	render.setLight(self.slnp)

		taskMgr.add(self.update, "update")
开发者ID:julymartiinez,项目名称:3DemoM2,代码行数:33,代码来源:Elifaleth.py

示例7: __setDirectionalLight

	def __setDirectionalLight(self,props):
		light = DirectionalLight(props['name'])
		light.setShadowCaster(props['castShadows'],1024,1024)
		lens = PerspectiveLens()
		light.setLens(lens)
		lens.setFov(1200/props['pos'].z)		
		return self.__createLight(light,props)
开发者ID:fredukita,项目名称:Pandark-Project,代码行数:7,代码来源:lightsmanager.py

示例8: setupLight

 def setupLight(self):
   ambientLight = AmbientLight("ambientLight")
   ambientLight.setColor((.8, .8, .8, 1))
   directionalLight = DirectionalLight("directionalLight")
   directionalLight.setDirection(LVector3(0, 45, -45))
   directionalLight.setColor((0.2, 0.2, 0.2, 1))
   render.setLight(render.attachNewNode(directionalLight))
   render.setLight(render.attachNewNode(ambientLight))
开发者ID:r3t,项目名称:master-term1-gamedev,代码行数:8,代码来源:main.py

示例9: setupLights

 def setupLights(self):  #This function sets up some default lighting
     ambientLight = AmbientLight("ambientLight")
     ambientLight.setColor(Vec4(.8, .8, .8, 1))
     directionalLight = DirectionalLight("directionalLight")
     directionalLight.setDirection(Vec3(0, 45, -45))
     directionalLight.setColor(Vec4(0.2, 0.2, 0.2, 1))
     render.setLight(render.attachNewNode(directionalLight))
     render.setLight(render.attachNewNode(ambientLight))
开发者ID:agoose77,项目名称:hivesystem,代码行数:8,代码来源:TutChessboard.py

示例10: setupLights

 def setupLights(self):
     ambientLight = AmbientLight("ambientLight")
     ambientLight.setColor((.8, .8, .75, 1))
     directionalLight = DirectionalLight("directionalLight")
     directionalLight.setDirection(LVector3(0, 0, -2.5))
     directionalLight.setColor((0.9, 0.8, 0.9, 1))
     render.setLight(render.attachNewNode(ambientLight))
     render.setLight(render.attachNewNode(directionalLight))
开发者ID:AdrianF98,项目名称:Toontown-2-Revised,代码行数:8,代码来源:main.py

示例11: loadSimpleLighting

 def loadSimpleLighting(self):
     ambientLight = AmbientLight( "ambientLight" )
     ambientLight.setColor( Vec4(.8, .8, .8, 1) )
     directionalLight = DirectionalLight( "directionalLight" )
     directionalLight.setDirection( Vec3( 0, 45, -45 ) )
     directionalLight.setColor( Vec4( 0.2, 0.2, 0.2, 0.6 ) )
     render.setLight(render.attachNewNode( directionalLight ) )
     render.setLight(render.attachNewNode( ambientLight ) )
开发者ID:genusgant,项目名称:Panda3d-TowerDefense_Game,代码行数:8,代码来源:gameEngine.py

示例12: add_celestial

 def add_celestial(self, azimuth, elevation, color, intensity, radius):
     location = Vec3(to_cartesian(azimuth, elevation, 1000.0 * 255.0 / 256.0))
     if intensity:
         dlight = DirectionalLight('celestial')
         dlight.set_color((color[0] * intensity, color[1] * intensity, color[2] * intensity, 1.0))
         node = self.node.attach_new_node(dlight)
         node.look_at(*(location * -1))
         self.node.set_light(node)
开发者ID:dcwatson,项目名称:pavara,代码行数:8,代码来源:world.py

示例13: setup_lights

    def setup_lights(self):
        ambientLight = AmbientLight('ambient')
        ambientLight.setColor( Vec4( .5, .5, .5, 1 ) )
        render.setLight(render.attachNewNode(ambientLight))

        directionalLight = DirectionalLight('directional')
        directionalLight.setDirection( Vec3( -10, 10, -25 ) )
        directionalLight.setColor( Vec4( .1, .1, .1, 1 ) )
        render.setLight(render.attachNewNode(directionalLight))
开发者ID:ekare,项目名称:panda3d-glhost,代码行数:9,代码来源:pandawrapper.py

示例14: setupLights

 def setupLights(self):
     ambientLight = AmbientLight("ambientLight")
     ambientLight.setColor(Vec4(.4, .4, .35, 1))
     directionalLight = DirectionalLight("directionalLight")
     directionalLight.setDirection(Vec3( 0, 8, -2.5 ) )
     directionalLight.setColor(Vec4( 0.9, 0.8, 0.9, 1 ) )
     #Set lighting on teapot so spark doesn't get affected
     self.t.setLight(self.t.attachNewNode(directionalLight))
     self.t.setLight(self.t.attachNewNode(ambientLight))
开发者ID:kridily,项目名称:fall_and_fix,代码行数:9,代码来源:sparp.py

示例15: setupLights

    def setupLights(self):
        ambientLight = AmbientLight("ambientLight")
        ambientLight.setColor(Vec4(0.4, 0.4, 0.35, 1))
        directionalLight = DirectionalLight("directionalLight")
        directionalLight.setDirection(Vec3(0, 8, -2.5))
        directionalLight.setColor(Vec4(0.9, 0.8, 0.9, 1))
        render.setLight(render.attachNewNode(directionalLight))
        render.setLight(render.attachNewNode(directionalLight))

        self.env.setLightOff()
开发者ID:jessehorne,项目名称:learningpanda,代码行数:10,代码来源:7.py


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