MCPcopy Create free account
hub / github.com/defold/defold / RenderScript_SetCamera

Function RenderScript_SetCamera

engine/render/src/render/render_script.cpp:2831–2861  ·  view source on GitHub ↗

sets the current render camera to be used for rendering * Sets the current render camera to be used for rendering. If a render camera * has been set by the render script, the renderer will be using its projection and view matrix * during rendering. If a projection and/or view matrix has been set by the render script, * they will not be used until the current render camera has

Source from the content-addressed store, hash-verified

2829 * ```
2830 */
2831 static int RenderScript_SetCamera(lua_State* L)
2832 {
2833 DM_LUA_STACK_CHECK(L, 0);
2834 RenderScriptInstance* i = RenderScriptInstance_Check(L);
2835
2836 HRenderCamera camera = 0;
2837 bool use_frustum = false;
2838
2839 if (lua_gettop(L) > 0 && !lua_isnil(L, 1))
2840 {
2841 RenderCamera* c = CheckRenderCamera(L, 1, i->m_RenderContext);
2842 camera = c->m_Handle;
2843
2844 // Parse options table
2845 if (lua_istable(L, 2))
2846 {
2847 luaL_checktype(L, 2, LUA_TTABLE);
2848 lua_pushvalue(L, 2);
2849
2850 lua_getfield(L, -1, "use_frustum");
2851 use_frustum = lua_toboolean(L, -1);
2852 lua_pop(L, 1);
2853
2854 lua_pop(L, 1);
2855 }
2856 }
2857
2858 if (InsertCommand(i, Command(COMMAND_TYPE_SET_RENDER_CAMERA, (uint64_t) camera, use_frustum)))
2859 return 0;
2860 return DM_LUA_ERROR("Command buffer is full (%d).", i->m_CommandBuffer.Capacity());
2861 }
2862
2863#define CHECK_COMPUTE_SUPPORT(render_script_instance) \
2864 if (!dmGraphics::IsContextFeatureSupported(i->m_RenderContext->m_GraphicsContext, dmGraphics::CONTEXT_FEATURE_COMPUTE_SHADER)) \

Callers

nothing calls this directly

Calls 10

lua_gettopFunction · 0.85
CheckRenderCameraFunction · 0.85
luaL_checktypeFunction · 0.85
lua_pushvalueFunction · 0.85
lua_getfieldFunction · 0.85
lua_tobooleanFunction · 0.85
InsertCommandFunction · 0.85
CommandClass · 0.70
CapacityMethod · 0.45

Tested by

no test coverage detected