public int getWidth() { final Camera cam = Camera.getCurrentCamera(); if (cam != null) { return cam.getWidth(); } else { return 1; } }
public int getHeight() { final Camera cam = Camera.getCurrentCamera(); if (cam != null) { return cam.getHeight(); } 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); }
@Override public synchronized void draw(final Renderer r) { if (_textString.length() > 0) { final Camera cam = Camera.getCurrentCamera(); if (!(_autoScale == AutoScale.Off && _autoFade == AutoFade.Off)) { updateScaleAndAlpha(cam, r); } correctTransform(cam); super.draw(r); } }
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); } }
protected void switchCameraIn(final int clear) { // grab non-rtt settings _oldCamera = Camera.getCurrentCamera(); // swap to rtt settings _parentRenderer.getQueue().pushBuckets(); // clear the scene if (clear != 0) { clearBuffers(clear); } getCamera().apply(_parentRenderer); }
@Override public synchronized void draw(final Renderer r) { if (_font != null && _textString.length() > 0) { final Camera cam = Camera.getCurrentCamera(); if (!(_autoScale == AutoScale.Off && _autoFade == AutoFade.Off)) { updateScaleAndAlpha(cam, r); } // if text is transparent, don't spend time // calculating transform and drawing if (getDefaultColor().getAlpha() > 0.05) { correctTransform(cam); updateWorldBound(false); super.draw(r); } } }
protected void switchCameraIn(final int clear) { // grab non-rtt settings _oldCamera = Camera.getCurrentCamera(); // swap to rtt settings _parentRenderer.getQueue().pushBuckets(); // clear the scene if (clear != 0) { clearBuffers(clear); } getCamera().update(); getCamera().apply(_parentRenderer); }
public void render(final Renderer renderer, final Camera camera, final List<Spatial> spatials, final Spatial spatial, final EnumMap<StateType, RenderState> enforcedStates) { if (camera != Camera.getCurrentCamera()) { camera.update(); } camera.apply(renderer); final RenderContext context = ContextManager.getCurrentContext(); context.enforceStates(enforcedStates); if (spatial != null) { spatial.onDraw(renderer); } else { for (final Spatial spat : spatials) { spat.onDraw(renderer); } } renderer.renderBuckets(); context.clearEnforcedStates(); }
/** * Rotate the billboard so it points directly opposite the direction the camera's facing */ private void rotateScreenAligned() { final Camera camera = Camera.getCurrentCamera(); _look.set(camera.getDirection()).negateLocal(); _left.set(camera.getLeft()).negateLocal(); _orient.fromAxes(_left, camera.getUp(), _look); if(_localRot != null) _orient.multiplyLocal(_localRot); _worldTransform.setRotation(_orient); }
/** * Rotate the billboard so it points directly opposite the direction the camera's facing * * @param camera * Camera */ private void rotateScreenAligned() { final Camera camera = Camera.getCurrentCamera(); // coopt diff for our in direction: _look.set(camera.getDirection()).negateLocal(); // coopt loc for our left direction: _left.set(camera.getLeft()).negateLocal(); _orient.fromAxes(_left, camera.getUp(), _look); _worldTransform.setRotation(_orient); }
@MainThread public boolean draw() { // set up context for rendering this canvas makeCurrentContext(); // render stuff, first apply our camera if we have one if (_camera != null) { if (Camera.getCurrentCamera() != _camera) { _camera.update(); } _camera.apply(_renderer); } _renderer.clearBuffers(_frameClear); final boolean drew = _scene.renderUnto(_renderer); _renderer.flushFrame(drew && _doSwap); // release the context if we're done (swapped and all) if (_doSwap) { releaseCurrentContext(); } return drew; }
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); } }
/** * Aligns this Billboard Node so that it points to the camera position. */ private void rotateCameraAligned() { final Camera camera = Camera.getCurrentCamera(); _look.set(camera.getLocation()).subtractLocal(_worldTransform.getTranslation()).normalizeLocal(); _left.set(camera.getUp()).crossLocal(_look); final Vector3 up = Vector3.fetchTempInstance(); up.set(_look).crossLocal(_left); _orient.fromAxes(_left, up, _look); if(_localRot != null) _orient.multiplyLocal(_localRot); _worldTransform.setRotation(_orient); Vector3.releaseTempInstance(up); }
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; }
@Override public void draw(final Renderer r) { final Camera camera = Camera.getCurrentCamera(); boolean anyAlive = false; for (int i = 0; i < _particles.length; i++) { final Particle particle = _particles[i]; if (particle.getStatus() == Particle.Status.Alive) { particle.updateVerts(camera); anyAlive = true; } } // Since we've updated our verts, update the model boundary where applicable if (getParticleGeometry().getWorldBound() != null && anyAlive) { getParticleGeometry().updateModelBound(); } if (!_particlesInWorldCoords) { getParticleGeometry().setWorldTransform(getWorldTransform()); } else { getParticleGeometry().setWorldTranslation(Vector3.ZERO); getParticleGeometry().setWorldRotation(Matrix3.IDENTITY); getParticleGeometry().setWorldScale(getWorldScale()); } getParticleGeometry().draw(r); }
@Override public void draw(final Renderer r) { final Camera camera = Camera.getCurrentCamera(); boolean anyAlive = false; for (int i = 0; i < _particles.length; i++) { final Particle particle = _particles[i]; if (particle.getStatus() == Particle.Status.Alive) { particle.updateVerts(camera); anyAlive = true; } } // Since we've updated our verts, update the model boundary where applicable if (getParticleGeometry().getWorldBound() != null && anyAlive) { getParticleGeometry().updateModelBound(); } if (!_particlesInWorldCoords) { getParticleGeometry().setWorldTransform(getWorldTransform()); } else { getParticleGeometry().setWorldTranslation(Vector3.ZERO); getParticleGeometry().setWorldRotation(Matrix3.IDENTITY); getParticleGeometry().setWorldScale(getWorldScale()); } getParticleGeometry().draw(r); }
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; }