SAP 3D Visual Enterprise applications SDK
IDVLRenderer Class Referenceabstract

#include <DVLRenderer.h>

Public Member Functions

virtual DVLRESULT SetDimensions (uint32_t width, uint32_t height)=0
 
virtual void SetBackgroundColor (float fTopRed, float fTopGreen, float fTopBlue, float fBottomRed, float fBottomGreen, float fBottomBlue)=0
 
virtual void SetBackgroundOpacity (float fTopAlpha, float fBottomAlpha)=0
 
virtual DVLRESULT AttachScene (IDVLScene *pScene)=0
 
virtual IDVLSceneGetAttachedScenePtr ()=0
 
virtual size_t GetAuxiliaryScenesCount ()=0
 
virtual DVLRESULT AttachAuxiliaryScene (IDVLScene *pScene)=0
 
virtual DVLRESULT DetachAuxiliaryScene (size_t index)=0
 
virtual DVLRESULT GetAuxiliarySceneInfo (size_t index, IDVLScene **ppScene, DVLID *pIDAnchorNode, sDVLMatrix *pTMWorld)=0
 
virtual DVLRESULT SetAuxiliarySceneAnchor (size_t index, DVLID idAnchorNode)=0
 
virtual DVLRESULT SetAuxiliarySceneAnchorMatrix (size_t index, const sDVLMatrix &tmLocal)=0
 
virtual DVLRESULT SetAuxiliarySceneMatrix (size_t index, const sDVLMatrix &tmWorld)=0
 
virtual bool ShouldRenderFrame () const =0
 
virtual DVLRESULT RenderFrame ()=0
 
virtual DVLRESULT RenderFrameEx (const sDVLMatrix &matView, const sDVLMatrix &matProjection)=0
 
virtual DVLRESULT GetCameraMatrices (sDVLMatrix &matView, sDVLMatrix &matProjection) const =0
 
virtual DVLRESULT SetCameraMatrices (const sDVLMatrix &matView, const sDVLMatrix &matProjection, float fCrossFadeSeconds)=0
 
virtual DVLRESULT SetOption (DVLRENDEROPTION type, bool bEnable)=0
 
virtual DVLRESULT GetOption (DVLRENDEROPTION type, bool &bEnabled)=0
 
virtual DVLRESULT SetOptionF (DVLRENDEROPTIONF type, float fValue)=0
 
virtual DVLRESULT GetOptionF (DVLRENDEROPTIONF type, float &fValue) const =0
 
virtual DVLRESULT ResetView (uint32_t flags=DVLRESETVIEWFLAG::DVLRESETVIEWFLAG_CAMERA|DVLRESETVIEWFLAG::DVLRESETVIEWFLAG_SMOOTHTRANSITION)=0
 
virtual DVLRESULT BeginGesture (float x, float y)=0
 
virtual DVLRESULT EndGesture ()=0
 
virtual DVLRESULT Pan (float dx, float dy)=0
 
virtual DVLRESULT Rotate (float dx, float dy)=0
 
virtual DVLRESULT Zoom (float f)=0
 
virtual bool CanIsolateNode (DVLID id)=0
 
virtual DVLRESULT SetIsolatedNode (DVLID id)=0
 
virtual DVLID GetIsolatedNode ()=0
 
virtual DVLRESULT ZoomTo (DVLZOOMTO what, DVLID idNode, float fCrossFadeSeconds)=0
 
virtual DVLRESULT Tap (float x, float y, bool bDouble)=0
 
virtual DVLRESULT HitTest (sDVLHitTest *pHitTest)=0
 
virtual DVLRESULT MultipleHitTest (size_t numHitTests, sDVLHitTest *pHitTests)=0
 
virtual IDVLTextureCreateTexture (uint32_t width, uint32_t height, uint8_t bpp, const void *pData)=0
 
virtual DVLRESULT ReleaseTexture (IDVLTexture *pTexture)=0
 

Detailed Description

This class defines the main interface for interaction with the rendering system of DVL

Member Function Documentation

§ AttachAuxiliaryScene()

virtual DVLRESULT IDVLRenderer::AttachAuxiliaryScene ( IDVLScene pScene)
pure virtual

