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


Python CommonFilters.CommonFilters类代码示例

本文整理汇总了Python中direct.filter.CommonFilters.CommonFilters的典型用法代码示例。如果您正苦于以下问题:Python CommonFilters类的具体用法?Python CommonFilters怎么用?Python CommonFilters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: toggleToonShading

	def toggleToonShading(self, checked):
		filters = CommonFilters(base.win, base.cam)
		
		if checked == True:
			filters.setCartoonInk()
		else:
			filters.delCartoonInk()
开发者ID:MGERMA,项目名称:Version-avec-programme-extrerne,代码行数:7,代码来源:EventHandler.py

示例2: toggleAmbientOcclusion

	def toggleAmbientOcclusion(self, checked):
		filters = CommonFilters(base.win, base.cam)
		
		if checked == True:
			filters.setAmbientOcclusion()
		else:
			filters.delAmbientOcclusion()
开发者ID:MGERMA,项目名称:Version-avec-programme-extrerne,代码行数:7,代码来源:EventHandler.py

示例3: MyApp

class MyApp(ShowBase):
 
	def __init__(self):
		ShowBase.__init__(self)

		# Turn Auto Shaders and Antialiasing
		self.render.setShaderAuto()
		self.render.setAntialias(AntialiasAttrib.MAuto)


		# Setup Bloom and Blur Filters
		self.filters = CommonFilters(base.win, base.cam)
		self.filters.setBloom(blend=(1,0,0,1), desat=-0.5, intensity=6.0, size=2)
		#self.filters.setBlurSharpen(amount=0.5)

		# Create Ambient Lighting
		alight = AmbientLight('alight')
		alight.setColor(VBase4(1, 1, 1, 1))
		alnp = render.attachNewNode(alight)
		self.render.setLight(alnp)

		# Load Model and Add it to Scene
		self.environ = self.loader.loadModel("untitled.egg")
		self.environ.reparentTo(self.render)
		self.environ.setTransparency(TransparencyAttrib.MAlpha)
开发者ID:zester,项目名称:KeepersOfRadvdyn,代码行数:25,代码来源:main.py

示例4: BurdenOfProof

class BurdenOfProof(ShowBase):

    def __init__(self):
        ShowBase.__init__(self)

        self.useAdvancedVisualEffects = ConfigVariableBool(
            "use-advanced-visual-effects", True)

        self.game = Game()

        self.setupFilters()
        self.setupModels()
        self.setupKeyboardControl()
        self.motionController = MotionController(self)
        self.camera.setPos(0.0, 0.0, 1.7)

    def setupKeyboardControl(self):
        self.accept("escape", sys.exit)

    def setupFilters(self):
        if (self.useAdvancedVisualEffects):
            self.filters = CommonFilters(self.win, self.cam)
            self.filters.setBloom()

    def setupModels(self):
        self.cityModel = self.loader.loadModel("data/models/city")
        self.cityModel.reparentTo(self.render)
        self.cityModel.setP(-90.0)

        self.pandaActor = Actor("models/panda-model",
                                {"walk": "models/panda-walk4"})
        self.pandaActor.setScale(0.005, 0.005, 0.005)
        self.pandaActor.loop("walk")

        population = self.game.getPopulation()
        self.characterInstances = []

        for i in range(1, population.getCharacterCount()):
            instance = self.render.attachNewNode("characterInstance")
            instance.setPos(
                population.getCharacter(i).getPosition(self.game.getTime()))
            self.pandaActor.instanceTo(instance)
            self.characterInstances.append(instance)

        self.taskMgr.add(self.update, "updateTask")

    def update(self, task):
        self.game.update(oneMinute)  # TODO(?) compute actual milliseconds

        population = self.game.getPopulation()

        for i in range(1, population.getCharacterCount()):
            self.characterInstances[i - 1].setPos(
                population.getCharacter(i).getPosition(self.game.getTime()))

        return Task.cont
开发者ID:codistmonk,项目名称:burdenofproof,代码行数:56,代码来源:burdenofproof.py

示例5: _loadFilters

	def _loadFilters(self):
		self.terrain.setShaderInput('waterlevel', self._water_level)
		
		# load default shaders
		cf = CommonFilters(base.win, base.cam)
		# bloomSize
		cf.setBloom(size='small', desat=0.7, intensity=1.5, mintrigger=0.6, maxtrigger=0.95)
		# hdrtype:
		render.setAttrib(LightRampAttrib.makeHdr1())
		# perpixel:
		render.setShaderAuto()
