3ds Max C++ API Reference
IInteractiveRenderSession Class Referenceabstract

An interface which encapsulates a render session for interactive rendering. More...

#include <IInteractiveRenderSession.h>

+ Inheritance diagram for IInteractiveRenderSession:

Public Member Functions

virtual bool InitiateInteractiveSession (const TimeValue t)=0
 Initializes the interactive rendering session. More...
 
virtual bool UpdateInteractiveSession (const TimeValue t, bool &doneRendering)=0
 Updates the interactive session at regular intervals. More...
 
virtual void TerminateInteractiveSession ()=0
 Requests that the rendering process be aborted as the session is being terminated. More...
 
virtual bool IsInteractiveSessionUpToDate (const TimeValue t)=0
 Returns whether there are interactive changes which have not yet been taken into account by the renderer This state may be used, for example, by scripts which wish to wait until rendering is done (see UpdateInteractiveSession()) and all pending scene changes have been processed, before they save the rendered image. More...
 
- Public Member Functions inherited from IRenderSession
virtual ~IRenderSession ()
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Detailed Description

An interface which encapsulates a render session for interactive rendering.

This render session is allocated for the duration of an ActiveShade session. It is created when the user initiates the ActiveShade render, and destroyed when the user terminates the ActiveShade process; these correspond roughly to calls to IInteractiveRenderer::BeginSession and IInteractiveRenderer::EndSession.

Member Function Documentation

◆ InitiateInteractiveSession()

virtual bool InitiateInteractiveSession ( const TimeValue  t)
pure virtual

Initializes the interactive rendering session.

This method is called once, from the main thread, just after the IInteractiveRenderSession is instantiated. The implementation should perform initial setup of the renderer, for example the initial translation of the scene. If any dialogs or pop-ups need to be shown to the user in case of scene errors, missing files, etc. - this is the place to do it. Modal interruptions of the interactive workflow should not occur beyond this initialization phase.

Remarks
This method may start the renderer, but should neither block nor wait for any reason. It should not perform frame buffer updates.
Parameters
tThe time at which the scene is to be translated.
Returns
True on success. False if initialize fails, causing the render session to be aborted and destroyed.

◆ UpdateInteractiveSession()

virtual bool UpdateInteractiveSession ( const TimeValue  t,
bool &  doneRendering 
)
pure virtual

Updates the interactive session at regular intervals.

This method is polled continuously to update the render session. This update normally consists of:

  • Update (re-translate) any part of the scene which might have been modified by the user since the last update, or which might not be valid at the new time value. Note that the renderer should re-start in this case.
  • Update the frame buffer if required (see ICameraContainer::Bitmap()).
Remarks
This method is called from a dedicated thread - not from the main thread. It's therefore unsafe to access the 3ds Max scene in any way. To perform tasks which require the main thread, use IRenderingProcess::RunJobFromMainThread().
This method is polled continuously, without any explicit wait between calls. It's the implementation's responsibility to wait for some milliseconds if it has nothing to do. Failing to do so will cause the thread to run at 100% usage and will impact rendering performance.
Parameters
tThe time at which the scene should be updated. This could differ from either that passed to the last call to this method, or to InitializeInteractiveSession(). A time change should be interpreted as the user moving the time slider. The render session must then update any scene element which is invalid at the new time.
doneRenderingA boolean which must be set to true, by this method's implementation, if rendering has finished. The state of being done is reversible: this method will continue to be called after the renderer is done, and the renderer is allowed to react to scene changes and restart rendering (at which point it will stop reporting itself as done). There are mechanisms that rely on interactive renderers correctly reporting when they are done - for example a script that would save the image once it's fully rendered.
Returns
True on success. False on error of any kind, causing the render session to be aborted.

◆ TerminateInteractiveSession()

virtual void TerminateInteractiveSession ( )
pure virtual

Requests that the rendering process be aborted as the session is being terminated.

This method is called when the session needs to be terminated, just before the IInteractiveRenderSession is destroyed.

Remarks
UpdateInteractiveSession() is guaranteed never to be called either during or after this call.
This method is called from the main thread.

◆ IsInteractiveSessionUpToDate()

virtual bool IsInteractiveSessionUpToDate ( const TimeValue  t)
pure virtual

Returns whether there are interactive changes which have not yet been taken into account by the renderer This state may be used, for example, by scripts which wish to wait until rendering is done (see UpdateInteractiveSession()) and all pending scene changes have been processed, before they save the rendered image.

Remarks
This is called from the main thread, and as such may be called concurrently with UpdateInteractiveSession(). It should therefore be thread safe.
Parameters
tThe time at which to check for scene validity. If the scene was updated/translated at a different time value, then it might not be valid for this one.