コード例 #1
0
def startCloudSky(hood,
                  parent=camera,
                  effects=CompassEffect.PRot | CompassEffect.PZ):
    hood.sky.reparentTo(parent)
    hood.sky.setDepthTest(0)
    hood.sky.setDepthWrite(0)
    hood.sky.setBin('background', 100)
    try:
        hood.sky.find('**/Sky').reparentTo(hood.sky, -1)
    except:
        pass

    hood.sky.reparentTo(parent)
    hood.sky.setZ(0.0)
    hood.sky.setHpr(0.0, 0.0, 0.0)
    ce = CompassEffect.make(NodePath(), effects)
    hood.sky.node().setEffect(ce)
    skyTrackTask = Task(hood.skyTrack)
    skyTrackTask.h = 0
    skyTrackTask.cloud1 = hood.sky.find('**/cloud1')
    skyTrackTask.cloud2 = hood.sky.find('**/cloud2')
    if not skyTrackTask.cloud1.isEmpty() and not skyTrackTask.cloud2.isEmpty():
        taskMgr.add(skyTrackTask, 'skyTrack')
    else:
        notify.warning("Couln't find clouds!")
コード例 #2
0
ファイル: SkyUtil.py プロジェクト: satire6/Anesidora
def startCloudSky(hood, parent=camera, effects = CompassEffect.PRot | CompassEffect.PZ):
    # Parent the sky to our camera, the task will counter rotate it
    hood.sky.reparentTo(parent)
    # Turn off depth tests on the sky because as the cloud layers interpenetrate
    # we do not want to see the polys cutoff. Since there is nothing behing them
    # we can get away with this.
    hood.sky.setDepthTest(0)
    hood.sky.setDepthWrite(0)
    hood.sky.setBin("background", 100)
    # Make sure they are drawn in the correct order in the hierarchy
    # The sky should be first, then the clouds
    hood.sky.find("**/Sky").reparentTo(hood.sky, -1)

    # Nowadays we use a CompassEffect to counter-rotate the sky
    # automatically at render time, rather than depending on a
    # task to do this just before the scene is rendered.
    hood.sky.reparentTo(parent)
    hood.sky.setZ(0.0)
    hood.sky.setHpr(0.0, 0.0, 0.0)
    ce = CompassEffect.make(NodePath(), effects)
    hood.sky.node().setEffect(ce)

    # Even with the CompassEffect, we still need the task to spin
    # the clouds.

    skyTrackTask = Task(hood.skyTrack)
    # Store the clouds and h value so the task has access to it
    skyTrackTask.h = 0
    skyTrackTask.cloud1 = hood.sky.find("**/cloud1")
    skyTrackTask.cloud2 = hood.sky.find("**/cloud2")

    if (not skyTrackTask.cloud1.isEmpty()) and (not skyTrackTask.cloud2.isEmpty()):
        taskMgr.add(skyTrackTask, "skyTrack")
    else:
        notify.warning("Couln't find clouds!")
コード例 #3
0
def startCloudSky(hood, parent = camera, effects = CompassEffect.PRot | CompassEffect.PZ):
    hood.sky.reparentTo(parent)
    hood.sky.setDepthTest(0)
    hood.sky.setDepthWrite(0)
    hood.sky.setBin('background', 100)
    hood.sky.find('**/Sky').reparentTo(hood.sky, -1)
    hood.sky.reparentTo(parent)
    hood.sky.setZ(0.0)
    hood.sky.setHpr(0.0, 0.0, 0.0)
    ce = CompassEffect.make(NodePath(), effects)
    hood.sky.node().setEffect(ce)
    skyTrackTask = Task(hood.skyTrack)
    skyTrackTask.h = 0
    skyTrackTask.cloud1 = hood.sky.find('**/cloud1')
    skyTrackTask.cloud2 = hood.sky.find('**/cloud2')
    if not skyTrackTask.cloud1.isEmpty() and not skyTrackTask.cloud2.isEmpty():
        taskMgr.add(skyTrackTask, 'skyTrack')
    else:
        notify.warning("Couln't find clouds!")
コード例 #4
0
def startClouds(sky,
                skyTrack,
                parent=camera,
                effects=CompassEffect.PRot | CompassEffect.PZ):
    sky.setDepthTest(0)
    sky.setDepthWrite(0)
    sky.setBin('background', 100)
    if sky.find('**/Sky').isEmpty():
        sky.reparentTo(render)
        return
    sky.reparentTo(parent)
    sky.find('**/Sky').reparentTo(sky, -1)
    if effects:
        ce = CompassEffect.make(NodePath(), effects)
        sky.node().setEffect(ce)
    skyTrackTask = Task(skyTrack)
    skyTrackTask.h = 0
    skyTrackTask.cloud1 = sky.find('**/cloud1')
    skyTrackTask.cloud2 = sky.find('**/cloud2')
    if not skyTrackTask.cloud1.isEmpty() and not skyTrackTask.cloud2.isEmpty():
        taskMgr.add(skyTrackTask, 'skyTrack')