cleaned up resource buf interface. Added some basic templating to eliminate need for separate mat_buff