/** * <code>updateWorldTransform</code> updates the rotation and translation of this node, and sets the camera's frame * buffer to reflect the current view. */ @Override public void updateWorldTransform(final boolean recurse) { super.updateWorldTransform(recurse); if (_camera != null) { final ReadOnlyVector3 worldTranslation = getWorldTranslation(); final ReadOnlyMatrix3 worldRotation = getWorldRotation(); _camera.setFrame(worldTranslation, worldRotation); } }
/** * <code>updateWorldTransform</code> updates the rotation and translation of this node, and sets the camera's frame * buffer to reflect the current view. */ @Override public void updateWorldTransform(final boolean recurse) { super.updateWorldTransform(recurse); if (_camera != null) { final ReadOnlyVector3 worldTranslation = getWorldTranslation(); final ReadOnlyMatrix3 worldRotation = getWorldRotation(); _camera.setFrame(worldTranslation, worldRotation); } }
public AbstractFBOTextureRenderer(final int width, final int height, final int depthBits, final int samples, final Renderer parentRenderer, final ContextCapabilities caps) { if (logger.isLoggable(Level.FINE)) { logger.fine("Creating FBOTextureRenderer sized: " + _width + " x " + _height); } _parentRenderer = parentRenderer; _samples = Math.min(samples, caps.getMaxFBOSamples()); _depthBits = depthBits; _supportsMultisample = caps.getMaxFBOSamples() != 0; _width = width; _height = height; _camera.resize(_width, _height); _camera.setFrustum(1.0f, 1000.0f, -0.50f, 0.50f, 0.50f, -0.50f); final Vector3 loc = new Vector3(0.0f, 0.0f, 0.0f); final Vector3 left = new Vector3(-1.0f, 0.0f, 0.0f); final Vector3 up = new Vector3(0.0f, 1.0f, 0.0f); final Vector3 dir = new Vector3(0.0f, 0f, -1.0f); _camera.setFrame(loc, left, up, dir); }
public void updateLeftRightCameraFrames() { // update camera frame final Vector3 rightDir = Vector3.fetchTempInstance(); final Vector3 work = Vector3.fetchTempInstance(); rightDir.set(getDirection()).crossLocal(getUp()).multiplyLocal(_eyeSeparation / 2.0); _leftCamera.setFrame(getLocation().subtract(rightDir, work), getLeft(), getUp(), getDirection()); _rightCamera.setFrame(getLocation().add(rightDir, work), getLeft(), getUp(), getDirection()); Vector3.releaseTempInstance(work); Vector3.releaseTempInstance(rightDir); }
public void updateLeftRightCameraFrames() { // update camera frame final Vector3 rightDir = Vector3.fetchTempInstance(); final Vector3 work = Vector3.fetchTempInstance(); rightDir.set(getDirection()).crossLocal(getUp()).multiplyLocal(_eyeSeparation / 2.0); _leftCamera.setFrame(getLocation().subtract(rightDir, work), getLeft(), getUp(), getDirection()); _rightCamera.setFrame(getLocation().add(rightDir, work), getLeft(), getUp(), getDirection()); Vector3.releaseTempInstance(work); Vector3.releaseTempInstance(rightDir); }
final Vector3 up = new Vector3(0.0f, 1.0f, 0.0f); final Vector3 dir = new Vector3(0.0f, 0f, -1.0f); _camera.setFrame(loc, left, up, dir);
final Vector3 up = new Vector3(0.0f, 1.0f, 0.0f); final Vector3 dir = new Vector3(0.0f, 0f, -1.0f); _camera.setFrame(loc, left, up, dir);
public static Camera newOrthoCamera(final Canvas canvas) { final int width = canvas.getContentWidth(); final int height = canvas.getContentHeight(); final Camera camera = new Camera(width, height); camera.setFrustum(-1, 1, 0, width, height, 0); camera.setProjectionMode(ProjectionMode.Orthographic); final Vector3 loc = new Vector3(0.0f, 0.0f, 0.0f); final Vector3 left = new Vector3(-1.0f, 0.0f, 0.0f); final Vector3 up = new Vector3(0.0f, 1.0f, 0.0f); final Vector3 dir = new Vector3(0.0f, 0f, -1.0f); /** Move our camera to a correct place and orientation. */ camera.setFrame(loc, left, up, dir); canvas.addListener(new ICanvasListener() { @Override public void onResize(final int newWidth, final int newHeight) { camera.resize(newWidth, newHeight); camera.setFrustumRight(newWidth); camera.setFrustumTop(newHeight); } }); return camera; } }
protected void render(final Renderer renderer, final Camera camera, final List<Spatial> spatials, final Spatial spatial, final EnumMap<StateType, RenderState> enforcedStates) { final TextureRenderer texRend = TextureRendererPool.fetch(_width, _height, renderer); if (!_texSetup) { texRend.setupTexture(_texture); _texSetup = true; } // set desired bg color texRend.setBackgroundColor(_backgroundColor); // setup camera if (camera != null) { texRend.getCamera().setFrame(camera); texRend.getCamera().setFrustum(camera); texRend.getCamera().setProjectionMode(camera.getProjectionMode()); } texRend.enforceStates(enforcedStates); // draw to texture if (spatial != null) { texRend.render(spatial, _texture, Renderer.BUFFER_COLOR_AND_DEPTH); } else { texRend.render(spatials, _texture, Renderer.BUFFER_COLOR_AND_DEPTH); } texRend.clearEnforcedStates(); TextureRendererPool.release(texRend); }
final Vector3 up = new Vector3(0.0f, 1.0f, 0.0f); final Vector3 dir = new Vector3(0.0f, 0f, -1.0f); _camera.setFrame(loc, left, up, dir);
protected void render(final Renderer renderer, final Camera camera, final List<Spatial> spatials, final Spatial spatial, final RenderMaterial enforcedMaterial, final EnumMap<StateType, RenderState> enforcedStates) { final TextureRenderer texRend = TextureRendererPool.fetch(_width, _height, renderer); if (!_texSetup) { texRend.setupTexture(_texture); _texSetup = true; } // set desired bg color texRend.setBackgroundColor(_backgroundColor); // setup camera if (camera != null) { texRend.getCamera().setFrame(camera); texRend.getCamera().setFrustum(camera); texRend.getCamera().setProjectionMode(camera.getProjectionMode()); } texRend.enforceMaterial(enforcedMaterial); texRend.enforceStates(enforcedStates); // draw to texture if (spatial != null) { texRend.renderSpatial(spatial, _texture, Renderer.BUFFER_COLOR_AND_DEPTH); } else { texRend.renderSpatials(spatials, _texture, Renderer.BUFFER_COLOR_AND_DEPTH); } texRend.clearEnforcedStates(); texRend.enforceMaterial(null); TextureRendererPool.release(texRend); }
@Override public void draw(final Renderer r) { if (_timer != null && _redrawRate > 0) { _elapsed += _timer.getTimePerFrame(); } if (_tRenderer == null) { init(r); } if (_cam == null) { _cam = Camera.getCurrentCamera(); _tRenderer.getCamera().setFrustum(_cam.getFrustumNear(), _cam.getFrustumFar(), _cam.getFrustumLeft(), _cam.getFrustumRight(), _cam.getFrustumTop(), _cam.getFrustumBottom()); _tRenderer.getCamera().setFrame(_cam.getLocation(), _cam.getLeft(), _cam.getUp(), _cam.getDirection()); } if (_doUpdate && (!_haveDrawn || shouldDoUpdate(_cam)) && _targetScene.getWorldBound() != null) { final BoundingVolume b = _targetScene.getWorldBound(); _center.set(b.getCenter()); updateCameraLookat(); calculateImposter(); updateCameraLookat(); updateCameraFrustum(); renderImposter(); _haveDrawn = true; } _imposterQuad.draw(r); }
@Override public void draw(final Renderer r) { if (_timer != null && _redrawRate > 0) { _elapsed += _timer.getTimePerFrame(); } if (_tRenderer == null) { init(r); } if (_cam == null) { _cam = Camera.getCurrentCamera(); _tRenderer.getCamera().setFrustum(_cam.getFrustumNear(), _cam.getFrustumFar(), _cam.getFrustumLeft(), _cam.getFrustumRight(), _cam.getFrustumTop(), _cam.getFrustumBottom()); _tRenderer.getCamera().setFrame(_cam.getLocation(), _cam.getLeft(), _cam.getUp(), _cam.getDirection()); } if (_doUpdate && (!_haveDrawn || shouldDoUpdate(_cam)) && _targetScene.getWorldBound() != null) { final BoundingVolume b = _targetScene.getWorldBound(); _center.set(b.getCenter()); updateCameraLookat(); calculateImposter(); updateCameraLookat(); updateCameraFrustum(); renderImposter(); _haveDrawn = true; } _imposterQuad.draw(r); }
final Vector3 dir = new Vector3(0.0f, 0f, -1.0f); _camera.setFrame(loc, left, up, dir); } else {
final Vector3 dir = new Vector3(0.0f, 0f, -1.0f); _camera.setFrame(loc, left, up, dir); } else {
final Vector3 dir = new Vector3(0.0f, 0f, -1.0f); _camera.setFrame(loc, left, up, dir); } else {