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


Java ViewPort.addProcessor方法代码示例

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


在下文中一共展示了ViewPort.addProcessor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: initialize

import com.jme3.renderer.ViewPort; //导入方法依赖的package包/类
@Override
public void initialize(AppStateManager stateManager, Application app) {
    super.initialize(stateManager, app);

    InputManager inputManager = app.getInputManager();
    inputManager.addMapping("ScreenShot", new KeyTrigger(KeyInput.KEY_SYSRQ));
    inputManager.addListener(this, "ScreenShot");

    List<ViewPort> vps = app.getRenderManager().getPostViews();
    ViewPort last = vps.get(vps.size()-1);
    last.addProcessor(this);

    appName = app.getClass().getSimpleName();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:15,代码来源:ScreenshotAppState.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.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: 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

示例5: addProcessor

import com.jme3.renderer.ViewPort; //导入方法依赖的package包/类
/**
 * 添加Scene Processor到场景,注:这个方法会把SceneProcessor添加到默认的ViewPort,
 * 如果需要将SceneProcessor添加到其它ViewPort,则需要给场景添加侦听器,
 * 并手动把SceneProcessor添加到其它ViewPort
 * @param sceneProcessor 
 */
@Override
public void addProcessor(SceneProcessor sceneProcessor) {
    if (processorViewPorts == null || processorViewPorts.length <= 0) {
        LOG.log(Level.WARNING, "Could not addProcessor, because no any ViewPorts set to the scene. sceneId={0}"
                , data.getId());
        return;
    }
    for (ViewPort viewPort : processorViewPorts) {
        if (!viewPort.getProcessors().contains(sceneProcessor)) {
            viewPort.addProcessor(sceneProcessor);
        }
    }
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:20,代码来源:AbstractScene.java


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