Skip to content

Commit

Permalink
[rcore] reveiwed GetWorldToScreenEx (#3351)
Browse files Browse the repository at this point in the history
* reveiwed GetWorldToScreenEx
Used the inputted "width" instead of global CORE.window.
Used Vector3Transform instead of quaternion.

* reverted accidental unrelated change

* reverted Vector3Transform back

* fixed mistyped result

---------

Co-authored-by: Brian-E <[email protected]>
  • Loading branch information
Brian-ED and Brian-E authored Oct 1, 2023
1 parent c3a1c8c commit 7351240
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/rcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -2952,7 +2952,7 @@ Vector2 GetWorldToScreenEx(Vector3 position, Camera camera, int width, int heigh
}
else if (camera.projection == CAMERA_ORTHOGRAPHIC)
{
float aspect = (float)CORE.Window.screen.width/(float)CORE.Window.screen.height;
double aspect = ((double)width/(double)height);
double top = camera.fovy/2.0;
double right = top*aspect;

Expand All @@ -2963,8 +2963,6 @@ Vector2 GetWorldToScreenEx(Vector3 position, Camera camera, int width, int heigh
// Calculate view matrix from camera look at (and transpose it)
Matrix matView = MatrixLookAt(camera.position, camera.target, camera.up);

// TODO: Why not use Vector3Transform(Vector3 v, Matrix mat)?

// Convert world position vector to quaternion
Quaternion worldPos = { position.x, position.y, position.z, 1.0f };

Expand Down

0 comments on commit 7351240

Please sign in to comment.