GoToZero will now affect all view cameras, because why not.

This commit is contained in:
Marco Cawthorne 2021-06-04 12:03:24 +02:00
parent d05f867562
commit 9ba6ef4628
3 changed files with 26 additions and 16 deletions

View file

@ -1973,21 +1973,6 @@ void CamWnd_LookThroughCamera(CamWnd &camwnd)
} }
} }
void GlobalCamera_GoToZero(void)
{
CamWnd &camwnd = *g_camwnd;
Vector3 zero;
zero[0] = 0;
zero[1] = 0;
zero[2] = 0;
Camera_setAngles(camwnd, zero);
Camera_setOrigin(camwnd, zero);
Camera_updateModelview(camwnd.getCamera());
Camera_updateProjection(camwnd.getCamera());
CamWnd_Update(camwnd);
}
inline CameraModel *Instance_getCameraModel(scene::Instance &instance) inline CameraModel *Instance_getCameraModel(scene::Instance &instance)
{ {
return InstanceTypeCast<CameraModel>::cast(instance); return InstanceTypeCast<CameraModel>::cast(instance);
@ -2021,6 +2006,23 @@ void GlobalCamera_LookThroughCamera()
CamWnd_LookThroughCamera(*g_camwnd); CamWnd_LookThroughCamera(*g_camwnd);
} }
/* sets origin and angle to 0,0,0 coords */
void XYZ_SetOrigin(const Vector3 &origin);
void GlobalCamera_GoToZero(void)
{
CamWnd &camwnd = *g_camwnd;
Vector3 zero;
zero[0] = 0;
zero[1] = 0;
zero[2] = 0;
Camera_setAngles(camwnd, zero);
Camera_setOrigin(camwnd, zero);
Camera_updateModelview(camwnd.getCamera());
Camera_updateProjection(camwnd.getCamera());
CamWnd_Update(camwnd);
XYZ_SetOrigin(zero);
}
struct RenderMode { struct RenderMode {
static void Export(const Callback<void(int)> &returnz) static void Export(const Callback<void(int)> &returnz)
{ {

View file

@ -2167,6 +2167,13 @@ void XY_UpdateAllWindows()
} }
} }
void XYZ_SetOrigin(const Vector3 &origin)
{
g_pParentWnd->GetXYWnd()->SetOrigin(origin);
g_pParentWnd->GetXZWnd()->SetOrigin(origin);
g_pParentWnd->GetYZWnd()->SetOrigin(origin);
}
void UpdateAllWindows() void UpdateAllWindows()
{ {
GlobalCamera_UpdateWindow(); GlobalCamera_UpdateWindow();

View file

@ -538,6 +538,7 @@ void FocusViews(const Vector3 &point, float angle)
#include "stringio.h" #include "stringio.h"
void GlobalCamera_GoToZero();
void Map_StartPosition() void Map_StartPosition()
{ {
Entity *entity = Scene_FindPlayerStart(); Entity *entity = Scene_FindPlayerStart();
@ -547,7 +548,7 @@ void Map_StartPosition()
string_parse_vector3(entity->getKeyValue("origin"), origin); string_parse_vector3(entity->getKeyValue("origin"), origin);
FocusViews(origin, string_read_float(entity->getKeyValue("angle"))); FocusViews(origin, string_read_float(entity->getKeyValue("angle")));
} else { } else {
FocusViews(g_vector3_identity, 0); GlobalCamera_GoToZero();
} }
} }