TombEngine/TR5Main/Game/camera.cpp

30 lines
761 B
C++
Raw Normal View History

2019-11-21 07:43:34 +01:00
#include "Camera.h"
2018-08-19 09:46:58 +02:00
#include <d3d9.h>
#include <d3dx9.h>
#include <stdio.h>
#include "draw.h"
void __cdecl LookAt(int posX, int posY, int posZ,
int targetX, int targetY, int targetZ,
short roll)
2018-08-19 09:46:58 +02:00
{
2019-01-13 21:57:16 +01:00
Vector3 position = Vector3(posX, posY, posZ);
Vector3 target = Vector3(targetX, targetY, targetZ);
Vector3 up = Vector3(0.0f, -1.0f, 0.0f);
2018-08-19 09:46:58 +02:00
float fov = TR_ANGLE_TO_RAD(CurrentFOV);
float r = TR_ANGLE_TO_RAD(roll);
2018-08-19 09:46:58 +02:00
g_Renderer->UpdateCameraMatrices(posX, posY, posZ, targetX, targetY, targetZ, r, fov);
2018-08-19 09:46:58 +02:00
}
void __cdecl AlterFOV(int value)
2019-01-13 21:57:16 +01:00
{
2018-08-19 09:46:58 +02:00
CurrentFOV = value;
PhdPerspective = PhdWidth / 2 * COS(CurrentFOV / 2) / SIN(CurrentFOV / 2);
2018-08-19 09:46:58 +02:00
}
void Inject_Camera()
{
INJECT(0x0048EDC0, AlterFOV);
INJECT(0x0048F760, LookAt);
2018-08-19 09:46:58 +02:00
}