def buildDirectionalLight(self, hpr, pos, color, near, far, casts_shadow,
                           shadow_caster, film_size):
     """
 Builds a Panda3D directional light with the specified rotation, position
 and color. 
 NOTE: This light tends to be buggy. Requires at least one spotlight for it 
 to work properly. 
 """
     if not self.has_dlight:
         self.light_counter += 1
         dlight = DirectionalLight("light%s" % self.light_counter)
         dlight.getLens().setFilmSize(*film_size)
         dlight.getLens().setNearFar(near, far)
         if shadow_caster:
             x, y = shadow_caster
             dlight.setShadowCaster(True, x, y)
         else:
             dlight.setShadowCaster(False)
         #dlight.showFrustum()
         dlightnp = render.attachNewNode(dlight)
         dlightnp.setPos(VBase3(*pos))
         dlightnp.setHpr(VBase3(*hpr))
         dlight.setColor(VBase4(*color))
         render.setLight(dlightnp)
         return dlightnp
     else:
         return 0
Ejemplo n.º 2
0
    def start(self):
        self.resetCamera()
        self.loadPlanet()
        self.loadShips()
        self.loadPlayers()
        self.loadStars()
        self.loadHUD()

        light = DirectionalLight('light')
        light.setDirection(Vec3(-1, .1, -.5))
        light.setColor(Vec4(.7, .6, .6, 0))
        light.setSpecularColor(Vec4(.3, .5, .7, 0))
        lightnode = render.attachNewNode(light)
        render.setLight(lightnode)

        render.setShaderAuto()
        render.setShaderInput('light', lightnode)

        render.setAntialias(AntialiasAttrib.MAuto)

        # TODO: it might be necessary here to check that the task
        # does not already exist in the task manager because the
        # unit tests at the moment call the start method
        # continuously.
        taskMgr.add(self.tick, "gameloop")
        self.time = self.getTime()
        self.registerListeners()
        self.state = Game.STATE_RUNNING

        # Load music
        self.music = loader.loadSfx('MVi - Ilwrath Are Watching.mp3')
        self.music.setLoop(True)
        self.music.setVolume(0.5)
        self.music.play()
Ejemplo n.º 3
0
    def set_lighting(self):
        dlight = DirectionalLight('dlight')
        dlnp = self.render.attachNewNode(dlight)
        dlnp.setHpr(45,-45,0)
        self.render.setLight(dlnp)

        ambientLight = AmbientLight('ambientLight')
        ambientLight.setColor(VBase4(0.5, 0.5, 0.5, 1))
        ambientLightNP = render.attachNewNode(ambientLight)
        self.render.setLight(ambientLightNP)
Ejemplo n.º 4
0
	def init_node_path(self):
		if self.node_path:
			self.parent.node_path_mesh.clearLight(self.node_path)
			self.node_path.remove()
		from pandac.PandaModules import DirectionalLight
		dlight = DirectionalLight('dlight')
		dlight.setColor(VBase4(*[x / 2048.0 for x in self.color] + [1.0]))
		self.node_path = self.parent.node_path_mesh.attachNewNode(dlight)
		self.node_path.setPos(*coords_to_panda(*self.direction.coords))
		self.node_path.lookAt(0,0,0)
		self.parent.node_path_mesh.setLight(self.node_path)
Ejemplo n.º 5
0
 def setupLights(self):
     lAttrib = LightAttrib.makeAllOff()
     ambientLight = AmbientLight( "ambientLight" )
     ambientLight.setColor( Vec4(.4, .4, .35, 1) )
     lAttrib = lAttrib.addLight( ambientLight )
     directionalLight = DirectionalLight( "directionalLight" )
     directionalLight.setDirection( Vec3( 0, 8, -2.5 ) )
     directionalLight.setColor( Vec4( 0.9, 0.8, 0.9, 1 ) )
     lAttrib = lAttrib.addLight( directionalLight )
     render.attachNewNode( directionalLight.upcastToPandaNode() ) 
     render.attachNewNode( ambientLight.upcastToPandaNode() ) 
     render.node().setAttrib( lAttrib )
