globalize some funcs in material.c