/**
*
*/
package net.cis.client.game;
import net.cis.client.game.scenery.factory.SkyBoxFactory;
import net.cis.client.game.ui.util.ResourceConstants;
import net.cis.client.login.CharacterViewUIController;
import com.jme3.app.SimpleApplication;
import com.jme3.light.DirectionalLight;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.niftygui.NiftyJmeDisplay;
import com.jme3.post.FilterPostProcessor;
import com.jme3.post.filters.BloomFilter;
import com.jme3.scene.Spatial;
import de.lessvoid.nifty.Nifty;
/**
* @author SchaeckerM
*
*/
public class TestLogin extends SimpleApplication {
private Nifty nifty;
public TestLogin() {
}
public static void main(String[] args) {
TestLogin app = new TestLogin();
app.setPauseOnLostFocus(false);
app.start();
}
@Override
public void simpleInitApp() {
FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
BloomFilter bloom = new BloomFilter(BloomFilter.GlowMode.Objects);
fpp.addFilter(bloom);
viewPort.addProcessor(fpp);
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager,
inputManager, audioRenderer, guiViewPort);
nifty = niftyDisplay.getNifty();
nifty.setGlobalProperties(ResourceConstants.getUserProperties());
nifty.fromXml("login/characterUI.xml", "characterUI", new CharacterViewUIController(this));
guiViewPort.addProcessor(niftyDisplay);
flyCam.setEnabled(false);
cam.setLocation(new Vector3f(0f,0f,10f));
inputManager.setCursorVisible(true);
rootNode.attachChild(SkyBoxFactory.createSimpleSkyBox(assetManager));
Spatial platform = assetManager
.loadModel("spaceobject/station/platform/Platform.mesh.xml");
Material mat_platform = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md");
mat_platform.setTexture("ColorMap", assetManager
.loadTexture("spaceobject/station/platform/hull.jpg"));
platform.setMaterial(mat_platform);
// platform.setLocalTranslation(-0.8f, -1f, 5.5f);
// Quaternion rotate = new Quaternion();
// rotate.fromAngleAxis(-FastMath.PI / 2, new Vector3f(1, 0, 0));
// platform.setLocalRotation(rotate);
// platform.scale(0.2f);
rootNode.attachChild(platform);
DirectionalLight sun = new DirectionalLight();
sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));
rootNode.addLight(sun);
}
private void loadCharacter(String id){
Spatial character = assetManager.loadModel("character/" + id + "/Mesh.mesh.xml");
character.setName(id);
character.setLocalTranslation(0f, 0f, 5f);
Material mat_character = new Material(assetManager,"Common/MatDefs/Light/Lighting.j3md");
mat_character.setTexture("DiffuseMap", assetManager.loadTexture("character/male/male.png"));
character.setMaterial(mat_character);
// Quaternion rotate = new Quaternion();
// rotate.fromAngleAxis(-FastMath.PI / 2, new Vector3f(1, 0, 0));
// character.setLocalRotation(rotate);
getRootNode().attachChild(character);
}
}