added memory management of materials to cudaRaytraceCore()