Attaches an auxiliary scene to the renderer. Index of this scene == GetAuxiliaryScenesCount(). Increases the total number of auxiliary scenes by one.

Note
It is possible to attach the same scene multiple times.
Anchor node is set to DVLID_INVALID (i.e. anchoring disabled) and matrix is set to identity.
Return values
DVLRESULT_NOTINITIALIZEDIf renderer initialization was not performed
DVLRESULT_ACCESSDENIEDIf master scene is not set using AttachScene() method
DVLRESULT_BADARGIf pScene is NULL
DVLRESULT_OUTOFMEMORYIf no memory to store pointer
DVLRESULT_OKIf worked correctly

§ AttachScene()

virtual DVLRESULT IDVLRenderer::AttachScene ( IDVLScene pScene)
pure virtual

Attaches a scene that will be displayed through this interface

The typical usage would be:

IDVLScene *pScene = NULL;
pCore->LoadScene("file://path/to/file.vds", NULL, &pScene);
pRenderer->AttachScene(pScene);
pScene->Release();
  • AttachScene() increments the reference counter of the scene object so you may release the original pointer if it not needed.
  • AttachScene() method releases the previously attached scene (if it exists).
  • Pass NULL value to release the current scene without attaching a new one.
Note
All auxiliary scenes are automatically detached when this method is called
Return values
DVLRESULT_NOTINITIALIZEDIf renderer initialization was not performed
DVLRESULT_OKIf worked correctly

§ BeginGesture()

virtual DVLRESULT IDVLRenderer::BeginGesture ( float  x,
float  y 
)
pure virtual

Begins a gesture by computing target hit point, touch direction etc. Should be called at the beginning of each gesture.

Note
The number of currently active gestures is tracked and only the very first one is really processed
Rotation (using Rotate() method) of the scene will be performed around a 3D point calculated in BeginGesture() by hit-testing 3D scene with given "x", "y" 2D coordinates. If nothing is hit, rotation will be around scene bounding box center.
Parameters
xHorizontal coordinate in points
yVertical coordinate in points
Return values
DVLRESULT_NOTINITIALIZEDIf renderer initialization was not performed
DVLRESULT_OKIf worked correctly

§ CanIsolateNode()

virtual bool IDVLRenderer::CanIsolateNode ( DVLID  id)
pure virtual

Checks if the provided node can be isolated (by seeing if there are any visible geometry underneath it)

§ DetachAuxiliaryScene()

virtual DVLRESULT IDVLRenderer::DetachAuxiliaryScene ( size_t  index)
pure virtual

Detaches an auxiliary scene from the renderer.

Parameters
indexIndex of the scene to be detached

§ EndGesture()

virtual DVLRESULT IDVLRenderer::EndGesture ( )
pure virtual

Ends a gesture, should be called at the end of each gesture to decrease the internal counter

Return values
DVLRESULT_NOTINITIALIZEDIf renderer initialization was not performed
DVLRESULT_PROCESSEDGesture was not started, thus ending gesture had no effect. This is not an error, you can call this method many times
DVLRESULT_OKIf worked correctly

§ GetAttachedScenePtr()

virtual IDVLScene* IDVLRenderer::GetAttachedScenePtr ( )
pure virtual

Returns a pointer to the currently attached scene

  • It returns NULL if no scene is attached.
  • Does not change reference count. You don't need to release this pointer.

§ GetAuxiliarySceneInfo()

virtual DVLRESULT IDVLRenderer::GetAuxiliarySceneInfo ( size_t  index,
IDVLScene **  ppScene,
DVLID pIDAnchorNode,
sDVLMatrix pTMWorld 
)
pure virtual

Retrieves auxiliary scene information by index: 1) Scene pointer 2) ID of anchor node (scene matrix is set to be equal to the matrix of anchor node). DVLID_INVALID if anchoring is not used. 3) scene matrix

Parameters
indexIndex of the scene to be queried
ppScenePointer to the scene. Set to NULL, if not needed
pIDAnchorNodePointer to anchor DVLID. Set to NULL, if not needed
pTMWorldPointer to world matrix of the scene. Set to NULL, if not needed

§ GetAuxiliaryScenesCount()

virtual size_t IDVLRenderer::GetAuxiliaryScenesCount ( )
pure virtual

