当前位置: 首页>>代码示例>>Java>>正文


Java FrameBuffer.setDepthTexture方法代码示例

本文整理汇总了Java中com.jme3.texture.FrameBuffer.setDepthTexture方法的典型用法代码示例。如果您正苦于以下问题:Java FrameBuffer.setDepthTexture方法的具体用法?Java FrameBuffer.setDepthTexture怎么用?Java FrameBuffer.setDepthTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.texture.FrameBuffer的用法示例。


在下文中一共展示了FrameBuffer.setDepthTexture方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: BasicShadowRenderer

import com.jme3.texture.FrameBuffer; //导入方法依赖的package包/类
/**
 * Creates a BasicShadowRenderer
 * @param manager the asset manager
 * @param size the size of the shadow map (the map is square)
 */
public BasicShadowRenderer(AssetManager manager, int size) {
    shadowFB = new FrameBuffer(size, size, 1);
    shadowMap = new Texture2D(size, size, Format.Depth);
    shadowFB.setDepthTexture(shadowMap);
    shadowCam = new Camera(size, size);

    preshadowMat = new Material(manager, "Common/MatDefs/Shadow/PreShadow.j3md");
    postshadowMat = new Material(manager, "Common/MatDefs/Shadow/PostShadow.j3md");
    postshadowMat.setTexture("ShadowMap", shadowMap);

    dispPic.setTexture(manager, shadowMap, false);

    for (int i = 0; i < points.length; i++) {
        points[i] = new Vector3f();
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:22,代码来源:BasicShadowRenderer.java

示例2: simpleInitApp

import com.jme3.texture.FrameBuffer; //导入方法依赖的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

示例3: createPreViews

import com.jme3.texture.FrameBuffer; //导入方法依赖的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

示例4: reshape

import com.jme3.texture.FrameBuffer; //导入方法依赖的package包/类
public void reshape(ViewPort vp, int w, int h) {
    diffuseData  = new Texture2D(w, h, Format.RGBA8);
    normalData   = new Texture2D(w, h, Format.RGBA8);
    specularData = new Texture2D(w, h, Format.RGBA8);
    depthData    = new Texture2D(w, h, Format.Depth);

    mat = new Material(assetManager, "Common/MatDefs/Light/Deferred.j3md");
    mat.setTexture("DiffuseData",  diffuseData);
    mat.setTexture("SpecularData", specularData);
    mat.setTexture("NormalData",   normalData);
    mat.setTexture("DepthData",    depthData);

    display.setMaterial(mat);
    display.setPosition(0, 0);
    display.setWidth(w);
    display.setHeight(h);

    display1.setTexture(assetManager, diffuseData, false);
    display2.setTexture(assetManager, normalData, false);
    display3.setTexture(assetManager, specularData, false);
    display4.setTexture(assetManager, depthData, false);

    display1.setPosition(0, 0);
    display2.setPosition(w/2, 0);
    display3.setPosition(0, h/2);
    display4.setPosition(w/2, h/2);

    display1.setWidth(w/2);
    display1.setHeight(h/2);

    display2.setWidth(w/2);
    display2.setHeight(h/2);

    display3.setWidth(w/2);
    display3.setHeight(h/2);

    display4.setWidth(w/2);
    display4.setHeight(h/2);

    guiNode.updateGeometricState();
    
    fb = new FrameBuffer(w, h, 1);
    fb.setDepthTexture(depthData);
    fb.addColorTexture(diffuseData);
    fb.addColorTexture(normalData);
    fb.addColorTexture(specularData);
    fb.setMultiTarget(true);

    /*
     * Marks pixels in front of the far light boundary
        Render back-faces of light volume
        Depth test GREATER-EQUAL
        Write to stencil on depth pass
        Skipped for very small distant lights
     */
    
    /*
     * Find amount of lit pixels inside the volume
         Start pixel query
         Render front faces of light volume
         Depth test LESS-EQUAL
         Don’t write anything – only EQUAL stencil test
     */

    /*
     * Enable conditional rendering
        Based on query results from previous stage
        GPU skips rendering for invisible lights
     */

    /*
     * Render front-faces of light volume
        Depth test - LESS-EQUAL
        Stencil test - EQUAL
        Runs only on marked pixels inside light
     */
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:78,代码来源:TestMultiRenderTarget.java


注:本文中的com.jme3.texture.FrameBuffer.setDepthTexture方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。