本文整理汇总了Python中panda3d.core.AmbientLight方法的典型用法代码示例。如果您正苦于以下问题:Python core.AmbientLight方法的具体用法?Python core.AmbientLight怎么用?Python core.AmbientLight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.core
的用法示例。
在下文中一共展示了core.AmbientLight方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _load_city
# 需要导入模块: from panda3d import core [as 别名]
# 或者: from panda3d.core import AmbientLight [as 别名]
def _load_city(self):
try:
self.skybox_node = self.app.loader.loadModel("skyboxes/01-clean-day/skybox-mesh")
self.skybox_node.reparentTo(self.app.render)
self.skybox_node.flattenStrong()
except IOError:
print("Some models are missing. Skipping loading file skyboxes/01-clean-day/skybox-mesh")
self.skybox_node = None
try:
self.city_node = self.app.loader.loadModel("levels/urban-level-02-medium")
self.city_node.reparentTo(self.app.render)
self.ambient_light = self.app.render.attachNewNode(AmbientLight('ambient_light'))
self.ambient_light.node().setColor((1, 1, 1, 1))
self.city_node.setLight(self.ambient_light)
self.sun_light = self.app.render.attachNewNode(PointLight('sun_light'))
self.sun_light.node().setColor((.2, .2, .2, 1))
self.sun_light.setPos((-2506., -634., 2596.))
self.city_node.setLight(self.sun_light)
self.city_node.flattenStrong()
except IOError:
print("Some models are missing. Skipping loading file levels/urban-level-02-medium")
self.city_node = None
示例2: _load_quad
# 需要导入模块: from panda3d import core [as 别名]
# 或者: from panda3d.core import AmbientLight [as 别名]
def _load_quad(self):
self.quad_node = self.app.loader.loadModel('iris')
self.quad_node.reparentTo(self.app.render)
ambient_color = (.1, .1, .1, 1)
sun_light_color = (.5, .5, .5, 1)
self.quad_node.setLightOff()
ambient_light = self.app.render.attachNewNode(AmbientLight('quad_ambient_light'))
ambient_light.node().setColor(ambient_color)
self.quad_node.setLight(ambient_light)
sun_light = self.app.render.attachNewNode(PointLight('quad_sun_light'))
sun_light.node().setColor(sun_light_color)
sun_light.setPos((-2506., -634., 2596.))
self.quad_node.setLight(sun_light)
self.quad_node.flattenStrong()
quad_prop_positions = [np.array([ 0.20610, 0.13830, 0.025]), # blue, right
np.array([ 0.22254, -0.12507, 0.025]), # black, right
np.array([-0.20266, 0.13830, 0.025]), # blue, left
np.array([-0.21911, -0.12507, 0.025])] # black, left
self.quad_prop_local_nodes = []
for quad_prop_id, quad_prop_pos in enumerate(quad_prop_positions):
is_ccw = quad_prop_id in (1, 2)
quad_prop_node = self.quad_node.attachNewNode('quad_prop_%d' % quad_prop_id)
quad_prop_local_node = self.app.loader.loadModel('iris_prop_%s' % ('ccw' if is_ccw else 'cw'))
quad_prop_local_node.reparentTo(quad_prop_node)
quad_prop_node.setPos(tuple(quad_prop_pos))
quad_prop_node.flattenStrong()
self.quad_prop_local_nodes.append(quad_prop_local_node)
示例3: _load_and_get_car_local
# 需要导入模块: from panda3d import core [as 别名]
# 或者: from panda3d.core import AmbientLight [as 别名]
def _load_and_get_car_local(self, model_name):
car_local_node = self.app.loader.loadModel(model_name)
# translate model so that the bottom of it is at a height of 0 in the local reference frame
car_local_pos = car_local_node.getPos()
car_local_pos[2] = -car_local_node.getTightBounds()[0][2]
car_local_node.setPos(tuple(car_local_pos))
# cars need lights that are different from the scene lights
if model_name in ('camaro2', 'sport'):
ambient_color = (.1, .1, .1, 1)
sun_light_color = (.8, .8, .8, 1)
elif model_name == 'mazda6':
ambient_color = (.1, .1, .1, 1)
sun_light_color = (1, 1, 1, 1)
elif model_name == 'mitsubishi_lancer_evo':
ambient_color = (.2, .2, .2, 1)
sun_light_color = (1, 1, 1, 1)
else:
ambient_color = (.3, .3, .3, 1)
sun_light_color = (1, 1, 1, 1)
car_local_node.setLightOff()
ambient_light = self.app.render.attachNewNode(AmbientLight('car_ambient_light'))
ambient_light.node().setColor(ambient_color)
car_local_node.setLight(ambient_light)
sun_light = self.app.render.attachNewNode(PointLight('car_sun_light'))
sun_light.node().setColor(sun_light_color)
sun_light.setPos((-2506., -634., 2596.))
car_local_node.setLight(sun_light)
car_local_node.flattenStrong()
return car_local_node
示例4: __init__
# 需要导入模块: from panda3d import core [as 别名]
# 或者: from panda3d.core import AmbientLight [as 别名]
def __init__(self, **kwargs):
self.type = 'ambient' # ambient or directional for now
self.color = color.rgb(0.3,0.3,0.3,1) # a modest amount of full-spectrum light
self.direction = Vec3(-1,-1,-1) # shining down from top-right corner, behind camera
self.node = None
for key, value in kwargs.items():
if key == 'type':
if value=='ambient' or value=='directional':
self.type = value
else:
print("ERR Light type is not 'ambient' or 'directional'")
elif key == 'color':
self.color = value
elif key == 'direction':
self.direction = value
else:
print("Err ",key," is not a valid keyword")
scene.lights.append(self) # light added for all subsequent entities
if self.type == 'ambient':
ambientLight = AmbientLight('ambientLight')
ambientLight.setColor(self.color)
self.node = scene.attachNewNode(ambientLight)
if self.type == 'directional':
directionalLight = DirectionalLight('directionalLight')
directionalLight.setColor(self.color)
self.node = scene.attachNewNode(directionalLight)
# This light should be facing straight down, but clearly it isn't.
self.node.setHpr(self.direction) # convert vector to Hpr (in degrees!?) first