当前位置: 首页>>代码示例>>Python>>正文


Python RenderingPipeline.removeLight方法代码示例

本文整理汇总了Python中Code.RenderingPipeline.RenderingPipeline.removeLight方法的典型用法代码示例。如果您正苦于以下问题:Python RenderingPipeline.removeLight方法的具体用法?Python RenderingPipeline.removeLight怎么用?Python RenderingPipeline.removeLight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Code.RenderingPipeline.RenderingPipeline的用法示例。


在下文中一共展示了RenderingPipeline.removeLight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Main

# 需要导入模块: from Code.RenderingPipeline import RenderingPipeline [as 别名]
# 或者: from Code.RenderingPipeline.RenderingPipeline import removeLight [as 别名]

#.........这里部分代码省略.........
       

        # Show loading screen a bit
        if True:
            self.doMethodLater(0.5, self.loadScene, "Load Scene")
        else:
            self.loadScene()


    def addDemoLight(self):
        """ Spawns a new light at a random position with a random color """
        randomRadius = 40.0
        light = SpotLight()
        spot = Vec3( (random()-0.5) * randomRadius, (random()-0.5) * randomRadius, 22)
        # spot = self.cam.getPos(self.render)
        light.setPos(spot)
        light.lookAt(Vec3(spot.x,spot.y,0))
        # print "pos is", spot,"look at",Vec3(spot.x,spot.y,0)
        light.setColor(Vec3( random(), random(), random()) * 0.2)
        # light.setColor(Vec3( 1.0, 0.5, 0.3) * 0.05)
        light.setNearFar(1.0, 50)
        light.setFov(140)
        light.setIESProfile("SoftArrow")
        # light.setIESProfileIndex(randint(0, 30))
        light.setShadowMapResolution(2048)
        # light.attachDebugNode(render)
        light.setCastsShadows(True)
        self.renderPipeline.addLight(light)
        self.demoLights.append(light)

    def removeDemoLight(self):
        """ Removes the last added demo light if present """
        if len(self.demoLights) > 0:
            self.renderPipeline.removeLight(self.demoLights[-1])
            del self.demoLights[-1]


    def update(self, task):
        """ Main update task """

        for idx, light in enumerate(self.movingLights):
            light.setZ(math.sin(idx +globalClock.getFrameTime())*2.0 + 10)
            # light.setZ(5)


        # import time
        # time.sleep(0.2)
        # globalClock.setMode(ClockObject.MLimited)
        # globalClock.setFrameRate(10)

        # Uncomment for party mode :-)
        # self.removeDemoLight()
        # self.addDemoLight()

        return task.cont

    def loadScene(self, task=None):
        """ Starts loading the scene, this is done async """
        # Load scene from disk
        self.debug("Loading Scene '" + self.sceneSource + "'")
        self.loader.loadModel(self.sceneSource, callback = self.onSceneLoaded)


    def onSceneLoaded(self, scene):
        """ Callback which gets called after the scene got loaded """
开发者ID:Solecist,项目名称:RenderPipeline,代码行数:69,代码来源:main.py


注:本文中的Code.RenderingPipeline.RenderingPipeline.removeLight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。