I was hoping to have just a blank blue background with a sphere and be able to have the ThirdPersonController control the sphere. All I get is a white screen. Insight, please
import com.jme.app.BaseGame;
import com.jme.bounding.BoundingBox;
import com.jme.bounding.BoundingSphere;
import com.jme.image.Texture;
import com.jme.input.ChaseCamera;
import com.jme.input.InputSystem;
import com.jme.input.KeyBindingManager;
import com.jme.input.KeyInput;
import com.jme.input.thirdperson.ThirdPersonMouseLook;
import com.jme.math.FastMath;
import com.jme.math.Vector3f;
import com.jme.renderer.Camera;
import com.jme.renderer.ColorRGBA;
import com.jme.scene.Node;
import com.jme.scene.shape.Sphere;
import com.jme.scene.state.CullState;
import com.jme.scene.state.FogState;
import com.jme.scene.state.TextureState;
import com.jme.system.DisplaySystem;
import com.jme.system.JmeException;
import com.jme.util.TextureManager;
import com.jme.util.Timer;
/*
* Fyrestone Game Client
* Version: 0.0.0000
*/
import java.util.HashMap;
public class GameClient extends BaseGame
{
/*Video Configuration*/
int width, height, depth, freq;
boolean fullscreen;
/*End Video Configuration*/
/*Scene Graph Variables*/
Node scene;
Sphere player;
FogState fog;
CullState cull;
ChaseCamera playercam;
Camera cam;
/*End Scene Graph Variables*/
/*System Information Variables*/
Timer timer;
/*End System Information Variables*/
public static void main(String args[])
{
GameClient app = new GameClient();
app.setDialogBehaviour(FIRSTRUN_OR_NOCONFIGFILE_SHOW_PROPS_DIALOG);
app.start();
}
@Override
protected void update(float interpolation)
{
interpolation = timer.getTimePerFrame();
timer.update();
playercam.update(interpolation);
keyHandle();
}
@Override
protected void render(float interpolation)
{
display.getRenderer().clearBuffers();
display.getRenderer().draw(scene);
}
@Override
protected void initSystem()
{
width = properties.getWidth();
height = properties.getHeight();
depth = properties.getDepth();
freq = properties.getFreq();
fullscreen = properties.getFullscreen();
initializeGraphics();
display.setTitle("Fyrestone Game Client");
display.getRenderer().setBackgroundColor(ColorRGBA.blue);
timer = Timer.getTimer();
cull = display.getRenderer().createCullState();
cull.setCullMode(cull.CS_BACK);
cull.setEnabled(true);
fog = display.getRenderer().createFogState();
fog.setStart(5.0f);
fog.setEnd(1000f);
fog.setDensity(1.2f);
fog.setColor(ColorRGBA.lightGray);
fog.setEnabled(true);
// scene.setRenderState(fog);
// scene.setRenderState(cull);
}
@Override
protected void initGame()
{
scene = new Node("SceneGraph");
createPlayer();
createCamera();
scene.updateGeometricState(0f, true);
scene.updateRenderState();
}
@Override
protected void reinit()
{
display.recreateWindow(width, height, depth, freq, fullscreen);
}
@Override
protected void cleanup()
{
System.out.println("Nothing to clean");
}
protected void initializeGraphics()
{
try
{
display = DisplaySystem.getDisplaySystem(properties.getRenderer());
display.createWindow(width, height, depth, freq, fullscreen);
}
catch(JmeException e)
{
System.out.println("Graphics card error.");
e.printStackTrace();
System.exit(1);
}
}
protected void createCamera()
{
cam = display.getRenderer().createCamera(width, height);
cam.setFrustumPerspective(45.0f, (float)width/(float)height, 1, 5000);
cam.update();
display.getRenderer().setCamera(cam);
Vector3f offset = new Vector3f();
offset.y = ((BoundingBox) player.getWorldBound()).yExtent * 1.5f;
playercam = new ChaseCamera(cam, player);
playercam.setMaxDistance(8);
playercam.setMinDistance(2);
}
protected void createPlayer()
{
player = new Sphere("Player", 5, 5, 15);
player.setLocalTranslation(new Vector3f(0,0,0));
player.setModelBound(new BoundingBox());
player.updateModelBound();
scene.attachChild(player);
player.updateWorldBound();
}
protected void createEarth()
{
//not yet implemented.
}
private void keyHandle()
{
if(KeyBindingManager.getKeyBindingManager().isValidCommand("exit"))
finished = true;
}
}