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


Python Fog.setLinearRange方法代码示例

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


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

示例1: __init__

# 需要导入模块: from panda3d.core import Fog [as 别名]
# 或者: from panda3d.core.Fog import setLinearRange [as 别名]
class CogdoFlyingLevelFog:

    def __init__(self, level, color = Globals.Level.FogColor):
        self._level = level
        self.color = color
        fogDistance = self._level.quadLengthUnits * max(1, self._level.quadVisibiltyAhead * 0.2)
        self.fog = Fog('RenderFog')
        self.fog.setColor(self.color)
        self.fog.setLinearRange(fogDistance * Globals.Level.RenderFogStartFactor, fogDistance)
        self._visible = False
        self._clearColor = Vec4(base.win.getClearColor())
        self._clearColor.setW(1.0)

    def destroy(self):
        self.setVisible(False)
        if hasattr(self, 'fog'):
            del self.fog

    def isVisible(self):
        return self._visible

    def setVisible(self, visible):
        self._visible = visible
        if self._visible:
            base.win.setClearColor(self.color)
            render.setFog(self.fog)
        else:
            base.win.setClearColor(self._clearColor)
            render.clearFog()
开发者ID:NostalgicTTR,项目名称:Toontown-Infinite-2016-Leak,代码行数:31,代码来源:CogdoFlyingObjects.py

示例2: begin

# 需要导入模块: from panda3d.core import Fog [as 别名]
# 或者: from panda3d.core.Fog import setLinearRange [as 别名]
	def begin(self):
		base.setBackgroundColor( self.environment['colourBackground'] )

		alight = AmbientLight('AmbientLight')
		alight.setColor(self.environment['colourAmbient'] )
		alnp = self.sceneNode.attachNewNode(alight)
		self.sceneNode.setLight(alnp)

		if self.environment['fog']:
			fog = Fog( 'sceneName' )
			fog.setColor( self.environment['fog']['color'] )

			if self.environment['fog']['mode'] == "linear":
				fog.setLinearRange(self.environment['fog']['linearStart']*1000,self.environment['fog']['linearEnd']*1000)
			else:
				fog.setExpDensity( self.environment['fog']['expDensity'] )

			self.sceneNode.setFog(fog)

		[self.createNode(props) for props in self.nodes]
		[self.createLight(props) for props in self.lights]
		[self.createCamera(props) for props in self.cameras]
		[self.createEntity(props) for props in self.entities]
		# [self.createStaticGeoms(props) for props in self.staticGeoms]

		self.sceneNode.clearModelNodes()
		self.sceneNode.flattenStrong() 
		self.sceneNode.setShaderAuto()
开发者ID:fredukita,项目名称:Pandark-Project,代码行数:30,代码来源:scenario.py

示例3: init

# 需要导入模块: from panda3d.core import Fog [as 别名]
# 或者: from panda3d.core.Fog import setLinearRange [as 别名]
    def init(self):
        """setup calls that can be repeated on code reload"""
        self.resetNodes()

        self.base.setBackgroundColor(0, 0, 0)
        self.base.render.setShaderAuto() # pp shading
        self.base.render.setAttrib(
            AntialiasAttrib.make(AntialiasAttrib.MMultisample))
        
        if 1:
            cam = self.base.render.find("camera")
            # I don't know how to set cam position

            f = Fog("fog")
            f.setColor(0,0,0)
            f.setLinearRange(18, 25)
            self.base.render.setFog(f) 

            import videowall
            reload(videowall)
            self.videoWall = videowall.VideoWall(self.base.loader, self.base.render)

        self.cubes = self.base.render.attachNewNode(ModelNode("cubes"))
        self.cubes.setPos(-4.3, 18, -3)
        ground = self.makeGround(self.cubes)

        lights = self.base.render.attachNewNode("lights")
        self.makeLights(lights)

        self.centerMessageNode, self.cornerMessageNode = self.makeMessages()

        self.setLighting(self.currentLighting)
        self.base.render.ls()
