PR formatting review
This commit is contained in:
parent
d8b8c0f3fc
commit
ce8d7042c6
2 changed files with 15 additions and 19 deletions
20
src/core.c
20
src/core.c
|
@ -1251,20 +1251,20 @@ void BeginMode2D(Camera2D camera)
|
|||
rlLoadIdentity(); // Reset current matrix (MODELVIEW)
|
||||
rlMultMatrixf(MatrixToFloat(screenScaling)); // Apply screen scaling if required
|
||||
|
||||
//The camera in world-space is set by
|
||||
//1. Move it to target
|
||||
//2. Rotate by -rotation and scale by (1/zoom)
|
||||
// The camera in world-space is set by
|
||||
// 1. Move it to target
|
||||
// 2. Rotate by -rotation and scale by (1/zoom)
|
||||
// When setting higher scale, it's more intuitive for the world to become bigger (= camera become smaller),
|
||||
// not for the camera getting bigger, hence the invert. Same deal with rotation.
|
||||
//3. Move it by (-offset);
|
||||
// 3. Move it by (-offset);
|
||||
// Offset defines target transform relative to screen, but since we're effectively "moving" screen (camera)
|
||||
// we need to do it into opposite direction (inverse transform)
|
||||
//
|
||||
//Having camera transform in world-space, inverse of it gives the modelview transform.
|
||||
//Since (A*B*C)' = C'*B'*A', the modelview is
|
||||
//1. Move to offset
|
||||
//2. Rotate and Scale
|
||||
//3. Move by -target
|
||||
|
||||
// Having camera transform in world-space, inverse of it gives the modelview transform.
|
||||
// Since (A*B*C)' = C'*B'*A', the modelview is
|
||||
// 1. Move to offset
|
||||
// 2. Rotate and Scale
|
||||
// 3. Move by -target
|
||||
Matrix matOrigin = MatrixTranslate(-camera.target.x, -camera.target.y, 0.0f);
|
||||
Matrix matRotation = MatrixRotate((Vector3){ 0.0f, 0.0f, 1.0f }, camera.rotation*DEG2RAD);
|
||||
Matrix matScale = MatrixScale(camera.zoom, camera.zoom, 1.0f);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue