本文整理汇总了Java中com.jme3.renderer.ViewPort.setClearFlags方法的典型用法代码示例。如果您正苦于以下问题:Java ViewPort.setClearFlags方法的具体用法?Java ViewPort.setClearFlags怎么用?Java ViewPort.setClearFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.renderer.ViewPort
的用法示例。
在下文中一共展示了ViewPort.setClearFlags方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toggleHeadCameraView
import com.jme3.renderer.ViewPort; //导入方法依赖的package包/类
public void toggleHeadCameraView() {
if (headCam != null) {
headCam = null;
renderManager.removeMainView("robot head camera");
} else {
headCam = renderManager.getMainView("Default").getCamera().clone();
float vpXMin = 0.6f;
float vpXMax = 1;
float vpYMin = 0;
float vpYMax = vpYMin + (vpXMax - vpXMin)
* ((float)headCamResHeight / (float)headCamResWidth)
/ ((float)headCam.getHeight() / (float)headCam.getWidth());
headCam.setViewPort(vpXMin, vpXMax, vpYMin, vpYMax);
headCam.setFrustumPerspective(headCamFov,
headCamResWidth / headCamResHeight, 0.01f, 100);
updateHeadCam();
ViewPort vp = renderManager.createMainView("robot head camera", headCam);
vp.setClearFlags(true, true, true);
vp.attachScene(rootNode);
}
}
示例2: 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);
}
示例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: buildBackground
import com.jme3.renderer.ViewPort; //导入方法依赖的package包/类
protected void buildBackground() {
String bgKey = "background";
background = new Picture( "background" );
clearBackground();
background.setWidth( cam.getWidth() );
background.setHeight( cam.getHeight() );
background.setPosition( 0, 0 );
background.updateGeometricState();
ViewPort pv = renderManager.createPreView( bgKey, cam );
pv.setClearFlags( true, true, true );
pv.attachScene( background );
background.updateGeometricState();
}
示例6: initialize
import com.jme3.renderer.ViewPort; //导入方法依赖的package包/类
@Override
public void initialize() {
super.initialize();
// guiViewPort.getCamera().resize( canvasSize.get().width, canvasSize.get().height, true );
// guiViewPort.getCamera().update();
// cam.resize( canvasSize.get().width, canvasSize.get().height, true );
// cam.update();
directInputHandler = new WrappedInputManager( inputManager );
// setup a GUI behind the main scene
// TODO: consider removing this and just adding a background-color layer!
backgroundGuiNode.setQueueBucket( Bucket.Gui );
backgroundGuiNode.setCullHint( CullHint.Never );
Camera backgroundGuiCam = new Camera( settings.getWidth(), settings.getHeight() );
final ViewPort backgroundGuiViewPort = renderManager.createPreView( "Background GUI", backgroundGuiCam );
backgroundGuiViewPort.setClearFlags( true, true, true );
backgroundGuiViewPort.attachScene( backgroundGuiNode );
backgroundColor.addObserver( new SimpleObserver() {
public void update() {
backgroundGuiViewPort.setBackgroundColor( backgroundColor.get() );
}
} );
liveNodes.add( backgroundGuiNode );
JMEView backgroundGui = new JMEView( this, backgroundGuiViewPort, backgroundGuiCam, backgroundGuiNode );
// make the "main" viewport not clear what is behind it
viewPort.setClearFlags( false, true, true );
viewPort.attachScene( sceneNode );
liveNodes.add( sceneNode );
// hook up the main "gui"
guiNode.setQueueBucket( Bucket.Gui );
guiNode.setCullHint( CullHint.Never );
guiViewPort.attachScene( guiNode );
liveNodes.add( guiNode );
JMEView gui = new JMEView( this, guiViewPort, guiViewPort.getCamera(), guiNode );
statistics.initialize( this, guiNode );
if ( inputManager != null ) {
inputManager.setCursorVisible( true );
}
}
示例7: simpleInitApp
import com.jme3.renderer.ViewPort; //导入方法依赖的package包/类
public void simpleInitApp() {
// create the geometry and attach it
Geometry teaGeom = (Geometry) assetManager.loadModel("Models/Teapot/Teapot.obj");
teaGeom.scale(3);
DirectionalLight dl = new DirectionalLight();
dl.setColor(ColorRGBA.White);
dl.setDirection(Vector3f.UNIT_XYZ.negate());
rootNode.addLight(dl);
rootNode.attachChild(teaGeom);
// Setup first view
viewPort.setBackgroundColor(ColorRGBA.Blue);
cam.setViewPort(.5f, 1f, 0f, 0.5f);
cam.setLocation(new Vector3f(3.3212643f, 4.484704f, 4.2812433f));
cam.setRotation(new Quaternion(-0.07680723f, 0.92299235f, -0.2564353f, -0.27645364f));
// Setup second view
Camera cam2 = cam.clone();
cam2.setViewPort(0f, 0.5f, 0f, 0.5f);
cam2.setLocation(new Vector3f(-0.10947256f, 1.5760219f, 4.81758f));
cam2.setRotation(new Quaternion(0.0010108891f, 0.99857414f, -0.04928594f, 0.020481428f));
ViewPort view2 = renderManager.createMainView("Bottom Left", cam2);
view2.setClearFlags(true, true, true);
view2.attachScene(rootNode);
// Setup third view
Camera cam3 = cam.clone();
cam3.setViewPort(0f, .5f, .5f, 1f);
cam3.setLocation(new Vector3f(0.2846221f, 6.4271426f, 0.23380789f));
cam3.setRotation(new Quaternion(0.004381671f, 0.72363687f, -0.69015175f, 0.0045953835f));
ViewPort view3 = renderManager.createMainView("Top Left", cam3);
view3.setClearFlags(true, true, true);
view3.attachScene(rootNode);
// Setup fourth view
Camera cam4 = cam.clone();
cam4.setViewPort(.5f, 1f, .5f, 1f);
cam4.setLocation(new Vector3f(4.775564f, 1.4548365f, 0.11491505f));
cam4.setRotation(new Quaternion(0.02356979f, -0.74957186f, 0.026729556f, 0.66096294f));
ViewPort view4 = renderManager.createMainView("Top Right", cam4);
view4.setClearFlags(true, true, true);
view4.attachScene(rootNode);
//test multiview for gui
guiViewPort.getCamera().setViewPort(.5f, 1f, .5f, 1f);
// Setup second gui view
Camera guiCam2 = guiViewPort.getCamera().clone();
guiCam2.setViewPort(0f, 0.5f, 0f, 0.5f);
ViewPort guiViewPort2 = renderManager.createPostView("Gui 2", guiCam2);
guiViewPort2.setClearFlags(false, false, false);
guiViewPort2.attachScene(guiViewPort.getScenes().get(0));
}