diff options
| author | jussi | 2022-03-31 13:55:02 +0300 |
|---|---|---|
| committer | jussi | 2022-03-31 13:55:02 +0300 |
| commit | 30d425aa26a3aa802cb2ff55f1f7655be056f3ed (patch) | |
| tree | 5d6e0e9a0d6c14df15f3e1ac8ab143dd9a8452c4 /src/lua_core.c | |
| parent | a3c28c00016fb2a2bd13b36e7269c69b0529c6a4 (diff) | |
| download | reilua-enhanced-30d425aa26a3aa802cb2ff55f1f7655be056f3ed.tar.gz reilua-enhanced-30d425aa26a3aa802cb2ff55f1f7655be056f3ed.tar.bz2 reilua-enhanced-30d425aa26a3aa802cb2ff55f1f7655be056f3ed.zip | |
Screen-space related functions for 3DCamera.
Diffstat (limited to 'src/lua_core.c')
| -rw-r--r-- | src/lua_core.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/lua_core.c b/src/lua_core.c index 4cfbafd..6006474 100644 --- a/src/lua_core.c +++ b/src/lua_core.c @@ -597,6 +597,10 @@ void luaRegister() { lua_register( L, "RL_GetGestureDragAngle", lcoreGetGestureDragAngle ); lua_register( L, "RL_GetGesturePinchVector", lcoreGetGesturePinchVector ); lua_register( L, "RL_GetGesturePinchAngle", lcoreGetGesturePinchAngle ); + /* Screen-space. */ + lua_register( L, "RL_GetMouseRay", lcoreGetMouseRay ); + lua_register( L, "RL_GetCameraMatrix", lcoreGetCameraMatrix ); + lua_register( L, "RL_GetWorldToScreen", lcoreGetWorldToScreen ); /* Shapes. */ /* Drawing. */ @@ -1304,6 +1308,28 @@ void uluaPushMatrix( lua_State *L, Matrix matrix ) { lua_rawseti( L, -2, 4 ); } +void uluaPushRay( lua_State *L, Ray ray ) { + lua_createtable( L, 2, 0 ); + + lua_createtable( L, 3, 0 ); + lua_pushnumber( L, ray.position.x ); + lua_rawseti( L, -2, 1 ); + lua_pushnumber( L, ray.position.y ); + lua_rawseti( L, -2, 2 ); + lua_pushnumber( L, ray.position.z ); + lua_rawseti( L, -2, 3 ); + lua_rawseti( L, -2, 1 ); + + lua_createtable( L, 3, 0 ); + lua_pushnumber( L, ray.direction.x ); + lua_rawseti( L, -2, 1 ); + lua_pushnumber( L, ray.direction.y ); + lua_rawseti( L, -2, 2 ); + lua_pushnumber( L, ray.direction.z ); + lua_rawseti( L, -2, 3 ); + lua_rawseti( L, -2, 2 ); +} + void uluaPushRayCollision( lua_State *L, RayCollision rayCol ) { lua_createtable( L, 4, 0 ); lua_pushboolean( L, rayCol.hit ); |
