Skip to content

Commit

Permalink
Added GetCameraViewVector().
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewRichards-Code committed Nov 28, 2024
1 parent b53c40e commit e631513
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CrossPlatform/Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,14 @@ const float *platform::crossplatform::GetCameraPosVector(const float *v)
return cam_pos;
}

const float *platform::crossplatform::GetCameraViewVector(const float *v)
{
platform::math::Matrix4x4 view(v);
static float cam_pos[4], view_dir[4];
GetCameraPosVector(view, (float *)cam_pos, (float *)view_dir);
return view_dir;
}

using namespace platform::math;
Matrix4x4 platform::crossplatform::MatrixLookInDirection(const float *dir,const float *view_up,bool lefthanded)
{
Expand Down
2 changes: 2 additions & 0 deletions CrossPlatform/Camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ namespace platform
extern SIMUL_CROSSPLATFORM_EXPORT void GetCameraPosVector(const float *v,float *dcam_pos,float *view_dir,float *up=0);
//! Get the camera position from a view matrix.
extern SIMUL_CROSSPLATFORM_EXPORT const float *GetCameraPosVector(const float *v);
//! Get the camera view direction from a view matrix.
extern SIMUL_CROSSPLATFORM_EXPORT const float *GetCameraViewVector(const float *v);

extern SIMUL_CROSSPLATFORM_EXPORT void UpdateMouseCamera( class Camera *cam
,float time_step
Expand Down

0 comments on commit e631513

Please sign in to comment.