MCPcopy Create free account
hub / github.com/crownengine/crown / load_api

Function load_api

src/lua/lua_api.cpp:956–4436  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

954}
955
956void load_api(LuaEnvironment &env)
957{
958 // code-format off
959 env.add_module_function("Math", "ray_plane_intersection", [](lua_State *L) {
960 LuaStack stack(L, +1);
961 const Plane3 p = plane3::from_point_and_normal(stack.get_vector3(3)
962 , stack.get_vector3(4)
963 );
964 const f32 t = ray_plane_intersection(stack.get_vector3(1)
965 , stack.get_vector3(2)
966 , p
967 );
968 stack.push_float(t);
969 return 1;
970 });
971 env.add_module_function("Math", "ray_disc_intersection", [](lua_State *L) {
972 LuaStack stack(L, +1);
973 const f32 t = ray_disc_intersection(stack.get_vector3(1)
974 , stack.get_vector3(2)
975 , stack.get_vector3(3)
976 , stack.get_float(4)
977 , stack.get_vector3(5)
978 );
979 stack.push_float(t);
980 return 1;
981 });
982 env.add_module_function("Math", "ray_sphere_intersection", [](lua_State *L) {
983 LuaStack stack(L, +1);
984 Sphere s;
985 s.c = stack.get_vector3(3);
986 s.r = stack.get_float(4);
987 const f32 t = ray_sphere_intersection(stack.get_vector3(1)
988 , stack.get_vector3(2)
989 , s
990 );
991 stack.push_float(t);
992 return 1;
993 });
994 env.add_module_function("Math", "ray_obb_intersection", [](lua_State *L) {
995 LuaStack stack(L, +1);
996 const f32 t = ray_obb_intersection(stack.get_vector3(1)
997 , stack.get_vector3(2)
998 , stack.get_matrix4x4(3)
999 , stack.get_vector3(4)
1000 );
1001 stack.push_float(t);
1002 return 1;
1003 });
1004 env.add_module_function("Math", "ray_triangle_intersection", [](lua_State *L) {
1005 LuaStack stack(L, +1);
1006 const f32 t = ray_triangle_intersection(stack.get_vector3(1)
1007 , stack.get_vector3(2)
1008 , stack.get_vector3(3)
1009 , stack.get_vector3(4)
1010 , stack.get_vector3(5)
1011 );
1012 stack.push_float(t);
1013 return 1;

Callers 1

load_libsMethod · 0.85

Calls 15

ray_plane_intersectionFunction · 0.85
ray_disc_intersectionFunction · 0.85
ray_sphere_intersectionFunction · 0.85
ray_obb_intersectionFunction · 0.85
obb_intersects_frustumFunction · 0.85
crossFunction · 0.85
normalizeFunction · 0.85
distanceFunction · 0.85
angleFunction · 0.85
from_translationFunction · 0.85

Tested by

no test coverage detected