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