This reference page is linked to from the following overview topics: Mudbox 2013, Scene Graph, Layers and Viewport Filters, Viewports.
Represents the 3D viewport where Mudbox renders the scene.
This class provides access to 3D rendering related functions and events. To get a pointer to the current Mudbox viewport, call Kernel()->ViewPort().
Definition at line 147 of file viewport.h.
#include <viewport.h>

Public Types |
|
| enum | RedrawType { eFull, eArea, eOverlayOnly } |
|
This type controls the behaviour of the Redraw function, used as a parameter there. More... |
|
| enum | SceneRenderMode
{ srmNormal = 0, srmFlatTexturesOnBlack, srmFlatTexturesOnWhite, srmFlatNoTextures, srmNoTextures } |
|
Describes how to render the scene off-screen with RenderScene. More... |
|
Public Member Functions |
|
| virtual unsigned int | FilterCount (void) const |
| Returns the number of ViewPortFilters
associated with this ViewPort.
|
|
| virtual ViewPortFilter * | Filter (unsigned int iIndex) const |
| Returns a pointer to a
ViewPortFilter associated with this ViewPort.
|
|
| virtual void | AddFilter (ViewPortFilter *pFilter) |
| Associates a
ViewPortFilter with this ViewPort.
|
|
| virtual void | RemoveFilter (unsigned int iIndex) |
| Removes a
ViewPortFilter that was associated with this ViewPort.
The filter is not deleted. |
|
| void | LockFilterCalibration (bool bLocked) |
| Locks/unlocks the calibration of all
viewport filters associated with this ViewPort.
(See ViewPortFilter::LockCalibration())
|
|
| virtual void | SaveScreenshot (const QString &sFileName) const |
| Saves a snapshot of the current viewport to
the given image file name. |
|
| virtual int | Width (void) |
| Returns the width of the ViewPort
in pixels. |
|
| virtual int | Height (void) |
| Returns the height of the ViewPort
in pixels. |
|
| class ImagePlaneInterface * | ActiveImagePlane () |
| Returns the current image plane. |
|
| virtual float | CursorXPosition (void) const |
| Returns the current cursor horizontal
position inside the viewport in the 0-1 range. |
|
| virtual float | CursorYPosition (void) const |
| Returns the current cursor vertical position
inside the viewport in the 0-1 range. |
|
| const SurfacePoint * | CursorSurfacePoint (bool bMirrored=false) const |
| Returns the surface point which is under the
cursor. |
|
| unsigned int | LayerCount (void) const |
| This is the same as
FilterCount() |
|
| class Layer * | Layer (unsigned int iLayerIndex) const |
| This is the same as
Filter() |
|
| void | UnlinkLayer (class Layer *pLayer) |
| This is the same as
RemoveFilter() |
|
| class Layer * | CreateLayer (void) |
| Returns a new
ViewPortFilter. |
|
| void | AddLayer (class Layer *pLayer) |
| This is the same as AddFilter()
|
|
| class Layer * | ActiveLayer (void) const |
| Returns a pointer to the active layer
(filter). That is, the one last clicked on by the user. |
|
| void | SetActiveLayer (class Layer *pLayer) |
| Set a layer (filter) to be the active one.
|
|
| ViewPortFilter::RequirementValue | ViewPortFilterRequirements (void) const |
| Returns the combined requirements of all
visible ViewPortFilters associated with this ViewPort.
|
|
| void | Redraw (RedrawType eType=eFull, float fXStart=0, float fYStart=0, float fXEnd=0, float fYEnd=0) |
| Calling this function will redraw the
viewport. |
|
| Image * | RenderScene (const QString &sChannel, int iWidth, int iHeight, SceneRenderMode renderMode, enum Image::Format fmt=Image::e8integer, bool bTiledImg=true) |
| Renders the scene, and returns it in an
image. |
|
| Image * | RenderScene (int iWidth, int iHeight, SceneRenderMode renderMode, enum Image::Format fmt=Image::e8integer, bool bTiledImg=true) |
| Renders the scene, and returns it in an
image. |
|
| Image * | RenderScene (int iWidth, int iHeight, enum Image::Format fmt=Image::e8integer, bool bTiledImg=true) const |
| Renders the scene, including background and
post-process filters, and returns it in an image. |
|
| virtual struct ViewPortState | ViewPortState (void) |
| Returns the viewport state structure.
|
|
| virtual bool | ShowCurves (void) const |
| Returns true if curves are being rendered in
this viewport. False otherwise. |
|
Static Public Attributes |
|
| static aevent | PreRenderEvent |
| This event is triggered when a new frame is
about to be drawn. |
|
| static aevent | FrameEvent |
| This event is triggered when a new frame is
displayed on the viewport. See the class EventGate
for more details. |
|
| static aevent | EndRenderEvent |
| This event is triggered when rendering a new
image of the scene is finished. See the class EventGate
for more details. |
|
| static aevent | PostRenderEvent |
| This event is triggered at the end of
rendering the scene into a rendertarget. |
|
| static aevent | MouseMoveEvent |
| This event is triggered when a mouse move
event occurs inside the viewport. |
|
| static aevent | LeftMouseButtonPressEvent |
| This event is triggered when left mouse
button down occurs. |
|
| static aevent | LeftMouseButtonReleaseEvent |
| This event is triggered when left mouse
button release occurs. |
|
| static aevent | ContextMenuEvent |
| This event is triggered on context menu
(right mouse button) |
|
| static aevent | SceneRenderEvent |
| This event is triggered after scene is
rendered. |
|
| static aevent | ViewportResizeEvent |
| This event is triggered when viewport's size
is changed. |
|
Protected Member Functions |
|
| ViewPort (void) | |
| Do not use the constructor directly.
|
|
| virtual Image * | RenderRegion (ImgTile bounds, ImgTile region, enum Image::Format eFormat, bool bTiled) const |
| enum RedrawType |
This type controls the behaviour of the Redraw function, used as a parameter there.
| eFull | |
| eArea |
Schedule a full redraw of the 3d viewport later, ViewPort::Redraw returns immediately when this parameter is used. |
| eOverlayOnly |
Schedule a redraw of the 3d viewport for the specified area only, ViewPort::Redraw returns immediately when this parameter is used. Redraws the overlay part of the viewport right away. The 3d content is not redrawn. |
Definition at line 249 of file viewport.h.
{
eFull,
eArea,
eOverlayOnly
};
| enum SceneRenderMode |
Describes how to render the scene off-screen with RenderScene.
Definition at line 266 of file viewport.h.
| ViewPort | ( | void | ) | [protected] |
Do not use the constructor directly.
It is unlikely that you would ever create your own scene in a plug-in. If you do need to, you should not call the constructor directly. Instead, use CreateInstances, like this:
Viewport *myNewScene = CreateInstance<Viewport>();
| virtual unsigned int FilterCount | ( | void | ) | const [virtual] |
Returns the number of ViewPortFilters associated with this ViewPort.
| virtual ViewPortFilter* Filter | ( | unsigned int | iIndex | ) | const [virtual] |
Returns a pointer to a ViewPortFilter associated with this ViewPort.
| [in] | iIndex | index of the ViewPortFilter to be returned |
| virtual void AddFilter | ( | ViewPortFilter * | pFilter | ) | [virtual] |
Associates a ViewPortFilter with this ViewPort.
| [in] | pFilter | a pointer to the ViewPortFilter to be added |
| virtual void RemoveFilter | ( | unsigned int | iIndex | ) | [virtual] |
Removes a ViewPortFilter that was associated with this ViewPort. The filter is not deleted.
| [in] | iIndex | index of the ViewPortFilter to be removed |
| void LockFilterCalibration | ( | bool | bLocked | ) |
Locks/unlocks the calibration of all viewport filters associated with this ViewPort. (See ViewPortFilter::LockCalibration())
| [in] | bLocked | Set this true to lock calibration, and false to unlock it |
| virtual void SaveScreenshot | ( | const QString & | sFileName | ) | const [virtual] |
Saves a snapshot of the current viewport to the given image file name.
The file type will be determined by the extension of the file name (eg .png, .bmp, .tif).
See also Kernel()->RenderScene() for a more flexible method.
| [in] | sFileName | Name of the image file where the screenshot should be saved |
| virtual int Width | ( | void | ) | [virtual] |
Returns the width of the ViewPort in pixels.
| virtual int Height | ( | void | ) | [virtual] |
Returns the height of the ViewPort in pixels.
| class ImagePlaneInterface* ActiveImagePlane | ( | ) |
Returns the current image plane.
| virtual float CursorXPosition | ( | void | ) | const [virtual] |
Returns the current cursor horizontal position inside the viewport in the 0-1 range.
| virtual float CursorYPosition | ( | void | ) | const [virtual] |
Returns the current cursor vertical position inside the viewport in the 0-1 range.
| const SurfacePoint* CursorSurfacePoint | ( | bool | bMirrored = false |
) | const |
Returns the surface point which is under the cursor.
| [in] | bMirrored | a bool to determine whether getting the mirrored surface point. |
| unsigned int LayerCount | ( | void | ) | const [virtual] |
This is the same as Filter()
| [in] | iLayerIndex | index of the layer (filter) to be returned |
Reimplemented from LayerContainer.
| void UnlinkLayer | ( | class Layer * | pLayer | ) | [virtual] |
This is the same as RemoveFilter()
| [in] | pLayer | index of the layer (filter) to be removed |
Reimplemented from LayerContainer.
| class Layer* CreateLayer | ( | void | ) | [virtual] |
| void AddLayer | ( | class Layer * | pLayer | ) | [virtual] |
This is the same as AddFilter()
| [in] | pLayer | a pointer to the layer (filter) to be added |
Reimplemented from LayerContainer.
| class Layer* ActiveLayer | ( | void | ) | const [virtual] |
Returns a pointer to the active layer (filter). That is, the one last clicked on by the user.
Reimplemented from LayerContainer.
| void SetActiveLayer | ( | class Layer * | pLayer | ) | [virtual] |
Set a layer (filter) to be the active one.
| [in] | pLayer | a pointer to the layer (filter) to be made active |
Reimplemented from LayerContainer.
| ViewPortFilter::RequirementValue ViewPortFilterRequirements | ( | void | ) | const |
Returns the combined requirements of all visible ViewPortFilters associated with this ViewPort.
| void Redraw | ( | RedrawType | eType = eFull, |
| float | fXStart = 0, |
||
| float | fYStart = 0, |
||
| float | fXEnd = 0, |
||
| float | fYEnd = 0 |
||
| ) |
Calling this function will redraw the viewport.
| [in] | eType | This parameter determined what should be affected by the function. See ViewPort::RedrawType for mode details. |
| [in] | fXStart | Left side of the area which has to be refreshed in the 0-1 intervall. Ignored if eType != eArea. |
| [in] | fYStart | Top side of the area which has to be refreshed in the 0-1 intervall. Ignored if eType != eArea. |
| [in] | fXEnd | Right side of the area which has to be refreshed in the 0-1 intervall. Ignored if eType != eArea. |
| [in] | fYEnd | Upper side of the area which has to be refreshed in the 0-1 intervall. Ignored if eType != eArea. |
| Image* RenderScene | ( | const QString & | sChannel, |
| int | iWidth, | ||
| int | iHeight, | ||
| SceneRenderMode | renderMode, | ||
| enum Image::Format | fmt =
Image::e8integer, |
||
| bool | bTiledImg =
true |
||
| ) |
Renders the scene, and returns it in an image.
Does not include extra things like the HUD or the cursor ring. Returns a pointer to an image object that the scene was rendered into. You can specify the desired size for the rendering, or leave the input variables set to 0 to render at the current screen resolution.
You can also describe a render mode -- the different render modes can be used together to extract unprojected textures or extract shading/shadow information.
currently only 8 bit images are supported by this operation Note: Once the image is returned, it is your responsibility to delete it when you are done with it.
| [in] | sChannel | the name of the channel to render |
| [in] | iWidth | The width of the rendering in pixels. Set to 0 to use current screen size. |
| [in] | iHeight | The height of the rendering in pixels. Set to 0 to use current screen size. |
| renderMode | describes variations on how to render the scene. | |
| [in] | fmt | Desired image format. |
| [in] | bTiledImg | hint -- true if the resulting image is to be tiled, false if contiguous. |
| Image* RenderScene | ( | int | iWidth, |
| int | iHeight, | ||
| SceneRenderMode | renderMode, | ||
| enum Image::Format | fmt =
Image::e8integer, |
||
| bool | bTiledImg =
true |
||
| ) |
Renders the scene, and returns it in an image.
Does not include extra things like the HUD or the cursor ring. Returns a pointer to an image object that the scene was rendered into. You can specify the desired size for the rendering, or leave the input variables set to 0 to render at the current screen resolution.
You can also describe a render mode -- the different render modes can be used together to extract unprojected textures or extract shading/shadow information.
currently only 8 bit images are supported by this operation Note: Once the image is returned, it is your responsibility to delete it when you are done with it.
| [in] | iWidth | The width of the rendering in pixels. Set to 0 to use current screen size. |
| [in] | iHeight | The height of the rendering in pixels. Set to 0 to use current screen size. |
| renderMode | describes variations on how to render the scene. | |
| [in] | fmt | Desired image format. |
| [in] | bTiledImg | hint -- true if the resulting image is to be tiled, false if contiguous. |
| Image* RenderScene | ( | int | iWidth, |
| int | iHeight, | ||
| enum Image::Format | fmt =
Image::e8integer, |
||
| bool | bTiledImg =
true |
||
| ) | const |
Renders the scene, including background and post-process filters, and returns it in an image.
Does not include extra things like the HUD or the cursor ring. Returns a pointer to an image object that the scene was rendered into. You can specify the desired size for the rendering, or leave the input variables set to 0 to render at the current screen resolution.
currently only 8 bit images are supported by this operation Note: Once the image is returned, it is your responsibility to delete it when you are done with it.
| [in] | iWidth | The width of the rendering in pixels. Set to 0 to use current screen size. |
| [in] | iHeight | The height of the rendering in pixels. Set to 0 to use current screen size. |
| [in] | fmt | Desired image format. |
| [in] | bTiledImg | hint -- true if the resulting image is to be tiled, false if contiguous. |
| virtual struct ViewPortState ViewPortState | ( | void | ) | [read, virtual] |
Returns the viewport state structure.
| virtual bool ShowCurves | ( | void | ) | const [virtual] |
Returns true if curves are being rendered in this viewport. False otherwise.
| virtual Image* RenderRegion | ( | ImgTile | bounds, |
| ImgTile | region, | ||
| enum Image::Format | eFormat, | ||
| bool | bTiled | ||
| ) | const [protected, virtual] |
aevent PreRenderEvent
[static] |
This event is triggered when a new frame is about to be drawn.
Definition at line 344 of file viewport.h.
aevent FrameEvent
[static] |
This event is triggered when a new frame is displayed on the viewport. See the class EventGate for more details.
Definition at line 347 of file viewport.h.
aevent EndRenderEvent
[static] |
This event is triggered when rendering a new image of the scene is finished. See the class EventGate for more details.
Definition at line 350 of file viewport.h.
aevent PostRenderEvent
[static] |
This event is triggered at the end of rendering the scene into a rendertarget.
Plugins can use this event to render additional content to the rendertargets, like gizmos or overlays. See the class EventGate for more details.
Definition at line 354 of file viewport.h.
aevent MouseMoveEvent
[static] |
This event is triggered when a mouse move event occurs inside the viewport.
Definition at line 357 of file viewport.h.
aevent LeftMouseButtonPressEvent
[static] |
This event is triggered when left mouse button down occurs.
Definition at line 360 of file viewport.h.
aevent LeftMouseButtonReleaseEvent
[static] |
This event is triggered when left mouse button release occurs.
Definition at line 363 of file viewport.h.
aevent ContextMenuEvent
[static] |
This event is triggered on context menu (right mouse button)
Definition at line 366 of file viewport.h.
aevent SceneRenderEvent
[static] |
This event is triggered after scene is rendered.
Should be used if plug in has any widgets to render into the scene.
Definition at line 370 of file viewport.h.
aevent ViewportResizeEvent
[static] |
This event is triggered when viewport's size is changed.
Definition at line 373 of file viewport.h.