Master scene (set in AttachScene()) is rendered in each frame. But it is also possible to render additional scenes in the same frame. Such scenes are called auxiliary. By default, there are no auxiliary scenes.

§ GetCameraMatrices()

virtual DVLRESULT IDVLRenderer::GetCameraMatrices ( sDVLMatrix matView,
sDVLMatrix matProjection 
) const
pure virtual

Gets camera matrices

Parameters
matViewView matrix
matProjectionProjection matrix
Return values
DVLRESULT_NOTINITIALIZEDIf renderer initialization was not performed
DVLRESULT_OKIf worked correctly

§ GetIsolatedNode()

virtual DVLID IDVLRenderer::GetIsolatedNode ( )
pure virtual

Returns the DVLID of currently isolated node or DVLID_INVALID if nothing is isolated

§ GetOption()

virtual DVLRESULT IDVLRenderer::GetOption ( DVLRENDEROPTION  type,
bool &  bEnabled 
)
pure virtual

Returns the current state of rendering options

See the DVLRENDEROPTION enum for the details.

Return values
DVLRESULT_NOTINITIALIZEDIf renderer initialization was not performed
DVLRESULT_BADARGIf such option does not exist
DVLRESULT_OKIf worked correctly

§ GetOptionF()

virtual DVLRESULT IDVLRenderer::GetOptionF ( DVLRENDEROPTIONF  type,
float &  fValue 
) const
pure virtual

Returns the current value of rendering options

See the DVLRENDEROPTIONF enum for the details.

Return values
DVLRESULT_NOTINITIALIZEDIf renderer initialization was not performed
DVLRESULT_BADARGIf such option does not exist
DVLRESULT_OKIf worked correctly

§ HitTest()

virtual DVLRESULT IDVLRenderer::HitTest ( sDVLHitTest pHitTest)
pure virtual

Performs hit testing and finds a 3D object under the X, Y coordinates and returns the world coordinates of the taps intersection with the 3D object

Return values
DVLRESULT_BADFORMATIf m_uSizeOfDVLHitTest is wrong
DVLRESULT_BADARGIf pHitTest == NULL
DVLRESULT_NOTINITIALIZEDIf renderer initialization was not performed
DVLRESULT_PROCESSEDIf worked correctly and no 3D objects were hit
DVLRESULT_OKIf worked correctly and 3D object was hit

§ MultipleHitTest()

virtual DVLRESULT IDVLRenderer::MultipleHitTest ( size_t  numHitTests,
sDVLHitTest pHitTests 
)
pure virtual

Performs mulptiple hit testing and finds a 3D object under the X, Y coordinates and returns the world coordinates of the taps intersection with the 3D object

Parameters
numHitTestsNumber of hit tests
pHitTestsHit test query structures
Return values
DVLRESULT_BADFORMATIf m_uSizeOfDVLHitTest is wrong
DVLRESULT_BADARGIf pHitTest == NULL
DVLRESULT_NOTINITIALIZEDIf renderer initialization was not performed
DVLRESULT_PROCESSEDIf worked correctly and no 3D objects were hit
DVLRESULT_OKIf worked correctly and 3D object was hit

§ Pan()

virtual DVLRESULT IDVLRenderer::Pan ( float  dx,
float  dy 
)
pure virtual

Pans the scene

Parameters
dxHorizontal delta in points
dyVertical delta in points
Return values
DVLRESULT_NOTINITIALIZEDIf renderer initialization was not performed
DVLRESULT_OKIf worked correctly

§ RenderFrame()

virtual DVLRESULT IDVLRenderer::RenderFrame ( )
pure virtual

Renders a single frame using currently activated camera

Call this method to draw the attached scene. It requires OpenGL context to work.

Return values
DVLRESULT_NOTINITIALIZEDIf renderer initialization was not performed
DVLRESULT_OKIf worked correctly

§ RenderFrameEx()

virtual DVLRESULT IDVLRenderer::RenderFrameEx ( const sDVLMatrix matView,
const sDVLMatrix matProjection 
)
pure virtual

Renders a single frame using explicitly defined View and Projection matrices

Call this method to draw the attached scene. It requires OpenGL context to work.

