Search in sources :

Example 6 with NiftyJmeDisplay

use of com.jme3.niftygui.NiftyJmeDisplay in project jmonkeyengine by jMonkeyEngine.

the class TestNiftyToMesh method simpleInitApp.

public void simpleInitApp() {
    ViewPort niftyView = renderManager.createPreView("NiftyView", new Camera(1024, 768));
    niftyView.setClearFlags(true, true, true);
    NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, niftyView);
    nifty = niftyDisplay.getNifty();
    nifty.fromXml("all/intro.xml", "start");
    niftyView.addProcessor(niftyDisplay);
    Texture2D depthTex = new Texture2D(1024, 768, Format.Depth);
    FrameBuffer fb = new FrameBuffer(1024, 768, 1);
    fb.setDepthTexture(depthTex);
    Texture2D tex = new Texture2D(1024, 768, Format.RGBA8);
    tex.setMinFilter(MinFilter.Trilinear);
    tex.setMagFilter(MagFilter.Bilinear);
    fb.setColorTexture(tex);
    niftyView.setClearFlags(true, true, true);
    niftyView.setOutputFrameBuffer(fb);
    Box b = new Box(1, 1, 1);
    Geometry geom = new Geometry("Box", b);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setTexture("ColorMap", tex);
    geom.setMaterial(mat);
    rootNode.attachChild(geom);
}
Also used : NiftyJmeDisplay(com.jme3.niftygui.NiftyJmeDisplay) Geometry(com.jme3.scene.Geometry) Texture2D(com.jme3.texture.Texture2D) ViewPort(com.jme3.renderer.ViewPort) Box(com.jme3.scene.shape.Box) Material(com.jme3.material.Material) Camera(com.jme3.renderer.Camera) FrameBuffer(com.jme3.texture.FrameBuffer)

Aggregations

NiftyJmeDisplay (com.jme3.niftygui.NiftyJmeDisplay)6 Material (com.jme3.material.Material)2 Geometry (com.jme3.scene.Geometry)2 Box (com.jme3.scene.shape.Box)2 AnimControl (com.jme3.animation.AnimControl)1 AnimationFactory (com.jme3.animation.AnimationFactory)1 Cinematic (com.jme3.cinematic.Cinematic)1 BitmapText (com.jme3.font.BitmapText)1 ChaseCamera (com.jme3.input.ChaseCamera)1 Vector3f (com.jme3.math.Vector3f)1 Camera (com.jme3.renderer.Camera)1 ViewPort (com.jme3.renderer.ViewPort)1 Spatial (com.jme3.scene.Spatial)1 FrameBuffer (com.jme3.texture.FrameBuffer)1 Texture2D (com.jme3.texture.Texture2D)1 Nifty (de.lessvoid.nifty.Nifty)1