本文整理汇总了Python中panda3d.core.DirectionalLight.setScene方法的典型用法代码示例。如果您正苦于以下问题:Python DirectionalLight.setScene方法的具体用法?Python DirectionalLight.setScene怎么用?Python DirectionalLight.setScene使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.core.DirectionalLight
的用法示例。
在下文中一共展示了DirectionalLight.setScene方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from panda3d.core import DirectionalLight [as 别名]
# 或者: from panda3d.core.DirectionalLight import setScene [as 别名]
def __init__(self, arenaNr):
arenaPath = "levels/arena%d/" % arenaNr
self.arena = loader.loadModel(arenaPath + "arena")
self.arena.setScale(2)
self.arena.reparentTo(render)
self.arena.hide()
ambientLight = AmbientLight("ambient_light")
ambientLight.setColor((0.2, 0.2, 0.2, 1))
self.alnp = render.attachNewNode(ambientLight)
sunLens = PerspectiveLens()
sunLens.setFilmSize(50)
sun = DirectionalLight("sun")
sun.setColor((1, 1, 1, 1))
sun.setShadowCaster(True, 2048, 2048)
sun.setScene(render)
#sun.showFrustum()
self.ambientSound = None
self.levelParticles = None
if arenaNr == 1:
sunLens.setNearFar(25,45)
sun.setLens(sunLens)
self.sunNp = render.attachNewNode(sun)
self.sunNp.setPos(-10, -10, 30)
self.sunNp.lookAt(0,0,0)
self.ambientSound = loader.loadSfx("assets/audio/ambientLevel1.ogg")
self.ambientSound.setLoop(True)
self.fog = Fog("Outside Fog")
self.fog.setColor(0.3,0.3,0.5)
self.fog.setExpDensity(0.025)
self.levelParticles = ParticleEffect()
self.levelParticles.loadConfig("assets/fx/Leafs.ptf")
self.levelParticles.start(parent = render2d, renderParent = render2d)
elif arenaNr == 2:
sunLens.setFov(120, 40)
sunLens.setNearFar(2,10)
sun.setLens(sunLens)
self.sunNp = render.attachNewNode(sun)
self.sunNp.setPos(0, 0, 5)
self.sunNp.lookAt(0,0,0)
self.fog = Fog("Temple Fog")
self.fog.setColor(0,0,0)
self.fog.setExpDensity(0.065)