开发者ID:drewp,项目名称:blockstack,代码行数:35,代码来源:gamescene.py

示例4: __init__

# 需要导入模块: from panda3d.core import Fog [as 别名]
# 或者: from panda3d.core.Fog import setLinearRange [as 别名]
    def __init__(self, *args, **kwargs):
        template.Panda.__init__(self, *args, **kwargs)
        print "Hurray!"

        self.cube = self.loader.loadModel("models/low-cube")
        self.cube.reparentTo(self.render)
        self.cube2 = self.loader.loadModel("models/low-cube")
        self.cube2.reparentTo(self.render)
        self.cube2.setPos(self.cube, 10,20,30)
        self.cube2.setHpr(175,3,45)

        self.taskMgr.add(self.update, "update")
        self.taskMgr.add(self.move, "move")
        self._dir = 1

        colour = (0.5,0.8,0.8)
        linfog = Fog("A linear-mode Fog node")
        linfog.setColor(*colour)
        linfog.setLinearRange(0,320)
        linfog.setLinearFallback(45,160,320)
        render.attachNewNode(linfog)
        render.setFog(linfog)
开发者ID:dgou,项目名称:gibson,代码行数:24,代码来源:robtest.py

示例5: Estate

# 需要导入模块: from panda3d.core import Fog [as 别名]
# 或者: from panda3d.core.Fog import setLinearRange [as 别名]

#.........这里部分代码省略.........
        self.fsm.request('teleportIn', [self.doneStatus])
        return Task.done

    def exitTeleportOut(self):
        Place.Place.exitTeleportOut(self)

    def exitDoorIn(self):
        self.toonSubmerged = -1
        self.notify.info('add estate-check-toon-underwater to TaskMgr in exitDoorIn()')
        if hasattr(self, 'fsm'):
            taskMgr.add(self.__checkToonUnderwater, 'estate-check-toon-underwater')
        Place.Place.exitDoorIn(self)

    def getZoneId(self):
        if self.zoneId:
            return self.zoneId
        else:
            self.notify.warning('no zone id available')

    def __checkCameraUnderwater(self, task):
        if base.camera.getZ(render) < -1.2:
            self.__submergeCamera()
        else:
            self.__emergeCamera()
        return Task.cont

    def __checkToonUnderwater(self, task):
        if base.localAvatar.getZ() < -4.0:
            self.__submergeToon()
        else:
            self.__emergeToon()
        return Task.cont

    def __submergeCamera(self):
        if self.cameraSubmerged == 1:
            return
        self.__setUnderwaterFog()
        base.playSfx(self.loader.underwaterSound, looping=1, volume=0.8)
        self.cameraSubmerged = 1
        self.walkStateData.setSwimSoundAudible(1)

    def __emergeCamera(self):
        if self.cameraSubmerged == 0:
            return
        self.loader.underwaterSound.stop()
        self.loader.hood.sky.setFogOff()
        self.__setFaintFog()
        self.cameraSubmerged = 0
        self.walkStateData.setSwimSoundAudible(0)

    def forceUnderWater(self):
        self.toonSubmerged = 0
        self.__submergeToon()

    def __submergeToon(self):
        if self.toonSubmerged == 1:
            return
        self.notify.debug('continuing in __submergeToon')
        if hasattr(self, 'loader') and self.loader:
            base.playSfx(self.loader.submergeSound)
        if base.config.GetBool('disable-flying-glitch') == 0:
            self.fsm.request('walk')
        self.walkStateData.fsm.request('swimming', [self.loader.swimSound])
        pos = base.localAvatar.getPos(render)
        base.localAvatar.d_playSplashEffect(pos[0], pos[1], -2.3)
        self.toonSubmerged = 1

    def __emergeToon(self):
        if self.toonSubmerged == 0:
            return
        self.notify.debug('continuing in __emergeToon')
        if hasattr(self, 'walkStateData'):
            self.walkStateData.fsm.request('walking')
        self.toonSubmerged = 0
        # The client April Toons Manager is currently broken, so we have to do this hacky thing instead. :(
        #if hasattr(base.cr, 'aprilToonsMgr'):
            #if self.isEventActive(AprilToonsGlobals.EventEstateGravity):
                #base.localAvatar.startAprilToonsControls()
        if base.config.GetBool('want-april-toons'):
            base.localAvatar.startAprilToonsControls()

    def __setUnderwaterFog(self):
        if base.wantFog:
            self.fog.setColor(Vec4(0.0, 0.0, 0.6, 1.0))
            self.fog.setLinearRange(0.1, 100.0)
            render.setFog(self.fog)
            self.loader.hood.sky.setFog(self.fog)

    def __setWhiteFog(self):
        if base.wantFog:
            self.fog.setColor(Vec4(0.8, 0.8, 0.8, 1.0))
            self.fog.setLinearRange(0.0, 400.0)
            render.setFog(self.fog)
            self.loader.hood.sky.setFog(self.fog)

    def __setFaintFog(self):
        if base.wantFog:
            self.fog.setColor(Vec4(0.8, 0.8, 0.8, 1.0))
            self.fog.setLinearRange(0.0, 700.0)
            render.setFog(self.fog)