Parameters
matViewView matrix
matProjectionProjection matrix
Return values
DVLRESULT_NOTINITIALIZEDIf renderer initialization was not performed
DVLRESULT_OKIf worked correctly

§ ResetView()

virtual DVLRESULT IDVLRenderer::ResetView ( uint32_t  flags = DVLRESETVIEWFLAG::DVLRESETVIEWFLAG_CAMERA|DVLRESETVIEWFLAG::DVLRESETVIEWFLAG_SMOOTHTRANSITION)
pure virtual

Changes view to default viewport (the "Home" mode)

Parameters
flagsOption that customize behavior of this method

After calling this method the scene will look like just loaded.

Return values
DVLRESULT_NOTINITIALIZEDIf renderer initialization was not performed
DVLRESULT_OKIf worked correctly

§ Rotate()

virtual DVLRESULT IDVLRenderer::Rotate ( float  dx,
float  dy 
)
pure virtual

Rotates the scene around 3d orbit rotation center (which is calculated in BeginGesture())

Parameters
dxHorizontal delta in points
dyVertical delta in points
Return values
DVLRESULT_NOTINITIALIZEDIf renderer initialization was not performed
DVLRESULT_OKIf worked correctly

§ SetAuxiliarySceneAnchor()

virtual DVLRESULT IDVLRenderer::SetAuxiliarySceneAnchor ( size_t  index,
DVLID  idAnchorNode 
)
pure virtual

Sets ID of a node in master scene that will act as anchor for a given auxiliary scene. This means that scene matrix will be equal to world matrix of anchor node. If anchor node changes matrix, auxiliary scene will also change matrix automatically.

Parameters
indexIndex of the scene
idAnchorNodeID of the node from master scene to be acting as an anchor
Note
Use DVLID_INVALID to remove anchor

§ SetAuxiliarySceneAnchorMatrix()

virtual DVLRESULT IDVLRenderer::SetAuxiliarySceneAnchorMatrix ( size_t  index,
const sDVLMatrix tmLocal 
)
pure virtual

Sets anchor matrix for the auxiliary scene.

Parameters
indexIndex of the scene
tmWorldTransformation matrix in local coordinates. All nodes in auxiliary scene will be pre-multiplied by this matrix during rendering.

§ SetAuxiliarySceneMatrix()

virtual DVLRESULT IDVLRenderer::SetAuxiliarySceneMatrix ( size_t  index,
const sDVLMatrix tmWorld 
)
pure virtual

Sets world matrix for the auxiliary scene.

Parameters
indexIndex of the scene
tmWorldTransformation matrix in world coordinates. All nodes in auxiliary scene will be pre-multiplied by this matrix during rendering.

§ SetBackgroundColor()

virtual void IDVLRenderer::SetBackgroundColor ( float  fTopRed,
float  fTopGreen,
float  fTopBlue,
float  fBottomRed,
float  fBottomGreen,
float  fBottomBlue 
)
pure virtual

Sets the color which is used to clear the screen. Can be gradient from top to bottom.

Some examples are below:

pRenderer->SetBackgroundColor(0.f, 0.f, 0.f, 0.f, 0.f, 0.f); // black
pRenderer->SetBackgroundColor(1.f, 1.f, 1.f, 1.f, 1.f, 1.f); // white
pRenderer->SetBackgroundColor(1.f, 1.f, 0.f, 1.f, 0.5f, 0.f); // yellow to orange gradient
Note
Default color is top black (0, 0, 0) + bottom black (0, 0, 0)

§ SetBackgroundOpacity()

virtual void IDVLRenderer::SetBackgroundOpacity ( float  fTopAlpha,
float  fBottomAlpha 
)
pure virtual

Sets the opacity which is used to clear the screen. Can be gradient from top to bottom.

Note
Default opacity is top black (1) + bottom black (1)

§ SetCameraMatrices()

virtual DVLRESULT IDVLRenderer::SetCameraMatrices ( const sDVLMatrix matView,
const sDVLMatrix matProjection,
float  fCrossFadeSeconds 
)
pure virtual

Sets camera matrices

