本文整理汇总了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);
}
示例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();
}
示例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);
}
示例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();
}
}
示例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);
}
}
}