NVIDIA IndeX API nvidia_logo_transpbg.gif Up
nv::index::IViewport Class Referenceabstract

A viewport defines a two-dimensional area of a canvas where the scene from a given DiCE scope should be rendered. More...

#include <iviewport.h>

Inherits mi::base::Interface_declare< 0x3dd9ae6f, ... >.

Public Member Functions

virtual void set_scope (mi::neuraylib::IScope *scope)=0
 Sets the DiCE scope that should be used for this viewport. More...
 
virtual mi::neuraylib::IScope * get_scope () const =0
 Returns the DiCE scope of this viewport. More...
 
virtual void set_position (const mi::math::Vector_struct< mi::Sint32, 2 > &anchor_position)=0
 Sets the anchor point of the viewport window on the IIndex_canvas. More...
 
virtual mi::math::Vector_struct< mi::Sint32, 2 > get_position () const =0
 Returns the anchor point of the viewport window on the IIndex_canvas in pixel. More...
 
virtual void set_size (const mi::math::Vector_struct< mi::Sint32, 2 > &resolution)=0
 Sets the window size (resolution). More...
 
virtual mi::math::Vector_struct< mi::Sint32, 2 > get_size () const =0
 Return the window size (resolution). More...
 
virtual void set_enabled (bool enable)=0
 Enable or disable the viewport for inclusion in rendering. More...
 
virtual bool get_enabled () const =0
 Returns whether the viewport should be rendered. More...
 

Detailed Description

A viewport defines a two-dimensional area of a canvas where the scene from a given DiCE scope should be rendered.

Creating multiple views allows to render the same scene or multiple scenes with modifications side-by-side to one canvas.

Without the multi-view functionality, NVIDIA IndeX implicitly uses a viewport that covers the entire canvas (IIndex_canvas) and uses the global DiCE scope.

The DiCE scoping mechanism makes it possible to define multiple versions of the same basic scene with different scene elements, while sharing those scene elements that are the same in all scopes. A simple example is setting a different camera for each viewport while keeping the same scene. This is achieved by first calling mi::neuraylib::IDice_transaction::localize() on the ICamera and then modifying the camera separately for each viewport scope. See the DiCE documentation for more details about the scoping mechanism.

Note
When creating new scene elements in a local scope, take care that they are not accessed from other scopes, where they are not visible and where an invalid tag access error would happen.

As a best practice, it is advisable to create the basic scene in the global scope, create multiple specialized versions of it in local scopes and then assign the local scopes to viewports. Scene changes that should be visible on all viewports can then simply be made in the global scope. Note that the global scope is not actually rendered in this scenario, only the local scopes that inherit from it.

To support efficient handling of large distributed data, NVIDIA IndeX makes some restrictions on how multiple scene scopes can be defined:

  • The scene in all viewport scopes must contain the same distributed data scene elements (i.e. ISparse_volume_scene_element, IRegular_heightfield) and a warning will be printed during rendering when such a scene element is missing from one viewport scope. The scene elements may still be localized and therefore differ between viewports, so it is possible to enable a volume in some of the viewports but disable it in others.
  • Results of IDistributed_compute_technique will only be shared between viewports when the compute technique is not localized.
  • When using Distributed_compute_technique to create volume data, all viewports must use the same compute technique. Otherwise data may be recomputed constantly.

Member Function Documentation

 get_enabled()

virtual bool nv::index::IViewport::get_enabled ( ) const
pure virtual

Returns whether the viewport should be rendered.

Returns
True if viewport should be rendered, false otherwise.

 get_position()

virtual mi::math::Vector_struct< mi::Sint32, 2 > nv::index::IViewport::get_position ( ) const
pure virtual

Returns the anchor point of the viewport window on the IIndex_canvas in pixel.

Returns
Anchor point position

 get_scope()

virtual mi::neuraylib::IScope * nv::index::IViewport::get_scope ( ) const
pure virtual

Returns the DiCE scope of this viewport.

Returns
DiCE scope.

 get_size()

virtual mi::math::Vector_struct< mi::Sint32, 2 > nv::index::IViewport::get_size ( ) const
pure virtual

Return the window size (resolution).

Returns
Window resolution in pixels

 set_enabled()

virtual void nv::index::IViewport::set_enabled ( bool  enable)
pure virtual

Enable or disable the viewport for inclusion in rendering.

Parameters
[in]enableIf false, viewport will be skipped for rendering.

 set_position()

virtual void nv::index::IViewport::set_position ( const mi::math::Vector_struct< mi::Sint32, 2 > &  anchor_position)
pure virtual

Sets the anchor point of the viewport window on the IIndex_canvas.

Parameters
[in]anchor_positionLower left position of viewport window in pixels

 set_scope()

virtual void nv::index::IViewport::set_scope ( mi::neuraylib::IScope *  scope)
pure virtual

Sets the DiCE scope that should be used for this viewport.

Parameters
[in]scopeDiCE scope, this class takes ownership.

 set_size()

virtual void nv::index::IViewport::set_size ( const mi::math::Vector_struct< mi::Sint32, 2 > &  resolution)
pure virtual

Sets the window size (resolution).

Parameters
[in]resolutionWindow resolution in pixels

The documentation for this class was generated from the following file: