/** * <code>setFrustumBottom</code> sets the value of the bottom frustum * plane. * * @param frustumBottom the value of the bottom frustum plane. */ public void setFrustumBottom(float frustumBottom) { this.frustumBottom = frustumBottom; onFrustumChange(); }
/** * Enable/disable parallel projection. * * @param value true to set up this camera for parallel projection is enable, false to enter normal perspective mode */ public void setParallelProjection(final boolean value) { this.parallelProjection = value; onFrustumChange(); }
/** * <code>setFrustumNear</code> sets the value of the near frustum plane. * * @param frustumNear the value of the near frustum plane. */ public void setFrustumNear(float frustumNear) { this.frustumNear = frustumNear; onFrustumChange(); }
/** * <code>setFrustumTop</code> sets the value of the top frustum plane. * * @param frustumTop the value of the top frustum plane. */ public void setFrustumTop(float frustumTop) { this.frustumTop = frustumTop; onFrustumChange(); }
/** * <code>setFrustumFar</code> sets the value of the far frustum plane. * * @param frustumFar the value of the far frustum plane. */ public void setFrustumFar(float frustumFar) { this.frustumFar = frustumFar; onFrustumChange(); }
/** * <code>setFrustumLeft</code> sets the value of the left frustum plane. * * @param frustumLeft the value of the left frustum plane. */ public void setFrustumLeft(float frustumLeft) { this.frustumLeft = frustumLeft; onFrustumChange(); }
/** * <code>setFrustumRight</code> sets the value of the right frustum plane. * * @param frustumRight the value of the right frustum plane. */ public void setFrustumRight(float frustumRight) { this.frustumRight = frustumRight; onFrustumChange(); }
/** * <code>setFrustum</code> sets the frustum of this camera object. * * @param near the near plane. * @param far the far plane. * @param left the left plane. * @param right the right plane. * @param top the top plane. * @param bottom the bottom plane. * @see Camera#setFrustum(float, float, float, float, * float, float) */ public void setFrustum(float near, float far, float left, float right, float top, float bottom) { frustumNear = near; frustumFar = far; frustumLeft = left; frustumRight = right; frustumTop = top; frustumBottom = bottom; onFrustumChange(); }
/** * <code>update</code> updates the camera parameters by calling * <code>onFrustumChange</code>,<code>onViewPortChange</code> and * <code>onFrameChange</code>. * * @see Camera#update() */ public void update() { onFrustumChange(); onViewPortChange(); //...this is always called by onFrustumChange() //onFrameChange(); }
/** * Resize this camera's view for the specified display size. Invoked by an * associated {@link RenderManager} to notify the camera of changes to the * display dimensions. * * @param width the new width of the display, in pixels * @param height the new height of the display, in pixels * @param fixAspect if true, recompute the camera's frustum to preserve its * prior aspect ratio */ public void resize(int width, int height, boolean fixAspect) { this.width = width; this.height = height; onViewPortChange(); if (fixAspect) { float h = height * (viewPortTop - viewPortBottom); float w = width * (viewPortRight - viewPortLeft); float aspectRatio = w / h; frustumRight = frustumTop * aspectRatio; frustumLeft = -frustumRight; onFrustumChange(); } }
/** * <code>setFrustumPerspective</code> defines the frustum for the camera. This * frustum is defined by a viewing angle, aspect ratio, and near/far planes * * @param fovY Frame of view angle along the Y in degrees. * @param aspect Width:Height ratio * @param near Near view plane distance * @param far Far view plane distance */ public void setFrustumPerspective(float fovY, float aspect, float near, float far) { if (Float.isNaN(aspect) || Float.isInfinite(aspect)) { // ignore. logger.log(Level.WARNING, "Invalid aspect given to setFrustumPerspective: {0}", aspect); return; } float h = FastMath.tan(fovY * FastMath.DEG_TO_RAD * .5f) * near; float w = h * aspect; frustumLeft = -w; frustumRight = w; frustumBottom = -h; frustumTop = h; frustumNear = near; frustumFar = far; // Camera is no longer parallel projection even if it was before parallelProjection = false; onFrustumChange(); }
/** * Constructor instantiates a new <code>Camera</code> object. All * values of the camera are set to default. */ public Camera(int width, int height) { this(); location = new Vector3f(); rotation = new Quaternion(); frustumNear = 1.0f; frustumFar = 2.0f; frustumLeft = -0.5f; frustumRight = 0.5f; frustumTop = 0.5f; frustumBottom = -0.5f; coeffLeft = new float[2]; coeffRight = new float[2]; coeffBottom = new float[2]; coeffTop = new float[2]; viewPortLeft = 0.0f; viewPortRight = 1.0f; viewPortTop = 1.0f; viewPortBottom = 0.0f; this.width = width; this.height = height; onFrustumChange(); onViewPortChange(); onFrameChange(); logger.log(Level.FINE, "Camera created (W: {0}, H: {1})", new Object[]{width, height}); }
public void read(JmeImporter e) throws IOException { InputCapsule capsule = e.getCapsule(this); location = (Vector3f) capsule.readSavable("location", Vector3f.ZERO.clone()); rotation = (Quaternion) capsule.readSavable("rotation", Quaternion.DIRECTION_Z.clone()); frustumNear = capsule.readFloat("frustumNear", 1); frustumFar = capsule.readFloat("frustumFar", 2); frustumLeft = capsule.readFloat("frustumLeft", -0.5f); frustumRight = capsule.readFloat("frustumRight", 0.5f); frustumTop = capsule.readFloat("frustumTop", 0.5f); frustumBottom = capsule.readFloat("frustumBottom", -0.5f); coeffLeft = capsule.readFloatArray("coeffLeft", new float[2]); coeffRight = capsule.readFloatArray("coeffRight", new float[2]); coeffBottom = capsule.readFloatArray("coeffBottom", new float[2]); coeffTop = capsule.readFloatArray("coeffTop", new float[2]); viewPortLeft = capsule.readFloat("viewPortLeft", 0); viewPortRight = capsule.readFloat("viewPortRight", 1); viewPortTop = capsule.readFloat("viewPortTop", 1); viewPortBottom = capsule.readFloat("viewPortBottom", 0); width = capsule.readInt("width", 1); height = capsule.readInt("height", 1); name = capsule.readString("name", null); onFrustumChange(); onViewPortChange(); onFrameChange(); } }
/** * <code>setFrustumTop</code> sets the value of the top frustum plane. * * @param frustumTop the value of the top frustum plane. */ public void setFrustumTop(float frustumTop) { this.frustumTop = frustumTop; onFrustumChange(); }
/** * <code>setFrustumRight</code> sets the value of the right frustum plane. * * @param frustumRight the value of the right frustum plane. */ public void setFrustumRight(float frustumRight) { this.frustumRight = frustumRight; onFrustumChange(); }
/** * <code>setFrustumRight</code> sets the value of the right frustum plane. * * @param frustumRight the value of the right frustum plane. */ public void setFrustumRight(float frustumRight) { this.frustumRight = frustumRight; onFrustumChange(); }
/** * <code>setFrustumBottom</code> sets the value of the bottom frustum * plane. * * @param frustumBottom the value of the bottom frustum plane. */ public void setFrustumBottom(float frustumBottom) { this.frustumBottom = frustumBottom; onFrustumChange(); }
/** * <code>setFrustumFar</code> sets the value of the far frustum plane. * * @param frustumFar the value of the far frustum plane. */ public void setFrustumFar(float frustumFar) { this.frustumFar = frustumFar; onFrustumChange(); }
/** * <code>setFrustumLeft</code> sets the value of the left frustum plane. * * @param frustumLeft the value of the left frustum plane. */ public void setFrustumLeft(float frustumLeft) { this.frustumLeft = frustumLeft; onFrustumChange(); }
/** * Enable/disable parallel projection. * * @param value true to set up this camera for parallel projection is enable, false to enter normal perspective mode */ public void setParallelProjection(final boolean value) { this.parallelProjection = value; onFrustumChange(); }