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

Function RenderScript_EnableState

engine/render/src/render/render_script.cpp:694–717  ·  view source on GitHub ↗

enables a render state * * Enables a particular render state. The state will be enabled until disabled. * * @name render.enable_state * @param state [type:constant] state to enable * * - `graphics.STATE_DEPTH_TEST` * - `graphics.STATE_STENCIL_TEST` * - `graphics.STATE_BLEND` * - `graphics.STATE_ALPHA_TEST` ([icon:iOS][icon:android] not available on

Source from the content-addressed store, hash-verified

692 * ```
693 */
694 int RenderScript_EnableState(lua_State* L)
695 {
696 int top = lua_gettop(L);
697 (void) top;
698
699 RenderScriptInstance* i = RenderScriptInstance_Check(L);
700 uint32_t state = luaL_checkinteger(L, 1);
701
702 if (state != dmGraphics::STATE_DEPTH_TEST &&
703 state != dmGraphics::STATE_STENCIL_TEST &&
704 state != dmGraphics::STATE_ALPHA_TEST &&
705 state != dmGraphics::STATE_BLEND &&
706 state != dmGraphics::STATE_CULL_FACE &&
707 state != dmGraphics::STATE_POLYGON_OFFSET_FILL)
708 {
709 return luaL_error(L, "Invalid state: %s.enable_state(%d).", RENDER_SCRIPT_LIB_NAME, state);
710 }
711 if (InsertCommand(i, Command(COMMAND_TYPE_ENABLE_STATE, state))) {
712 assert(top == lua_gettop(L));
713 return 0;
714 } else {
715 return luaL_error(L, "Command buffer is full (%d).", i->m_CommandBuffer.Capacity());
716 }
717 }
718
719 /*# disables a render state
720 *

Callers

nothing calls this directly

Calls 8

lua_gettopFunction · 0.85
luaL_checkintegerFunction · 0.85
luaL_errorFunction · 0.85
InsertCommandFunction · 0.85
CommandClass · 0.70
assertFunction · 0.50
CapacityMethod · 0.45

Tested by

no test coverage detected