1) The AC source code has something like this:

C++:

```
glmatrixf mvmatrix, projmatrix, mvpmatrix, invmvmatrix, invmvpmatrix;
vec worldpos, camdir, camup, camright;
void readmatrices()
{
glGetFloatv(GL_MODELVIEW_MATRIX, mvmatrix.v);
glGetFloatv(GL_PROJECTION_MATRIX, projmatrix.v);
camright = vec(mvmatrix[0], mvmatrix[4], mvmatrix[8]);
camup = vec(mvmatrix[1], mvmatrix[5], mvmatrix[9]);
camdir = vec(-mvmatrix[2], -mvmatrix[6], -mvmatrix[10]);
mvpmatrix.mul(projmatrix, mvmatrix);
invmvmatrix.invert(mvmatrix);
invmvpmatrix.invert(mvpmatrix);
}
```

The model to world matrix would have to be different for every object because the matrix depends on the object's location in the game world. How then, can there be a singular model-view-projection matrix or a model-view matrix (mvmatrix in the code) if every model has a different model to world matrix?

2) Fleep's COD ESP source code has something like this:

C++:

```
//Grabs our 3d Coordinates and changes them to 2d for us to play with
//---------------------------------------------------------------------------
bool ESP::WorldToScreen(Vect3d &WorldLocation, Vect3d &mypos)
{
Vect3d vLocal, vTransForm;
vForward = new Vect3d();
vRight = new Vect3d();
vUpward = new Vect3d();
AngleVectors();
vLocal = SubVectorDist(WorldLocation, mypos);
vTransForm.x = vLocal.dotproduct(*vRight);
vTransForm.y = vLocal.dotproduct(*vUpward);
vTransForm.z = vLocal.dotproduct(*vForward);
if (vTransForm.z < 0.01)
return false;
ScreenX = screencenter[0] + (screencenter[0] / vTransForm.z * (1 / fov[0])) * vTransForm.x;
ScreenY = screencenter[1] - (screencenter[1] / vTransForm.z * (1 / fov[1])) * vTransForm.y;
return true;
}
...
....
....
/// <summary>
/// One of Kn4cker's functions, this beauty does all our complex maths
/// if you want to know more about it get very comfortable with Pythagora
/// </summary>
void ESP::AngleVectors()
{
float angle;
float sr, sp, sy, cr, cp, cy,
cpi = (3.141f * 2 / 360);
angle = viewAngles.y * cpi;
//cpi = same view angles.x isn't
sy = (float)sin(angle);
cy = (float)cos(angle);
angle = viewAngles.x * cpi;
sp = (float)sin(angle);
cp = (float)cos(angle);
angle = viewAngles.z * cpi;
sr = (float)sin(angle);
cr = (float)cos(angle);
vForward->x = cp * cy;
vForward->y = cp * sy;
vForward->z = -sp;
vRight->x = (-1 * sr * sp * cy + -1 * cr * -sy);
vRight->y = (-1 * sr * sp * sy + -1 * cr * cy);
vRight->z = -1 * sr * cp;
vUpward->x = (cr * sp * cy + -sr * -sy);
vUpward->y = (cr * sp * sy + -sr * cy);
vUpward->z = cr * cp;
}
```

Is there a good resource anywhere to understand what's he doing here? (the math behind it)

And why does it seem like people prefer to do the MVP approach rather than this approach? (do people even prefer the matrix approach for the WorldToScreen function?) It seems it'd be easier to find view angles and fov than it is to find the matrices.

3) I was looking at a ESP tutorial on unkn0wncheats (https://www.unkn0wncheats.me/forum/h1z1/147272-pimp-my-c-esp-episode-3-fix-my-worldtoscreen.html) and was confused about a part of the code OP presented.

C++:

```
private bool WorldToScreen(Vector3 vector, out Vector3 screen)
{
screen = Vector3.Zero;
// multiply the matrix by hand like this: float w = M41 * vector.X + M42 * vector.Y + M43 * vector.Z + M44;
float w = Vector3.Dot(GetMatrixAxis(GameMatrix, 3), vector) + GameMatrix.M44;
if (w < 0.098f) return false;
float x = Vector3.Dot(GetMatrixAxis(GameMatrix, 0), vector) + GameMatrix.M14;
float y = Vector3.Dot(GetMatrixAxis(GameMatrix, 1), vector) + GameMatrix.M24;
screen.X = ((((this.GameWindowSize.X) / 2) * (1f + (x / w))) + this.GameWindowRect.Left);
screen.Y = ((((this.GameWindowSize.Y) / 2) * (1f - (y / w))) + this.GameWindowRect.Top);
return true;
}
```

From looking at https://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/, it looks like the w value is in computer graphics matrices to help make some of the operations possible and to differentiate between direction and position vectors. Clearly, I'm missing something because that usage of w wouldn't make sense in this code snippet. (Plus, the w row in the AC matricies aren't just 1 or 0). So what exactly is w?

Thanks for reading my post. If you don't know the answer, I'd love some resources on where I can find it out on my own.