Ejemplo n.º 6
0
	def addLight(self, type, tag, pos, color, hpr):
		''' Create a light of the given type and assign the given properties.
			Dynamic class instantantiation is difficult due to the Panda module
			layout so we use conditionals
			TODO - support for attenuation.
		'''
		
		LOG.debug("[GXMgr] Adding light of type %s"%type)
		
		if hasattr(pandac.PandaModules, type):
			LOG.debug("[GXMgr] Found light class - %s"%type)
			
			if (type.lower() == 'ambientlight'):
				from pandac.PandaModules import AmbientLight
				l = AmbientLight(tag)
				if color:
					l.setColor(color)
				lnp = render.attachNewNode(l)
			elif (type.lower() == 'directionallight'):
				from pandac.PandaModules import DirectionalLight
				l = DirectionalLight(tag)
				if color:
					l.setColor(color)
				lnp = render.attachNewNode(l)
				if hpr:
					lnp.setHpr(hpr)
			elif (type.lower() == 'pointlight'):
				from pandac.PandaModules import PointLight
				l = PointLight(tag)
				if color:
					l.setColor(color)
				lnp = render.attachNewNode(l)
				if pos:
					lnp.setPos(pos)
			elif (type.lower() == 'spotlight'):
				from pandac.PandaModules import Spotlight
				l = Spotlight(tag)
				if lens:
					lightLens = PerspectiveLens()
					l.setLens(lightLens)
				if color:
					l.setColor(color)
				lnp = render.attachNewNode(l)
				if hpr:
					lnp.setHpr(hpr)
				if pos:
					lnp.setPos(pos)
			
			self.lightList.append(lnp)
			render.setLight(lnp)
		else:
			LOG.error("[GXMgr] Unknown light class - %s"%type)
Ejemplo n.º 7
0
    def create(self, lightAttrib):
        #create directional light
        directionalLight = DirectionalLight(self.name)
        directionalLight.setDirection(self.direction)
        directionalLight.setColor(self.color * self.intensity)
        directionalLight.setSpecularColor(Vec4(0.5, 0.5, 0.5, 0.5))
        lightAttrib = lightAttrib.addLight(directionalLight)

        #attach lights to scene graph
        render.attachNewNode(directionalLight)
        self.directionalLight = directionalLight

        return lightAttrib
Ejemplo n.º 8
0
 def init_lights(self):
     from pandac.PandaModules import AmbientLight, DirectionalLight
     from pandac.PandaModules import ShadeModelAttrib
     # Set flat shading
     flatShade = ShadeModelAttrib.make(ShadeModelAttrib.MFlat)
     self.nodePath.setAttrib(flatShade)
     # Create directional light
     dlight1 = DirectionalLight('dlight1')
     dlight1.setColor(VBase4(1.0, 1.0, 1.0, 1.0))
     dlnp1 = self.nodePath.attachNewNode(dlight1)
     dlnp1.setHpr(-10, -30, 0)
     self.nodePath.setLight(dlnp1)
     # Create second directional light
     dlight2 = DirectionalLight('dlight2')
     dlight2.setColor(VBase4(0.0, 0.1, 0.2, 1.0))
     dlnp2 = self.nodePath.attachNewNode(dlight2)
     dlnp2.setHpr(170, 0, 0)
     self.nodePath.setLight(dlnp2)
     # Create ambient light
     alight = AmbientLight('alight')
     alight.setColor(VBase4(0.3, 0.3, 0.3, 1.0))
     alnp = self.nodePath.attachNewNode(alight)
     self.nodePath.setLight(alnp)
