Class Camera

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Camera.ViewFrustum
      The view frustum has parameters [rmin,rmax], [umin,umax], and [dmin,dmax].
    • Constructor Summary

      Constructors 
      Constructor Description
      Camera()
      Default constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void dispose()
      Delete memory
      int GetDiskUsed​(StreamVersion rkVersion)
      Returns the size of this object and it's children on disk for the current StreamVersion parameter.
      float GetDMax()
      Get the far frustum value.
      float GetDMin()
      Get the near frustum value.
      Vector3f GetDVector()
      The camera frame is always in world coordinates.
      float[] GetFrustum()
      Get the view frustum.
      Vector3f GetLocation()
      The camera frame is always in world coordinates.
      boolean GetPickRay​(int iX, int iY, int iWidth, int iHeight, Vector3f rkOrigin, Vector3f rkDirection)
      Mouse picking support.
      float GetPortB()
      Get the viewport (contained in [0,1]^2)
      float GetPortF()
      Get depth range (contained in [0,1])
      float GetPortL()
      Get the viewport (contained in [0,1]^2)
      float GetPortN()
      Get depth range (contained in [0,1])
      float GetPortR()
      Get the viewport (contained in [0,1]^2)
      float GetPortT()
      Get the viewport (contained in [0,1]^2)
      float GetRMax()
      Get the right frustum value.
      float GetRMin()
      Get the left frustum value.
      Vector3f GetRVector()
      The camera frame is always in world coordinates.
      float GetUMax()
      Get the top frustum value.
      float GetUMin()
      Get the bottom frustum value.
      Vector3f GetUVector()
      The camera frame is always in world coordinates.
      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.
      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.
      boolean Register​(Stream rkStream)
      Registers this object with the input Stream parameter.
      void Save​(Stream rkStream)
      Write this object and all it's children to the Stream.
      StringTree SaveStrings​(java.lang.String acTitle)
      Write this object into a StringTree for the scene-graph visualization.
      void SetAxes​(Vector3f rkDVector, Vector3f rkUVector, Vector3f rkRVector)
      The camera frame is always in world coordinates.
      void SetDepthRange​(float fNear, float fFar)
      Set depth range (contained in [0,1])
      void SetFrame​(Vector3f rkLocation, Vector3f rkDVector, Vector3f rkUVector, Vector3f rkRVector)
      The camera frame is always in world coordinates.
      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".
      void SetFrustum​(float fRMin, float fRMax, float fUMin, float fUMax, float fDMin, float fDMax)
      Set the view frustum.
      void SetLocation​(Vector3f rkLocation)
      The camera frame is always in world coordinates.
      void SetViewport​(float fLeft, float fRight, float fTop, float fBottom)
      Set the viewport (contained in [0,1]^2)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • 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.
    • Constructor Detail

      • Camera

        public Camera()
        Default constructor.
    • Method Detail

      • 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:
        GetDiskUsed in interface StreamInterface
        Overrides:
        GetDiskUsed in class GraphicsObject
        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 width
        iHeight - screen height
        rkOrigin - origin of PickRay, return value
        rkDirection - 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:
        Link in interface StreamInterface
        Overrides:
        Link in class GraphicsObject
        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:
        Load in interface StreamInterface
        Overrides:
        Load in class GraphicsObject
        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:
        Register in interface StreamInterface
        Overrides:
        Register in class GraphicsObject
        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:
        Save in interface StreamInterface
        Overrides:
        Save in class GraphicsObject
        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:
        SaveStrings in interface StreamInterface
        Overrides:
        SaveStrings in class GraphicsObject
        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 - near
        fFar - 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 - left
        fRight - right
        fTop - top
        fBottom - bottom