19.5 Cameras


19.5 Cameras

Most 3D scenes in OGRE have at least one camera, and the purpose of the camera is the same as in the real world. Cameras are the point of view for any 3D scene, and the content of a scene is projected onto the 2D surface of the monitor. Cameras have a position in 3D space (x, y, z). Cameras also have a focus point (known as a lookAt point), which is the (x, y, z) position where the camera is directly looking. Consider the following code to set the camera position and change the lookAt.

      mCamera->setPosition(0,75,375);      mCamera->lookAt(0,0,0); 

Following is a list of some of the most notable methods of the Camera class. A full list of methods and details of their use can be found in the OGRE documentation.

  • void roll (const Radian &angle)

    Rolls the camera counterclockwise around its local z-axis.

  • void yaw (const Radian &angle)

    Rotates the camera counterclockwise around its local y-axis.

  • void pitch (const Radian &angle)

    Pitches the camera up and down counterclockwise around its local z-axis.

  • void rotate (const Vector3 &axis, const Radian &angle)

    Rotates the camera around an arbitrary axis.

  • void lookAt (Real x, Real y, Real z)

    Points the camera at a location in world space.

  • bool isVisible (const AxisAlignedBox &bound, Frustum-Plane *culledBy=0) const

    Determines if a box shape, and all it contains, is visible to the camera given the camera's current position. If the box is visible, true is returned. Otherwise, false is returned.

  • bool isVisible (const Sphere &bound, FrustumPlane *culledBy=0) const

    Determines if a sphere shape, and all it contains, is visible to the camera given the camera's current position. If the sphere is visible, true is returned. Otherwise, false is returned.

  • bool isVisible (const Vector3 &vert, FrustumPlane *culledBy=0) const

    Determines whether a vertex is visible to the camera given the camera's current position. If the vertex is visible, true is returned. Otherwise, false is returned.




Introduction to Game Programming with C++
Introduction to Game Programming with C++ (Wordware Game Developers Library)
ISBN: 1598220322
EAN: 2147483647
Year: 2007
Pages: 225
Authors: Alan Thorn

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net