开发者ID:Toonerz,项目名称:TTI-Leak--From-2015-,代码行数:104,代码来源:Estate.py

示例6: __init__

# 需要导入模块: from panda3d.core import Fog [as 别名]
# 或者: from panda3d.core.Fog import setLinearRange [as 别名]
class CogdoBarrelRoom:
    notify = DirectNotifyGlobal.directNotify.newCategory('DistributedCogdoBarrelRoom')

    def __init__(self):
        self.timer = None
        self.model = None
        self._isLoaded = False
        self.dummyElevInNode = None
        self.cogdoBarrelsNode = None
        self.entranceNode = None
        self.nearBattleNode = None
        self.rewardUi = None
        self.rewardUiTaskName = 'CogdoBarrelRoom-RewardUI'
        self.rewardCameraTaskName = 'CogdoBarrelRoom-RewardCamera'
        self.fog = None
        self.defaultFar = None
        self.stomperSfx = None
        return

    def destroy(self):
        self.unload()

    def load(self):
        if self._isLoaded:
            return
        self.timer = ToontownTimer.ToontownTimer()
        self.timer.stash()
        self.model = loader.loadModel(CogdoBarrelRoomConsts.BarrelRoomModel)
        self.model.setPos(*CogdoBarrelRoomConsts.BarrelRoomModelPos)
        self.model.reparentTo(render)
        self.model.stash()
        self.dummyElevInNode = self.model.attachNewNode('elevator-in')
        self.dummyElevInNode.hide()
        self.entranceNode = self.model.attachNewNode('door-entrance')
        self.entranceNode.setPos(0, -65, 0)
        self.nearBattleNode = self.model.attachNewNode('near-battle')
        self.nearBattleNode.setPos(0, -25, 0)
        self.rewardUi = CogdoBarrelRoomRewardPanel.CogdoBarrelRoomRewardPanel()
        self.hideRewardUi()
        self.stomperSfx = base.loadSfx(CogdoBarrelRoomConsts.StomperSound)
        self.fog = Fog('barrel-room-fog')
        self.fog.setColor(CogdoBarrelRoomConsts.BarrelRoomFogColor)
        self.fog.setLinearRange(*CogdoBarrelRoomConsts.BarrelRoomFogLinearRange)
        self._isLoaded = True

    def unload(self):
        if self.model:
            self.model.removeNode()
            self.model = None
        if self.timer:
            self.timer.destroy()
            self.timer = None
        if self.rewardUi:
            self.rewardUi.destroy()
            self.rewardUi = None
        if self.fog:
            render.setFogOff()
            del self.fog
        taskMgr.remove(self.rewardUiTaskName)
        taskMgr.remove(self.rewardCameraTaskName)
        self._isLoaded = False
        return

    def isLoaded(self):
        return self._isLoaded

    def show(self):
        if not self.cogdoBarrelsNode:
            self.cogdoBarrelsNode = render.find('**/@@CogdoBarrels')
            self.cogdoBarrelsNode.reparentTo(self.model)
            self.cogdoBarrelsNode.unstash()
        self.defaultFar = base.camLens.getFar()
        base.camLens.setFar(CogdoBarrelRoomConsts.BarrelRoomCameraFar)
        self.showBattleAreaLight(True)
        render.setFog(self.fog)
        self.model.unstash()

    def hide(self):
        self.model.stash()
        render.setFogOff()
        if self.defaultFar is not None:
            base.camLens.setFar(self.defaultFar)
        return

    def activate(self):
        self.notify.info('Activating barrel room: %d sec timer.' % CogdoBarrelRoomConsts.CollectionTime)
        self.timer.unstash()
        self.timer.posAboveShtikerBook()
        self.timer.countdown(CogdoBarrelRoomConsts.CollectionTime)
        base.cr.playGame.getPlace().fsm.request('walk')

    def deactivate(self):
        self.notify.info('Deactivating barrel room.')
        self.timer.stop()
        self.timer.stash()

    def placeToonsAtEntrance(self, toons):
        for i in xrange(len(toons)):
            toons[i].setPosHpr(self.entranceNode, *CogdoBarrelRoomConsts.BarrelRoomPlayerSpawnPoints[i])