开发者ID:Vetrik,项目名称:python-utils,代码行数:11,代码来源:main.py

示例6: postProcessingChanged

def postProcessingChanged():
    global filters
    if enablePostProcessing:
        if filters == None:
            filters = CommonFilters(base.win, base.cam)
        render.setAttrib(LightRampAttrib.makeHdr1())
        filters.setBloom(intensity = 1, size = 2)
    else:
        if filters != None:
            filters.delBloom()
    saveConfigFile()
开发者ID:wezu,项目名称:a3p-koparka,代码行数:11,代码来源:engine.py

示例7: filters

class filters():

    def __init__(self):

        self.filters = CommonFilters(base.win, base.cam)

        self.initCartoonInk()

    def initCartoonInk(self):

        self.filters.setCartoonInk(separation= -1)
开发者ID:flips30240,项目名称:Run-Free,代码行数:11,代码来源:filters.py

示例8: __init__

class Filters:
  """Class handles postprocessing filters and effects"""
  def __init__(self,manager,xml):
    self.cf = CommonFilters(base.win,base.cam)
    self.reload(manager,xml)


  def reload(self,manager,xml):
    hdr = xml.find('hdr')
    if hdr!=None:
      self.hdrtype = hdr.get('type')
      assert self.hdrtype in ['0', '1', '2']
    else:
      self.hdrtype = None

    self.perpixel =  xml.find('perpixel')!=None

    bloom = xml.find('bloom')
    if bloom!=None:
      self.bloomSize = bloom.get('size', 'medium')
    else:
      self.bloomSize = None

    self.showbuffers = xml.find('showbuffers')!=None


  def start(self):
    if self.hdrtype!=None:
      render.setAttrib(getattr(LightRampAttrib, "makeHdr" + self.hdrtype)())

    if self.perpixel:
      render.setShaderAuto()

    if self.bloomSize!=None:
      self.cf.setBloom(size=self.bloomSize)

    if self.showbuffers:
      base.bufferViewer.toggleEnable()


  def stop(self):
    if self.hdrtype!=None:
      render.clearAttrib(LightRampAttrib.getClassType())

    if self.perpixel:
      render.setShaderOff()
    
    if self.bloomSize!=None:
      self.cf.delBloom()
    
    if self.showbuffers:
      base.bufferViewer.toggleEnable()
开发者ID:StephenLujan,项目名称:Naith,代码行数:52,代码来源:filters.py

示例9: __init__

    def __init__(self):
        ShowBase.__init__(self)
        self.disableMouse()

        props = WindowProperties()
        props.setTitle('Test')
        self.win.requestProperties(props)

        # self.render.setAntiAlias(AntialiasAttrib.MAuto)

        self.transitions = Transitions(self.loader)
        self.transitions.setFadeColor(0, 0, 0)

        self.filters = CommonFilters(self.win, self.cam)
        # self.filters.setCartoonInk()
        self.filters.setBlurSharpen(1)
        # self.filters.setVolumetricLighting(self.render)

        # self.buffer = self.win.makeTextureBuffer("Post-processing buffer", self.win.getXSize(), self.win.getXSize())
        # print self.buffer.getYSize()
        # self.texture = self.buffer.getTexture()
        # self.buffer.setSort(-100)
        #
        # self.originalCamera = self.camera
        # self.offScreenCamera = self.makeCamera(self.buffer)
        # self.camera = self.offScreenCamera
        #
        # self.img = OnscreenImage(image=self.texture, pos=(0, 0, 0.5))

        self.scene = None
        self.channel = Channel()
开发者ID:and3rson,项目名称:gs,代码行数:31,代码来源:engine.py

示例10: __init__

	def __init__(self):
		base.disableMouse()
		base.setBackgroundColor(0.52, 0.80, 0.99)
		self.inputManager = InputManager()
		self.filters = CommonFilters(base.win, base.cam)
		filterok = self.filters.setBloom(blend=(0, 0, 0, 1), desat=-0.5, intensity=3.0, size=2)
		render.setShaderAuto()
		
		self.menuGraphics = loader.loadModel("Models/MenuGraphics.egg")

		self.fonts = {
			"silver": loader.loadFont("Fonts/LuconSilver.egg"),
			"blue": loader.loadFont("Fonts/LuconBlue.egg"),
			"orange": loader.loadFont("Fonts/LuconOrange.egg")
		}
		
		gui = Gui(self.fonts)
		self.race = Race(self.inputManager, gui)
		self.race.createDemoRace()
		self.createStartMenu()

		musicMgr = base.musicManager
		self.music = musicMgr.getSound("Sound/music_1.wav")
		self.music.setLoop(True)
		self.music.setVolume(.5)
		self.music.play()
开发者ID:Iraniya,项目名称:game,代码行数:26,代码来源:main.py

示例11: ToonMaker

class ToonMaker(DirectObject):
    def __init__(self):
        base.disableMouse()
        base.cam.node().getLens().setNear(10.0)
        base.cam.node().getLens().setFar(9999999)
        camera.setPos(0, -50, 0)
        
        # Check video card capabilities.
        
        if (base.win.getGsg().getSupportsBasicShaders() == 0):
            addTitle("Toon Shader: Video driver reports that shaders are not supported.")
            return
        
        # Enable a 'light ramp' - this discretizes the lighting,
        # which is half of what makes a model look like a cartoon.
        # Light ramps only work if shader generation is enabled,
        # so we call 'setShaderAuto'.

        tempnode = NodePath(PandaNode("temp node"))
        tempnode.setAttrib(LightRampAttrib.makeSingleThreshold(0.5, 0.4))
        tempnode.setShaderAuto()
        base.cam.node().setInitialState(tempnode.getState())
        
        # Use class 'CommonFilters' to enable a cartoon inking filter.
        # This can fail if the video card is not powerful enough, if so,
        # display an error and exit.
        
        self.separation = 1 # Pixels
        self.filters = CommonFilters(base.win, base.cam)
        filterok = self.filters.setCartoonInk(separation=self.separation)
        if (filterok == False):
            addTitle("Toon Shader: Video card not powerful enough to do image postprocessing")
            return
        
        # Create a non-attenuating point light and an ambient light.
        
        plightnode = PointLight("point light")
        plightnode.setAttenuation(Vec3(1,0,0))
        plight = render.attachNewNode(plightnode)
        plight.setPos(30,-50,0)
        alightnode = AmbientLight("ambient light")
        alightnode.setColor(Vec4(0.8,0.8,0.8,1))
        alight = render.attachNewNode(alightnode)
        render.setLight(alight)
        render.setLight(plight)
        
        # Panda contains a built-in viewer that lets you view the 
        # results of all render-to-texture operations.  This lets you
        # see what class CommonFilters is doing behind the scenes.
        
        self.accept("v", base.bufferViewer.toggleEnable)
        self.accept("V", base.bufferViewer.toggleEnable)
        base.bufferViewer.setPosition("llcorner")
        self.accept("s", self.filters.manager.resizeBuffers)
        
        # These allow you to change cartooning parameters in realtime
        
        self.accept("escape", sys.exit, [0])
开发者ID:mitchellvitez,项目名称:Bubble-Bonanza,代码行数:58,代码来源:fishtank_single_copy.py

示例12: __init__

	def __init__(self, neweval, starList=[]):#, console=[]):
                #messenger.toggleVerbose()
                self.stars=starList
                self.mouselook=True
                self.zoom = .33
                self.mapMode = False
                self.evaluator = neweval
                self.hudScale = 1
                self.objectScale=.01
                self.starScale = .1
                self.skyScale=40000
		self.dt=.02
		self.starting=True
		self.mouseX = 0
                self.mouseY = 0
                self.dX=0
                self.dY=0
                self.dZ=0
                self.player = Body()
##		self.mouseBody = Body()
##		self.mouseBody.name = "mouse"
		self.player.name = "player"
		self.player.mass = 0
		self.player.position.x=0
		self.player.position.y=0
		self.player.position.z=-0.04
		self.player.orientation.y=90
		self.accRate =2
#		self.player.bodies=[]
#		self.evaluator.system.bodies.append(self.player)
		neweval.system.bodies.append(self.player)

                self.evaluator= soPhysics.soPhysics(neweval.system)                
                self.evaluator.system.moveToStar()
                self.filters = CommonFilters(base.win, base.cam)
                self.filterok = self.filters.setBloom(blend=(1,1,1,1), desat=-0.5, intensity=1.0, size="small")
                self.glowSize=1
                
                #base.enableParticles()
		#self.p = ParticleEffect()
                #self.p.loadConfig("sun2.ptf")


                self.loadPlanets()
                
                #self.console = console

                self.toggleConsole()
                
                if len(starList)>0:
                        self.loadStars()
                base.camLens.setNear(0.01)
                base.camLens.setFar(100000)
