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


Java Format.Depth方法代码示例

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


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

示例1: BasicShadowRenderer

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

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

示例4: createTextures

import com.jme3.texture.Image.Format; //导入方法依赖的package包/类
protected void createTextures() {
    reflectionTexture = new Texture2D(renderWidth, renderHeight, Format.RGBA8);
    refractionTexture = new Texture2D(renderWidth, renderHeight, Format.RGBA8);
    depthTexture = new Texture2D(renderWidth, renderHeight, Format.Depth);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:6,代码来源:SimpleWaterProcessor.java

示例5: PssmShadowRenderer

import com.jme3.texture.Image.Format; //导入方法依赖的package包/类
/**
 * Create a PSSM Shadow Renderer 
 * More info on the technique at http://http.developer.nvidia.com/GPUGems3/gpugems3_ch10.html
 * @param manager the application asset manager
 * @param size the size of the rendered shadowmaps (512,1024,2048, etc...)
 * @param nbSplits the number of shadow maps rendered (the more shadow maps the more quality, the less fps). 
 */
public PssmShadowRenderer(AssetManager manager, int size, int nbSplits) {
    assetManager = manager;
    nbSplits = Math.max(Math.min(nbSplits, 4), 1);
    this.nbSplits = nbSplits;

    shadowFB = new FrameBuffer[nbSplits];
    shadowMaps = new Texture2D[nbSplits];
    dispPic = new Picture[nbSplits];
    lightViewProjectionsMatrices = new Matrix4f[nbSplits];
    splits = new ColorRGBA();
    splitsArray = new float[nbSplits + 1];

    //DO NOT COMMENT THIS (it prevent the OSX incomplete read buffer crash)
    dummyTex = new Texture2D(size, size, Format.RGBA8);

    preshadowMat = new Material(manager, "Common/MatDefs/Shadow/PreShadow.j3md");
    postshadowMat = new Material(manager, "Common/MatDefs/Shadow/PostShadowPSSM.j3md");

    for (int i = 0; i < nbSplits; i++) {
        lightViewProjectionsMatrices[i] = new Matrix4f();
        shadowFB[i] = new FrameBuffer(size, size, 1);
        shadowMaps[i] = new Texture2D(size, size, Format.Depth);

        shadowFB[i].setDepthTexture(shadowMaps[i]);

        //DO NOT COMMENT THIS (it prevent the OSX incomplete read buffer crash)
        shadowFB[i].setColorTexture(dummyTex);

        postshadowMat.setTexture("ShadowMap" + i, shadowMaps[i]);

        //quads for debuging purpose
        dispPic[i] = new Picture("Picture" + i);
        dispPic[i].setTexture(manager, shadowMaps[i], false);
    }

    setCompareMode(CompareMode.Hardware);
    setFilterMode(FilterMode.Bilinear);

    shadowCam = new Camera(size, size);
    shadowCam.setParallelProjection(true);

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

示例6: PssmShadowRenderer

import com.jme3.texture.Image.Format; //导入方法依赖的package包/类
/**
 * Create a PSSM Shadow Renderer 
 * More info on the technique at <a href="http://http.developer.nvidia.com/GPUGems3/gpugems3_ch10.html">http://http.developer.nvidia.com/GPUGems3/gpugems3_ch10.html</a>
 * @param manager the application asset manager
 * @param size the size of the rendered shadowmaps (512,1024,2048, etc...)
 * @param nbSplits the number of shadow maps rendered (the more shadow maps the more quality, the less fps). 
 */
public PssmShadowRenderer(AssetManager manager, int size, int nbSplits) {
    assetManager = manager;
    nbSplits = Math.max(Math.min(nbSplits, 4), 1);
    this.nbSplits = nbSplits;

    shadowFB = new FrameBuffer[nbSplits];
    shadowMaps = new Texture2D[nbSplits];
    dispPic = new Picture[nbSplits];
    lightViewProjectionsMatrices = new Matrix4f[nbSplits];
    splits = new ColorRGBA();
    splitsArray = new float[nbSplits + 1];

    //DO NOT COMMENT THIS (it prevent the OSX incomplete read buffer crash)
    dummyTex = new Texture2D(size, size, Format.RGBA8);

    preshadowMat = new Material(manager, "Common/MatDefs/Shadow/PreShadow.j3md");
    postshadowMat = new Material(manager, "Common/MatDefs/Shadow/PostShadowPSSM.j3md");

    for (int i = 0; i < nbSplits; i++) {
        lightViewProjectionsMatrices[i] = new Matrix4f();
        shadowFB[i] = new FrameBuffer(size, size, 1);
        shadowMaps[i] = new Texture2D(size, size, Format.Depth);

        shadowFB[i].setDepthTexture(shadowMaps[i]);

        //DO NOT COMMENT THIS (it prevent the OSX incomplete read buffer crash)
        shadowFB[i].setColorTexture(dummyTex);

        postshadowMat.setTexture("ShadowMap" + i, shadowMaps[i]);

        //quads for debuging purpose
        dispPic[i] = new Picture("Picture" + i);
        dispPic[i].setTexture(manager, shadowMaps[i], false);
    }

    setCompareMode(CompareMode.Hardware);
    setFilterMode(FilterMode.Bilinear);
    setShadowIntensity(0.7f);

    shadowCam = new Camera(size, size);
    shadowCam.setParallelProjection(true);

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

示例7: getDefaultPassDepthFormat

import com.jme3.texture.Image.Format; //导入方法依赖的package包/类
/**
 * returns the default pass depth format
 * @return 
 */
protected Format getDefaultPassDepthFormat() {
    return Format.Depth;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:8,代码来源:Filter.java

示例8: getDefaultPassDepthFormat

import com.jme3.texture.Image.Format; //导入方法依赖的package包/类
/**
 * returns the default pass depth format
 * @return
 */
protected Format getDefaultPassDepthFormat() {
    return Format.Depth;
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:8,代码来源:Filter.java


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