/** * Set the background color for both left and right view ports. * @param clr the background color. */ public void setBackgroundColors(ColorRGBA clr) { if( viewmanager == null ) { getViewPort().setBackgroundColor(clr); } else if( viewmanager.getLeftViewPort() != null ) { viewmanager.getLeftViewPort().setBackgroundColor(clr); if( viewmanager.getRightViewPort() != null ) viewmanager.getRightViewPort().setBackgroundColor(clr); } }
/** * creates an offsceen VP * * @param name * @param offCamera * @return */ protected ViewPort createOffViewPort(final String name, final Camera offCamera) { final ViewPort offView = new ViewPort(name, offCamera); offView.setClearFlags(true, true, true); offView.setBackgroundColor(backGroundColor); return offView; }
/** * Set the background color for both left and right view ports. * @param clr the background color. */ public void setBackgroundColors(ColorRGBA clr) { if( environment.getVRViewManager() == null ) { application.getViewPort().setBackgroundColor(clr); } else if( environment.getVRViewManager().getLeftViewPort() != null ) { environment.getVRViewManager().getLeftViewPort().setBackgroundColor(clr); if( environment.getVRViewManager().getRightViewPort() != null ){ environment.getVRViewManager().getRightViewPort().setBackgroundColor(clr); } } }
private void initView() { viewPort.setBackgroundColor(ColorRGBA.DarkGray); cam.setLocation(new Vector3f(8.569681f, 3.335546f, 5.4372444f)); cam.setRotation(new Quaternion(-0.07608022f, 0.9086564f, -0.18992864f, -0.3639813f)); flyCam.setMoveSpeed(10); }
private ViewPort setupViewBuffers(Camera cam, String viewName) { // TODO this function is identical to that in VRViewManagerOpenVR; merge the two. if (environment != null) { if (environment.getApplication() != null) { ViewPort viewPort = environment.getApplication().getRenderManager().createPreView(viewName, cam); viewPort.setClearFlags(true, true, true); viewPort.setBackgroundColor(ColorRGBA.Black); Iterator<Spatial> spatialIter = environment.getApplication().getViewPort().getScenes().iterator(); while (spatialIter.hasNext()) { viewPort.attachScene(spatialIter.next()); } // The viewbuffer to render into will be set during prerender. return viewPort; } else { throw new IllegalStateException("This VR environment is not attached to any application."); } } else { throw new IllegalStateException("This VR view manager is not attached to any VR environment."); } } }
@Override public void simpleInitApp() { setPauseOnLostFocus(false); setDisplayStatView(false); setDisplayFps(false); viewPort.setBackgroundColor(ColorRGBA.LightGray); setupTestScene(); setupUserInput(); setupInstructionsNote(); }
private void setupFinalFullTexture(Camera cam) { if (environment != null) { if (environment.getApplication() != null) { // create offscreen framebuffer FrameBuffer out = new FrameBuffer(cam.getWidth(), cam.getHeight(), 1); //offBuffer.setSrgb(true); //setup framebuffer's texture dualEyeTex = new Texture2D(cam.getWidth(), cam.getHeight(), Image.Format.RGBA8); dualEyeTex.setMinFilter(Texture2D.MinFilter.BilinearNoMipMaps); dualEyeTex.setMagFilter(Texture2D.MagFilter.Bilinear); logger.config("Dual eye texture " + dualEyeTex.getName() + " (" + dualEyeTex.getImage().getId() + ")"); logger.config(" Type: " + dualEyeTex.getType()); logger.config(" Size: " + dualEyeTex.getImage().getWidth() + "x" + dualEyeTex.getImage().getHeight()); logger.config(" Image depth: " + dualEyeTex.getImage().getDepth()); logger.config(" Image format: " + dualEyeTex.getImage().getFormat()); logger.config(" Image color space: " + dualEyeTex.getImage().getColorSpace()); //setup framebuffer to use texture out.setDepthBuffer(Image.Format.Depth); out.setColorTexture(dualEyeTex); ViewPort viewPort = environment.getApplication().getViewPort(); viewPort.setClearFlags(true, true, true); viewPort.setBackgroundColor(ColorRGBA.Black); viewPort.setOutputFrameBuffer(out); } else { throw new IllegalStateException("This VR environment is not attached to any application."); } } else { throw new IllegalStateException("This VR view manager is not attached to any VR environment."); } }
viewPort.setBackgroundColor(ColorRGBA.Black); viewPort.setOutputFrameBuffer(out); } else {
@Override public void simpleInitApp() { viewPort.setBackgroundColor(ColorRGBA.Gray); cam.setLocation(new Vector3f(-5.6310086f, 5.0892987f, -13.000479f)); cam.setRotation(new Quaternion(0.1779095f, 0.20036356f, -0.03702727f, 0.96272093f)); cam.update(); cam.setFrustumFar(300); flyCam.setMoveSpeed(30); rootNode.setCullHint(CullHint.Never); setupLighting(); setupModel(); setupFilters(); }
public void simpleInitApp() { cam.setLocation(new Vector3f(0f, 0.5f, 3f)); viewPort.setBackgroundColor(ColorRGBA.LightGray); // Add a light source to the scene. DirectionalLight directionalLight = new DirectionalLight(); directionalLight.setColor(ColorRGBA.Magenta); directionalLight.setDirection(Vector3f.UNIT_XYZ.negate()); rootNode.addLight(directionalLight); // Create and add a teapot to the scene graph. Spatial teapotModel = assetManager.loadModel("Models/Teapot/Teapot.obj"); rootNode.attachChild(teapotModel); // Create the two moving quads with custom blend modes. createLeftQuad(); createRightQuad(); }
clonecam.setParallelProjection(true); viewPort.setClearFlags(true, true, true); viewPort.setBackgroundColor(ColorRGBA.Black); Picture pic = new Picture("fullscene"); pic.setLocalTranslation(-0.75f, -0.5f, 0f);
clonecam.setParallelProjection(true); viewPort.setClearFlags(true, true, true); viewPort.setBackgroundColor(ColorRGBA.Black); Picture pic = new Picture("fullscene"); pic.setLocalTranslation(-0.75f, -0.5f, 0f);
private ViewPort setupMirrorBuffers(Camera cam, Texture2D tex, boolean expand) { if (environment != null) { if (environment.getApplication() != null) { Camera clonecam = cam.clone(); ViewPort viewPort = environment.getApplication().getRenderManager().createPostView("MirrorView", clonecam); clonecam.setParallelProjection(true); viewPort.setClearFlags(true, true, true); viewPort.setBackgroundColor(ColorRGBA.Black); Picture pic = new Picture("fullscene"); pic.setLocalTranslation(-0.75f, -0.5f, 0f); if (expand) { pic.setLocalScale(3f, 1f, 1f); } else { pic.setLocalScale(1.5f, 1f, 1f); } pic.setQueueBucket(Bucket.Opaque); pic.setTexture(environment.getApplication().getAssetManager(), (Texture2D) tex, false); viewPort.attachScene(pic); viewPort.setOutputFrameBuffer(null); pic.updateGeometricState(); return viewPort; } else { throw new IllegalStateException("This VR environment is not attached to any application."); } } else { throw new IllegalStateException("This VR view manager is not attached to any VR environment."); } }
@Override public void simpleInitApp() { viewPort.setBackgroundColor(ColorRGBA.LightGray); initKeys(); /** Add a light source so we can see the model */ DirectionalLight dl = new DirectionalLight(); dl.setDirection(new Vector3f(-0.1f, -1f, -1).normalizeLocal()); rootNode.addLight(dl); /** Load a model that contains animation */ player = (Node) assetManager.loadModel("Models/Oto/OtoOldAnim.j3o"); player.setLocalScale(0.5f); rootNode.attachChild(player); /** Create a controller and channels. */ control = player.getControl(AnimControl.class); control.addListener(this); channel = control.createChannel(); channel.setAnim("stand"); }
@Override public void simpleInitApp() { viewPort.setBackgroundColor(ColorRGBA.DarkGray); flyCam.setEnabled(false);
offView.setBackgroundColor(ColorRGBA.DarkGray);
public void simpleInitApp() { viewPort.setBackgroundColor(ColorRGBA.DarkGray); flyCam.setMoveSpeed(20);
@Override public void simpleInitApp() { viewPort.setBackgroundColor(ColorRGBA.DarkGray); //load model with packed images Spatial ogre = assetManager.loadModel("Blender/2.4x/Sinbad.blend"); rootNode.attachChild(ogre); //load model with referenced images Spatial track = assetManager.loadModel("Blender/2.4x/MountainValley_Track.blend"); rootNode.attachChild(track); // sunset light DirectionalLight dl = new DirectionalLight(); dl.setDirection(new Vector3f(-0.1f,-0.7f,1).normalizeLocal()); dl.setColor(new ColorRGBA(0.44f, 0.30f, 0.20f, 1.0f)); rootNode.addLight(dl); // skylight dl = new DirectionalLight(); dl.setDirection(new Vector3f(-0.6f,-1,-0.6f).normalizeLocal()); dl.setColor(new ColorRGBA(0.10f, 0.22f, 0.44f, 1.0f)); rootNode.addLight(dl); // white ambient light dl = new DirectionalLight(); dl.setDirection(new Vector3f(1, -0.5f,-0.1f).normalizeLocal()); dl.setColor(new ColorRGBA(0.80f, 0.70f, 0.80f, 1.0f)); rootNode.addLight(dl); }
public void simpleInitApp() { this.flyCam.setMoveSpeed(10); cam.setLocation(new Vector3f(0.028406568f, 2.015769f, 7.386517f)); cam.setRotation(new Quaternion(-1.0729783E-5f, 0.9999721f, -0.0073241726f, -0.0014647911f)); makeScene(); //Creating the main view port post processor FilterPostProcessor fpp = new FilterPostProcessor(assetManager); fpp.addFilter(new ColorOverlayFilter(ColorRGBA.Blue)); viewPort.addProcessor(fpp); //creating a frame buffer for the mainviewport FrameBuffer mainVPFrameBuffer = new FrameBuffer(cam.getWidth(), cam.getHeight(), 1); Texture2D mainVPTexture = new Texture2D(cam.getWidth(), cam.getHeight(), Image.Format.RGBA8); mainVPFrameBuffer.addColorTexture(mainVPTexture); mainVPFrameBuffer.setDepthBuffer(Image.Format.Depth); viewPort.setOutputFrameBuffer(mainVPFrameBuffer); //creating the post processor for the gui viewport final FilterPostProcessor guifpp = new FilterPostProcessor(assetManager); guifpp.setFrameBufferFormat(Image.Format.RGBA8); guifpp.addFilter(new ColorOverlayFilter(ColorRGBA.Red)); //this will compose the main viewport texture with the guiviewport back buffer. //Note that you can switch the order of the filters so that guiviewport filters are applied or not to the main viewport texture guifpp.addFilter(new ComposeFilter(mainVPTexture)); guiViewPort.addProcessor(guifpp); //compositing is done by mixing texture depending on the alpha channel, //it's important that the guiviewport clear color alpha value is set to 0 guiViewPort.setBackgroundColor(ColorRGBA.BlackNoAlpha); guiViewPort.setClearColor(true); }
@Override public void simpleInitApp() { viewPort.setBackgroundColor(ColorRGBA.DarkGray); Spatial bumpy = (Spatial) assetManager.loadModel("Models/MonkeyHead/MonkeyHead.mesh.xml"); rootNode.attachChild(bumpy); lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f)); lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m")); rootNode.attachChild(lightMdl); // flourescent main light pl = new PointLight(); pl.setColor(new ColorRGBA(0.88f, 0.92f, 0.95f, 1.0f)); rootNode.addLight(pl); // sunset light DirectionalLight dl = new DirectionalLight(); dl.setDirection(new Vector3f(-0.1f,-0.7f,1).normalizeLocal()); dl.setColor(new ColorRGBA(0.44f, 0.30f, 0.20f, 1.0f)); rootNode.addLight(dl); // skylight dl = new DirectionalLight(); dl.setDirection(new Vector3f(-0.6f,-1,-0.6f).normalizeLocal()); dl.setColor(new ColorRGBA(0.10f, 0.22f, 0.44f, 1.0f)); rootNode.addLight(dl); // white ambient light dl = new DirectionalLight(); dl.setDirection(new Vector3f(1, -0.5f,-0.1f).normalizeLocal()); dl.setColor(new ColorRGBA(0.50f, 0.40f, 0.50f, 1.0f)); rootNode.addLight(dl); }