diff --git a/code/ryzom/client/src/camera.cpp b/code/ryzom/client/src/camera.cpp
new file mode 100644
index 000000000..66aac6f76
--- /dev/null
+++ b/code/ryzom/client/src/camera.cpp
@@ -0,0 +1,85 @@
+// Ryzom - MMORPG Framework
+// Copyright (C) 2010 Winch Gate Property Limited
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+#include
+#include "camera.h"
+
+#include
+
+#include "global.h"
+#include "misc.h"
+
+using namespace NLMISC;
+using namespace NL3D;
+
+//---------------------------------------------------
+// update the camera perspective setup
+//---------------------------------------------------
+void updateCameraPerspective()
+{
+ float fov, aspectRatio;
+ computeCurrentFovAspectRatio(fov, aspectRatio);
+
+ // change the perspective of the scene
+ if(!MainCam.empty())
+ MainCam.setPerspective(fov, aspectRatio, CameraSetupZNear, ClientCfg.Vision);
+ // change the perspective of the root scene
+ if(SceneRoot)
+ {
+ UCamera cam= SceneRoot->getCam();
+ cam.setPerspective(fov, aspectRatio, SceneRootCameraZNear, SceneRootCameraZFar);
+ }
+}
+
+void buildCameraClippingPyramid(std::vector &planes)
+{
+ if (StereoDisplay) StereoDisplay->getClippingFrustum(0, &MainCam);
+
+ // Compute pyramid in view basis.
+ CVector pfoc(0,0,0);
+ const CFrustum &frustum = MainCam.getFrustum();
+ InvMainSceneViewMatrix = MainCam.getMatrix();
+ MainSceneViewMatrix = InvMainSceneViewMatrix;
+ MainSceneViewMatrix.invert();
+
+ CVector lb(frustum.Left, frustum.Near, frustum.Bottom );
+ CVector lt(frustum.Left, frustum.Near, frustum.Top );
+ CVector rb(frustum.Right, frustum.Near, frustum.Bottom );
+ CVector rt(frustum.Right, frustum.Near, frustum.Top );
+
+ CVector lbFar(frustum.Left, ClientCfg.CharacterFarClip, frustum.Bottom);
+ CVector ltFar(frustum.Left, ClientCfg.CharacterFarClip, frustum.Top );
+ CVector rtFar(frustum.Right, ClientCfg.CharacterFarClip, frustum.Top );
+
+ planes.resize (4);
+ // planes[0].make(lbFar, ltFar, rtFar);
+ planes[0].make(pfoc, lt, lb);
+ planes[1].make(pfoc, rt, lt);
+ planes[2].make(pfoc, rb, rt);
+ planes[3].make(pfoc, lb, rb);
+
+ // Compute pyramid in World basis.
+ // The vector transformation M of a plane p is computed as p*M-1.
+ // Here, ViewMatrix== CamMatrix-1. Hence the following formula.
+ uint i;
+
+ for (i = 0; i < 4; i++)
+ {
+ planes[i] = planes[i]*MainSceneViewMatrix;
+ }
+}
+
+/* end of file */
\ No newline at end of file
diff --git a/code/ryzom/client/src/camera.h b/code/ryzom/client/src/camera.h
new file mode 100644
index 000000000..037661c3a
--- /dev/null
+++ b/code/ryzom/client/src/camera.h
@@ -0,0 +1,29 @@
+// Ryzom - MMORPG Framework
+// Copyright (C) 2010 Winch Gate Property Limited
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+#ifndef CL_CAMERA_H
+#define CL_CAMERA_H
+
+#include
+
+#include
+
+void updateCameraPerspective();
+void buildCameraClippingPyramid(std::vector &planes);
+
+#endif // CL_CAMERA_H
+
+/* end of file */
diff --git a/code/ryzom/client/src/main_loop.cpp b/code/ryzom/client/src/main_loop.cpp
index 64379b7c2..7338493c1 100644
--- a/code/ryzom/client/src/main_loop.cpp
+++ b/code/ryzom/client/src/main_loop.cpp
@@ -142,6 +142,7 @@
// pulled from main_loop.cpp
#include "ping.h"
#include "profiling.h"
+#include "camera.h"
#include "main_loop_debug.h"
#include "main_loop_temp.h"
#include "main_loop_utilities.h"
@@ -351,44 +352,6 @@ void displaySceneProfiles();
// validate current dialogs (end them if the player is too far from its interlocutor)
void validateDialogs(const CGameContextMenu &gcm);
-void buildCameraClippingPyramid (vector &planes)
-{
- if (StereoDisplay) StereoDisplay->getClippingFrustum(0, &MainCam);
-
- // Compute pyramid in view basis.
- CVector pfoc(0,0,0);
- const CFrustum &frustum = MainCam.getFrustum();
- InvMainSceneViewMatrix = MainCam.getMatrix();
- MainSceneViewMatrix = InvMainSceneViewMatrix;
- MainSceneViewMatrix.invert();
-
- CVector lb(frustum.Left, frustum.Near, frustum.Bottom );
- CVector lt(frustum.Left, frustum.Near, frustum.Top );
- CVector rb(frustum.Right, frustum.Near, frustum.Bottom );
- CVector rt(frustum.Right, frustum.Near, frustum.Top );
-
- CVector lbFar(frustum.Left, ClientCfg.CharacterFarClip, frustum.Bottom);
- CVector ltFar(frustum.Left, ClientCfg.CharacterFarClip, frustum.Top );
- CVector rtFar(frustum.Right, ClientCfg.CharacterFarClip, frustum.Top );
-
- planes.resize (4);
- // planes[0].make(lbFar, ltFar, rtFar);
- planes[0].make(pfoc, lt, lb);
- planes[1].make(pfoc, rt, lt);
- planes[2].make(pfoc, rb, rt);
- planes[3].make(pfoc, lb, rb);
-
- // Compute pyramid in World basis.
- // The vector transformation M of a plane p is computed as p*M-1.
- // Here, ViewMatrix== CamMatrix-1. Hence the following formula.
- uint i;
-
- for (i = 0; i < 4; i++)
- {
- planes[i] = planes[i]*MainSceneViewMatrix;
- }
-}
-
void preRenderNewSky ()
{
CSky &sky = ContinentMngr.cur()->CurrentSky;
diff --git a/code/ryzom/client/src/main_loop_utilities.cpp b/code/ryzom/client/src/main_loop_utilities.cpp
index 26be0ab0d..7afba0a9f 100644
--- a/code/ryzom/client/src/main_loop_utilities.cpp
+++ b/code/ryzom/client/src/main_loop_utilities.cpp
@@ -33,29 +33,11 @@
#include "entities.h"
#include "input.h"
#include "sound_manager.h"
+#include "camera.h"
using namespace NLMISC;
using namespace NL3D;
-//---------------------------------------------------
-// update the camera perspective setup
-//---------------------------------------------------
-void updateCameraPerspective()
-{
- float fov, aspectRatio;
- computeCurrentFovAspectRatio(fov, aspectRatio);
-
- // change the perspective of the scene
- if(!MainCam.empty())
- MainCam.setPerspective(fov, aspectRatio, CameraSetupZNear, ClientCfg.Vision);
- // change the perspective of the root scene
- if(SceneRoot)
- {
- UCamera cam= SceneRoot->getCam();
- cam.setPerspective(fov, aspectRatio, SceneRootCameraZNear, SceneRootCameraZFar);
- }
-}
-
//---------------------------------------------------
// Compare ClientCfg and LastClientCfg to know what we must update
//---------------------------------------------------
diff --git a/code/ryzom/client/src/main_loop_utilities.h b/code/ryzom/client/src/main_loop_utilities.h
index 48d6a3880..d8ea3dedf 100644
--- a/code/ryzom/client/src/main_loop_utilities.h
+++ b/code/ryzom/client/src/main_loop_utilities.h
@@ -24,9 +24,6 @@
// This is mainly for system configuration related functions
// such as config file changes.
-/// does not belong here
-void updateCameraPerspective();
-
/// Compare ClientCfg and LastClientCfg to know what we must update
void updateFromClientCfg();