This callback is called by the Render Manager to signal to the renderer plug-in that it should stop whatever it is doing in the Process callback and return as soon as possible. The Abort callback itself should perform no processing, only raise a signal to the Process callback. After receiving the abort signal, the Process callback should stop sending tiles or performing any further processing and return as soon as possible with CStatus::Abort.
If the Process callback is performing a long operation while holding the scene lock, such as translating the entire scene graph to the renderer, it should periodically check whether the abort flag has been set. The optimal way of doing this is to unlock the scene graph first, and then check whether the flag has been set, in which case it should stop immediately, otherwise then lock the scene graph again and carry on.
Using the custom renderer example below, the isAborted function can be modified slightly to do this automatically. In this case, if it is passed a pointer to the Renderer object, then it automatically assumes that it is being called while the scene lock is being held.
CStatus <renderer_name>_Abort( CRef& in_context ) { ... } |
<renderer_name> is the name specified in the call to PluginRegistrar::RegisterRenderer, with any spaces converted to underscores.
Parameter | Language | Type | Description |
---|---|---|---|
in_context | C++ | CRef& | A reference to the RendererContext object. Context::GetSource returns the Renderer. |
bool isAborted( Renderer *in_renderer ) { bool bAbort; // If passed a Renderer object, assume that the scene lock is being held. if( in_renderer ) in_renderer->UnlockSceneData( ); ::EnterCriticalSection( &g_barrierAbort ); bAbort = g_bAborted; ::LeaveCriticalSection( &g_barrierAbort ); if( bAbort ) return( true ); if( in_renderer && in_renderer->LockSceneData() != CStatus::OK ) return( true ); return( false ); } |