Ejemplo n.º 9
0
	def setupLights(self):
		lAttrib = LightAttrib.makeAllOff()
		ambientLight = AmbientLight( "ambientLight" )
		ambientLight.setColor( Vec4(.6, .6, .55, 1) )
		lAttrib = lAttrib.addLight( ambientLight )
		directionalLight = DirectionalLight( "directionalLight" )
		directionalLight.setDirection( Vec3( 0, 8, -2.5 ) )
		directionalLight.setColor( Vec4( 0.9, 0.8, 0.9, 1 ) )
		lAttrib = lAttrib.addLight( directionalLight )
		#set lighting on teapot so steam doesn't get affected
		#self.t.attachNewNode( directionalLight.upcastToPandaNode() )
		self.t.attachNewNode( directionalLight ) 
		#self.t.attachNewNode( ambientLight.upcastToPandaNode() )
		self.t.attachNewNode( ambientLight) 
		self.t.node().setAttrib( lAttrib )
Ejemplo n.º 10
0
    def setLights(self):
        # Ambient Light
        ambientLight = AmbientLight('ambientLight')
        ambientLight.setColor(Vec4(0.1, 0.1, 0.1, 1))
        ambientLightNP = render.attachNewNode(ambientLight.upcastToPandaNode())
        render.setLight(ambientLightNP)

        # Directional light 01
        directionalLight = DirectionalLight("directionalLight")
        directionalLight.setColor(Vec4(1, 1, 1, 1))
        directionalLightNP = render.attachNewNode(
            directionalLight.upcastToPandaNode())
        directionalLightNP.setPos(10, -20, 20)
        directionalLightNP.lookAt(0, 0, 0)
        render.setLight(directionalLightNP)

        # Directional light 02
        directionalLight = DirectionalLight("directionalLight")
        directionalLight.setColor(Vec4(1, 1, 1, 1))
        directionalLightNP = render.attachNewNode(
            directionalLight.upcastToPandaNode())
        directionalLightNP.lookAt(0, 0, 0)
        directionalLightNP.setPos(10, 20, 20)
        render.setLight(directionalLightNP)
Ejemplo n.º 11
0
 def __init__( self, *args, **kwargs ):
     p3d.Object.__init__( self, *args, **kwargs )
     
     self._gizmos = {}
     self._activeGizmo = None
     
     # Create gizmo manager mouse picker
     self.picker = p3d.MousePicker( 'mouse', *args, **kwargs )
     self.picker.Start()
     
     # Create a directional light and attach it to the camera so the gizmos
     # don't look flat
     dl = DirectionalLight( 'gizmoManagerDirLight' )
     self.dlNp = self.camera.attachNewNode( dl )
     self.rootNp.setLight( self.dlNp )
