Maven module :un.engine : engine-opengl :
Class : un.engine.opengl.scenegraph.AbstractCamera
Extends/Implements : un.engine.opengl.scenegraph.Camera
Subclasses : -

author  Johann Sorel


Variables : renderRectangle, right, up, rightHanded, autoResize, cameraType, fieldOfView, nearPlane, farPlane, projectionMatrix, context
Functions : AbstractCamera, AbstractCamera, copy, getContext, getRenderArea, setRenderArea, getForward, isDirty, setDirty, getUpAxis, setUpAxis, getRightAxis, setRightAxis, getFieldOfView, setFieldOfView, getNearPlane, setNearPlane, getFarPlane, setFarPlane, setCameraType, getProjectionMatrix, calculateRayWorldCS, calculateRayCameraCS, calculateFrustrumCorners, calculateFrustrumCorners, update, calculateMatrices




protected Rectangle renderRectangle



protected Vector right

protected Vector up

protected boolean rightHanded

protected boolean autoResize



protected int cameraType

protected double fieldOfView

protected double nearPlane

protected double farPlane


Camera3D to Homogeneous coordinates.
protected Matrix4 projectionMatrix

protected GLProcessContext context



Create a right handed camera.
public void AbstractCamera ()


param  rightHanded is scene using a right handed coordinate system.
param  autoResize resize automaticaly the paint area when the GL drawable size change.
public void AbstractCamera (boolean rightHanded, boolean autoResize)

public void copy (AbstractCamera camera)

public GLProcessContext getContext ()

public Rectangle getRenderArea ()

public void setRenderArea (Rectangle paintArea)

public Vector getForward ()

protected boolean isDirty ()

protected void setDirty (boolean dirty)


return  Vector3 copy of current up axis.
public Vector getUpAxis ()

public void setUpAxis (Vector value)

public Vector getRightAxis ()

public void setRightAxis (Vector value)


return  field of view, in degree.
public double getFieldOfView ()

public void setFieldOfView (double fieldOfView)


return  frustrum near plane.
public double getNearPlane ()

public void setNearPlane (double nearPlane)


return  frustrum far plane.
public double getFarPlane ()

public void setFarPlane (double farPlane)

public void setCameraType (int cameraType)


DO NOT MODIFY MATRIX
return  DO NOT MODIFY MATRIX
public Matrix4 getProjectionMatrix ()


Calculate a ray from 2D X/Y projection.
A mouse click for example.
Origin : anton gerdelan
http://www.antongerdelan.net/opengl4/raycasting.html
param  mouse_x
param  mouse_y
return  Ray in World Space
public Ray calculateRayWorldCS (int mouse_x, int mouse_y)


Calculate a ray from 2D X/Y projection.
A mouse click for example.
Origin : anton gerdelan
http://www.antongerdelan.net/opengl4/raycasting.html
param  mouse_x
param  mouse_y
return  Ray in Camera Space
public Ray calculateRayCameraCS (int mouse_x, int mouse_y)

public Vector[] calculateFrustrumCorners ()


Calculate frustrum corners.
param  maxDistance maximum far plane
return  8 Vectors [n1,n2,n3,n4,f1,f2,f3,f4]
public Vector[] calculateFrustrumCorners (double maxDistance)


param  context
param  nanotime
param  renderSize : in view port coordinate system, (0,0) is lower left
public void update (RenderContext context, long nanotime, Rectangle renderSize)

protected void calculateMatrices ()