if (getProjectionMode() == ProjectionMode.Perspective) { final double nearSquared = _frustumNear * _frustumNear; final double leftSquared = _frustumLeft * _frustumLeft; _coeffTop[0] = -_frustumNear * inverseLength; _coeffTop[1] = _frustumTop * inverseLength; } else if (getProjectionMode() == ProjectionMode.Parallel) { if (_frustumRight > _frustumLeft) { _coeffLeft[0] = -1;
if (getProjectionMode() == ProjectionMode.Perspective) { final double nearSquared = _frustumNear * _frustumNear; final double leftSquared = _frustumLeft * _frustumLeft; _coeffTop[0] = -_frustumNear * inverseLength; _coeffTop[1] = _frustumTop * inverseLength; } else if (getProjectionMode() == ProjectionMode.Orthographic) { if (_frustumRight > _frustumLeft) { _coeffLeft[0] = -1;
/** * Updates the value of our projection matrix. */ protected void updateProjectionMatrix() { if (getProjectionMode() == ProjectionMode.Parallel) { _projection.setIdentity(); _projection.setM00(2.0 / (_frustumRight - _frustumLeft)); _projection.setM11(2.0 / (_frustumTop - _frustumBottom)); _projection.setM22(-2.0 / (_frustumFar - _frustumNear)); _projection.setM30(-(_frustumRight + _frustumLeft) / (_frustumRight - _frustumLeft)); _projection.setM31(-(_frustumTop + _frustumBottom) / (_frustumTop - _frustumBottom)); _projection.setM32(-(_frustumFar + _frustumNear) / (_frustumFar - _frustumNear)); } else if (getProjectionMode() == ProjectionMode.Perspective) { _projection.setIdentity(); _projection.setM00((2.0 * _frustumNear) / (_frustumRight - _frustumLeft)); _projection.setM11((2.0 * _frustumNear) / (_frustumTop - _frustumBottom)); _projection.setM20((_frustumRight + _frustumLeft) / (_frustumRight - _frustumLeft)); _projection.setM21((_frustumTop + _frustumBottom) / (_frustumTop - _frustumBottom)); _projection.setM22(-(_frustumFar + _frustumNear) / (_frustumFar - _frustumNear)); _projection.setM23(-1.0); _projection.setM32(-(2.0 * _frustumFar * _frustumNear) / (_frustumFar - _frustumNear)); _projection.setM33(-0.0); } _updatePMatrix = false; }
/** * Updates the value of our projection matrix. */ protected void updateProjectionMatrix() { if (getProjectionMode() == ProjectionMode.Orthographic) { _projection.setIdentity(); _projection.setM00(2.0 / (_frustumRight - _frustumLeft)); _projection.setM11(2.0 / (_frustumTop - _frustumBottom)); _projection.setM22(-2.0 / (_frustumFar - _frustumNear)); _projection.setM30(-(_frustumRight + _frustumLeft) / (_frustumRight - _frustumLeft)); _projection.setM31(-(_frustumTop + _frustumBottom) / (_frustumTop - _frustumBottom)); _projection.setM32(-(_frustumFar + _frustumNear) / (_frustumFar - _frustumNear)); } else if (getProjectionMode() == ProjectionMode.Perspective) { _projection.setIdentity(); _projection.setM00((2.0 * _frustumNear) / (_frustumRight - _frustumLeft)); _projection.setM11((2.0 * _frustumNear) / (_frustumTop - _frustumBottom)); _projection.setM20((_frustumRight + _frustumLeft) / (_frustumRight - _frustumLeft)); _projection.setM21((_frustumTop + _frustumBottom) / (_frustumTop - _frustumBottom)); _projection.setM22(-(_frustumFar + _frustumNear) / (_frustumFar - _frustumNear)); _projection.setM23(-1.0); _projection.setM32(-(2.0 * _frustumFar * _frustumNear) / (_frustumFar - _frustumNear)); _projection.setM33(-0.0); } _updatePMatrix = false; }
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); }
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); }
if (cam.getProjectionMode() == ProjectionMode.Parallel) { heightAtZ = cam.getFrustumTop(); } else {
_projectionMode = source.getProjectionMode();
_projectionMode = source.getProjectionMode();
if (cam.getProjectionMode().equals(ProjectionMode.Orthographic)) { heightAtZ = cam.getFrustumBottom(); } else {
_worldPlane[TOP_PLANE].setConstant(_location.dot(planeNormal)); if (getProjectionMode() == ProjectionMode.Parallel) { if (_frustumRight > _frustumLeft) { _worldPlane[LEFT_PLANE].setConstant(_worldPlane[LEFT_PLANE].getConstant() + _frustumLeft);
_worldPlane[TOP_PLANE].setConstant(_location.dot(planeNormal)); if (getProjectionMode() == ProjectionMode.Orthographic) { if (_frustumRight > _frustumLeft) { _worldPlane[LEFT_PLANE].setConstant(_worldPlane[LEFT_PLANE].getConstant() + _frustumLeft);