###########################################################
# Load Lighting - Railshooter Module
# Creates the Lighting Setups used for the Game
###########################################################

# DESCRIPTION:
# This Class contains the various Light Setups used in this
# game.  At the moment, only the Level1Outdoors Setting is
# available.


from direct.showbase.ShowBaseGlobal import *
from direct.showbase import DirectObject

import ClassGlobals


########################################
# Lighting Class
########################################
class Lighting(DirectObject.DirectObject):
    def __init__(self):
	pass

    # Load Outdoor Lighting Setup
    def level1Outdoors(self):

	# Create the Light Attribute
	lightAttributes = LightAttrib.makeAllOff()


	# Create a Slightly Red-Pink Ambient Light
	self.ambientLight = AmbientLight("ambientLight")
	# self.ambientLight.setColor(Vec4( 0.2, 0.2, 0.1, 1 ))
	self.ambientLight.setColor(Vec4( 0.3, 0.15, 0.08, 1 ))
	lightAttributes = lightAttributes.addLight(self.ambientLight)
	render.attachNewNode(self.ambientLight.upcastToPandaNode()) 


	# Create a Red-Orange Directional Light
	self.directionalLight = DirectionalLight("directionalLight")
	# self.directionalLight.setColor(Vec4( 1.0, 0.5, 0.3, 1 ))
	self.directionalLight.setColor(Vec4( 1.0, 1.0, 0.7, 1 ))

	# Set Lighting Direction, given as a 3D vector
	# self.directionalLight.setDirection(Vec3( 1, 1, -2 )) 
	# self.directionalLight.setDirection( Vec3( 15, 45, 0 ) )
	self.directionalLight.setDirection( Vec3(-90, 0, -90) )
        lightAttributes = lightAttributes.addLight(self.directionalLight)
 	render.attachNewNode(self.directionalLight.upcastToPandaNode()) 


	# Create a Blue-Purple Directional Light in the Opposite Direction
	self.directionalLight = DirectionalLight("directionalLight")
	# self.directionalLight.setColor(Vec4( 1.0, 0.5, 0.3, 1 ))
	self.directionalLight.setColor(Vec4( 0.1, 0.2, 0.5, 1 ))

	# Set Lighting Direction, given as a 3D vector
	self.directionalLight.setDirection( Vec3(90, 0, -90) )
        lightAttributes = lightAttributes.addLight(self.directionalLight)
 	render.attachNewNode(self.directionalLight.upcastToPandaNode()) 

	# Enable Lighting
	render.node().setAttrib(lightAttributes)
