1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include "nel/3d/u_camera.h"
20 #include "nel/3d/camera.h"
29 const float UCamera::DefLx
=0.26f
;
30 const float UCamera::DefLy
=0.2f
;
31 const float UCamera::DefLzNear
=0.15f
;
32 const float UCamera::DefLzFar
=1000.0f
;
34 // ***************************************************************************
36 void UCamera::setFrustum(const CFrustum
&f
)
38 CCamera
*object
= getObjectPtr();
39 object
->setFrustum(f
);
42 // ***************************************************************************
44 const CFrustum
&UCamera::getFrustum() const
46 CCamera
*object
= getObjectPtr();
47 return object
->getFrustum();
50 // ***************************************************************************
52 void UCamera::setFrustum(float left
, float right
, float bottom
, float top
, float znear
, float zfar
, bool perspective
)
54 CCamera
*object
= getObjectPtr();
55 object
->setFrustum(left
, right
, bottom
, top
, znear
, zfar
, perspective
);
58 // ***************************************************************************
60 void UCamera::setFrustum(float width
, float height
, float znear
, float zfar
, bool perspective
)
62 CCamera
*object
= getObjectPtr();
63 object
->setFrustum(width
, height
, znear
, zfar
, perspective
);
66 // ***************************************************************************
68 void UCamera::getFrustum(float &left
, float &right
, float &bottom
, float &top
, float &znear
, float &zfar
) const
70 CCamera
*object
= getObjectPtr();
71 object
->getFrustum(left
, right
, bottom
, top
, znear
, zfar
);
74 // ***************************************************************************
76 bool UCamera::isOrtho() const
78 CCamera
*object
= getObjectPtr();
79 return object
->isOrtho();
82 // ***************************************************************************
84 bool UCamera::isPerspective() const
86 CCamera
*object
= getObjectPtr();
87 return object
->isPerspective();
90 // ***************************************************************************
92 void UCamera::setPerspective(float fov
, float aspectRatio
, float znear
, float zfar
)
94 CCamera
*object
= getObjectPtr();
95 object
->setPerspective(fov
, aspectRatio
, znear
, zfar
);
98 // ***************************************************************************
100 void UCamera::buildCameraPyramid(std::vector
<NLMISC::CPlane
> &pyramid
, bool useWorldMatrix
)
102 CCamera
*object
= getObjectPtr();
103 object
->buildCameraPyramid(pyramid
, useWorldMatrix
);
106 // ***************************************************************************
107 void UCamera::buildCameraPyramidCorners(std::vector
<NLMISC::CVector
> &pyramidCorners
, bool useWorldMatrix
)
109 CCamera
*object
= getObjectPtr();
110 object
->buildCameraPyramidCorners(pyramidCorners
, useWorldMatrix
);
113 // ***************************************************************************