本文整理汇总了Python中panda3d.core.PointLight.getLens方法的典型用法代码示例。如果您正苦于以下问题:Python PointLight.getLens方法的具体用法?Python PointLight.getLens怎么用?Python PointLight.getLens使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.core.PointLight
的用法示例。
在下文中一共展示了PointLight.getLens方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setupLightSources
# 需要导入模块: from panda3d.core import PointLight [as 别名]
# 或者: from panda3d.core.PointLight import getLens [as 别名]
def setupLightSources(self, base, scene):
for np in self.model.findAllMatches('**/=Light'):
if np.getTag('Light') == 'Point':
light = PointLight('PointLight.%d' % (len(self.lights) + 1,))
elif np.getTag('Light') == 'Spot':
light = Spotlight('Spotlight.%d' % (len(self.lights) + 1,))
fov = np.getTag('Fov')
if fov:
light.getLens().setFov(float(fov))
nf = np.getTag('NearFar').split(',')
if len(nf) > 1:
light.getLens().setNearFar(float(nf[0]), float(nf[1]))
exp = np.getTag('Exponent')
if exp:
light.setExponent(float(exp))
elif np.getTag('Light') == 'Directional':
light = DirectionalLight('DirectionalLight.%d' % (len(self.lights) + 1,))
materials = np.findAllMaterials()
if len(materials) > 0:
light.setColor(materials[0].getDiffuse())
attenuation = np.getTag('Attenuation').split(',')
if len(attenuation) > 0 and not isinstance(light, DirectionalLight):
light.setAttenuation(tuple([float(a) for a in attenuation]))
# if np.getTag('Shadow'):
# self.model.setShaderAuto()
# light.setShadowCaster(True)
self.lights.append(light)
lightNP = self.model.attachNewNode(light)
lightNP.setPos(np.getPos())
lightNP.setHpr(np.getHpr())
# lightNP.setCompass()
self.model.setLight(lightNP)