root/cafu/trunk/CaWE/Camera.hpp

Revision 457, 3.6 KB (checked in by Carsten, 4 months ago)

Using UltraEdit's multi-line search-and-replace-in-files feature, replaced


^#ifndef _(CAFU|CF|CFS|CA)_(.*)_$
^#define _\1_\2_$

with

#ifndef CAFU_\2_INCLUDED
#define CAFU_\2_INCLUDED

and


^#ifndef _(.*)_HPP_$
^#define _\1_HPP_$

with

#ifndef CAFU_\1_HPP_INCLUDED
#define CAFU_\1_HPP_INCLUDED

Closes #91.

Line 
1/*
2=================================================================================
3This file is part of Cafu, the open-source game engine and graphics engine
4for multiplayer, cross-platform, real-time 3D action.
5Copyright (C) 2002-2012 Carsten Fuchs Software.
6
7Cafu is free software: you can redistribute it and/or modify it under the terms
8of the GNU General Public License as published by the Free Software Foundation,
9either version 3 of the License, or (at your option) any later version.
10
11Cafu is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13PURPOSE. See the GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with Cafu. If not, see <http://www.gnu.org/licenses/>.
17
18For support and more information about Cafu, visit us at <http://www.cafu.de>.
19=================================================================================
20*/
21
22#ifndef CAFU_CAMERA_HPP_INCLUDED
23#define CAFU_CAMERA_HPP_INCLUDED
24
25#include "Math3D/Angles.hpp"
26#include "Math3D/Matrix.hpp"
27
28
29/// This class implements a camera. Cameras are associated with the 3D views and controlled with the Camera tool.
30/// A camera is represented by an orthogonal, right-handed coordinate system,
31/// where the x-axis points right, the y-axis points forward (the viewing direction) and the z-axis points up.
32class CameraT
33{
34    public:
35
36    CameraT();
37
38    Vector3fT      GetXAxis() const;    ///< Returns the x-axis (pointing right)   of the camera space.
39    Vector3fT      GetYAxis() const;    ///< Returns the y-axis (pointing forward) of the camera space. This is the direction the camera is looking into!
40    Vector3fT      GetZAxis() const;    ///< Returns the z-axis (pointing up)      of the camera space.
41    const MatrixT& GetMatrix() const;   ///< Returns the matrix that represents the position and orientation of this camera.
42
43    void SetLookAtPos(const Vector3fT& LookAtPos);  ///< This method automatically computes the orientation of the camera so that it looks at the given point.
44    void LimitAngles();                             ///< This method wraps the yaw into the [0°, 360°[ intervall and clamps the pitch to -90° and +90°. Call this method after each manipulation of the angles!
45
46
47    // Regular members that define the essential properties of the camera.
48    Vector3fT          Pos;             ///< The cameras position in the world.
49    cf::math::AnglesfT Angles;          ///< The angles that describe the cameras orientation. The pitch value is limited/clamped to the interval from -90° to +90°, and roll is not used at all.
50    float              ViewDirLength;   ///< This member defines how long the view direction vector (GetYAxis()) is drawn in the 2D views.
51
52    // Additional members that augment the definition of the cameras view pyramid (frustum).
53    float              VerticalFOV;     ///< The cameras field-of-view angle, in vertical (up/down) direction.
54    float              NearPlaneDist;   ///< The distance of the near clip plane to the tip of the view pyramid.
55    float              FarPlaneDist;    ///< The distance of the far  clip plane to the tip of the view pyramid.
56
57
58    private:
59
60    mutable Vector3fT          m_MatrixPos;     ///< The position with which the m_Matrix was built.
61    mutable cf::math::AnglesfT m_MatrixAngles;  ///< The angles   with which the m_Matrix was built.
62    mutable MatrixT            m_Matrix;        ///< The matrix that transforms from world to camera space.
63};
64
65#endif
Note: See TracBrowser for help on using the browser.