本文整理汇总了Python中panda3d.core.Fog类的典型用法代码示例。如果您正苦于以下问题:Python Fog类的具体用法?Python Fog怎么用?Python Fog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Fog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: loadPrisonCrater
def loadPrisonCrater():
## Sky color
base.win.setClearColor(Vec4(.46,.824,.904,1))
## Load Ground
sand = loader.loadModel("data/models/sand.bam")
sand.reparentTo(render)
sand.setTexScale(TextureStage.getDefault(),5000,5000)
craterwalls = loader.loadModel("data/models/craterwalls.bam")
craterwalls.reparentTo(render)
craterwalls.setTexScale(TextureStage.getDefault(),500,50)
## World Effects
fog = Fog("Fog")
fog.setColor(255,215,143)
fog.setExpDensity(.0000001)
render.setFog(fog)
alight = render.attachNewNode(AmbientLight("Abient"))
alight.node().setColor(Vec4(.9,.9,.9,1))
render.setLight(alight)
sun = DirectionalLight('Sun')
sun.setColor(Vec4(1,1,1,1))
sunNP = render.attachNewNode(sun)
sunNP.setPos(0,0,4000)
sunNP.setHpr(0,-90,0)
render.setLight(sunNP)
示例2: __init__
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()
示例3: BRHood
class BRHood(ToonHood):
notify = directNotify.newCategory("BRHood")
ID = ToontownGlobals.TheBrrrgh
TOWNLOADER_CLASS = BRTownLoader
SAFEZONELOADER_CLASS = BRSafeZoneLoader
STORAGE_DNA = "phase_8/dna/storage_BR.pdna"
SKY_FILE = "phase_3.5/models/props/BR_sky"
SPOOKY_SKY_FILE = "phase_3.5/models/props/BR_sky"
TITLE_COLOR = (0.3, 0.6, 1.0, 1.0)
HOLIDAY_DNA = {
ToontownGlobals.WINTER_DECORATIONS: ["phase_8/dna/winter_storage_BR.pdna"],
ToontownGlobals.WACKY_WINTER_DECORATIONS: ["phase_8/dna/winter_storage_BR.pdna"],
ToontownGlobals.HALLOWEEN_PROPS: ["phase_8/dna/halloween_props_storage_BR.pdna"],
ToontownGlobals.SPOOKY_PROPS: ["phase_8/dna/halloween_props_storage_BR.pdna"],
}
def load(self):
ToonHood.load(self)
self.fog = Fog("BRFog")
def setFog(self):
if base.wantFog:
self.fog.setColor(0.9, 0.9, 0.9)
self.fog.setExpDensity(0.004)
render.clearFog()
render.setFog(self.fog)
self.sky.clearFog()
self.sky.setFog(self.fog)
示例4: init
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()
示例5: setFogOn
def setFogOn(self, fog):
self.fogOn = fog
if self.fogOn:
myFog = Fog('Fog Rendering Fog of Rendering')
myFog.setColor(1.0, 0.0, 0.0)
myFog.setExpDensity(0.5)
self.setFog(myFog)
else:
self.clearFog()
示例6: toggle_smoke
def toggle_smoke(self):
from panda3d.core import Fog
if self.render.getFog():
self.render.clearFog()
else:
smoke = Fog("smoke")
smoke.setColor(config.smoke_color)
smoke.setExpDensity(config.smoke_exp_density)
render.setFog(smoke)
示例7: __init__
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)
示例8: setupFog
def setupFog(self):
self.fog = Fog("fog")
self.fog.setColor(FOG_COLOR)
self.fog.setExpDensity(FOG_EXP_DENSITY)
self.render.setFog(self.fog)
示例9: createSafeZone
def createSafeZone(self, foo):
self.geom = loader.loadModel('phase_14/models/neighborhoods/cogtropolis.egg')
self.geom.reparentTo(hidden)
for i in range(2):
bldgSectionNode = render.attachNewNode('bldgSection' + str(i))
bldgSectionNode.setPos(self.bldgSectionData[i][0])
bldgSectionNode.setHpr(self.bldgSectionData[i][1])
for point in self.bldgPoints:
bldg = loader.loadModel('phase_14/models/props/cogtropolis_big_building_1.egg')
bldg.reparentTo(bldgSectionNode)
bldg.setPos(point)
self.buildingSectionNodes.append(bldgSectionNode)
for data in self.tLightData:
node = render.attachNewNode('tlight-intersection-holder')
node.setPos(data[0])
node.setHpr(data[1])
light = TrafficLight.TrafficLight()
light.reparentTo(node)
light.startFlashing()
light2 = TrafficLight.TrafficLight(1)
light2.reparentTo(node)
light2.startFlashing()
self.trafficLightNodes.append(node)
self.trafficLights.append(light)
self.trafficLights.append(light2)
self.fog = Fog('CogTropolis-fog')
self.fog.setColor(0.3, 0.3, 0.3)
self.fog.setExpDensity(0.0075)
self.geom.flattenMedium()
gsg = base.win.getGsg()
if gsg:
self.geom.prepareScene(gsg)
示例10: load
def load(self):
Place.Place.load(self)
self.fog = Fog('EstateFog')
taskMgr.add(self.__checkCameraUnderwater, 'estate-check-cam-underwater')
path = self.loader.geom.find('**/Path')
path.setBin('ground', 10, 1)
self.parentFSMState.addChild(self.fsm)
示例11: load
def load(self):
base.cr.renderFrame()
base.camLens.setMinFov(CIGlobals.DefaultCameraFov / (4.0 / 3.0))
self.__setupStageToon()
self.world = loader.loadModel('phase_9/models/cogHQ/SellbotHQExterior.bam')
self.world.reparentTo(base.render)
self.world.setPos(0, 227.09, -25.36)
self.sky = loader.loadModel('phase_9/models/cogHQ/cog_sky.bam')
self.sky.setScale(1)
self.sky.reparentTo(base.render)
self.sky.find('**/InnerGroup').removeNode()
self.fog = Fog('charSelectFog')
self.fog.setColor(0.2, 0.2, 0.2)
self.fog.setExpDensity(0.003)
base.render.setFog(self.fog)
self.title = DirectLabel(text=self.TITLE, text_font=CIGlobals.getMickeyFont(), text_fg=(1, 0.9, 0.1, 1), relief=None, text_scale=0.13, pos=(0, 0, 0.82))
self.charNameLabel = OnscreenText(text='', font=CIGlobals.getMickeyFont(), pos=(-0.25, 0.5, 0), fg=(1, 0.9, 0.1, 1.0))
self.charNameLabel.hide()
self.playOrCreateButton = DirectButton(text='', pos=(0.8125, 0, -0.735), command=self.__action, geom=CIGlobals.getDefaultBtnGeom(), text_scale=0.06, relief=None, text_pos=(0, -0.01))
self.playOrCreateButton.hide()
self.deleteButton = DirectButton(text='Delete', pos=(0.8125, 0, -0.835), command=self.__action, extraArgs=['delete'], geom=CIGlobals.getDefaultBtnGeom(), text_scale=0.06, relief=None, text_pos=(0, -0.01))
self.deleteButton.hide()
self.quitButton = DirectButton(text='Quit', pos=(-1.1, 0, -0.925), command=self.__action, extraArgs=['quit'], text_scale=0.06, geom=CIGlobals.getDefaultBtnGeom(), relief=None, text_pos=(0, -0.01))
textRolloverColor = Vec4(1, 1, 0, 1)
textDownColor = Vec4(0.5, 0.9, 1, 1)
textDisabledColor = Vec4(0.4, 0.8, 0.4, 1)
for slot in range(6):
if self.avChooser.hasToonInSlot(slot):
choice = self.avChooser.getAvChoiceBySlot(slot)
text = choice.name
else:
text = self.NO_TOON
btn = DirectButton(relief=None, text=text, text_scale=0.06, text_align=TextNode.ALeft, text1_bg=textDownColor, text2_bg=textRolloverColor, text3_fg=textDisabledColor, textMayChange=0, command=self.__handleCharButton, extraArgs=[slot], text_pos=(0, 0, 0.0))
btn.setPythonTag('slot', slot)
self.charButtons.append(btn)
btn['state'] = DGG.NORMAL
gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui.bam')
listXorigin = -0.02
listFrameSizeX = 0.625
listZorigin = -0.96
listFrameSizeZ = 1.04
arrowButtonScale = 1.3
itemFrameXorigin = -0.237
itemFrameZorigin = 0.365
buttonXstart = itemFrameXorigin + 0.293
self.charList = DirectScrolledList(relief=None, pos=(0.75, 0, 0.08), incButton_image=(gui.find('**/FndsLst_ScrollUp'),
gui.find('**/FndsLst_ScrollDN'),
gui.find('**/FndsLst_ScrollUp_Rllvr'),
gui.find('**/FndsLst_ScrollUp')), incButton_relief=None, incButton_scale=(arrowButtonScale, arrowButtonScale, -arrowButtonScale), incButton_pos=(buttonXstart, 0, itemFrameZorigin - 0.999), incButton_image3_color=Vec4(1, 1, 1, 0.2), decButton_image=(gui.find('**/FndsLst_ScrollUp'),
gui.find('**/FndsLst_ScrollDN'),
gui.find('**/FndsLst_ScrollUp_Rllvr'),
gui.find('**/FndsLst_ScrollUp')), decButton_relief=None, decButton_scale=(arrowButtonScale, arrowButtonScale, arrowButtonScale), decButton_pos=(buttonXstart, 0, itemFrameZorigin + 0.125), decButton_image3_color=Vec4(1, 1, 1, 0.2), itemFrame_pos=(itemFrameXorigin, 0, itemFrameZorigin), itemFrame_scale=1.0, itemFrame_relief=DGG.SUNKEN, itemFrame_frameSize=(listXorigin,
listXorigin + listFrameSizeX,
listZorigin,
listZorigin + listFrameSizeZ), itemFrame_frameColor=(0.85, 0.95, 1, 1), itemFrame_borderWidth=(0.01, 0.01), numItemsVisible=15, forceHeight=0.075, items=self.charButtons)
base.camera.setPos(75.12, 63.22, -23)
base.camera.setHpr(26.57, 9.62, 0)
return
示例12: begin
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()
示例13: __init__
def __init__(self, _heightField):
texture = loader.loadTexture("ground_tex.png")
self.zScale = 45
self.terrain = GeoMipTerrain("BasicTerrain")
self.terrain.setHeightfield(_heightField)
# Dynamic settings?
self.terrain.setBlockSize(16)
self.terrain.setNear(20)
self.terrain.setFar(100)
self.terrain.setFocalPoint(base.camera)
# Settings
self.terrain.getRoot().setSz(self.zScale)
self.terrain.getRoot().setTexture(texture)
self.terrain.getRoot().reparentTo(render)
self.terrain.generate()
self.terrainSize = (self.terrain.heightfield().getReadXSize(), self.terrain.heightfield().getReadYSize())
print "Terrain Size:", self.terrainSize
taskMgr.add(self.terrainTask, "TerrainTask")
self.skydome = loader.loadModel("Skydome")
self.skydome.setDepthTest(False)
self.skydome.setAttrib(CullBinAttrib.make("skydomeBin", 1000))
self.skydome.reparentTo(camera)
self.skydome.setScale(2)
self.skydome.setPos(0, 0, -0.5)
self.skydome.setCollideMask(BitMask32.allOff())
taskMgr.add(self.skydomeTask, "paperplanet_skydome")
# Add some fancy fog
self.fog = Fog("Fog Name")
self.fog.setColor(0.4,0.2,0.3)
self.fog.setExpDensity(0.015)
render.setFog(self.fog)
# Some Test light
dlight = DirectionalLight("dlight")
dlight.setColor(VBase4(0.8, 0.8, 0.5, 1))
dlnp = render.attachNewNode(dlight)
dlnp.setHpr(0, -60, 0)
render.setLight(dlnp)
# Add basic blacksmith hut
tmp = loader.loadModel("blacksmith_hut")
tmp.reparentTo(render)
tmp.setPos(164.054, 340.92, 11.3384)
示例14: BossbotHQ
class BossbotHQ(CogHood):
notify = directNotify.newCategory("BossbotHQ")
ID = ToontownGlobals.BossbotHQ
LOADER_CLASS = BossbotCogHQLoader
def load(self):
CogHood.load(self)
self.fog = Fog("BossbotHQFog")
self.sky.hide()
def enter(self, requestStatus):
CogHood.enter(self, requestStatus)
base.localAvatar.setCameraFov(ToontownGlobals.CogHQCameraFov)
base.camLens.setNearFar(ToontownGlobals.BossbotHQCameraNear, ToontownGlobals.BossbotHQCameraFar)
self.setFog()
def spawnTitleText(self, zoneId, floorNum=None):
if ZoneUtil.isMintInteriorZone(zoneId):
text = "%s\n%s" % (ToontownGlobals.StreetNames[zoneId][-1], TTLocalizer.MintFloorTitle % (floorNum + 1))
self.doSpawnTitleText(text)
else:
CogHood.spawnTitleText(self, zoneId)
def setFog(self):
if base.wantFog:
self.fog.setColor(0.1, 0.1, 0.1)
self.fog.setExpDensity(0.004)
render.clearFog()
render.setFog(self.fog)
self.sky.clearFog()
self.sky.setFog(self.fog)
示例15: createEnvironment
def createEnvironment(self):
# Fog
expfog = Fog("scene-wide-fog")
expfog.setColor(0.5, 0.5, 0.5)
expfog.setExpDensity(0.002)
self.render.setFog(expfog)
# Sky
skysphere = self.loader.loadModel("assets/blue-sky-sphere")
skysphere.setEffect(CompassEffect.make(self.render))
skysphere.setScale(0.08)
skysphere.reparentTo(self.camera)
# Lights
ambientLight = AmbientLight("ambientLight")
ambientLight.setColor(Vec4(0.6, 0.6, 0.6, 1))
self.render.setLight(self.render.attachNewNode(ambientLight))
directionalLight = DirectionalLight("directionalLight")
directionalLight.setColor(VBase4(0.8, 0.8, 0.5, 1))
dlnp = self.render.attachNewNode(directionalLight)
dlnp.setPos(0, 0, 260)
dlnp.lookAt(self.player)
self.render.setLight(dlnp)
# Water
self.water = self.loader.loadModel("assets/square.egg")
self.water.setSx(self.worldsize * 2)
self.water.setSy(self.worldsize * 2)
self.water.setPos(self.worldsize / 2, self.worldsize / 2, 25)
self.water.setTransparency(TransparencyAttrib.MAlpha)
newTS = TextureStage("1")
self.water.setTexture(newTS, self.loader.loadTexture("assets/water.png"))
self.water.setTexScale(newTS, 4)
self.water.reparentTo(self.render)
LerpTexOffsetInterval(self.water, 200, (1, 0), (0, 0), textureStage=newTS).loop()