/*
* Project Beknyou
* Copyright (c) 2010-2011 Saint Paul College, All Rights Reserved
* Redistributions in source code form must reproduce the above
* Copyright and this condition.
* The contents of this file are subject to the GNU General Public
* License, Version 2 (the "License"); you may not use this file
* except in compliance with the License. A copy of the License is
* available at http://www.opensource.org/licenses/gpl-license.php.
*/
package com.benkyou.client.systems;
import com.benkyou.client.GameClient;
import com.jme3.light.DirectionalLight;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.queue.RenderQueue.ShadowMode;
import com.jme3.shadow.BasicShadowRenderer;
/**
*
* @author Austin Allman
*/
public class LightManagmentSystem {
private GameClient gameClient;
private DirectionalLight sun;
/**
*
* @param gameClient
*/
public LightManagmentSystem(GameClient gameClient) {
this.gameClient = gameClient;
}
/**
*
*/
public void defaultLighting() {
//create light
sun = new DirectionalLight();
sun.setColor(ColorRGBA.White);
sun.setDirection(new Vector3f(-0.1f, -10f, -1.0f).normalizeLocal());
gameClient.getRootNode().addLight(sun);
//light test stuff
gameClient.getRootNode().setShadowMode(ShadowMode.Off);
BasicShadowRenderer bsr = new BasicShadowRenderer(gameClient.getAssetManager(), 512);
bsr.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
gameClient.getTerrainSystem().getTerrain().setShadowMode(ShadowMode.Receive);
gameClient.getViewPort().addProcessor(bsr);
}
}