Package WildMagic.LibGraphics.Rendering
Class Camera
- java.lang.Object
-
- WildMagic.LibGraphics.ObjectSystem.GraphicsObject
-
- WildMagic.LibGraphics.Rendering.Camera
-
- All Implemented Interfaces:
java.io.Serializable,StreamInterface
public class Camera extends GraphicsObject implements StreamInterface, java.io.Serializable
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCamera.ViewFrustumThe view frustum has parameters [rmin,rmax], [umin,umax], and [dmin,dmax].
-
Field Summary
Fields Modifier and Type Field Description protected float[]m_afFrustumview frustum (near, far, bottom, top, left, right)protected floatm_fPortBviewportprotected floatm_fPortFdepth rangeprotected floatm_fPortLviewportprotected floatm_fPortNdepth rangeprotected floatm_fPortRviewportprotected floatm_fPortTviewportprotected Vector3fm_kDVectorworld coordinate frameprotected Vector3fm_kLocationworld coordinate frameprotected Vector3fm_kRVectorworld coordinate frameprotected Vector3fm_kUVectorworld coordinate frameprotected Rendererm_pkRendererThe renderer to which this camera has been attached.booleanPerspectiveAllow for orthogonal cameras as well as perspective cameras.private static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description Camera()Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()Delete memoryintGetDiskUsed(StreamVersion rkVersion)Returns the size of this object and it's children on disk for the current StreamVersion parameter.floatGetDMax()Get the far frustum value.floatGetDMin()Get the near frustum value.Vector3fGetDVector()The camera frame is always in world coordinates.float[]GetFrustum()Get the view frustum.Vector3fGetLocation()The camera frame is always in world coordinates.booleanGetPickRay(int iX, int iY, int iWidth, int iHeight, Vector3f rkOrigin, Vector3f rkDirection)Mouse picking support.floatGetPortB()Get the viewport (contained in [0,1]^2)floatGetPortF()Get depth range (contained in [0,1])floatGetPortL()Get the viewport (contained in [0,1]^2)floatGetPortN()Get depth range (contained in [0,1])floatGetPortR()Get the viewport (contained in [0,1]^2)floatGetPortT()Get the viewport (contained in [0,1]^2)floatGetRMax()Get the right frustum value.floatGetRMin()Get the left frustum value.Vector3fGetRVector()The camera frame is always in world coordinates.floatGetUMax()Get the top frustum value.floatGetUMin()Get the bottom frustum value.Vector3fGetUVector()The camera frame is always in world coordinates.voidLink(Stream rkStream, Stream.Link pkLink)Copies this objects children objects from the input Stream's HashTable, based on the LinkID of the child stored in the pkLink parameter.voidLoad(Stream rkStream, Stream.Link pkLink)Loads this object from the input parameter rkStream, using the input Stream.Link to store the IDs of children objects of this object for linking after all objects are loaded from the Stream.booleanRegister(Stream rkStream)Registers this object with the input Stream parameter.voidSave(Stream rkStream)Write this object and all it's children to the Stream.StringTreeSaveStrings(java.lang.String acTitle)Write this object into a StringTree for the scene-graph visualization.voidSetAxes(Vector3f rkDVector, Vector3f rkUVector, Vector3f rkRVector)The camera frame is always in world coordinates.voidSetDepthRange(float fNear, float fFar)Set depth range (contained in [0,1])voidSetFrame(Vector3f rkLocation, Vector3f rkDVector, Vector3f rkUVector, Vector3f rkRVector)The camera frame is always in world coordinates.voidSetFrustum(float fUpFovDegrees, float fAspectRatio, float fDMin, float fDMax)Set a symmetric view frustum (umin = -umax, rmin = -rmax) using a field of view in the "up" direction and an aspect ratio "width/height".voidSetFrustum(float fRMin, float fRMax, float fUMin, float fUMax, float fDMin, float fDMax)Set the view frustum.voidSetLocation(Vector3f rkLocation)The camera frame is always in world coordinates.voidSetViewport(float fLeft, float fRight, float fTop, float fBottom)Set the viewport (contained in [0,1]^2)-
Methods inherited from class WildMagic.LibGraphics.ObjectSystem.GraphicsObject
GetAllObjectsByName, GetID, GetName, GetNextID, GetObjectByID, GetObjectByIDBase, GetObjectByName, GetObjectByNameBase, SetName
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
Perspective
public boolean Perspective
Allow for orthogonal cameras as well as perspective cameras. The default is perspective (value is 'true'). Set to 'false' for an orthogonal camera. TO DO. Stream this member.
-
m_kLocation
protected Vector3f m_kLocation
world coordinate frame
-
m_kDVector
protected Vector3f m_kDVector
world coordinate frame
-
m_kUVector
protected Vector3f m_kUVector
world coordinate frame
-
m_kRVector
protected Vector3f m_kRVector
world coordinate frame
-
m_afFrustum
protected float[] m_afFrustum
view frustum (near, far, bottom, top, left, right)
-
m_fPortL
protected float m_fPortL
viewport
-
m_fPortR
protected float m_fPortR
viewport
-
m_fPortT
protected float m_fPortT
viewport
-
m_fPortB
protected float m_fPortB
viewport
-
m_fPortN
protected float m_fPortN
depth range
-
m_fPortF
protected float m_fPortF
depth range
-
m_pkRenderer
protected Renderer m_pkRenderer
The renderer to which this camera has been attached. The camera is considered to be active if this pointer is not null. By necessity, a camera cannot be attached to multiple renderers, but a camera may be shared by renderers as long as only one renderer at a time uses the camera. The renderer is responsible for setting this Camera member.
-
-
Method Detail
-
dispose
public void dispose()
Delete memory- Overrides:
disposein classGraphicsObject
-
GetDiskUsed
public int GetDiskUsed(StreamVersion rkVersion)
Returns the size of this object and it's children on disk for the current StreamVersion parameter.- Specified by:
GetDiskUsedin interfaceStreamInterface- Overrides:
GetDiskUsedin classGraphicsObject- Parameters:
rkVersion- the current version of the Stream file being created.- Returns:
- the size of this object on disk.
-
GetDMax
public final float GetDMax()
Get the far frustum value.- Returns:
- the far frustum value.
-
GetDMin
public final float GetDMin()
Get the near frustum value.- Returns:
- the near frustum value.
-
GetDVector
public final Vector3f GetDVector()
The camera frame is always in world coordinates. default location E = (0,0,0) default direction D = (0,0,-1) default up U = (0,1,0) default right R = (1,0,0)- Returns:
- direction vector.
-
GetFrustum
public final float[] GetFrustum()
Get the view frustum.- Returns:
- the view frustum.
-
GetLocation
public final Vector3f GetLocation()
The camera frame is always in world coordinates. default location E = (0,0,0) default direction D = (0,0,-1) default up U = (0,1,0) default right R = (1,0,0)- Returns:
- location vector.
-
GetPickRay
public boolean GetPickRay(int iX, int iY, int iWidth, int iHeight, Vector3f rkOrigin, Vector3f rkDirection)Mouse picking support. The (x,y) input point is in left-handed screen coordinates (what you usually read from the windowing system). The function returns 'true' if and only if the input point is located in the current viewport. When 'true', the origin and direction values are valid and are in world coordinates. The direction vector is unit length.- Parameters:
iX- x screen coordinate (left-handed)iY- y screen coordinate (left-handed)iWidth- screen widthiHeight- screen heightrkOrigin- origin of PickRay, return valuerkDirection- direction of PickRay, return value- Returns:
- 'true' if and only if the input point is located in the current viewport.
-
GetPortB
public final float GetPortB()
Get the viewport (contained in [0,1]^2)- Returns:
- bottom
-
GetPortF
public final float GetPortF()
Get depth range (contained in [0,1])- Returns:
- far
-
GetPortL
public final float GetPortL()
Get the viewport (contained in [0,1]^2)- Returns:
- left
-
GetPortN
public final float GetPortN()
Get depth range (contained in [0,1])- Returns:
- near
-
GetPortR
public final float GetPortR()
Get the viewport (contained in [0,1]^2)- Returns:
- right
-
GetPortT
public final float GetPortT()
Get the viewport (contained in [0,1]^2)- Returns:
- top
-
GetRMax
public final float GetRMax()
Get the right frustum value.- Returns:
- the right frustum value.
-
GetRMin
public final float GetRMin()
Get the left frustum value.- Returns:
- the left frustum value.
-
GetRVector
public final Vector3f GetRVector()
The camera frame is always in world coordinates. default location E = (0,0,0) default direction D = (0,0,-1) default up U = (0,1,0) default right R = (1,0,0)- Returns:
- right vector.
-
GetUMax
public final float GetUMax()
Get the top frustum value.- Returns:
- the top frustum value.
-
GetUMin
public final float GetUMin()
Get the bottom frustum value.- Returns:
- the bottom frustum value.
-
GetUVector
public final Vector3f GetUVector()
The camera frame is always in world coordinates. default location E = (0,0,0) default direction D = (0,0,-1) default up U = (0,1,0) default right R = (1,0,0)- Returns:
- up vector.
-
Link
public void Link(Stream rkStream, Stream.Link pkLink)
Copies this objects children objects from the input Stream's HashTable, based on the LinkID of the child stored in the pkLink parameter.- Specified by:
Linkin interfaceStreamInterface- Overrides:
Linkin classGraphicsObject- Parameters:
rkStream- the Stream where the child objects are stored.pkLink- the Link class from which the child object IDs are read.
-
Load
public void Load(Stream rkStream, Stream.Link pkLink)
Loads this object from the input parameter rkStream, using the input Stream.Link to store the IDs of children objects of this object for linking after all objects are loaded from the Stream.- Specified by:
Loadin interfaceStreamInterface- Overrides:
Loadin classGraphicsObject- Parameters:
rkStream- the Stream from which this object is being read.pkLink- the Link class for storing the IDs of this object's children objects.
-
Register
public boolean Register(Stream rkStream)
Registers this object with the input Stream parameter. All objects streamed to disk are registered with the Stream so that a unique list of objects is maintained.- Specified by:
Registerin interfaceStreamInterface- Overrides:
Registerin classGraphicsObject- Parameters:
rkStream- the Stream where the child objects are stored.- Returns:
- true if this object is registered, false if the object has already been registered.
-
Save
public void Save(Stream rkStream)
Write this object and all it's children to the Stream.- Specified by:
Savein interfaceStreamInterface- Overrides:
Savein classGraphicsObject- Parameters:
rkStream- the Stream where the child objects are stored.
-
SaveStrings
public StringTree SaveStrings(java.lang.String acTitle)
Write this object into a StringTree for the scene-graph visualization.- Specified by:
SaveStringsin interfaceStreamInterface- Overrides:
SaveStringsin classGraphicsObject- Parameters:
acTitle- the header for this object in the StringTree.- Returns:
- StringTree containing a String-based representation of this object and it's children.
-
SetAxes
public void SetAxes(Vector3f rkDVector, Vector3f rkUVector, Vector3f rkRVector)
The camera frame is always in world coordinates. default location E = (0,0,0) default direction D = (0,0,-1) default up U = (0,1,0) default right R = (1,0,0)- Parameters:
rkDVector- direction vector.rkUVector- up vector.rkRVector- right vector.
-
SetDepthRange
public void SetDepthRange(float fNear, float fFar)Set depth range (contained in [0,1])- Parameters:
fNear- nearfFar- near
-
SetFrame
public void SetFrame(Vector3f rkLocation, Vector3f rkDVector, Vector3f rkUVector, Vector3f rkRVector)
The camera frame is always in world coordinates. default location E = (0,0,0) default direction D = (0,0,-1) default up U = (0,1,0) default right R = (1,0,0)- Parameters:
rkLocation- location vector.rkDVector- direction vector.rkUVector- up vector.rkRVector- right vector.
-
SetFrustum
public void SetFrustum(float fUpFovDegrees, float fAspectRatio, float fDMin, float fDMax)Set a symmetric view frustum (umin = -umax, rmin = -rmax) using a field of view in the "up" direction and an aspect ratio "width/height". This call is the equivalent of gluPerspective in OpenGL. As such, the field of view in this function must be specified in degrees and be in the interval (0,180).- Parameters:
fUpFovDegrees- field of view in the "up" direction.fAspectRatio- aspect ratio "width/height"fDMin- "near"fDMax- "far"
-
SetFrustum
public void SetFrustum(float fRMin, float fRMax, float fUMin, float fUMax, float fDMin, float fDMax)Set the view frustum. The interval [rmin,rmax] is measured in the right direction R. These are the "left" and "right" frustum values. The interval [umin,umax] is measured in the up direction U. These are the "bottom" and "top" values. The interval [dmin,dmax] is measured in the view direction D. These are the "near" and "far" values.- Parameters:
fRMin- "left"fRMax- "right"fUMin- "bottom"fUMax- "top"fDMin- "near"fDMax- "far"
-
SetLocation
public void SetLocation(Vector3f rkLocation)
The camera frame is always in world coordinates. default location E = (0,0,0) default direction D = (0,0,-1) default up U = (0,1,0) default right R = (1,0,0)- Parameters:
rkLocation- location vector.
-
SetViewport
public void SetViewport(float fLeft, float fRight, float fTop, float fBottom)Set the viewport (contained in [0,1]^2)- Parameters:
fLeft- leftfRight- rightfTop- topfBottom- bottom
-
-