Parameters
matViewView matrix
matProjectionProjection matrix
fCrossFadeSecondsTime to perform the "fly to" animation. Set to 0.0f to do this immediately
Return values
DVLRESULT_NOTINITIALIZEDIf renderer initialization was not performed
DVLRESULT_OKIf worked correctly

§ SetDimensions()

virtual DVLRESULT IDVLRenderer::SetDimensions ( uint32_t  width,
uint32_t  height 
)
pure virtual

Sets dimensions of the canvas

You usually call this in OnResize() handler of your application. You also need to call it once the renderer is created to let it know the target resolution.

Return values
DVLRESULT_NOTINITIALIZEDIf renderer initialization was not performed
DVLRESULT_OKIf worked correctly

§ SetIsolatedNode()

virtual DVLRESULT IDVLRenderer::SetIsolatedNode ( DVLID  id)
pure virtual

Sets/clears isolated node

Parameters
idSpecifies the node to be isolated. Set to DVLID_INVALID to clear isolation.

§ SetOption()

virtual DVLRESULT IDVLRenderer::SetOption ( DVLRENDEROPTION  type,
bool  bEnable 
)
pure virtual

Sets the specified rendering option to ON or OFF

See the DVLRENDEROPTION enum for the details.

Return values
DVLRESULT_NOTINITIALIZEDIf renderer initialization was not performed
DVLRESULT_HARDWAREERRORIf new option is not supported by hardware
DVLRESULT_BADARGIf such option does not exist
DVLRESULT_OKIf worked correctly

§ SetOptionF()

virtual DVLRESULT IDVLRenderer::SetOptionF ( DVLRENDEROPTIONF  type,
float  fValue 
)
pure virtual

Sets the specified rendering option value

See the DVLRENDEROPTIONF enum for the details.

Return values
DVLRESULT_NOTINITIALIZEDIf renderer initialization was not performed
DVLRESULT_HARDWAREERRORIf new option is not supported by hardware
DVLRESULT_BADARGIf such option does not exist
DVLRESULT_OKIf worked correctly

§ ShouldRenderFrame()

virtual bool IDVLRenderer::ShouldRenderFrame ( ) const
pure virtual

Checks if the scene has been somehow modified and requires repaint

Use this method to check if the scene needs repainting. There are two reasons why scenes may need to be redrawn: if something is changed by the user or if something is changed inside the core, like mesh has been moved by animation. You can handle events of the first type yourself, but you can't do this for the internal events. So there is a method that tells you if the scene has been changed "inside" and needs updating.

§ Tap()

virtual DVLRESULT IDVLRenderer::Tap ( float  x,
float  y,
bool  bDouble 
)
pure virtual

Sends the "tap" event to the core (for selection)

Parameters
xHorizontal coordinate in points
yVertical coordinate in points
bDoubleIs that double or single tap
Return values
DVLRESULT_NOTINITIALIZEDIf renderer initialization was not performed
DVLRESULT_OKIf worked correctly

§ Zoom()

virtual DVLRESULT IDVLRenderer::Zoom ( float  f)
pure virtual

Zooms the scene

Parameters
fZoom velocity in points per second
Return values
DVLRESULT_NOTINITIALIZEDIf renderer initialization was not performed
DVLRESULT_OKIf worked correctly

§ ZoomTo()

virtual DVLRESULT IDVLRenderer::ZoomTo ( DVLZOOMTO  what,
DVLID  idNode,
float  fCrossFadeSeconds 
)
pure virtual

Zooms the scene to a bounding box created from a particular set of nodes

Parameters
whatWhat set of nodes to zoom to
fCrossFadeSecondsTime to perform the "fly to" animation. Set to 0.0f to do this immediately
idNodeIs only used if what == DVLZOOMTO_NODE
Note
IDVLRenderer::ZoomTo(all|visible|selected|node) saves current viewport state and it can be later restored with IDVLRenderer::ZoomTo() call with the DVLZOOMTO_RESTORE parameter.
Return values
DVLRESULT_NOTINITIALIZEDIf scene was not properly initialized
DVLRESULT_NOTFOUNDIf the nodes set was empty (for example DVLZOOMTO_VISIBLE and all is hidden)
DVLRESULT_NOTINITIALIZEDIf DVLZOOMTO_RESTORE and there is no saved view
DVLRESULT_OKIf worked correctly

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