Change reorient to support future camera controls

This commit is contained in:
Muaz Ahmad 2023-05-03 16:28:08 +05:00
parent 53a10a8b43
commit f7ac3c397a
2 changed files with 2 additions and 4 deletions

View file

@ -50,9 +50,6 @@ void OPGLWidget::paintGL() {
} }
void OPGLWidget::reorient() { void OPGLWidget::reorient() {
float F_mag = pow(pow(loc[0], 2) + pow(loc[1], 2) +pow(loc[2], 2), 0.5);
GLfloat f[] = {-loc[0]/F_mag, -loc[1] / F_mag, -loc[2] / F_mag};
GLfloat s[] = {-f[2], 0, f[0]}; GLfloat s[] = {-f[2], 0, f[0]};
float s_mag = pow(pow(s[0], 2) + pow(s[1], 2) + pow(s[2], 2), 0.5); float s_mag = pow(pow(s[0], 2) + pow(s[1], 2) + pow(s[2], 2), 0.5);

View file

@ -12,6 +12,7 @@ protected:
void reorient(); void reorient();
int mtl_idx = -1; int mtl_idx = -1;
float loc[3] = {10, 0, 10}; float loc[3] = {0, 0, 10};
float f[3] = {0, 0, -1};
ObjectLoader obj; ObjectLoader obj;
}; };