private void initDisplay(){ // aquire important objects // from the context settings = context.getSettings(); // Only reset the timer if a user has not already provided one if (timer == null) { timer = context.getTimer(); } renderer = context.getRenderer(); }
private void initDisplay(){ // aquire important objects // from the context settings = context.getSettings(); // Only reset the timer if a user has not already provided one if (timer == null) { timer = context.getTimer(); } renderer = context.getRenderer(); }
/** * Get the ratio between the {@link #getCanvasSize() GUI canvas size} and the application main windows (if available) or the screen size. * @return the ratio between the {@link #getCanvasSize() GUI canvas size} and the application main windows (if available). * @see #getCanvasSize() */ public Vector2f getCanvasToWindowRatio() { if (environment != null){ if (environment.getApplication() != null){ if( ratio == null ) { ratio = new Vector2f(); Vector2f canvas = getCanvasSize(); int width = Integer.min(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode().getWidth(), environment.getApplication().getContext().getSettings().getWidth()); int height = Integer.min(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode().getHeight(), environment.getApplication().getContext().getSettings().getHeight()); ratio.x = Float.max(1f, canvas.x / width); ratio.y = Float.max(1f, canvas.y / height); } return ratio; } else { throw new IllegalStateException("VR GUI manager underlying environment is not attached to any application."); } } else { throw new IllegalStateException("VR GUI manager is not attached to any environment."); } }
public void setupFilters(){ if (renderer.getCaps().contains(Caps.GLSL100)){ fpp=new FilterPostProcessor(assetManager); //fpp.setNumSamples(4); int numSamples = getContext().getSettings().getSamples(); if( numSamples > 0 ) { fpp.setNumSamples(numSamples); } CartoonEdgeFilter toon=new CartoonEdgeFilter(); toon.setEdgeColor(ColorRGBA.Yellow); fpp.addFilter(toon); viewPort.addProcessor(fpp); } }
if (size.x < environment.getApplication().getContext().getSettings().getWidth()) { size.x = environment.getApplication().getContext().getSettings().getWidth(); if (size.y < environment.getApplication().getContext().getSettings().getHeight()) { size.y = environment.getApplication().getContext().getSettings().getHeight();
if (size.x < environment.getApplication().getContext().getSettings().getWidth()) { size.x = environment.getApplication().getContext().getSettings().getWidth(); if (size.y < environment.getApplication().getContext().getSettings().getHeight()) { size.y = environment.getApplication().getContext().getSettings().getHeight();
if( size.x < environment.getApplication().getContext().getSettings().getWidth() ) { size.x = environment.getApplication().getContext().getSettings().getWidth(); if( size.y < environment.getApplication().getContext().getSettings().getHeight() ) { size.y = environment.getApplication().getContext().getSettings().getHeight();
if( size.x < environment.getApplication().getContext().getSettings().getWidth() ) { size.x = environment.getApplication().getContext().getSettings().getWidth(); if( size.y < environment.getApplication().getContext().getSettings().getHeight() ) { size.y = environment.getApplication().getContext().getSettings().getHeight();
@Override public void centerMouse() { if (environment != null){ if (environment.getApplication() != null){ // set mouse in center of the screen if newly added Vector2f size = environment.getVRGUIManager().getCanvasSize(); MouseInput mi = environment.getApplication().getContext().getMouseInput(); AppSettings as = environment.getApplication().getContext().getSettings(); if( mi instanceof GlfwMouseInputVR ) ((GlfwMouseInputVR)mi).setCursorPosition((int)(as.getWidth() / 2f), (int)(as.getHeight() / 2f)); if( environment.isInVR() ) { cursorPos.x = size.x / 2f; cursorPos.y = size.y / 2f; recentCenterCount = 2; } } 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."); } }
windowSize.x = Math.max(windowSize.x * 2f, leftCamera.getWidth()); org.lwjgl.glfw.GLFW.glfwSetWindowSize(window, (int)windowSize.x, (int)windowSize.y); environment.getApplication().getContext().getSettings().setResolution((int)windowSize.x, (int)windowSize.y);
/** * Get the GUI canvas size. This method return the size in pixels of the GUI available area within the VR view. * @return the GUI canvas size. This method return the size in pixels of the GUI available area within the VR view. */ public Vector2f getCanvasSize() { if (environment != null){ if (environment.getApplication() != null){ if( screenSize == null ) { if( environment.isInVR() && environment.getVRHardware() != null ) { screenSize = new Vector2f(); environment.getVRHardware().getRenderSize(screenSize); screenSize.multLocal(environment.getVRViewManager().getResolutionMuliplier()); } else { AppSettings as = environment.getApplication().getContext().getSettings(); screenSize = new Vector2f(as.getWidth(), as.getHeight()); } } return screenSize; } else { throw new IllegalStateException("VR GUI manager underlying environment is not attached to any application."); } } else { throw new IllegalStateException("VR GUI manager is not attached to any environment."); } }
if (environment.getApplication().getContext().getSettings().isSwapBuffers()) { setupMirrorBuffers(environment.getCamera(), dualEyeTex, true); if (environment.getApplication().getContext().getSettings().isSwapBuffers()) { setupMirrorBuffers(environment.getCamera(), leftEyeTexture, false);
if( environment.getApplication().getContext().getSettings().isSwapBuffers() ) { setupMirrorBuffers(environment.getCamera(), dualEyeTex, true); if( environment.getApplication().getContext().getSettings().isSwapBuffers() ) { setupMirrorBuffers(environment.getCamera(), leftEyeTexture, false);
if( environment.getApplication().getContext().getSettings().isSwapBuffers() ) { setupMirrorBuffers(environment.getCamera(), dualEyeTex, true); if( environment.getApplication().getContext().getSettings().isSwapBuffers() ) { setupMirrorBuffers(environment.getCamera(), leftEyeTexture, false);
public void simpleInitApp() { this.flyCam.setMoveSpeed(50); Node mainScene=new Node(); cam.setLocation(new Vector3f(-34.74095f, 95.21318f, -287.4945f)); cam.setRotation(new Quaternion(0.023536969f, 0.9361278f, -0.016098259f, -0.35050195f)); // load sky mainScene.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", SkyFactory.EnvMapType.CubeMap)); createTerrain(mainScene); DirectionalLight sun = new DirectionalLight(); Vector3f lightDir=new Vector3f(-0.37352666f, -0.50444174f, -0.7784704f); sun.setDirection(lightDir); sun.setColor(ColorRGBA.White.clone().multLocal(2)); mainScene.addLight(sun); rootNode.attachChild(mainScene); fpp=new FilterPostProcessor(assetManager); //fpp.setNumSamples(4); int numSamples = getContext().getSettings().getSamples(); if( numSamples > 0 ) { fpp.setNumSamples(numSamples); } fog=new FogFilter(); fog.setFogColor(new ColorRGBA(0.9f, 0.9f, 0.9f, 1.0f)); fog.setFogDistance(155); fog.setFogDensity(1.0f); fpp.addFilter(fog); viewPort.addProcessor(fpp); initInputs(); }
int numSamples = getContext().getSettings().getSamples(); if (numSamples > 0) { fpp.setNumSamples(numSamples);
int numSamples = context.getSettings().getSamples(); if (numSamples > 0) { fpp.setNumSamples(numSamples);
int numSamples = getContext().getSettings().getSamples(); if (numSamples > 0) { fpp.setNumSamples(numSamples);
int numSamples = getContext().getSettings().getSamples(); if( numSamples > 0 ) { fpp.setNumSamples(numSamples);
int numSamples = getContext().getSettings().getSamples(); if( numSamples > 0 ) { fpp.setNumSamples(numSamples);