draws all 3d debug graphics * Draws all 3d debug graphics such as lines drawn with "draw_line" messages and physics visualization. * @name render.draw_debug3d * @param [options] [type:table] optional table with properties: * * `frustum` * : [type:matrix4] A frustum matrix used to cull renderable items. (E.g. `local frustum = proj * view`). May be nil. * * `f
| 1832 | * ``` |
| 1833 | */ |
| 1834 | int RenderScript_DrawDebug3d(lua_State* L) |
| 1835 | { |
| 1836 | RenderScriptInstance* i = RenderScriptInstance_Check(L); |
| 1837 | dmVMath::Matrix4* frustum_matrix = 0; |
| 1838 | dmRender::FrustumPlanes frustum_num_planes = dmRender::FRUSTUM_PLANES_SIDES; |
| 1839 | |
| 1840 | if (lua_istable(L, 1)) |
| 1841 | { |
| 1842 | luaL_checktype(L, 1, LUA_TTABLE); |
| 1843 | lua_pushvalue(L, 1); |
| 1844 | |
| 1845 | lua_getfield(L, -1, "frustum"); |
| 1846 | frustum_matrix = lua_isnil(L, -1) ? 0 : dmScript::CheckMatrix4(L, -1); |
| 1847 | lua_pop(L, 1); |
| 1848 | |
| 1849 | lua_getfield(L, -1, "frustum_planes"); |
| 1850 | frustum_num_planes = lua_isnil(L, -1) ? frustum_num_planes : (dmRender::FrustumPlanes)luaL_checkinteger(L, -1); |
| 1851 | lua_pop(L, 1); |
| 1852 | |
| 1853 | lua_pop(L, 1); |
| 1854 | } |
| 1855 | |
| 1856 | // we need to pass ownership to the command queue |
| 1857 | FrustumOptions* frustum_options = 0; |
| 1858 | if (frustum_matrix) |
| 1859 | { |
| 1860 | frustum_options = new FrustumOptions; |
| 1861 | frustum_options->m_Matrix = *frustum_matrix; |
| 1862 | frustum_options->m_NumPlanes = frustum_num_planes; |
| 1863 | } |
| 1864 | |
| 1865 | if (InsertCommand(i, Command(COMMAND_TYPE_DRAW_DEBUG3D, (uint64_t)frustum_options))) |
| 1866 | return 0; |
| 1867 | else |
| 1868 | return luaL_error(L, "Command buffer is full (%d).", i->m_CommandBuffer.Capacity()); |
| 1869 | } |
| 1870 | |
| 1871 | /*# sets the view matrix |
| 1872 | * |
nothing calls this directly
no test coverage detected