public final class PerspectiveProjection
extends java.lang.Object
| Constructor and Description |
|---|
PerspectiveProjection(float fovYInDegrees,
float ratio,
float zNear,
float zFar) |
| Modifier and Type | Method and Description |
|---|---|
void |
adjust(ICamera view,
IBoundable boundable,
float zNearRatio,
float minZNear,
float zFarRatio,
float maxZFar) |
float |
depthToZ(float depth) |
Vec2 |
getFarPlaneSize()
Calculate the back frustum face dimension, according to those formulas:
height = 2 * zFar * tan(fovY/2)width = height * aspectRatio |
float |
getFovXInDegrees() |
float |
getFovXInRadians() |
float |
getFovYInDegrees() |
float |
getFovYInRadians() |
Mat4x4 |
getMatrix() |
Vec2 |
getNearPlaneSize()
Calculate the front frustum face dimension, according to those formulas:
height = 2 * zNear * tan(fovY/2)width = height * aspectRatio |
float |
getPlaneDepthFromHeight(float h)
Calculate the distance of a face, laying on the xy plane, according to those formulas:
dist = h / ( 2 * tan(fovY/2) ) |
float |
getPlaneDepthFromWidth(float w)
Calculate the distance of a face, laying on the xy plane, according to those formulas:
dist = zNear / aspect * w / ( 2 * tan(fovY/2) ) |
Vec2 |
getPlaneSize(float z)
Calculate the face (laying on the xy plane) dimension, according to those formulas:
height = 2 * z * tan(fovY/2)width = height * aspectRatio |
float |
getRatio() |
float |
getZFar() |
float |
getZNear() |
float |
getZoom()
Simulate a camera zooming
|
Vec2 |
projectionPoint(Vec2 dst,
float zFaceDist,
Vec2 point,
float zProjectionFaceDist) |
Vec3 |
projectionPoint(Vec3 dst,
Vec3 point,
float zProjectionFaceDist) |
boolean |
projectSphereInNDC(Rectangle dst,
Vec3 center,
float r)
Project Sphere in Normal Device Coordinates
Reference: http://article.gmane.org/gmane.games.devel.algorithms/21697 |
void |
set(float fovYInDegrees,
float ratio,
float zNear,
float zFar) |
void |
set(PerspectiveProjection src) |
void |
setFovY(float fovY)
Fov Y in degrees
|
void |
setRatio(float ratio) |
void |
setZFar(float zFar) |
void |
setZNear(float zNear) |
void |
setZoom(float zoom)
Simulate a camera zooming
|
public PerspectiveProjection(float fovYInDegrees,
float ratio,
float zNear,
float zFar)
fovY - angle in degreeratio - zNear - zFar - public void set(PerspectiveProjection src)
public final void set(float fovYInDegrees,
float ratio,
float zNear,
float zFar)
fovY - angle in degreeratio - zNear - zFar - public final float getRatio()
public final float getZNear()
public final float getZFar()
public final float getZoom()
public final void setFovY(float fovY)
public final void setRatio(float ratio)
public final void setZNear(float zNear)
public final void setZFar(float zFar)
public final void setZoom(float zoom)
public final float getFovYInDegrees()
public final float getFovYInRadians()
public final float getFovXInDegrees()
public final float getFovXInRadians()
public final Vec2 getNearPlaneSize()
height = 2 * zNear * tan(fovY/2)width = height * aspectRatiopublic final Vec2 getFarPlaneSize()
height = 2 * zFar * tan(fovY/2)width = height * aspectRatiopublic final Vec2 getPlaneSize(float z)
height = 2 * z * tan(fovY/2)width = height * aspectRatioz - distance of the face, on the xy plane, from the viewing volume 'origin'.public final float getPlaneDepthFromHeight(float h)
dist = h / ( 2 * tan(fovY/2) )h - the height of the facepublic final float getPlaneDepthFromWidth(float w)
dist = zNear / aspect * w / ( 2 * tan(fovY/2) )w - the width of the facepublic final Vec2 projectionPoint(Vec2 dst, float zFaceDist, Vec2 point, float zProjectionFaceDist)
public final boolean projectSphereInNDC(Rectangle dst, Vec3 center, float r)
center - center of the sphere in modelview coordinatesr - radius of the spheredst - destination Area to store area (x1, x2, y1, y2) in NDC coordinatesdstpublic final float depthToZ(float depth)
depth - in window coordinate, meaning ranges [0;1]getZNear(). At depth = 1, returns getZFar()public final void adjust(ICamera view, IBoundable boundable, float zNearRatio, float minZNear, float zFarRatio, float maxZFar)
view - view (camera) matrixboundable - scene volumezNearRatio - minZNear - zFarRatio - maxZFar - public Mat4x4 getMatrix()
Bonzai Engine 1.3.4 11/12/2015 - A Java OpenGL engine and tools for Windows/Mac/Linux/Android
Copyright © 2007-2015 Jérôme Jouvie bonzaiengine.com contact@bonzaiengine.com