本文整理汇总了Python中panda3d.core.DirectionalLight.set_color方法的典型用法代码示例。如果您正苦于以下问题:Python DirectionalLight.set_color方法的具体用法?Python DirectionalLight.set_color怎么用?Python DirectionalLight.set_color使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.core.DirectionalLight
的用法示例。
在下文中一共展示了DirectionalLight.set_color方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_celestial
# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import set_color [as 别名]
def add_celestial(self, azimuth, elevation, color, intensity, radius):
location = Vec3(to_cartesian(azimuth, elevation, 1000.0 * 255.0 / 256.0))
if intensity:
dlight = DirectionalLight('celestial')
dlight.set_color((color[0] * intensity, color[1] * intensity, color[2] * intensity, 1.0))
node = self.node.attach_new_node(dlight)
node.look_at(*(location * -1))
self.node.set_light(node)
示例2: createLighting
# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import set_color [as 别名]
def createLighting(self):
light = DirectionalLight('light')
light.set_color(VBase4(0.2, 0.2, 0.2, 1))
np = self.render.attach_new_node(light)
np.setPos(0, -200, 0)
np.lookAt(0, 0, 0)
self.render.set_light(np)
light = AmbientLight('ambient')
light.set_color(VBase4(0.4, 0.4, 0.4, 1))
np = self.render.attachNewNode(light)
self.render.setLight(np)
示例3: add_celestial
# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import set_color [as 别名]
def add_celestial(self, azimuth, elevation, color, intensity, radius, visible):
"""
Adds a celestial light source to the scene. If it is a visible celestial, also add a sphere model.
"""
if not self.camera:
return
location = Vec3(to_cartesian(azimuth, elevation, 1000.0 * 255.0 / 256.0))
if intensity:
dlight = DirectionalLight('celestial')
dlight.set_color((color[0] * intensity, color[1] * intensity,
color[2] * intensity, 1.0))
node = self.scene.attach_new_node(dlight)
node.look_at(*(location * -1))
self.scene.set_light(node)
if visible:
if radius <= 2.0:
samples = 6
elif radius >= 36.0:
samples = 40
else:
samples = int(round(((1.5 * radius) * (2 / 3.0)) + 3.75))
celestial = Dome(radius * 1.5, samples, 2, color, 0, location,
((-(math.degrees(azimuth))), 90 + math.degrees(elevation), 0))
self.celestials.attach(celestial)