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


Python DirectionalLight.setColor方法代码示例

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


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

示例1: __init__

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setColor [as 别名]
 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,代码行数:34,代码来源:missile.py

示例2: initialize_lighting

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setColor [as 别名]
    def initialize_lighting(self):
        ambientLight_color = Vec4(0.5,0.5,0.5,1)
        sunLight_color = Vec4(0.5,0.5,0.5,1)
        backLight_color = Vec4(0.22,0.44,0.44,1)
        if self.timeOfDay == "morning":
            ambientLight_color = Vec4(0.56,0.52,0.62,1)
            sunLight_color = Vec4(0.86,0.75,0.63,1)

        # Create Ambient Light 
        ambientLight = AmbientLight('ambientLight')
        ambientLight.setColor(ambientLight_color)
        ambientLightNP = render.attachNewNode(ambientLight)
        render.setLight(ambientLightNP)

        #Create Directional Light
        sunLight = DirectionalLight('sunLight')
        sunLight.setColor(sunLight_color)
        sunLightNP = render.attachNewNode(sunLight)
        sunLightNP.setHpr(180,-20,0)
        render.setLight(sunLightNP)

        #Create Directional Light
        backLight = DirectionalLight('backLight')
        backLight.setColor(backLight_color)
        backLightNP = render.attachNewNode(backLight)
        backLightNP.setHpr(-180,160,0)
        render.setLight(backLightNP)
开发者ID:ztmunyikwa,项目名称:pirate-game,代码行数:29,代码来源:environment.py

示例3: createLighting

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setColor [as 别名]
    def createLighting(self):
        #creates lighting for the scene
        aLightVal = 0.3
        dLightVal1 = -5
        dLightVal2 = 5

        #set up the ambient light
        ambientLight = AmbientLight("ambientLight")
        ambientLight.setColor(Vec4(aLightVal, aLightVal, aLightVal, 1))
        ambientLight1 = AmbientLight("ambientLight1")
        ambientLight1.setColor(Vec4(aLightVal, aLightVal, aLightVal, 1))
        ambientLight2 = AmbientLight("ambientLight2")
        ambientLight2.setColor(Vec4(aLightVal, aLightVal, aLightVal, 1))

        #sets a directional light
        directionalLight = DirectionalLight("directionalLight")
        directionalLight.setDirection(Vec3(dLightVal1, dLightVal1, dLightVal1))
        directionalLight.setColor(Vec4(1, 1, 1, 1))
        directionalLight.setSpecularColor(Vec4(0, 0, 0, 1))

        #sets a directional light
        directionalLight1 = DirectionalLight("directionalLight2")
        directionalLight1.setDirection(Vec3(dLightVal2, dLightVal1, dLightVal1))
        directionalLight1.setColor(Vec4(1, 1, 1, 1))
        directionalLight1.setSpecularColor(Vec4(1, 1, 1, 1))


        #attaches lights to scene
        render.setLight(render.attachNewNode(ambientLight))
        render.setLight(render.attachNewNode(ambientLight1))
        render.setLight(render.attachNewNode(ambientLight1))
        render.setLight(render.attachNewNode(directionalLight))
        render.setLight(render.attachNewNode(directionalLight1))
开发者ID:jli8554,项目名称:aMAZEing,代码行数:35,代码来源:mazeAnimation.py

示例4: __init__

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setColor [as 别名]
    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,代码行数:28,代码来源:world.py