Ejemplo n.º 12
0
    def __init__(self):
        """Initialise the scene."""

        # Show the framerate
        base.setFrameRateMeter(True)

        # Initialise terrain:
        # Make 4 terrain nodepath objects with different hilliness values
        # and arrange them side-by-side in a 2x2 grid, giving a big terrain
        # with variable hilly and flat areas.

        color = (0.6, 0.8, 0.5, 1)  # Bright green-ish
        scale = 12
        height = 18  # FIXME: For now we are raising the terrain so it
        # floats above the sea to prevent lakes from
        # appearing (but you still get them sometimes)

        t1 = Terrain(color=color,
                     scale=scale,
                     trees=0.7,
                     pos=P.Point3(0, 0, height))
        t1.prime.reparentTo(render)
        t2 = Terrain(color=color,
                     scale=scale,
                     h=24,
                     pos=P.Point3(32 * scale, 0, height),
                     trees=0.5)
        t2.prime.reparentTo(render)
        t3 = Terrain(color=color,
                     scale=scale,
                     h=16,
                     pos=P.Point3(32 * scale, 32 * scale, height),
                     trees=0.3)
        t3.prime.reparentTo(render)
        t4 = Terrain(color=color,
                     scale=scale,
                     h=2,
                     pos=P.Point3(0, 32 * scale, height),
                     trees=0.9)
        t4.prime.reparentTo(render)

        #tnp1.setPos(tnp1,-32,-32,terrainHeight)

        # Initialise sea
        sea = Sea()

        # Initialise skybox.
        self.box = loader.loadModel("models/skybox/space_sky_box.x")
        self.box.setScale(6)
        self.box.reparentTo(render)

        # Initialise characters
        self.characters = []
        self.player = C.Character(model='models/eve',
                                  run='models/eve-run',
                                  walk='models/eve-walk')
        self.player.prime.setZ(100)
        self.player._pos = SteerVec(32 * 12 + random.random() * 100,
                                    32 * 12 + random.random() * 100)
        self.player.maxforce = 0.4
        self.player.maxspeed = 0.55
        EdgeScreenTracker(self.player.prime, dist=200)  # Setup camera
        for i in range(0, 11):
            self.characters.append(C.Character())
            self.characters[i].prime.setZ(100)
            self.characters[i].wander()
            self.characters[i].maxforce = 0.3
            self.characters[i].maxspeed = 0.2
            self.characters[i]._pos = SteerVec(32 * 12 + random.random() * 100,
                                               32 * 12 + random.random() * 100)

        C.setContainer(
            ContainerSquare(pos=SteerVec(32 * 12, 32 * 12), radius=31 * 12))

        #C.toggleAnnotation()

        # Initialise keyboard controls.
        self.accept("c", C.toggleAnnotation)
        self.accept("escape", sys.exit)

        # Setup CollisionRay and CollisionHandlerQueue for mouse picking.
        self.pickerQ = P.CollisionHandlerQueue()
        self.picker = camera.attachNewNode(
            P.CollisionNode('Picker CollisionNode'))
        self.picker.node().addSolid(P.CollisionRay())
        # We want the picker ray to collide with the floor and nothing else.
        self.picker.node().setFromCollideMask(C.floorMASK)
        self.picker.setCollideMask(P.BitMask32.allOff())
        base.cTrav.addCollider(self.picker, self.pickerQ)
        try:
            handler.addCollider(self.picker, camera)
        except:
            pass
        self.accept('mouse1', self.onClick)

        # Set the far clipping plane to be far enough away that we can see the
        # skybox.
        base.camLens.setFar(10000)

        # Initialise lighting
        self.alight = AmbientLight('alight')
        self.alight.setColor(VBase4(0.35, 0.35, 0.35, 1))
        self.alnp = render.attachNewNode(self.alight)
        render.setLight(self.alnp)

        self.dlight = DirectionalLight('dlight')
        self.dlight.setColor(VBase4(0.4, 0.4, 0.4, 1))
        self.dlnp = render.attachNewNode(self.dlight)
        self.dlnp.setHpr(45, -45, 0)
        render.setLight(self.dlnp)

        self.plight = PointLight('plight')
        self.plight.setColor(VBase4(0.8, 0.8, 0.5, 1))
        self.plnp = render.attachNewNode(self.plight)
        self.plnp.setPos(160, 160, 50)

        self.slight = Spotlight('slight')
        self.slight.setColor(VBase4(1, 1, 1, 1))
        lens = PerspectiveLens()
        self.slight.setLens(lens)
        self.slnp = render.attachNewNode(self.slight)
        self.slnp.setPos(-20, -20, 20)
        self.slnp.lookAt(50, 50, 0)

        # Initialise some scene-wide exponential fog
        colour = (0.5, 0.8, 0.8)
        self.expfog = Fog("Scene-wide exponential Fog object")
        self.expfog.setColor(*colour)
        self.expfog.setExpDensity(0.0005)
        render.setFog(self.expfog)
        base.setBackgroundColor(*colour)

        # Add a task for this Plant to the global task manager.
        self.stepcount = 0
        taskMgr.add(self.step, "Plant step task")
    def __init__(self, filters):
        self.filters = filters
        self.updateTask = None
        self.finalQuad = None

        self.sun = base.cam.attachNewNode('sun')
        loader.loadModel("models/sphere").reparentTo(self.sun)
        self.sun.setScale(0.08)
        self.sun.setTwoSided(True)
        self.sun.setColorScale(1.0, 1.0, 1.0, 1.0, 10001)
        self.sun.setLightOff(1)
        self.sun.setShaderOff(1)
        self.sun.setFogOff(1)
        self.sun.setCompass()
        self.sun.setBin('background', 2)
        self.sun.setDepthWrite(False)
        self.sun.setDepthTest(False)
        # Workaround an annoyance in Panda. No idea why it's needed.
        self.sun.node().setBounds(OmniBoundingVolume())     

        direct = Vec4(2.0, 1.9, 1.8, 1) #bright for hdr
        #direct = Vec4(0.7, 0.65, 0.6, 1)
        self.dlight = DirectionalLight('dlight')
        self.dlight.setColor(direct)
        dlnp = self.sun.attachNewNode(self.dlight)
        render.setLight(dlnp)
        render.setShaderInput('dlight0', dlnp)

        self.setTime(700.0)

        pandaVolumetricLighting = False


        if pandaVolumetricLighting:
            self.filters.setVolumetricLighting( dlnp )
        else:
            self.vlbuffer = base.win.makeTextureBuffer('volumetric-lighting', base.win.getXSize() / 2, base.win.getYSize() / 2)
            self.vlbuffer.setClearColor(Vec4(0, 0, 0, 1))
            cam = base.makeCamera(self.vlbuffer)
            cam.node().setLens(base.camLens)
            cam.reparentTo(base.cam)
            initstatenode = NodePath('InitialState')
            initstatenode.setColorScale(0, 0, 0, 1, 10000)
            initstatenode.setShaderOff(10000)
            initstatenode.setFogOff(1)
            initstatenode.setLightOff(10000)
            initstatenode.setMaterialOff(10000)
            initstatenode.setTransparency(TransparencyAttrib.MBinary, 10000)
            cam.node().setCameraMask(BitMask32.bit(2))
            cam.node().setInitialState(initstatenode.getState())
            self.vltexture = self.vlbuffer.getTexture()
            self.vltexture.setWrapU(Texture.WMClamp)
            self.vltexture.setWrapV(Texture.WMClamp)
            card = CardMaker('VolumetricLightingCard')
            card.setFrameFullscreenQuad()
            self.finalQuad = render2d.attachNewNode(card.generate())
            self.finalQuad.setAttrib(ColorBlendAttrib.make(ColorBlendAttrib.MAdd, ColorBlendAttrib.OIncomingColor, ColorBlendAttrib.OFbufferColor))
            self.finalQuad.setShader(Shader.load("shaders/filter-vlight.cg"))
            self.finalQuad.setShaderInput('src', self.vltexture)
            self.finalQuad.setShaderInput('vlparams', 32, 0.95 / 32.0, 0.985, 0.5) # Note - first 32 is now hardcoded into shader for cards that don't support variable sized loops.
            self.finalQuad.setShaderInput('casterpos', 0.5, 0.5, 0, 0)
            # Last parameter to vlcolor is the exposure
            vlcolor = Vec4(1, 0.99, 0.80, 0.03)
            self.finalQuad.setShaderInput('vlcolor', vlcolor)

        self.start()
