int gr_node_set_refractionIndex_cmd(lua_State* L) { GRLUA_DEBUG_CALL; gr_node_ud* selfdata = (gr_node_ud*)luaL_checkudata(L, 1, "gr.node"); luaL_argcheck(L, selfdata != 0, 1, "Node expected"); GeometryNode* self = dynamic_cast<GeometryNode*>(selfdata->node); luaL_argcheck(L, self != 0, 1, "Geometry node expected"); double index = luaL_checknumber(L, 2); PhongMaterial * pM = (PhongMaterial*)self->get_material(); if (pM == NULL) { std::cerr << "LUA:You are using a non-phong Material!" << std::endl; return 0; } pM->setRefractiveIndex(index); return 0; }
int gr_node_set_km_cmd(lua_State* L) { GRLUA_DEBUG_CALL; gr_node_ud* selfdata = (gr_node_ud*)luaL_checkudata(L, 1, "gr.node"); luaL_argcheck(L, selfdata != 0, 1, "Node expected"); GeometryNode* self = dynamic_cast<GeometryNode*>(selfdata->node); luaL_argcheck(L, self != 0, 1, "Geometry node expected"); double km[3]; for (int i = 0; i < 3; i++) { km[i] = luaL_checknumber(L, i + 2); } PhongMaterial * pM = (PhongMaterial*)self->get_material(); if (pM == NULL) { std::cerr << "LUA:You are using a non-phong Material!" << std::endl; return 0; } pM->setKM(Colour(km[0], km[1], km[2])); return 0; }