示例5: __init__

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setColor [as 别名]
    def __init__(self):

        self.setAI()

        self.keyMap = {"left": 0, "right": 0, "forward": 0, "backward": 0, "cam-left": 0, "cam-right": 0}
        base.win.setClearColor(Vec4(0, 0, 0, 1))

        # the menu
        self.loadAudio()
        self.showMenu()

        # keyboard and mouse events
        self.accept("escape", sys.exit)
        self.accept("w", self.setKey, ["forward", 1])
        self.accept("a", self.setKey, ["left", 1])
        self.accept("s", self.setKey, ["backward", 1])
        self.accept("d", self.setKey, ["right", 1])
        self.accept("w-up", self.setKey, ["forward", 0])
        self.accept("a-up", self.setKey, ["left", 0])
        self.accept("s-up", self.setKey, ["backward", 0])
        self.accept("d-up", self.setKey, ["right", 0])
        self.accept("arrow_left", self.setKey, ["cam-left", 1])
        self.accept("arrow_left-up", self.setKey, ["cam-left", 0])
        self.accept("arrow_right", self.setKey, ["cam-right", 1])
        self.accept("arrow_right-up", self.setKey, ["cam-right", 0])

        # create some lighting
        ambientLight = AmbientLight("ambientLight")
        ambientLight.setColor(Vec4(0.3, 0.3, 0.3, 1))
        directionalLight = DirectionalLight("directionalLight")
        directionalLight.setDirection(Vec3(-5, -5, -5))
        directionalLight.setColor(Vec4(1, 1, 1, 1))
        directionalLight.setSpecularColor(Vec4(1, 1, 1, 1))
        render.setLight(render.attachNewNode(ambientLight))
        render.setLight(render.attachNewNode(directionalLight))
开发者ID:khzaw,项目名称:Timed-Obstacle-Course-Game,代码行数:37,代码来源:main.py

示例6: __init__

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setColor [as 别名]
    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,代码行数:34,代码来源:base_app.py

示例7: loadPrisonCrater

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setColor [as 别名]
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,代码行数:31,代码来源:world.py

示例8: __init__

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setColor [as 别名]
  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,代码行数:36,代码来源:23_SoftbodyPressure.py

示例9: __init__

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setColor [as 别名]
    def __init__(self):
        self.hotelModel = loader.loadModel("menuBG/menuback")
        self.hotelModel.reparentTo(render)
        self.hotelModel.stash()

        # setup some lights
        plight = PointLight("mapgen_plight")
        plight.setColor(VBase4(0.45, 0.35, 0.35, 1))
        self.plnp = self.hotelModel.attachNewNode(plight)
        self.plnp.setPos(-3, 3, 5)
        base.render.setLight(self.plnp)

        # setup a default ambient light
        alight = AmbientLight("mapgen_alight")
        alight.setColor(VBase4(0.20, 0.20, 0.28, 1))
        self.alnp = self.hotelModel.attachNewNode(alight)
        base.render.setLight(self.alnp)

        sun = DirectionalLight('sun')
        sun.setColor(VBase4(0.8, 0.8, 0.8, 1))
        lens = PerspectiveLens()
        lens.setFar(50)
        lens.setFov(80, 80)
        sun.setLens(lens)
        ms = 1024 #graphicMgr.shadowMapSize
        sun.setShadowCaster(True, ms, ms)
        self.sunnp = self.hotelModel.attachNewNode(sun)
        self.sunnp.setHpr(85, -50, 0)
        self.sunnp.setPos(12, 0, 10)
        base.render.setLight(self.sunnp)
开发者ID:grimfang,项目名称:rising_reloaded,代码行数:32,代码来源:MenuBG.py

示例10: __init__

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setColor [as 别名]
	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,代码行数:35,代码来源:Elifaleth.py

示例11: setupLights

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setColor [as 别名]
 def setupLights(self):  # Sets up some default lighting
     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))
     render.setLight(render.attachNewNode(directionalLight))
     render.setLight(render.attachNewNode(ambientLight))
开发者ID:AdrianF98,项目名称:Toontown-2-Revised,代码行数:10,代码来源:main.py

示例12: setupLights

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setColor [as 别名]
 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,代码行数:10,代码来源:TutChessboard.py

示例13: setupLight

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setColor [as 别名]
 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,代码行数:10,代码来源:main.py

示例14: loadSimpleLighting

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setColor [as 别名]
 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,代码行数:10,代码来源:gameEngine.py

示例15: light

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setColor [as 别名]
 def light(self):
     ambientLight = AmbientLight("ambientLight")
     ambientLight.setColor(Vec4(.3, .3, .3, 1))
     directionalLight = DirectionalLight("directionalLight")
     directionalLight.setDirection(Vec3(-5, -5, -5))
     directionalLight.setColor(Vec4(1, 1, 1, 1))
     directionalLight.setSpecularColor(Vec4(1, 1, 1, 1))
     render.setLight(render.attachNewNode(ambientLight))
     render.setLight(render.attachNewNode(directionalLight))
开发者ID:pavelkang,项目名称:Term_Project,代码行数:11,代码来源:ball.py


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