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


Python PointLight.setSpecularColor方法代码示例

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


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

示例1: MyApp

# 需要导入模块: from panda3d.core import PointLight [as 别名]
# 或者: from panda3d.core.PointLight import setSpecularColor [as 别名]
class MyApp(ShowBase):
 
	def __init__(self):
		ShowBase.__init__(self)
		dir(self)
		self.disableMouse()
 
		# Load the environment model.
		self.environ = self.loader.loadModel("../levels/level01.egg")
		# Reparent the model to render.
		self.environ.reparentTo(self.render)
		'''add a light'''
		self.light = PointLight("dLight")
		self.light.setAttenuation( (.01,.01,.01 ) )
		self.light.setSpecularColor ( VBase4(1,1,0,1 ) )
		self.lightNode = render.attachNewNode(self.light)
		self.lightNode.setZ(10)
		render.setLight(self.lightNode)

		'''move light constants'''
		self.moveLightDirection = -1000

		self.taskMgr.add(self.moveLight,"lightMove")
		self.taskMgr.add(self.fpsInput,"fpsInput")

		'''fps cam controls'''
		self.keymap={"w":0,"a":0,"s":0,"d":0,"e":0,"q":0,
				"j":0,"k":0,"l":0,"i":0}
		
		self.fps = FpsCam(self.camera)
		self.accept("a", self.setKey,     ["a",1] )
		self.accept("a-up", self.setKey,  ['a',0] )
		self.accept("w", self.setKey,     ["w",1] )
		self.accept("w-up", self.setKey,  ["w",0] )
		self.accept("s", self.setKey,     ["s",1] )
		self.accept("s-up", self.setKey,  ["s",0] )
		self.accept("d", self.setKey,     ["d",1] )
		self.accept("d-up", self.setKey,  ["d",0] )
		self.accept("e", self.setKey,     ["e",1] )
		self.accept("e-up", self.setKey,  ["e",0] )
		self.accept("q", self.setKey,     ["q",1] )
		self.accept("q-up", self.setKey,  ["q",0] )
		self.accept("j", self.setKey,     ["j",1] )
		self.accept("j-up", self.setKey,  ["j",0] )
		self.accept("k", self.setKey,     ["k",1] )
		self.accept("k-up", self.setKey,  ["k",0] )
		self.accept("l", self.setKey,     ["l",1] )
		self.accept("l-up", self.setKey,  ["l",0] )
		self.accept("i", self.setKey,     ["i",1] )
		self.accept("i-up", self.setKey,  ["i",0] )
		self.accept("escape",sys.exit )




	def setKey(self,key,value):
		self.keymap[key]=value
		return

	def fpsInput(self,task):
		self.fps.moveX( self.keymap["d"]-self.keymap["a"])
		self.fps.moveY( self.keymap["w"]-self.keymap["s"])
		self.fps.moveZ( self.keymap["e"]-self.keymap["q"])
		self.fps.yaw  ( self.keymap["j"]-self.keymap["l"])
		self.fps.pitch( self.keymap["i"]-self.keymap["k"])
		return task.cont

	def moveLight(self,task):
		#print dir(self.lightNode)
		where = self.lightNode.getX()
		#print where
		self.lightNode.setX(where-task.getDt()*self.moveLightDirection)
		if self.lightNode.getX()< -10:
			self.moveLightDirection *= -1
		elif self.lightNode.getX() > 10:
			self.moveLightDirection *= -1

		return task.cont
开发者ID:zwparchman,项目名称:zwparchmanTank,代码行数:80,代码来源:viewer.py


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