Ejemplo n.º 14
0
    def __init__(self):
        from pandac.PandaModules import CollisionHandlerFloor, CollisionHandlerPusher, CollisionHandlerEvent, CollisionTraverser
        from pandac.PandaModules import DirectionalLight, AmbientLight, VBase4
        ShowBase.__init__(self)

        self.sky = self.loader.loadModel('models/sky-sphere')
        self.sky.reparentTo(self.render)
        self.stage = self.loader.loadModel('models/test-collide')
        self.stage.reparentTo(self.render)
        self.floor = self.stage.findAllMatches('**/=CollideType=floor')
        self.floor.setCollideMask(FLOOR_MASK)
        self.obstacles = self.stage.findAllMatches('**/=CollideType=obstacle')
        if self.obstacles:
            self.obstacles.setCollideMask(OBSTACLE_MASK)
        self.zones = self.stage.findAllMatches('**/=CollideType=zone')
        if self.zones:
            self.zones.setCollideMask(ZONE_MASK)
        self.create_stanchions()

        # Character rig, which allows camera to follow character
        self.char_rig = self.stage.attachNewNode('char_rig')

        self.active_char = Character('mainchar', self.char_rig)

        self.cam.reparentTo(self.char_rig)
        self.cam.setPos(0.5, -3, 1.5)
        self.cam.lookAt(0.5, 0, 1.5)

        self.light = DirectionalLight('dlight')
        self.light.setColor(VBase4(0.3, 0.28, 0.26, 1.0))
        self.lightNP = self.stage.attachNewNode(self.light)
        self.lightNP.setHpr(-75, -45, 0)
        self.stage.setLight(self.lightNP)

        self.amblight = AmbientLight('amblight')
        self.amblight.setColor(VBase4(0.7, 0.68, 0.66, 1.0))
        self.amblightNP = self.stage.attachNewNode(self.amblight)
        self.stage.setLight(self.amblightNP)

        self.accept('w', self.active_char.begin_forward)
        self.accept('a', self.active_char.begin_left)
        self.accept('s', self.active_char.begin_backward)
        self.accept('d', self.active_char.begin_right)
        self.accept('w-up', self.active_char.end_forward)
        self.accept('a-up', self.active_char.end_left)
        self.accept('s-up', self.active_char.end_backward)
        self.accept('d-up', self.active_char.end_right)
        self.taskMgr.add(self.active_char.MoveTask, 'MoveTask')

        self.look = False
        self.prev_pos = None
        self.accept('mouse2', self.begin_look)
        self.accept('mouse2-up', self.end_look)
        self.accept('mouse3', self.active_char.begin_spin)
        self.accept('mouse3-up', self.active_char.end_spin)
        self.taskMgr.add(self.MouseTask, 'MouseTask')

        self.floor_handler = CollisionHandlerFloor()
        self.floor_handler.addCollider(self.active_char.actor_from_floor,
                                       self.char_rig)
        self.wall_handler = CollisionHandlerPusher()
        self.wall_handler.addCollider(self.active_char.actor_from_obstacle,
                                      self.char_rig)
        self.zone_handler = CollisionHandlerEvent()
        self.zone_handler.addInPattern('%fn-into')
        self.zone_handler.addOutPattern('%fn-out')

        def foo(entry):
            print 'You are in the zone'

        def bar(entry):
            print 'You are not in the zone'

        self.accept('blockchar_zone-into', foo)
        self.accept('blockchar_zone-out', bar)
        self.cTrav = CollisionTraverser('main traverser')
        self.cTrav.setRespectPrevTransform(True)
        self.cTrav.addCollider(self.active_char.actor_from_floor,
                               self.floor_handler)
        self.cTrav.addCollider(self.active_char.actor_from_obstacle,
                               self.wall_handler)
        self.cTrav.addCollider(self.active_char.actor_from_zone,
                               self.zone_handler)
