Search in sources :

Example 1 with DetailedProfilerState

use of com.jme3.app.DetailedProfilerState in project jmonkeyengine by jMonkeyEngine.

the class TestSSAO2 method simpleInitApp.

@Override
public void simpleInitApp() {
    DirectionalLight dl = new DirectionalLight();
    dl.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());
    rootNode.addLight(dl);
    flyCam.setDragToRotate(true);
    setPauseOnLostFocus(false);
    getStateManager().attach(new DetailedProfilerState());
    Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
    mat.setFloat("Shininess", 16f);
    //mat.setBoolean("VertexLighting", true);
    Geometry floor = new Geometry("floor", new Box(1000, 0.1f, 1000));
    floor.setMaterial(mat);
    rootNode.attachChild(floor);
    Node teapotNode = (Node) assetManager.loadModel("Models/Teapot/Teapot.mesh.xml");
    Geometry teapot = (Geometry) teapotNode.getChild(0);
    teapot.setMaterial(mat);
    //Material mat = new Material(assetManager, "Common/MatDefs/Misc/ShowNormals.j3md");
    for (int f = 10; f > 3; f--) {
        for (int y = -f; y < f; y++) {
            for (int x = -f; x < f; x++) {
                Geometry clonePot = teapot.clone();
                //clonePot.setMaterial(mat);
                clonePot.setLocalTranslation(x * .5f, 10 - f, y * .5f);
                clonePot.setLocalScale(.15f);
                rootNode.attachChild(clonePot);
            }
        }
    }
    cam.setLocation(new Vector3f(10.247649f, 8.275992f, 10.405156f));
    cam.setRotation(new Quaternion(-0.083419204f, 0.90370524f, -0.20599906f, -0.36595422f));
    FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
    SSAOFilter ssaoFilter = new SSAOFilter(2.9299974f, 25f, 5.8100376f, 0.091000035f);
    int numSamples = context.getSettings().getSamples();
    if (numSamples > 0) {
        fpp.setNumSamples(numSamples);
    }
    //ssaoFilter.setApproximateNormals(true);
    fpp.addFilter(ssaoFilter);
    SSAOUI ui = new SSAOUI(inputManager, ssaoFilter);
    viewPort.addProcessor(fpp);
}
Also used : SSAOFilter(com.jme3.post.ssao.SSAOFilter) DetailedProfilerState(com.jme3.app.DetailedProfilerState) Material(com.jme3.material.Material) Box(com.jme3.scene.shape.Box) FilterPostProcessor(com.jme3.post.FilterPostProcessor)

Aggregations

DetailedProfilerState (com.jme3.app.DetailedProfilerState)1 Material (com.jme3.material.Material)1 FilterPostProcessor (com.jme3.post.FilterPostProcessor)1 SSAOFilter (com.jme3.post.ssao.SSAOFilter)1 Box (com.jme3.scene.shape.Box)1