3ds Max C++ API Reference
|
The Rendering API's interface for managing the render process. More...
#include <IRenderingProcess.h>
Classes | |
class | IMainThreadJob |
Interface to a job which gets executed from the main thread. More... | |
class | NamedTimerGuard |
Guard class for starting and stopping a timer automatically. More... | |
Public Types | |
enum class | ProgressType { Translation , Rendering } |
Public Member Functions | |
Progress Reporting | |
virtual void | SetRenderingProgressTitle (const MCHAR *title)=0 |
Sets the progress title, displayed in the render progress dialog. More... | |
virtual void | SetRenderingProgress (const size_t done, const size_t total, const ProgressType progressType)=0 |
Sets the numerical progress to be displayed in the progress dialog. More... | |
virtual void | SetInfiniteProgress (const size_t done, const ProgressType progressType)=0 |
Reports progress for an infinite render. More... | |
Scene Reporting & Statistics | |
virtual void | SetSceneStats (int nlights, int nrayTraced, int nshadowed, int nobj, int nfaces)=0 |
Sets the scene statistics which get displayed in the render progress dialog. More... | |
virtual void | ReportMissingUVWChannel (INode &node, const unsigned int channel_id)=0 |
Reports a UVW channel is required but missing on the given geometric object. More... | |
Abort Management | |
virtual bool | HasAbortBeenRequested ()=0 |
Returns whether the user has requested that the renderer abort. More... | |
Event Logging | |
These methods implement events which are used by the system for logging and reporting timing statistics. | |
virtual void | TranslationStarted ()=0 |
To be called when the render session starts translating the scene. More... | |
virtual void | TranslationFinished ()=0 |
To be called when the render session finishes translating the scene. More... | |
virtual void | RenderingStarted ()=0 |
To be called when the render session starts rendering the scene. More... | |
virtual void | RenderingPaused ()=0 |
To be called by the render session when it effectively pauses the renderer. More... | |
virtual void | RenderingResumed ()=0 |
To be called by the render session when it effectively resumes the renderer, following a pause. More... | |
virtual void | RenderingFinished ()=0 |
To be called when the render session finishes, aborts, or stops rendering the scene. More... | |
virtual float | GetTranslationTimeInSeconds () const =0 |
Returns the elapsed translation time, as delimited by calls to TranslationStarted() and TranslationFinished(). More... | |
virtual float | GetRenderingTimeInSeconds () const =0 |
Returns the elapsed rendering time, as delimited by calls to RenderingStarted() and RenderingFinished(). More... | |
Timing Statistics | |
These method are used to register timing statistics, associating them with a name that may be reported to the user at the end of the rendering operation. Starts the timer with the given name. | |
virtual void | StartTimer (const MSTR &timer_name)=0 |
Creates a new timer with the given name, and starts that timer. More... | |
virtual void | StopTimer (const MSTR &timer_name)=0 |
Stops the timer with the given name. More... | |
virtual float | GetTimerElapsedSeconds (const MCHAR *timer_name) const =0 |
Returns the total time accumulated for the timer with the given name. More... | |
Running Jobs from the Main Thread | |
virtual void | CancelMainThreadJobs ()=0 |
Cancels all pending main thread jobs, preventing further jobs from running. More... | |
virtual bool | RunJobFromMainThread (IMainThreadJob &job)=0 |
Runs a job from the main thread. More... | |
Protected Member Functions | |
virtual | ~IRenderingProcess () |
Protected destructor prevents deletion through this interface. More... | |
The Rendering API's interface for managing the render process.
This interface abstracts various tasks related to the rendering process:
The interface's implementation of these tasks is specialized for the rendering API, and should be used rather than existing (more general) 3ds Max SDK equivalents (such as RendProgressCallback).
|
strong |
|
inlineprotectedvirtual |
Sets the progress title, displayed in the render progress dialog.
title | The string to display as the progress title. |
|
pure virtual |
Sets the numerical progress to be displayed in the progress dialog.
done | The number of units of work which are done. Current progress is expressed as: done / total. |
total | The number of units of work in total. Current progress is expressed as: done / total. |
progressType | The type of progress being reported. The system may report both types of progress differently. |
|
pure virtual |
Reports progress for an infinite render.
This method is used to report the number of work units performed, when there is no set limit - i.e. the renderer will progress indefinitely, until explicitly stopped by the user. The progress dialog will set itself up with an infinite/ongoing progress bar.
done | The number of units of work which are done. |
progressType | The type of progress being reported. The system may report both types of progress differently. |
|
pure virtual |
Sets the scene statistics which get displayed in the render progress dialog.
Reports a UVW channel is required but missing on the given geometric object.
A translator may determine that it requires a certain UVW channel to be present (because a texture may be dependent on it). If the channel is not present on the mesh, then it should report it using this method. The system will automatically report the error using the standard mechanisms - though only for offline rendering (MEdit and ActiveShade do not report an error).
node | The node which references the mesh for which a UVW channel is missing. |
channel_id | The ID for the UVW channel which is missing. |
|
pure virtual |
Returns whether the user has requested that the renderer abort.
This method is to be polled at regular intervals by the renderer to determine whether the user has requested that the renderer abort. If it returns true, then the renderer should terminate as soon as possible, regardless of how far the rendering process has progressed. It is perfectly fine to have a partial or otherwise invalid frame buffer when aborting.
|
pure virtual |
To be called when the render session starts translating the scene.
This method reports a progress message and starts a timer.
|
pure virtual |
To be called when the render session finishes translating the scene.
This method reports a progress message and the total time used for translating the scene.
|
pure virtual |
To be called when the render session starts rendering the scene.
This method reports a progress message and starts a timer.
|
pure virtual |
To be called by the render session when it effectively pauses the renderer.
This method reports a progress message and pauses the rendering timer.
|
pure virtual |
To be called by the render session when it effectively resumes the renderer, following a pause.
This method reports a progress message and resumes the rendering timer.
|
pure virtual |
To be called when the render session finishes, aborts, or stops rendering the scene.
This method reports a progress message and the total time used for rendering.
|
pure virtual |
Returns the elapsed translation time, as delimited by calls to TranslationStarted() and TranslationFinished().
|
pure virtual |
Returns the elapsed rendering time, as delimited by calls to RenderingStarted() and RenderingFinished().
Creates a new timer with the given name, and starts that timer.
If a timer with that name already exists, then it is resumed (un-paused).
timer_name | The name of the timer, which will be reported to the user (through the log system) at the end of the rendering operation. An empty name causes the call to no-op. |
Stops the timer with the given name.
Stops the existing timer with the given name.
timer_name | The name of the timer, which will be reported to the user (through the log system) at the end of the rendering operation. An empty name causes the call to no-op. |
|
pure virtual |
Returns the total time accumulated for the timer with the given name.
timer_name | The name of the timer for which to retrieve the running timer. |
|
pure virtual |
Cancels all pending main thread jobs, preventing further jobs from running.
This must be called by an offline renderer when it cancels its render in order to avoid deadlocks. When a render is aborted, some render threads may be waiting on a main thread job to finish executing - for example through logging, progress reporting call, or bitmap update. To avoid a deadlock, where the main thread would be waiting for the renderer to abort which would in turn be waiting for main thread jobs to finish, it's crucial that the offline render session call this method before it starts waiting for the renderer to finish. Calling this method causes all calls to RunJobFromMainThread() to return false.
|
pure virtual |
Runs a job from the main thread.
The 3ds Max SDK is generally not thread safe. Most SDK operations, such as scene translation/update, must therefore be done from the main thread. Because the render session will not necessarily operate from the main thread (e.g. IInteractiveRenderSession::UpdateInteractiveSession()), this method provides a simple mechanism for execute an arbitrary job from the main thread.