#.........这里部分代码省略.........
开发者ID:NostalgicTTR,项目名称:Toontown-Infinite-2016-Leak,代码行数:103,代码来源:CogdoBarrelRoom.py

示例7: DistributedRace

# 需要导入模块: from panda3d.core import Fog [as 别名]
# 或者: from panda3d.core.Fog import setLinearRange [as 别名]

#.........这里部分代码省略.........
                        continue
                    l = bldgGroup.findAllMatches('**/+ModelNode')
                    for n in l:
                        n2 = n.getParent().attachNewNode(n.getName())
                        n.getChildren().reparentTo(n2)
                        n.removeNode()
                    self.buildingGroups[side].append(bldgGroup)
        treeNodes = self.townGeom.findAllMatches('**/prop_tree_*')
        for tree in treeNodes:
            tree.flattenStrong()
        snowTreeNodes = self.townGeom.findAllMatches('**/prop_snow_tree_*')
        for snowTree in snowTreeNodes:
            snowTree.flattenStrong()
        for side in ['inner', 'outer', 'innersidest', 'outersidest']:
            for grp in self.buildingGroups[side]:
                grp.stash()
        self.showBuildings(0)

    def unloadUrbanTrack(self):
        del self.buildingGroups
        self.townGeom.removeNode()

    def loadFog(self):
        self.hasFog = True
        if self.isUrbanTrack:
            base.camLens.setFar(650)
        else:
            base.camLens.setFar(650)
        self.dummyNode = render.attachNewNode('dummyNode')
        if base.wantFog:
            self.fog = Fog('TrackFog')
            self.fog.setColor(Vec4(0.6, 0.7, 0.8, 1.0))
            if self.isUrbanTrack:
                self.fog.setLinearRange(200.0, 650.0)
            else:
                self.fog.setLinearRange(200.0, 800.0)
            render.setFog(self.fog)
        self.sky.setScale(1.725)
        self.sky.reparentTo(self.dummyNode)

    def showBuildings(self, t, forceRecompute = False):
        firstTimeCalled = 0
        if self.curve:
            t = t / self.curve.getMaxT()
        else:
            firstTimeCalled = 1
        if self.reversed:
            t = 1.0 - t
        numGroupsShown = 5
        for side in ['inner', 'outer']:
            numBldgGroups = len(self.buildingGroups[side])
            bldgInd = int(t * numBldgGroups)
            bldgInd = bldgInd % numBldgGroups
            if self.trackId in (RaceGlobals.RT_Urban_2, RaceGlobals.RT_Urban_2_rev):
                oldBldgInd = int(self.oldT * numBldgGroups)
                newBldgInd = int(t * numBldgGroups)
                kartPoint = self.startPos
                kart = base.cr.doId2do.get(self.kartMap.get(localAvatar.doId, None), None)
                if kart:
                    kartPoint = self.localKart.getPos()
                if not self.currBldgInd[side]:
                    self.currBldgInd[side] = 0
                curInd = self.currBldgInd[side]
                myCurGroup = self.buildingGroups[side][curInd]
                prevGrp = (curInd - 1) % numBldgGroups
                myPrevGroup = self.buildingGroups[side][prevGrp]
