Skip to content

Commit

Permalink
--copypasta
Browse files Browse the repository at this point in the history
  • Loading branch information
rtri committed Jul 8, 2019
1 parent 70fc51b commit b98931f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions rts/Lua/LuaObjectRendering.cpp
Expand Up @@ -362,7 +362,6 @@ static int SetMaterialUniform(lua_State* L, LuaObjType objType, LuaMatShader::Pa
LuaObjectMaterial* objMat = nullptr;
LuaMatRef* lodMatRef = nullptr;
LuaMatBin* matBin = nullptr;
LuaMatUniforms* matUniforms = nullptr;

const char* materialName = luaL_checkstring(L, 2);
const char* uniformName = luaL_checkstring(L, 4);
Expand All @@ -376,11 +375,10 @@ static int SetMaterialUniform(lua_State* L, LuaObjType objType, LuaMatShader::Pa
return 0;
if ((matBin = lodMatRef->GetBin()) == nullptr)
return 0;
if ((matUniforms = &matBin->uniforms[matPass]) == nullptr)
return 0;

LuaMatUniforms& matUniforms = matBin->uniforms[matPass];
// find an existing uniform to update
LuaMatUniform& objUniform = matUniforms->GetObjectUniform(lua_toint(L, 1), objType, uniformName);
LuaMatUniform& objUniform = matUniforms.GetObjectUniform(lua_toint(L, 1), objType, uniformName);
LuaMatUniform& dmyUniform = LuaMatUniforms::GetDummyObjectUniform();

constexpr size_t S = sizeof(objUniform.name);
Expand Down Expand Up @@ -416,7 +414,7 @@ static int SetMaterialUniform(lua_State* L, LuaObjType objType, LuaMatShader::Pa
} break;
}

lua_pushboolean(L, &objUniform != &dmyUniform || matUniforms->AddObjectUniform(lua_toint(L, 1), objType, objUniform));
lua_pushboolean(L, &objUniform != &dmyUniform || matUniforms.AddObjectUniform(lua_toint(L, 1), objType, objUniform));
return 1;
}

Expand Down

0 comments on commit b98931f

Please sign in to comment.