public int getWidth() { final Camera cam = Camera.getCurrentCamera(); if (cam != null) { return cam.getWidth(); } else { return 1; } }
public static void drawBuffer(final TextureStoreFormat rttFormat, final int location, final Renderer r) { final Camera cam = Camera.getCurrentCamera(); drawBuffer(rttFormat, location, r, cam.getWidth() / 6.25); }
public static void drawBuffer(final TextureStoreFormat rttFormat, final int location, final Renderer r) { final Camera cam = Camera.getCurrentCamera(); drawBuffer(rttFormat, location, r, cam.getWidth() / 6.25); }
public int getWidth() { return _canvas.getCanvasRenderer().getCamera().getWidth(); }
/** * Construct a new camera, using the given source camera's values. * * @param source */ public Camera(final Camera source) { _coeffLeft = new double[2]; _coeffRight = new double[2]; _coeffBottom = new double[2]; _coeffTop = new double[2]; _worldPlane = new Plane[MAX_WORLD_PLANES]; for (int i = 0; i < MAX_WORLD_PLANES; i++) { _worldPlane[i] = new Plane(); } set(source); _logger.fine("Camera created. W: " + getWidth() + " H: " + getHeight()); }
/** * Construct a new camera, using the given source camera's values. * * @param source */ public Camera(final Camera source) { _coeffLeft = new double[2]; _coeffRight = new double[2]; _coeffBottom = new double[2]; _coeffTop = new double[2]; _worldPlane = new Plane[MAX_WORLD_PLANES]; for (int i = 0; i < MAX_WORLD_PLANES; i++) { _worldPlane[i] = new Plane(); } set(source); _logger.fine("Camera created. W: " + getWidth() + " H: " + getHeight()); }
public synchronized static void exportCurrentScreen(final Renderer renderer, final ScreenExportable exportable) { final ImageDataFormat format = exportable.getFormat(); final Camera camera = Camera.getCurrentCamera(); final int width = camera.getWidth(), height = camera.getHeight(); // prepare our data buffer final int size = renderer.getExpectedBufferSizeToGrabScreenContents(format, PixelDataType.UnsignedByte, width, height); if (_scratch.capacity() < size) { _scratch = BufferUtils.createByteBuffer(size); } else { _scratch.limit(size); _scratch.rewind(); } // Ask the renderer for the current scene to be stored in the buffer renderer.grabScreenContents(_scratch, format, 0, 0, width, height); // send the buffer to the exportable object for processing. exportable.export(_scratch, width, height); } }
public synchronized static void exportCurrentScreen(final Renderer renderer, final ScreenExportable exportable) { final ImageDataFormat format = exportable.getFormat(); final Camera camera = Camera.getCurrentCamera(); final int width = camera.getWidth(), height = camera.getHeight(); // prepare our data buffer final int size = renderer.getExpectedBufferSizeToGrabScreenContents(format, PixelDataType.UnsignedByte, width, height); if (_scratch.capacity() < size) { _scratch = BufferUtils.createByteBuffer(size); } else { _scratch.limit(size); _scratch.rewind(); } // Ask the renderer for the current scene to be stored in the buffer renderer.grabScreenContents(_scratch, format, 0, 0, width, height); // send the buffer to the exportable object for processing. exportable.export(_scratch, width, height); } }
/** * Centers this frame on the view of the camera * * @param cam * the camera to center on. */ public void setLocationRelativeTo(final Camera cam) { final Rectangle2 rectA = getRelativeComponentBounds(null); int x = (cam.getWidth() - rectA.getWidth()) / 2; int y = (cam.getHeight() - rectA.getHeight()) / 2; x -= rectA.getX(); y -= rectA.getY(); setHudXY(x, y); updateGeometricState(0); }
GL11.glScissor(0, 0, cam.getWidth(), cam.getHeight()); record.setClippingTestEnabled(true);
/** * Converts a position in world coordinate space to an x,y screen position and depth value using the current * settings of this camera. * * @param worldPos * the position in space to retrieve screen coordinates for. * @param store * Use to avoid object creation. if not null, the results are stored in the given vector and returned. * Otherwise, a new vector is created. * @return a vector containing the screen coordinates as x and y and the distance as a percent between near and far * planes. */ public Vector3 getScreenCoordinates(final ReadOnlyVector3 worldPosition, Vector3 store) { store = getNormalizedDeviceCoordinates(worldPosition, store); store.setX(((store.getX() + 1) * (_viewPortRight - _viewPortLeft) / 2) * getWidth()); store.setY(((store.getY() + 1) * (_viewPortTop - _viewPortBottom) / 2) * getHeight()); store.setZ((store.getZ() + 1) / 2); return store; }
GL11C.glScissor(0, 0, cam.getWidth(), cam.getHeight()); record.setClippingTestEnabled(true);
/** * Converts a position in world coordinate space to an x,y screen position and depth value using the current * settings of this camera. * * @param worldPos * the position in space to retrieve screen coordinates for. * @param store * Use to avoid object creation. if not null, the results are stored in the given vector and returned. * Otherwise, a new vector is created. * @return a vector containing the screen coordinates as x and y and the distance as a percent between near and far * planes. */ public Vector3 getScreenCoordinates(final ReadOnlyVector3 worldPosition, Vector3 store) { store = getNormalizedDeviceCoordinates(worldPosition, store); store.setX(((store.getX() + 1) * (_viewPortRight - _viewPortLeft) / 2) * getWidth()); store.setY(((store.getY() + 1) * (_viewPortTop - _viewPortBottom) / 2) * getHeight()); store.setZ((store.getZ() + 1) / 2); return store; }
public void update(final ReadOnlyTimer timer) { final double tpf = timer.getTimePerFrame(); // Execute update queue items GameTaskQueueManager.getManager(ParticleEditorFrame.GLOBAL_CONTEXT).getQueue(GameTaskQueue.UPDATE).execute(); _logicalLayer.checkTriggers(tpf); rootNode.updateGeometricState(tpf); if (Constants.stats) { final Camera cam = Camera.getCurrentCamera(); if (cam != null) { labGraph.setTranslation((cam.getWidth() - .5f * labGraph.getWidth()), (.5f * labGraph.getHeight()), 0); } statNode.updateGeometricState(tpf); } }
public void setOrtho() { if (_inOrthoMode) { throw new Ardor3dException("Already in Orthographic mode."); } // set up ortho mode final RendererRecord matRecord = ContextManager.getCurrentContext().getRendererRecord(); LwjglRendererUtil.switchMode(matRecord, GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glLoadIdentity(); final Camera camera = Camera.getCurrentCamera(); final double viewportWidth = camera.getWidth() * (camera.getViewPortRight() - camera.getViewPortLeft()); final double viewportHeight = camera.getHeight() * (camera.getViewPortTop() - camera.getViewPortBottom()); GL11.glOrtho(0, viewportWidth, 0, viewportHeight, -1, 1); LwjglRendererUtil.switchMode(matRecord, GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); _inOrthoMode = true; }
position.set((screenPosition.getX() / getWidth() - _viewPortLeft) / (_viewPortRight - _viewPortLeft) * 2 - 1, (screenPosition.getY() / getHeight() - _viewPortBottom) / (_viewPortTop - _viewPortBottom) * 2 - 1, zDepth * 2 - 1, 1);
position.set((screenPosition.getX() / getWidth() - _viewPortLeft) / (_viewPortRight - _viewPortLeft) * 2 - 1, (screenPosition.getY() / getHeight() - _viewPortBottom) / (_viewPortTop - _viewPortBottom) * 2 - 1, zDepth * 2 - 1, 1);
public void setOrtho() { if (_inOrthoMode) { throw new Ardor3dException("Already in Orthographic mode."); } // set up ortho mode final JoglRendererRecord matRecord = (JoglRendererRecord) ContextManager.getCurrentContext() .getRendererRecord(); JoglRendererUtil.switchMode(matRecord, GLMatrixFunc.GL_PROJECTION); matRecord.getMatrixBackend().pushMatrix(); matRecord.getMatrixBackend().loadIdentity(); final Camera camera = Camera.getCurrentCamera(); final double viewportWidth = camera.getWidth() * (camera.getViewPortRight() - camera.getViewPortLeft()); final double viewportHeight = camera.getHeight() * (camera.getViewPortTop() - camera.getViewPortBottom()); matRecord.getMatrixBackend().setOrtho(0, viewportWidth, 0, viewportHeight, -1, 1); JoglRendererUtil.switchMode(matRecord, GLMatrixFunc.GL_MODELVIEW); matRecord.getMatrixBackend().pushMatrix(); matRecord.getMatrixBackend().loadIdentity(); _inOrthoMode = true; }
_width = source.getWidth(); _height = source.getHeight();
_width = source.getWidth(); _height = source.getHeight();