本文整理匯總了Python中pandac.PandaModules.AmbientLight.setLens方法的典型用法代碼示例。如果您正苦於以下問題:Python AmbientLight.setLens方法的具體用法?Python AmbientLight.setLens怎麽用?Python AmbientLight.setLens使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pandac.PandaModules.AmbientLight
的用法示例。
在下文中一共展示了AmbientLight.setLens方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: addLight
# 需要導入模塊: from pandac.PandaModules import AmbientLight [as 別名]
# 或者: from pandac.PandaModules.AmbientLight import setLens [as 別名]
def addLight(self, type, tag, pos, color, hpr):
''' Create a light of the given type and assign the given properties.
Dynamic class instantantiation is difficult due to the Panda module
layout so we use conditionals
TODO - support for attenuation.
'''
LOG.debug("[GXMgr] Adding light of type %s"%type)
if hasattr(pandac.PandaModules, type):
LOG.debug("[GXMgr] Found light class - %s"%type)
if (type.lower() == 'ambientlight'):
from pandac.PandaModules import AmbientLight
l = AmbientLight(tag)
if color:
l.setColor(color)
lnp = render.attachNewNode(l)
elif (type.lower() == 'directionallight'):
from pandac.PandaModules import DirectionalLight
l = DirectionalLight(tag)
if color:
l.setColor(color)
lnp = render.attachNewNode(l)
if hpr:
lnp.setHpr(hpr)
elif (type.lower() == 'pointlight'):
from pandac.PandaModules import PointLight
l = PointLight(tag)
if color:
l.setColor(color)
lnp = render.attachNewNode(l)
if pos:
lnp.setPos(pos)
elif (type.lower() == 'spotlight'):
from pandac.PandaModules import Spotlight
l = Spotlight(tag)
if lens:
lightLens = PerspectiveLens()
l.setLens(lightLens)
if color:
l.setColor(color)
lnp = render.attachNewNode(l)
if hpr:
lnp.setHpr(hpr)
if pos:
lnp.setPos(pos)
self.lightList.append(lnp)
render.setLight(lnp)
else:
LOG.error("[GXMgr] Unknown light class - %s"%type)