當前位置: 首頁>>代碼示例>>Java>>正文


Java ViewPort.setOutputFrameBuffer方法代碼示例

本文整理匯總了Java中com.jme3.renderer.ViewPort.setOutputFrameBuffer方法的典型用法代碼示例。如果您正苦於以下問題:Java ViewPort.setOutputFrameBuffer方法的具體用法?Java ViewPort.setOutputFrameBuffer怎麽用?Java ViewPort.setOutputFrameBuffer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.jme3.renderer.ViewPort的用法示例。


在下文中一共展示了ViewPort.setOutputFrameBuffer方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: simpleInitApp

import com.jme3.renderer.ViewPort; //導入方法依賴的package包/類
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(Vector3f.ZERO, 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);
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:31,代碼來源:TestNiftyToMesh.java

示例2: createPreViews

import com.jme3.renderer.ViewPort; //導入方法依賴的package包/類
protected void createPreViews() {
    reflectionCam = new Camera(renderWidth, renderHeight);
    refractionCam = new Camera(renderWidth, renderHeight);

    // create a pre-view. a view that is rendered before the main view
    reflectionView = new ViewPort("Reflection View", reflectionCam);
    reflectionView.setClearFlags(true, true, true);
    reflectionView.setBackgroundColor(ColorRGBA.Black);
    // create offscreen framebuffer
    reflectionBuffer = new FrameBuffer(renderWidth, renderHeight, 1);
    //setup framebuffer to use texture
    reflectionBuffer.setDepthBuffer(Format.Depth);
    reflectionBuffer.setColorTexture(reflectionTexture);

    //set viewport to render to offscreen framebuffer
    reflectionView.setOutputFrameBuffer(reflectionBuffer);
    reflectionView.addProcessor(new ReflectionProcessor(reflectionCam, reflectionBuffer, reflectionClipPlane));
    // attach the scene to the viewport to be rendered
    reflectionView.attachScene(reflectionScene);

    // create a pre-view. a view that is rendered before the main view
    refractionView = new ViewPort("Refraction View", refractionCam);
    refractionView.setClearFlags(true, true, true);
    refractionView.setBackgroundColor(ColorRGBA.Black);
    // create offscreen framebuffer
    refractionBuffer = new FrameBuffer(renderWidth, renderHeight, 1);
    //setup framebuffer to use texture
    refractionBuffer.setDepthBuffer(Format.Depth);
    refractionBuffer.setColorTexture(refractionTexture);
    refractionBuffer.setDepthTexture(depthTexture);
    //set viewport to render to offscreen framebuffer
    refractionView.setOutputFrameBuffer(refractionBuffer);
    refractionView.addProcessor(new RefractionProcessor());
    // attach the scene to the viewport to be rendered
    refractionView.attachScene(reflectionScene);
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:37,代碼來源:SimpleWaterProcessor.java

示例3: createPreViews

import com.jme3.renderer.ViewPort; //導入方法依賴的package包/類
protected void createPreViews() {
        reflectionCam = new Camera(renderWidth, renderHeight);
//        refractionCam = new Camera(renderWidth, renderHeight);

        // create a pre-view. a view that is rendered before the main view
        reflectionView = new ViewPort("Reflection View", reflectionCam);
        reflectionView.setClearFlags(true, true, true);
        reflectionView.setBackgroundColor(ColorRGBA.Black);
        // create offscreen framebuffer
        reflectionBuffer = new FrameBuffer(renderWidth, renderHeight, 1);
        //setup framebuffer to use texture
        reflectionBuffer.setColorTexture(reflectionTexture);
        
        // remove20160704,不要使用DepthBuffer,這在Android下無法支持
//        reflectionBuffer.setDepthBuffer(Format.Depth);
        
        //set viewport to render to offscreen framebuffer
        reflectionView.setOutputFrameBuffer(reflectionBuffer);
        reflectionView.addProcessor(new ReflectionProcessor(reflectionCam, reflectionBuffer, reflectionClipPlane));
        
        // attach the scene to the viewport to be rendered
        if (!tempReflectionScenes.isEmpty()) {
            for (Spatial scene : tempReflectionScenes) {
                addReflectionScene(scene);
            }
            tempReflectionScenes.clear();
        }
    }
 
開發者ID:huliqing,項目名稱:LuoYing,代碼行數:29,代碼來源:VerySimpleWaterProcessor.java


注:本文中的com.jme3.renderer.ViewPort.setOutputFrameBuffer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。