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


Python DirectionalLight.setDirection方法代码示例

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


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

示例1: createLighting

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setDirection [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

示例2: __init__

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setDirection [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

示例3: __init__

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setDirection [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

示例4: __init__

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setDirection [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

示例5: setupLights

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setDirection [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

示例6: loadSimpleLighting

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setDirection [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

示例7: setupLights

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setDirection [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

示例8: setupLight

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setDirection [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

示例9: setup_lights

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

示例10: light

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setDirection [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

示例11: setupLights

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

示例12: __init__

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setDirection [as 别名]
    def __init__(self):
        __builtin__.main = self
        self.taskMgr = taskMgr
        self.base = base
        
        # Connect to the server
        self.cManager = ConnectionManager()
        self.startConnection()
    
        self.characters = dict()
        self.cpList = dict()

        base.win.setClearColor(Vec4(0,0,0,1))


        self.environ = loader.loadModel("models/world")
        self.environ.reparentTo(render)
        self.environ.setPos(0,0,0)
        self.ralphStartPos = self.environ.find("**/start_point").getPos()

        # Create a floater object.  We use the "floater" as a temporary
        # variable in a variety of calculations.

        self.floater = NodePath(PandaNode("floater"))
        self.floater.reparentTo(render)

        self.accept("escape", sys.exit)
        
        # Login as 'CPHandler'
        # Temporary workaround, can add a seperate request/response for client/NPC client logins later
        self.name = "CPHandler"
        factionId = 0
        self.cManager.sendRequest(Constants.CMSG_AUTH, [self.name, factionId])

        # Create two control points
        cp1 = ControlPoint(1, -107.575, 0.6066, 0.490075, 10, RED)
        cp2 = ControlPoint(2, -100.575, -35.6066, 0.090075, 10, BLUE)

        self.cpList[1] = cp1
        self.cpList[2] = cp2

        taskMgr.doMethodLater(0.1, self.refresh, "heartbeat")
        taskMgr.doMethodLater(1, self.CPHandler, 'CPHandler')

        # Set up the camera
        base.disableMouse()
        #base.camera.setPos(self.character.actor.getX(),self.character.actor.getY()+10,2)

        # Create some lighting
        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:jaimodha,项目名称:MMOG,代码行数:59,代码来源:ControlPointClient.py

示例13: setupLights

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

示例14: setupLights

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setDirection [as 别名]
	def setupLights(self):
		#This is one area I know hardly anything about. I really don't know how to get this to behave nicely.
		#The black pieces are hardly distinguishable.
		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:christian-mann,项目名称:fog-of-war-chess,代码行数:12,代码来源:main.py

示例15: __init__

# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setDirection [as 别名]
	def __init__(self, aCol, dDir, dCol):
		render.setAttrib(LightRampAttrib.makeHdr1())
		ambientLight = AmbientLight("ambientLight")
		ambientLight.setColor(aCol)
		directionalLight = DirectionalLight("directionalLight")
		directionalLight.setDirection(dDir)
		directionalLight.setColor(dCol)
		directionalLight.setSpecularColor(Vec4(2.0, 2.0, 2.0, 0))
		render.setLight(render.attachNewNode(ambientLight))
		render.setLight(render.attachNewNode(directionalLight))
开发者ID:tbackus127,项目名称:AbominableSnowmanGame,代码行数:12,代码来源:SMLighting.py


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