#		base.camLens.setFar(170000000000000000000000000000000000000)
         	self.mouselook=False
         	#render.setShaderAuto()
		self.loadLights()
		taskMgr.add(self.move,"move")
开发者ID:m181190,项目名称:stableorbit,代码行数:58,代码来源:planetarium.py

示例13: Filters

class Filters():

    def __init__(self):
        self.filters = CommonFilters(base.win, base.cam)
        self.glowShader = loader.loadShader("./shaders/glowShader.sha")

    def enableFilters(self, player):
        #self.filters.setBloom(mintrigger=.35)
        self.filters.setBloom(blend=(1, 0, .2, 1), desat=-1, intensity=10, size="small")
        #self.filters.setCartoonInk(separation=-5)
        self.filters.setAmbientOcclusion(numsamples = 2, radius = 0.0025, amount = 2, strength = 0.001, falloff = 0.01)

        player.setShader(self.glowShader)
        player.setShaderInput("scale",4,4)

        path = render.find("renderDummy")

        path.setShader(self.glowShader)
        path.setShaderInput("scale",1,1,1)
开发者ID:flips30240,项目名称:VoxelDash,代码行数:19,代码来源:Filters.py

示例14: initShader

 def initShader(self):
     tempnode = NodePath(PandaNode("temp node"))
     tempnode.setAttrib(LightRampAttrib.makeSingleThreshold(0.5, 0.9))
     tempnode.setShaderAuto()
     base.cam.node().setInitialState(tempnode.getState())
     self.separation = 1 # Pixels
     self.filters = CommonFilters(base.win, base.cam)
     filterok = self.filters.setBloom()
     if (filterok == False):
         addTitle("Toon Shader: Video card not powerful enough to do image postprocessing")
         sys.exit
开发者ID:warycat,项目名称:Debugger,代码行数:11,代码来源:Arena.py

示例15: __init__

 def __init__(self, mouse):
     ShowBase.__init__(self)
     self.mouse = mouse
     self.joy_x = None
     self.joy_y = None
     props = WindowProperties()
     props.setMouseMode(WindowProperties.MRelative)  # keep mouse in screen
     self.disableMouse()
     self.win.requestProperties(props)
     self.setBackgroundColor(0, 0, 0)
     # Make missiles glow
     self.filters = CommonFilters(self.win, self.cam)
     self.filters.setBloom(blend=(0, 0, 0, 1), desat=-0.5, intensity=3.0, size="large")
     self.screen_width = self.win.getXSize()
     self.screen_height = self.win.getYSize()
     self.center_x = self.screen_width/2
     self.center_y = self.screen_height/2
     # self.win.movePointer(0, self.center_x, self.center_y)
     self.enableParticles()
     self.cTrav = CollisionTraverser()
     # self.cTrav.setRespectPrevTransform(True)
     self.pusher = PhysicsCollisionHandler()
     self.pusher.addInPattern('%fn-into-%in')
     self.target = None
     self.maxvel = 50
     self.roll_time = 0
     self.fuel = 1000
     self.ship()
     self.sounds()
     self.hud()
     self.part = Spacedust(self)
     self.events()
     self.camLens.setFov(70)
     self.camLens.setNear(1)
     self.camLens.setFar(500)
     self.get_key = {
         "ACCEL": False,
         "DECEL": False,
         "FORWARD_THRUST": False,
         "REVERSE_THRUST": False,
         "ROLL_LEFT": False,
         "ROLL_RIGHT": False,
         "ROLL_LEFT_BEG": False,
         "ROLL_RIGHT_BEG": False,
         "FIRE": False,
         "FIRING": False,
         "LOCK": False,
         "LOCKING": False,
     }
     self.AIworld = AIWorld(self.render)
     self.taskMgr.add(self.update, "task-update")
     self.taskMgr.doMethodLater(1, self.fuel_usage, "task-fuel-usage")
     self.taskMgr.add(self.AI_update, "AI-update")
     self.gen_enemy()
开发者ID:freevryheid,项目名称:spanda3D,代码行数:54,代码来源:engine.py


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