Bloom Glow jme3 - Java Game

Java examples for Game:JME3

Description

Bloom Glow jme3

Demo Code

package Effects;/*from   w ww.j  a va2s. c o  m*/

import com.jme3.app.SimpleApplication;
import com.jme3.asset.plugins.ZipLocator;
import com.jme3.light.DirectionalLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.post.FilterPostProcessor;
import com.jme3.post.filters.BloomFilter;
import com.jme3.renderer.RenderManager;
import com.jme3.scene.Geometry;
import com.jme3.scene.Spatial;

/**
 * test
 *
 * @author normenhansen
 */
public class BloomGlow extends SimpleApplication {

    private Spatial sceneGeo;
    private FilterPostProcessor fpp;
    private BloomFilter bloom;

    public static void main(String[] args) {
        BloomGlow app = new BloomGlow();
        app.start();
    }

    @Override
    public void simpleInitApp() {
        flyCam.setMoveSpeed(50);
        fpp = new FilterPostProcessor(assetManager);
        viewPort.addProcessor(fpp);
        bloom = new BloomFilter();
        fpp.addFilter(bloom);
        assetManager.registerLocator("town.zip", ZipLocator.class);
        sceneGeo = assetManager.loadModel("main.scene");
        rootNode.attachChild(sceneGeo);
        DirectionalLight sunLight = new DirectionalLight();
        sunLight.setDirection(new Vector3f(0.3f, -0.5f, -0.5f));
        rootNode.addLight(sunLight);

        Geometry teapotGeo = (Geometry) assetManager
                .loadModel("Models/Teapot/Teapot.j3o");
        Material teapotMat = new Material(assetManager,
                "Common/MatDefs/Light/Lighting.j3md");
        teapotMat.setBoolean("UseMaterialColors", true);
        teapotMat.setColor("Diffuse", ColorRGBA.Pink);
        teapotGeo.setMaterial(teapotMat);
        teapotGeo.scale(3);
        teapotGeo.setLocalTranslation(32, 3, -24);
        rootNode.attachChild(teapotGeo);
    }

    @Override
    public void simpleUpdate(float tpf) {
        //TODO: add update code
    }

    @Override
    public void simpleRender(RenderManager rm) {
        //TODO: add render code
    }
}

Related Tutorials