开发者ID:NostalgicTTR,项目名称:Toontown-Infinite-2016-Leak,代码行数:70,代码来源:DistributedRace.py

示例8: World

# 需要导入模块: from panda3d.core import Fog [as 别名]
# 或者: from panda3d.core.Fog import setLinearRange [as 别名]

#.........这里部分代码省略.........
        direct_level = 0.8
        directionalLight = DirectionalLight("directionalLight")
        directionalLight.setDirection(Vec3(0.0, 0.0, -1.0))
        directionalLight.setColor(Vec4(direct_level, direct_level, direct_level, 1))
        directionalLight.setSpecularColor(Vec4(direct_level, direct_level, direct_level, 1))
        render.setLight(render.attachNewNode(directionalLight))

        # create a point light that will follow our view point (the camera for now)
        # attenuation is set so that this point light has a torch like effect
        self.plight = PointLight("plight")
        self.plight.setColor(VBase4(0.8, 0.8, 0.8, 1.0))
        self.plight.setAttenuation(Point3(0.0, 0.0, 0.0002))

        self.plnp = base.camera.attachNewNode(self.plight)
        self.plnp.setPos(0, 0, 0)
        render.setLight(self.plnp)
        self.cam_light = 1

        self.keyMap = {
            "left": 0,
            "right": 0,
            "forward": 0,
            "backward": 0,
            "cam-left": 0,
            "cam-right": 0,
            "mouse3": 0,
            "flymode": 1,
        }

        # setup FOG
        self.fog_colour = (0.8, 0.8, 0.8, 1.0)
        self.linfog = Fog("A linear-mode Fog node")
        self.linfog.setColor(self.fog_colour)
        self.linfog.setLinearRange(700, 980)  # onset, opaque distances as params
        # linfog.setLinearFallback(45,160,320)
        base.camera.attachNewNode(self.linfog)
        render.setFog(self.linfog)
        self.fog = 1

        # camera control
        self.campos = Point3(0, 0, 0)
        self.camHeading = 0.0
        self.camPitch = 0.0
        base.camLens.setFov(65.0)
        base.camLens.setFar(1200)

        self.cam_speed = 0  # index into self.camp_speeds
        self.cam_speeds = [40.0, 80.0, 160.0, 320.0, 640.0]

        # Collision Detection for "WALKMODE"
        # We will detect the height of the terrain by creating a collision
        # ray and casting it downward toward the terrain.  The ray will start above the camera.
        # A ray may hit the terrain, or it may hit a rock or a tree.  If it
        # hits the terrain, we can detect the height.  If it hits anything
        # else, we rule that the move is illegal.

        self.cTrav = CollisionTraverser()
        self.camGroundRay = CollisionRay()
        self.camGroundRay.setOrigin(0.0, 0.0, 0.0)
        self.camGroundRay.setDirection(0, 0, -1)  # straight down
        self.camGroundCol = CollisionNode("camRay")
        self.camGroundCol.addSolid(self.camGroundRay)
        self.camGroundCol.setFromCollideMask(BitMask32.bit(0))
        self.camGroundCol.setIntoCollideMask(BitMask32.allOff())

        # attach the col node to the camCollider dummy node
开发者ID:proxeeus,项目名称:panda-zonewalk,代码行数:70,代码来源:zonewalk.py


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