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
| 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 | * |
nothing calls this directly
no test coverage detected