adding method cache, use graphics is2D/is3D instead of instanceof check