Ejemplo n.º 15
0
        if self.steer2d:
            base.cam.setX(self.avatar.getX())
            base.cam.setZ(self.avatar.getZ() + self.camdistZ)
        base.cam.lookAt(self.avatar)

        return Task.cont


#=========================================================================
# Main
#=========================================================================

alight = AmbientLight('alight')
alight.setColor((.3, .3, .3, 1))
alnp = render.attachNewNode(alight)
render.setLight(alnp)

dlight = DirectionalLight('dlight')
lv = .6
dlight.setColor((lv, lv, lv, 1))
dlnp = render.attachNewNode(dlight)
render.setLight(dlnp)
dlnp.setPos(0, -20, 35)
dlnp.lookAt(0, 0, 0)

DO = DirectObject()
DO.accept('c', toggle_collisions)
DO.accept('h', toggle_info)
DO.accept('x', toggle_wire)
DO.accept('escape', sys.exit)
Ejemplo n.º 16
0
	def __init__(self):
		ShowBase.__init__(self)

		# generate a new game
		game = Game()
		game.create_player('Player One')
		game.create_player('Player Two')
		game.create_player('Player Three')

		game.initialize_board()

		# place some random cities
		for player in game.players.values():
			# give the player some random resources
			for resource in player.resources:
				player.resources[resource] = random.randint(0,8)
			while True:
				n = random.choice(game.board.network.nodes())
				if game.board.node_available(n):
					game.board.update_building(n, player, 'city')

					# place a random road
					m = random.choice(game.board.network.neighbors(n))
					game.board.network.edge[n][m]['road'] = True
					game.board.network.edge[n][m]['player'] = player
					break

		self.board_renderer = BoardRenderer(self, game.board)
		self.hand_renderer = HandRenderer(self, game.players.values()[0])

		# setup some 3-point lighting for the whole board
		lKey = DirectionalLight('lKey')
		lKey.setColor(VBase4(0.9,0.9,0.9,1))
		lKeyNode = render.attachNewNode(lKey)
		lKeyNode.setH(-63)
		lKeyNode.setP(-60)
		lKeyNode.setR(-30)
		render.setLight(lKeyNode)

		lFill = DirectionalLight('lFill')
		lFill.setColor(VBase4(0.4,0.4,0.4,1))
		lFillNode = render.attachNewNode(lFill)
		lFillNode.setH(27)
		lFillNode.setP(-15)
		lFillNode.setR(-30)
		render.setLight(lFillNode)

		lBack = DirectionalLight('lBack')
		lBack.setColor(VBase4(0.3,0.3,0.3,1))
		lBackNode = render.attachNewNode(lBack)
		lBackNode.setH(177)
		lBackNode.setP(-20)
		lBackNode.setR(0)
		render.setLight(lBackNode)

		lBelow = DirectionalLight('lBelow')
		lBelow.setColor(VBase4(0.4,0.4,0.4,1))
		lBelowNode = render.attachNewNode(lBelow)
		lBelowNode.setH(0)
		lBelowNode.setP(90)
		lBelowNode.setR(0)
		render.setLight(lBelowNode)

		self.accept('a', self.on_toggle_anti_alias)
		self.mouse_controlled = True
		self.on_toggle_mouse_control()
		self.accept('m', self.on_toggle_mouse_control)
		self.accept('q', self.on_quit)

		# onto-board selection collision test
		select_mask = BitMask32(0x100)
		self.select_ray = CollisionRay()
		select_node = CollisionNode('mouseToSurfaceRay')
		select_node.setFromCollideMask(select_mask)
		select_node.addSolid(self.select_ray)
		select_np = self.camera.attachNewNode(select_node)

		self.select_queue = CollisionHandlerQueue()
		self.select_traverser = CollisionTraverser()
		self.select_traverser.addCollider(select_np, self.select_queue)

		# create a plane that only collides with the mouse ray
		select_plane = CollisionPlane(Plane(Vec3(0,0,1), Point3(0,0,0)))

		# add plane to render
		self.select_node = CollisionNode('boardCollisionPlane')
		self.select_node.setCollideMask(select_mask)
		self.select_node.addSolid(select_plane)
		self.select_plane_np = self.render.attachNewNode(self.select_node)

		self.debug_select = draw_debugging_arrow(self, Vec3(0,0,0), Vec3(0,1,0))

		self.taskMgr.add(self.update_mouse_target, "mouseTarget")
		self.taskMgr.add(self.update_debug_arrow, "updateDebugArrow")