/** * Convenience method for retrieving the Camera set on the current RenderContext. Similar to * ContextManager.getCurrentContext().getCurrentCamera() but with null checks for current context. * * @return the Camera on the current RenderContext. */ public static Camera getCurrentCamera() { if (ContextManager.getCurrentContext() == null) { return null; } return ContextManager.getCurrentContext().getCurrentCamera(); }
public RenderContext(final Object key, final ContextCapabilities caps, final RenderContext shared) { _contextKey = key; _capabilities = caps; setupRecords(); _glContextRef = (shared == null) ? new RenderContextRef() : shared._glContextRef; }
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 static TextureRenderer fetch(final int width, final int height, final Renderer renderer) { for (final Iterator<TextureRenderer> it = INSTANCE.renderers.iterator(); it.hasNext();) { final TextureRenderer texRend = it.next(); if (texRend.getWidth() == width && texRend.getHeight() == height) { it.remove(); return texRend; } } // none found, make one return TextureRendererFactory.INSTANCE.createTextureRenderer(width, height, renderer, ContextManager .getCurrentContext().getCapabilities()); }
protected void switchCameraIn(final int clear) { // Note: no need for storing and replacing old camera since pbuffer is a separate context. // swap to rtt settings _parentRenderer.getQueue().pushBuckets(); // clear the scene if (clear != 0) { clearBuffers(clear); } getCamera().update(); getCamera().apply(_parentRenderer); }
private void init(final Renderer renderer) { _tRenderer = TextureRendererFactory.INSTANCE.createTextureRenderer(_twidth, _theight, _depth, _samples, renderer, ContextManager.getCurrentContext().getCapabilities()); _tRenderer.setBackgroundColor(new ColorRGBA(0, 0, 0, 0)); resetTexture(); }
private void updateCameraLookat() { _tRenderer.getCamera().setLocation(_cam.getLocation()); _tRenderer.getCamera().lookAt(_center, _worldUpVector); }
/** * Applies all currently set renderstates to the supplied context * * @param context */ public void applyPassNodeStates(final RenderContext context) { context.pushEnforcedStates(); context.enforceStates(_passStates); }
/** * Should only be called on a thread with an active context. */ public void contextLost() { // Notify any interested parties of the deletion. ContextManager.fireCleanContextEvent(this); // invalidate our render states invalidateStates(); // force camera update if (_currentCamera != null) { _currentCamera.update(); } } }
@Override public void doRender(final TextureRenderer r, final int clear, final List<Texture> texs) { r.render(_spatials, texs, clear); } }
/** * @param frustumLeft * the new value of the left frustum plane. */ public void setFrustumLeft(final double frustumLeft) { _frustumLeft = frustumLeft; onFrustumChange(); }
public static void fireCleanContextEvent(final RenderContext renderContext) { for (final ContextCleanListener listener : _cleanListeners) { listener.cleanForContext(renderContext); } }
/** * @param bottom * the new bottom boundary of the viewport */ public void setViewPortBottom(final double bottom) { _viewPortBottom = bottom; onViewPortChange(); }
/** * @return the inverse of this camera's 4x4 model view X projection matrix. */ public ReadOnlyMatrix4 getModelViewProjectionInverseMatrix() { checkInverseModelViewProjection(); return _modelViewProjectionInverse; }
/** * Converts a position in world coordinate space to a x,y,z frustum position using the current settings of this * camera. * * @param worldPos * the position in space to retrieve frustum coordinates for. * @return a new vector containing the x,y,z frustum position */ public Vector3 getFrustumCoordinates(final ReadOnlyVector3 worldPos) { return getFrustumCoordinates(worldPos, null); }
/** * update modelView if necessary. */ private void checkModelView() { if (_updateMVMatrix) { updateModelViewMatrix(); _updateMVMatrix = false; } }
/** * Convenience method for retrieving the Camera set on the current RenderContext. Similar to * ContextManager.getCurrentContext().getCurrentCamera() but with null checks for current context. * * @return the Camera on the current RenderContext. */ public static Camera getCurrentCamera() { if (ContextManager.getCurrentContext() == null) { return null; } return ContextManager.getCurrentContext().getCurrentCamera(); }
/** * Should only be called on a thread with an active context. */ public void contextLost() { // Notify any interested parties of the deletion. ContextManager.fireCleanContextEvent(this); // invalidate our render states invalidateStates(); // force camera update if (_currentCamera != null) { _currentCamera.update(); } } }
/** * @param frustumRight * the new value of the right frustum plane. */ public void setFrustumRight(final double frustumRight) { _frustumRight = frustumRight; onFrustumChange(); }