mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-24 09:58:46 +00:00
Return view as CQuat, see #43
This commit is contained in:
parent
a68f54b4e8
commit
5665253af7
5 changed files with 23 additions and 5 deletions
|
@ -26,6 +26,8 @@ using namespace NLMISC;
|
|||
// ***************************************************************************
|
||||
// Main System
|
||||
NL3D::UDriver *Driver = 0; // The main 3D Driver
|
||||
NL3D::CStereoOVR *StereoDisplay = NULL; // Stereo display
|
||||
NL3D::CStereoOVR *StereoHMD = NULL; // Head mount display
|
||||
CSoundManager *SoundMngr = 0; // the sound manager
|
||||
NL3D::UMaterial GenericMat; // Generic Material
|
||||
NL3D::UTextContext *TextContext = 0; // Context for all the text in the client.
|
||||
|
|
|
@ -40,6 +40,7 @@ namespace NL3D
|
|||
class UMaterial;
|
||||
class UTextContext;
|
||||
class UWaterEnvMap;
|
||||
class CStereoOVR;
|
||||
}
|
||||
|
||||
class CEntityAnimationManager;
|
||||
|
@ -77,6 +78,8 @@ const float ExtraZoneLoadingVision = 100.f;
|
|||
// ***************************************************************************
|
||||
// Main System
|
||||
extern NL3D::UDriver *Driver; // The main 3D Driver
|
||||
extern NL3D::CStereoOVR *StereoDisplay; // Stereo display
|
||||
extern NL3D::CStereoOVR *StereoHMD;
|
||||
extern CSoundManager *SoundMngr; // the sound manager
|
||||
extern NL3D::UMaterial GenericMat; // Generic Material
|
||||
extern NL3D::UTextContext *TextContext; // Context for all the text in the client.
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "nel/3d/u_material.h"
|
||||
#include "nel/3d/u_instance_material.h"
|
||||
#include "nel/3d/u_cloud_scape.h"
|
||||
#include "nel/3d/stereo_ovr.h"
|
||||
// game share
|
||||
#include "game_share/brick_types.h"
|
||||
#include "game_share/light_cycle.h"
|
||||
|
@ -136,6 +137,7 @@
|
|||
#include "nel/3d/driver_user.h"
|
||||
|
||||
|
||||
|
||||
#ifdef USE_WATER_ENV_MAP
|
||||
#include "water_env_map_rdr.h"
|
||||
#endif
|
||||
|
@ -452,6 +454,8 @@ void validateDialogs(const CGameContextMenu &gcm);
|
|||
|
||||
void buildCameraClippingPyramid (vector<CPlane> &planes)
|
||||
{
|
||||
if (StereoDisplay) StereoDisplay->getClippingFrustum(0, &MainCam);
|
||||
|
||||
// Compute pyramid in view basis.
|
||||
CVector pfoc(0,0,0);
|
||||
const CFrustum &frustum = MainCam.getFrustum();
|
||||
|
@ -1006,7 +1010,7 @@ static void renderCanopyPart(UScene::TRenderPart renderPart)
|
|||
{
|
||||
// Update Camera Position/Rotation.
|
||||
camRoot.setPos(View.currentViewPos());
|
||||
camRoot.setRotQuat(View.currentView());
|
||||
camRoot.setRotQuat(View.currentViewQuat());
|
||||
}
|
||||
// Render the root scene
|
||||
SceneRoot->renderPart(renderPart);
|
||||
|
@ -1859,9 +1863,9 @@ bool mainLoop()
|
|||
|
||||
// Update Camera Position/Orientation.
|
||||
CVector currViewPos = View.currentViewPos();
|
||||
MainCam.setPos(currViewPos);;
|
||||
MainCam.setRotQuat(View.currentView());
|
||||
|
||||
MainCam.setPos(currViewPos);
|
||||
MainCam.setRotQuat(View.currentViewQuat());
|
||||
if (StereoDisplay) StereoDisplay->updateCamera(0, &MainCam);
|
||||
|
||||
// see if camera is below water (useful for sort order)
|
||||
if (ContinentMngr.cur())
|
||||
|
|
|
@ -183,7 +183,6 @@ CVector CView::currentViewPos() const
|
|||
|
||||
//-----------------------------------------------
|
||||
// currentView :
|
||||
// Set the user position.
|
||||
//-----------------------------------------------
|
||||
CVector CView::currentView() const
|
||||
{
|
||||
|
@ -200,6 +199,14 @@ CVector CView::currentView() const
|
|||
return _View;
|
||||
}// currentView //
|
||||
|
||||
NLMISC::CQuat CView::currentViewQuat() const
|
||||
{
|
||||
CMatrix mat;
|
||||
mat.setRot(CVector::I, currentView(), CVector::K);
|
||||
mat.normalize(CMatrix::YZX);
|
||||
return mat.getRot();
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
// currentCameraTarget :
|
||||
//-----------------------------------------------
|
||||
|
|
|
@ -115,6 +115,8 @@ public:
|
|||
CVector currentViewPos() const;
|
||||
// Return the current view (rear or normal)
|
||||
CVector currentView() const;
|
||||
// Return the current view as a quaternion
|
||||
NLMISC::CQuat currentViewQuat() const;
|
||||
|
||||
// Return the current Camera Target (for 3rd person only. 1st person: return currentViewPos())
|
||||
CVector currentCameraTarget() const;
|
||||
|
|
Loading…
Reference in a new issue