Screen/world-space related functions rename
This commit is contained in:
parent
c251e9309e
commit
fb3f616be5
|
|
@ -60,7 +60,7 @@ int main(void)
|
|||
{
|
||||
if (!collision.hit)
|
||||
{
|
||||
ray = GetMouseRay(GetMousePosition(), camera);
|
||||
ray = GetScreenToWorldRay(GetMousePosition(), camera);
|
||||
|
||||
// Check collision between ray and box
|
||||
collision = GetRayCollisionBox(ray,
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ int main(void)
|
|||
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
|
||||
{
|
||||
// Check collision between ray and box
|
||||
if (GetRayCollisionBox(GetMouseRay(GetMousePosition(), camera), bounds).hit) selected = !selected;
|
||||
if (GetRayCollisionBox(GetScreenToWorldRay(GetMousePosition(), camera), bounds).hit) selected = !selected;
|
||||
else selected = false;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ int main(void)
|
|||
Color cursorColor = WHITE;
|
||||
|
||||
// Get ray and test against objects
|
||||
ray = GetMouseRay(GetMousePosition(), camera);
|
||||
ray = GetScreenToWorldRay(GetMousePosition(), camera);
|
||||
|
||||
// Check ray collision against ground quad
|
||||
RayCollision groundHitInfo = GetRayCollisionQuad(ray, g0, g1, g2, g3);
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ int main(void)
|
|||
// Handle clicking the cube
|
||||
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
|
||||
{
|
||||
Ray ray = GetMouseRay(GetMousePosition(), camera);
|
||||
Ray ray = GetScreenToWorldRay(GetMousePosition(), camera);
|
||||
|
||||
// Check collision between ray and box
|
||||
RayCollision collision = GetRayCollisionBox(ray,
|
||||
|
|
|
|||
|
|
@ -1049,8 +1049,8 @@ RLAPI void SetShaderValueTexture(Shader shader, int locIndex, Texture2D texture)
|
|||
RLAPI void UnloadShader(Shader shader); // Unload shader from GPU memory (VRAM)
|
||||
|
||||
// Screen-space-related functions
|
||||
RLAPI Ray GetMouseRay(Vector2 mousePosition, Camera camera); // Get a ray trace from mouse position
|
||||
RLAPI Ray GetViewRay(Vector2 mousePosition, Camera camera, float width, float height); // Get a ray trace from mouse position in a viewport
|
||||
RLAPI Ray GetScreenToWorldRay(Vector2 mousePosition, Camera camera); // Get a ray trace from mouse position
|
||||
RLAPI Ray GetScreenToWorldRayEx(Vector2 mousePosition, Camera camera, float width, float height); // Get a ray trace from mouse position in a viewport
|
||||
RLAPI Vector2 GetWorldToScreen(Vector3 position, Camera camera); // Get the screen space position for a 3d world space position
|
||||
RLAPI Vector2 GetWorldToScreenEx(Vector3 position, Camera camera, int width, int height); // Get size position for a 3d world space position
|
||||
RLAPI Vector2 GetWorldToScreen2D(Vector2 position, Camera2D camera); // Get the screen space position for a 2d camera world space position
|
||||
|
|
|
|||
|
|
@ -1404,13 +1404,13 @@ void SetShaderValueTexture(Shader shader, int locIndex, Texture2D texture)
|
|||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Get a ray trace from mouse position
|
||||
Ray GetMouseRay(Vector2 mousePosition, Camera camera)
|
||||
Ray GetScreenToWorldRay(Vector2 mousePosition, Camera camera)
|
||||
{
|
||||
return GetViewRay(mousePosition, camera, (float)GetScreenWidth(), (float)GetScreenHeight());
|
||||
return GetScreenToWorldRayEx(mousePosition, camera, (float)GetScreenWidth(), (float)GetScreenHeight());
|
||||
}
|
||||
|
||||
// Get a ray trace from the mouse position within a specific section of the screen
|
||||
Ray GetViewRay(Vector2 mousePosition, Camera camera, float width, float height)
|
||||
Ray GetScreenToWorldRayEx(Vector2 mousePosition, Camera camera, float width, float height)
|
||||
{
|
||||
Ray ray = { 0 };
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user