LCOV - code coverage report
Current view: top level - src - api_camera.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 19 0
Test Date: 2026-04-03 02:26:39 Functions: 0.0 % 1 0

            Line data    Source code
       1              : /**
       2              :  * @file api_camera.cpp
       3              :  * @brief Krig Game Engine Lua Scripting API - Camera
       4              :  *
       5              :  * Camera focused API functionality.
       6              :  */
       7              : #include "api.h"
       8              : #include "api_camera.h"
       9              : 
      10              : #if DOXYGEN_ONLY
      11              : /**
      12              :  * Return the definition of the specified plane as a list containing:
      13              :  * A, B, C and D, where: Ax + By + Cz + D = 0.
      14              :  * @param int plane number (0-6), where: 0 - left, 1 - right, 2 - down, 3 - up, 4 - far, and 5 - near.
      15              :  * @return Vector4 - definition of plane.
      16              :  */
      17              : Vector4 get_frustum_plane(int);
      18              : #endif
      19            0 : static int get_frustum_plane(lua_State *L) {
      20            0 :   luaL_checktype(L, 1, LUA_TTABLE);
      21            0 :   Camera *camera = static_cast<Camera*>(loadObject(L, 1));
      22              : 
      23            0 :   int plane_num = lua_tonumber(L, 2);
      24              :   float a, b, c, d;
      25              : 
      26            0 :   camera->getFrustum()->getPlaneDefinition(plane_num, a, b, c, d);
      27              : 
      28            0 :   lua_newtable(L);
      29              : 
      30            0 :   lua_pushnumber(L, 1);
      31            0 :   lua_pushnumber(L, a);
      32            0 :   lua_rawset(L, -3);
      33              : 
      34            0 :   lua_pushnumber(L, 2);
      35            0 :   lua_pushnumber(L, b);
      36            0 :   lua_rawset(L, -3);
      37              : 
      38            0 :   lua_pushnumber(L, 3);
      39            0 :   lua_pushnumber(L, c);
      40            0 :   lua_rawset(L, -3);
      41              : 
      42            0 :   lua_pushnumber(L, 4);
      43            0 :   lua_pushnumber(L, d);
      44            0 :   lua_rawset(L, -3);
      45              : 
      46            0 :   return 1;
      47              : }
      48              : 
      49              : const luaL_Reg krigCameraLib[] = {
      50              :   {"get_frustum_plane", get_frustum_plane},
      51              :   {NULL, NULL}
      52              : };
        

Generated by: LCOV version 2.4-0