當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。