sm = app.getStateManager();
cam = app.getCamera();
DebugMaterials.setAssetManager(am);
Sphere s = new Sphere(4, 4, 1);
camPosGeom = new Geometry("Camera position", s);
camPosGeom.setMaterial(new Material(am, Materials.UNSHADED));
debugNode.attachChild(camPosGeom);
simpleApp.getRootNode().attachChild(debugNode);
setEnabled(true);
}
if (!sm.hasState(sm.getState(FlyCamAppState.class))) {
flyCam = new DebugCam(cam);
flyCam.registerWithInput(im);
flyCam.setDragToRotate(true);
} else flyCam = simpleApp.getFlyByCamera();
// Initialize advanced application stuff
if (app instanceof AdvancedApplication) {
scenegraph = ((AdvancedApplication) app).getScenegraph();
scenegraph.addScenegraphListener(this);
}
// Initialize GUI stuff
gui = new DebugGUI(simpleApp, this);
gui.getNifty().fromXml("interface/debugInterface.xml", "DebugInfo", this);
gui.getNifty().setIgnoreKeyboardEvents(true);
// gui.getNifty().setDebugOptionPanelColors(true);
guiFont = am.loadFont("Interface/Fonts/Default.fnt");
// Initialize debug stuff
coordNode = createCoordinationNode(256, 1);
debugNode.attachChild(coordNode);
debugNode.updateModelBound();
mouse = sm.getState(DebugMouse.class);
if (mouse == null) {
mouse = new DebugMouse();
Material mat = new Material(app.getAssetManager(), Materials.UNSHADED);
mat.setColor("Color", ColorRGBA.Orange);
mouse.setMaterial(mat);
sm.attach(mouse);
debugNode.attachChild(mouse.getPointer());
}
directionalLight = new DirectionalLight();
directionalLight.setName("Debug light");
directionalLight.setColor(ColorRGBA.White);
directionalLight.setDirection(new Vector3f(.5f, -1f, -.1f).normalizeLocal());
simpleApp.getRootNode().addLight(directionalLight);
ambientLight = new AmbientLight();
ambientLight.setColor(ColorRGBA.Gray);
simpleApp.getRootNode().addLight(ambientLight);
screenshotState = new ScreenshotAppState();
screenshotState.setFilePath("d:/");
sm.attach(screenshotState);
// Initialize voxel world stuff
if (sm.getState(VoxelState.class) != null) {
voxelState = sm.getState(VoxelState.class);
Sphere s = new Sphere(32, 32, voxelState.getCalcBound().getRadius());
s.setMode(Mode.Lines);
worldCalcBoundGeom = new Geometry("Voxel world calculation bound", s);
worldCalcBoundGeom.setMaterial(new Material(am, Materials.UNSHADED));
// debugNode.attachChild(worldCalcBoundGeom);
addState(voxelState);
}