Add beforeCompileFunc function to scene to enable onRendering events